src/common.h

changeset 223
4f95d7f2e9ef
parent 211
8d35e631bef3
child 224
805bf9ef9529
--- a/src/common.h	Sun May 19 02:55:29 2013 +0300
+++ b/src/common.h	Sun May 19 03:42:25 2013 +0300
@@ -72,6 +72,18 @@
 #define NDEBUG // remove asserts
 #endif // RELEASE
 
+// Read-only, private property with a get accessor
+#define READ_PROPERTY(T, GET) \
+private: \
+	T m_##GET; \
+public: \
+	const T& GET () const { return m_##GET; } \
+
+// Read/write private property with get and set accessors
+#define PROPERTY(T, GET, SET) \
+	READ_PROPERTY(T, GET) \
+	void SET (T val) { m_##GET = val; }
+
 #ifdef null
 #undef null
 #endif // null

mercurial