src/common.h

changeset 250
6e80f038e8df
parent 249
6b2cc2d82ba6
child 266
12e7302f14e9
--- a/src/common.h	Fri May 24 03:34:09 2013 +0300
+++ b/src/common.h	Fri May 24 04:34:20 2013 +0300
@@ -93,10 +93,24 @@
 public: \
 	T const& GET () const { return m_##GET; } \
 
+// Same as above except not const
+#define MUTABLE_READ_PROPERTY(T, GET) \
+private: \
+	T m_##GET; \
+public: \
+	T& GET () { return m_##GET; } \
+
 // Read/write private property with get and set accessors
+#define SET_ACCESSOR(T, GET, SET) \
+	void SET (T val) { m_##GET = val; }
+
 #define PROPERTY(T, GET, SET) \
 	READ_PROPERTY(T, GET) \
-	void SET (T val) { m_##GET = val; }
+	SET_ACCESSOR(T, GET, SET)
+
+#define MUTABLE_PROPERTY(T, GET, SET) \
+	MUTABLE_READ_PROPERTY(T, GET) \
+	SET_ACCESSOR(T, GET, SET)
 
 // Property that triggers a callback when it is changed
 #define CALLBACK_PROPERTY(T, GET, SET) \

mercurial