34 #if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT) 35 #error "Only <final/final.h> can be included directly." 41 #include "final/util/fstring.h" 54 FPoint () noexcept =
default;
55 FPoint (
int,
int) noexcept;
62 auto getClassName()
const ->
FString;
63 auto getX()
const noexcept -> int;
64 auto getY()
const noexcept -> int;
65 void setX (
int) noexcept;
66 void setY (
int) noexcept;
67 void setPoint (
const FPoint&) noexcept;
68 void setPoint (
int,
int) noexcept;
71 auto isOrigin()
const noexcept -> bool;
74 auto x_ref() & noexcept ->
int&;
75 auto y_ref() & noexcept ->
int&;
78 void move (
int,
int) noexcept;
79 void move (
const FPoint&) noexcept;
87 friend inline auto operator == (
const FPoint& p1,
const FPoint& p2) ->
bool 89 return p1.xpos == p2.xpos && p1.ypos == p2.ypos;
92 friend inline auto operator != (
const FPoint& p1,
const FPoint& p2) ->
bool 94 return p1.xpos != p2.xpos || p1.ypos != p2.ypos;
99 return {p1.xpos + p2.xpos, p1.ypos + p2.ypos};
104 return {p1.xpos - p2.xpos, p1.ypos - p2.ypos};
107 friend inline auto operator - (
const FPoint& p) ->
FPoint 109 return {-p.xpos, -p.ypos};
112 friend inline auto operator << (std::ostream& outstr,
const FPoint& p) -> std::ostream&
114 outstr << p.xpos <<
" " << p.ypos;
118 friend inline auto operator >> (std::istream& instr,
FPoint& p) -> std::istream&
132 inline FPoint::FPoint (
int x,
int y) noexcept
138 inline auto FPoint::getClassName()
const ->
FString 142 inline auto FPoint::getX()
const noexcept ->
int 146 inline auto FPoint::getY()
const noexcept ->
int 150 inline void FPoint::setX (
int x) noexcept
154 inline void FPoint::setY (
int y) noexcept
158 inline void FPoint::setPoint (
const FPoint& p) noexcept
159 { setPoint(p.xpos, p.ypos); }
162 inline void FPoint::setPoint (
int x,
int y) noexcept
169 inline auto FPoint::isOrigin()
const noexcept ->
bool 170 {
return xpos == 0 && ypos == 0; }
173 inline auto FPoint::x_ref() & noexcept ->
int&
177 inline auto FPoint::y_ref() & noexcept ->
int&
181 inline void FPoint::move (
int dx,
int dy) noexcept
188 inline void FPoint::move (
const FPoint& d) noexcept
Definition: class_template.cpp:25