|
Objective-C++ Preprocessor
5.0 with ARC & GC
C++ classes to enhance syntax and manage reference counting.
|
#include <objcpp.h>
Protected Member Functions | |
| oo_inline void | destruct () |
| oo_inline RTYPE | rawset (RTYPE val) OO_RETURNS |
| oo_inline RTYPE | set (RTYPE val) OO_RETURNS |
| oo_inline RTYPE | set (NSUInteger nilOrCapacity) OO_RETURNS |
| oo_inline OO_AUTOTYPE | noalloc () const OO_AUTORETURNS |
| oo_inline OO_AUTOTYPE | autoget () const OO_AUTORETURNS |
Private Member Functions | |
| oo_inline Class | classOfReference () const |
| oo_inline RTYPE | init (RTYPE val=OOEmpty) OO_RETURNS |
Private Attributes | |
| RTYPE | ref |
A class managing basic ref counting references retain/release mechansim for use in instance variables which will not allow constructors or destructors. Use the &operator to get a pointer with "autorelease" scope for use in the rest of your program.
To free the ref either assign nil references the "=" operator or call use the ~ operator which returns a transient ref. Use &~var to free the ref with autorelrease scope.
Usage:
OOReference<NSString *> immutableRef = "STRING"; // take referrence to a string OOReference<NSMutableArray *> mutableRef <<= [NSArray array]; // take mutable copy NSMutableArray *ptr = &mutableRef; // get autoreleasing pointer to original object NSMutableArray *ptr = *mutableRef; // get pointer to original object ~mutableRef; // clear out pointer and remove "release" object.
do something
return &str; // get autoreleasing pointer to return ref is discarded when object destructed on function exit. }
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
|
inlineprivate |
|
inline |
|
inline |
|
inlineprotected |
|
inline |
|
inlineprivate |
|
inlineprotected |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
for OOArray<id>
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
private |
1.8.2