CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
point.h
1
2#ifndef _aspose_system_drawing_point_h_
3#define _aspose_system_drawing_point_h_
4
5#include "fwd.h"
6#include <system/string.h>
7#include <system/boxed_value.h>
8#include <functional>
9
10namespace System { namespace Drawing {
14 class ASPOSECPP_SHARED_CLASS Point
15 {
16 RTTI_INFO_VALUE_TYPE(Point)
17 public:
19 ASPOSECPP_SHARED_API Point();
23 ASPOSECPP_SHARED_API Point(int x, int y);
28 ASPOSECPP_SHARED_API Point(const Size& size);
34 ASPOSECPP_SHARED_API Point(int dw);
35
39 inline bool get_IsEmpty() const { return (m_x == 0 && m_y == 0); }
40
42 inline int get_X() const { return m_x; }
44 inline int get_Y() const { return m_y; }
45
48 inline void set_X(int value) { m_x = value; }
51 inline void set_Y(int value) { m_y = value; }
52
57 ASPOSECPP_SHARED_API bool Equals(const Point& point) const;
58
60 ASPOSECPP_SHARED_API int GetHashCode() const;
63 ASPOSECPP_SHARED_API String ToString() const;
64
71 static ASPOSECPP_SHARED_API Point Add(const Point& point, const Size& size);
78 static ASPOSECPP_SHARED_API Point Subtract(const Point& point, const Size& size);
79
84 static ASPOSECPP_SHARED_API Point Ceiling(const PointF& point);
89 static ASPOSECPP_SHARED_API Point Truncate(const PointF& point);
94 static ASPOSECPP_SHARED_API Point Round(const PointF& point);
95
100 inline void Offset(int dx, int dy) { m_x += dx; m_y += dy; }
104 inline void Offset(Point point) { Offset(point.m_x, point.m_y); }
105
108 ASPOSECPP_SHARED_API operator PointF() const;
111 ASPOSECPP_SHARED_API operator Size() const;
112
119 friend ASPOSECPP_SHARED_API Point operator+(const Point& point, const Size& size);
126 friend ASPOSECPP_SHARED_API Point operator-(const Point& point, const Size& size);
127
133 friend ASPOSECPP_SHARED_API bool operator==(const Point& point1, const Point& point2);
139 friend ASPOSECPP_SHARED_API bool operator!=(const Point& point1, const Point& point2);
142 friend ASPOSECPP_SHARED_API bool operator<(const Point& point1, const Point& point2);
143
145 static const ASPOSECPP_SHARED_API Point Empty;
146
148 bool IsNull() const { return false; }
150 size_t getStdHash() const;
151
152 private:
156 inline int hi_word(int n) { return ((n >> 16) & 0xffff); }
160 inline int lo_word(int n) { return (n & 0xffff); }
161
163 int m_x;
165 int m_y;
166
167 };
168
173 inline std::ostream& operator<<(std::ostream& stream, const Point& point)
174 {
175 stream << point.ToString();
176 return stream;
177 }
178
183 inline std::wostream& operator<<(std::wostream& stream, const Point& point)
184 {
185 stream << point.ToString();
186 return stream;
187 }
188
189}} // namespace System::Drawing
190
191namespace System
192{
194
196 template<> struct IsBoxable<Drawing::Point> : std::true_type {};
197
199 template <>
200 class BoxedValue<System::Drawing::Point> : public DefaultBoxedValue<System::Drawing::Point>
201 {
202 public:
206 : DefaultBoxedValue<System::Drawing::Point>(value)
207 {}
208 };
209
211}
212namespace std
213{
215 template<> struct hash<System::Drawing::Point>
216 {
219 inline size_t operator()(System::Drawing::Point const& p) const
220 {
221 return p.getStdHash();
222 }
223 };
224}
225
226#endif // _aspose_system_drawing_point_h_
BoxedValue(const T &value)
Constructs an object that represents the specified value boxed.
Definition: boxed_value.h:192
Represents a pair of single-precision floating point X and Y coordinates of a point on a 2-dimensiona...
Definition: point_f.h:14
Represents a pair of integer X and Y coordinates of a point on a 2-dimensional plane....
Definition: point.h:15
friend bool operator<(const Point &point1, const Point &point2)
Always throws InvalidOperationException.
void Offset(Point point)
Offsets the X and Y coordinates represented by the current object by the values of X and Y coordinate...
Definition: point.h:104
bool get_IsEmpty() const
Determines if both X and Y coordinates values are equal to 0.
Definition: point.h:39
void Offset(int dx, int dy)
Offsets the X and Y coordinates value represented by the current object by the specified values.
Definition: point.h:100
static Point Add(const Point &point, const Size &size)
Adds the width and height values of the specified Size object to the X and Y coordinates values of th...
Point(int x, int y)
Constructs a new Point object and initializes it with the specified values.
static Point Round(const PointF &point)
Constructs a Point object from the specified PointF object by rounding the PointF object's X and Y co...
static Point Ceiling(const PointF &point)
Constructs a Point object from the specified PointF object by rounding the PointF object's X and Y co...
Point(int dw)
Constructs a new Point object and initializes its X coordinate value with a value formed by high 16 b...
friend bool operator==(const Point &point1, const Point &point2)
Determines if the specified Point objects are equal, i.e. represent the same pair of X and Y coordina...
bool IsNull() const
Always returns false.
Definition: point.h:148
friend Point operator+(const Point &point, const Size &size)
Adds the width and height values of the specified Size object to the X and Y coordinates values of th...
int get_Y() const
Returns the value of Y coordinate represented by the current object.
Definition: point.h:44
String ToString() const
Returns the string representation of the pair of X and Y coordinates values represented by the curren...
size_t getStdHash() const
Returns a hash value for the current object.
static Point Truncate(const PointF &point)
Constructs a Point object from the specified PointF object by truncating the PointF object's X and Y ...
int GetHashCode() const
Returns a hash code for the current object.
bool Equals(const Point &point) const
Determines if the current object and the specified object are equal, i.e. represent the same pair of ...
static Point Subtract(const Point &point, const Size &size)
Subtracts the width and height values of the specified Size object from the X and Y coordinates value...
void set_Y(int value)
Sets the value of Y coordinate represented by the current object.
Definition: point.h:51
static const Point Empty
An empty instance of Point class whose X and Y coordinates values are 0.
Definition: point.h:145
friend Point operator-(const Point &point, const Size &size)
Subtracts the width and height values of the specified Size object from the X and Y coordinates value...
int get_X() const
Returns the value of X coordinate represented by the current object.
Definition: point.h:42
void set_X(int value)
Sets the value of X coordinate represented by the current object.
Definition: point.h:48
Point()
Constructs a new Point object and initializes its X and Y coordinates values with 0.
friend bool operator!=(const Point &point1, const Point &point2)
Determines if the specified Point objects are not equal, i.e. represent the distinct pairs of X and Y...
Point(const Size &size)
Constructs a new Point object and initializes its X and Y coordinates values with the values of width...
Represents a pair of integer values that represent width and height of an image. This type should be ...
Definition: size.h:14
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
std::ostream & operator<<(std::ostream &stream, Color color)
Insert data into the stream using UTF-8 encoding.
Definition: color.h:427
@ Point
A printer's point (1/72 of an inch).
Definition: db_command.h:9