Guest User

Untitled

a guest
Jan 23rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. @interface MyClass ()
  2.  
  3. @property (readwrite, strong) CFMutableSetRef __attribute__((NSObject)) completeContents;
  4.  
  5. @end
  6.  
  7. Boolean APIObjectEqual (const void *value1, const void *value2);
  8.  
  9. Boolean APIObjectEqual (const void *value1, const void *value2)
  10. {
  11. return [(__bridge_transfer OSPAPIObject *)value1 isEqualToAPIObject:(__bridge_transfer OSPAPIObject *)value2];
  12. }
  13.  
  14. @implementation MyClass
  15.  
  16. @synthesize completeContents;
  17.  
  18. - (id)init
  19. {
  20. self = [super init];
  21.  
  22. if (nil != self)
  23. {
  24. CFSetCallBacks callbacks = kCFTypeSetCallBacks;
  25. callbacks.equal = APIObjectEqual;
  26. [self setCompleteContents:CFSetCreateMutable(NULL, 0, &callbacks)];
  27. }
  28.  
  29. return self;
  30. }
  31.  
  32. - (void)addObject:(OSPAPIObject *)apiObject
  33. {
  34. CFSetAddValue([self completeContents], (__bridge_retained const void *)apiObject);
  35. }
  36.  
  37. @end
Add Comment
Please, Sign In to add comment