From fac0ed79f59978f6cad1ce3e34407a608ce7f0e6 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 6 May 2012 12:49:27 -0700 Subject: A few random improvements to Menes ObjectHandle. --- Menes/ObjectHandle.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'Menes') 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 -- cgit v1.2.3