/
NNPoint

NNPoint

class NNPoint { public: NNPoint(); NNPoint(uint32_t x, uint32_t y); public: void setX(uint32_t x); uint32_t getX(); void setY(uint32_t y); uint32_t getY(); public: virtual std::string getType(); virtual std::string toString(); virtual std::shared_ptr<NNPoint> clone(bool deep); };

Introduction to the class

Represents a point in a 2D space with integer coordinates.

This class provides methods for setting and getting the x and y coordinates, as well as virtual methods for retrieving the type of point and generating a string representation. It also includes a clone method for creating a copy of the point, with an option for deep copying (though in this simple class, deep and shallow copying are the same).

Introduction to the Class's Methods

  1. NNPoint()

    • brief: Default constructor. Initializes the point at the origin (0, 0).

  2. NNPoint(uint32_t x, uint32_t y)

    • brief: Parameterized constructor. Initializes the point with the specified x and y coordinates.

    • param

      • x: The x coordinate of the point.

      • y: The y coordinate of the point.

  3. void setX(uint32_t x)

    • brief: Sets the x coordinate of the point.

    • param

      • x: The new x coordinate.

  4. uint32_t getX()

    • brief: Gets the x coordinate of the point.

    • return uint32_t: The x coordinate of the point.

  5. void setY(uint32_t y)

    • brief: Sets the y coordinate of the point.

    • param

      • y: The new y coordinate.

  6. uint32_t getY()

    • brief: Gets the y coordinate of the point.

    • return uint32_t: The y coordinate of the point.

  7. std::string getType()

    • brief: Gets the type of the point.

    • return string: A string representing the type of the point.

  8. std::string toString()

    • brief: Generates a string representation of the point.

    • return string: A string representing the point.

  9. std::shared_ptr<NNPoint> clone(bool deep)

    • brief: Creates a copy of the point. This method provides an option for deep copying, though in this simple class deep and shallow copying are equivalent.

    • param

      • deep: A boolean indicating whether to perform a deep copy. In this class, it has no effect.

    • return shared_ptr<NNPoint>: A shared pointer to a copy of the point.

Related content

NNRect
More like this
NNSize
More like this
NNFloatData
More like this
NNObject
More like this
NNData
More like this
NNRawData
More like this