Skip to content

Instantly share code, notes, and snippets.

@beelsebob
Created August 29, 2011 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beelsebob/1178475 to your computer and use it in GitHub Desktop.
Save beelsebob/1178475 to your computer and use it in GitHub Desktop.
@interface MyClass ()
@property (readwrite, strong) CFMutableSetRef __attribute__((NSObject)) completeContents;
@end
Boolean APIObjectEqual (const void *value1, const void *value2);
Boolean APIObjectEqual (const void *value1, const void *value2)
{
return [(__bridge_transfer OSPAPIObject *)value1 isEqualToAPIObject:(__bridge_transfer OSPAPIObject *)value2];
}
@implementation MyClass
@synthesize completeContents;
- (id)init
{
self = [super init];
if (nil != self)
{
CFSetCallBacks callbacks = kCFTypeSetCallBacks;
callbacks.equal = APIObjectEqual;
[self setCompleteContents:CFSetCreateMutable(NULL, 0, &callbacks)];
}
return self;
}
- (void)addObject:(OSPAPIObject *)apiObject
{
CFSetAddValue([self completeContents], (__bridge_retained const void *)apiObject);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment