/ NSCFType.m
NSCFType.m
1 // 2 // NSCFType.m 3 // CoreFoundation 4 // 5 // Copyright (c) 2014 Apportable. All rights reserved. 6 // 7 8 #import "NSCFType.h" 9 #import "CFRuntime.h" 10 #import "ForFoundationOnly.h" 11 12 @implementation NSObject (NSCFType) 13 14 - (NSString *)_copyDescription 15 { 16 return [(id)[self description] copy]; 17 } 18 19 - (CFTypeID)_cfTypeID 20 { 21 return CFTypeGetTypeID(); 22 } 23 24 @end 25 26 @implementation __NSCFType 27 28 - (NSUInteger)hash 29 { 30 return CFHash((CFTypeRef)self); 31 } 32 33 - (id)retain 34 { 35 return (id)CFRetain((CFTypeRef)self); 36 } 37 38 - (oneway void)release 39 { 40 CFRelease((CFTypeRef)self); 41 } 42 43 - (NSString *)description 44 { 45 return [(id)CFCopyDescription((CFTypeRef)self) autorelease]; 46 } 47 48 - (NSString *)descriptionWithLocale:(id)locale 49 { 50 return [self description]; 51 } 52 53 - (BOOL)isEqual:(id)other 54 { 55 if (other == nil) 56 { 57 return NO; 58 } 59 return CFEqual((CFTypeRef)self, (CFTypeRef)other); 60 } 61 62 @end