summaryrefslogtreecommitdiff
path: root/Menes/ObjectHandle.h
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2012-05-06 12:49:27 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2012-05-06 12:49:27 -0700
commitfac0ed79f59978f6cad1ce3e34407a608ce7f0e6 (patch)
tree44c4e7585fcb34ee50b24eca045fa5dfd8123a33 /Menes/ObjectHandle.h
parent1450c2b32c974cac7d6598a1ae5d8eb658e11841 (diff)
A few random improvements to Menes ObjectHandle.
Diffstat (limited to 'Menes/ObjectHandle.h')
-rw-r--r--Menes/ObjectHandle.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/Menes/ObjectHandle.h b/Menes/ObjectHandle.h
index da46dd8..32cc7ea 100644
--- a/Menes/ObjectHandle.h
+++ b/Menes/ObjectHandle.h
@@ -107,6 +107,10 @@ class MenesObjectHandle {
return value_;
}
+ _finline Type_ *operator ->() const {
+ return value_;
+ }
+
_finline MenesObjectHandle &operator =(Type_ *value) {
if (value_ != value) {
Type_ *old(value_);
@@ -123,4 +127,25 @@ class MenesObjectHandle {
#define _H MenesObjectHandle
+#define rproperty_(Class, field) \
+ - (typeof(((Class*)nil)->_##field.operator->())) field { \
+ return _##field; \
+ }
+
+#define wproperty_(Class, field, Field) \
+ - (void) set##Field:(typeof(((Class*)nil)->_##field.operator->()))field { \
+ _##field = field; \
+ }
+
+#define roproperty(Class, field) \
+@implementation Class (Menes_##field) \
+rproperty_(Class, field) \
+@end
+
+#define rwproperty(Class, field, Field) \
+@implementation Class (Menes_##field) \
+rproperty_(Class, field) \
+wproperty_(Class, field, Field) \
+@end
+
#endif//Menes_ObjectHandle_H