CreatureLib/src/GenericTemplates.hpp

24 lines
1.9 KiB
C++

/*!
\brief GetProperty creates a simple wrapper for a field, creating a private field, and a public getter method.
*/
#define GetProperty(type, name) \
protected: \
type __##name; \
\
public: \
[[nodiscard]] inline type Get##name() const { return __##name; };
/*!
\brief GetProperty creates a simple wrapper for a field, creating a private field, a public getter method, and a public
setter method.
*/
#define GetSetProperty(type, name) \
private: \
type __##name; \
\
public: \
[[nodiscard]] inline type Get##name() const { return __##name; }; \
\
public: \
inline void Set##name(type value) { __##name = value; };