6 #ifndef _SECNSADDITIONS_H_
7 #define _SECNSADDITIONS_H_
9 #import <Foundation/Foundation.h>
11 static inline BOOL
NSIsEqualSafe(NSObject
* obj1
, NSObject
* obj2
) {
12 return obj1
== nil
? (obj2
== nil
) : [obj1 isEqual
:obj2
];
18 @interface
NSArray (compactDescription
)
19 - (NSMutableString
*) concatenateWithSeparator
: (NSString
*) separator
;
22 @interface
NSDictionary (SOSDictionaryFormat
)
23 - (NSString
*) compactDescription
;
26 @interface
NSMutableDictionary (FindAndRemove
)
27 -(NSObject
*)extractObjectForKey
:(NSString
*)key
;
32 @interface
NSSet (Emptiness
)
36 @interface
NSSet (HasElements
)
37 - (bool) containsElementsNotIn
: (NSSet
*) other
;
40 @interface
NSSet (compactDescription
)
41 - (NSString
*) shortDescription
;
44 @interface
NSSet (Stringizing
)
45 - (NSString
*) sortedElementsJoinedByString
: (NSString
*) separator
;
46 - (NSString
*) sortedElementsTruncated
: (NSUInteger
) length JoinedByString
: (NSString
*) separator
;
53 static inline NSString
* asNSString(NSObject
* object
) {
54 return [object isKindOfClass
:[NSString
class]] ? (NSString
*) object
: nil
;
57 @interface
NSString (FileOutput
)
58 - (void) writeTo
: (FILE*) file
;
59 - (void) writeToStdOut
;
60 - (void) writeToStdErr
;
65 @interface
NSData (Hexinization
)
66 - (NSString
*) asHexString
;
69 @interface
NSMutableData (filledAndClipped
)
70 + (instancetype
) dataWithSpace
: (NSUInteger
) initialSize DEREncode
: (uint8_t*(^)(size_t size
, uint8_t *buffer
)) initialization
;
73 #endif /* SecNSAdditions_h */