From: Jay Freeman (saurik) Date: Sun, 6 May 2012 19:49:27 +0000 (-0700) Subject: A few random improvements to Menes ObjectHandle. X-Git-Tag: v1.1.7~9 X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/fac0ed79f59978f6cad1ce3e34407a608ce7f0e6 A few random improvements to Menes ObjectHandle. --- diff --git a/Menes/ObjectHandle.h b/Menes/ObjectHandle.h index da46dd87..32cc7ea6 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