// // DSDictionaryCategories.h // Shared categories // // Created by David Sinclair on Sat Aug 10 2002. // Copyright © 2002 - 2007 Dejal Systems, LLC. All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // Redistributions of source code must retain this list of conditions and the following disclaimer. // // The name of Dejal Systems, LLC may not be used to endorse or promote products derived from this // software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE AUTHORS OR // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THIS SOFTWARE. // #import @interface NSDictionary (DSDictionaryCategories) + (id)dictionaryWithArrayOfDictionaries:(NSArray *)array usingKey:(NSString *)key; - (id)deepCopy; - (id)emptyStringOrObjectForKey:(id)aKey; - (BOOL)hasKey:(id)key; - (NSArray *)sortedKeys; - (BOOL)boolForKey:(id)key; - (int)integerForKey:(id)key; - (float)floatForKey:(id)key; - (NSString *)stringForKey:(id)key; - (int)stringLengthForKey:(id)key; - (BOOL)containsSomethingForKey:(id)key; - (id)objectForKey:(id)aKey orBool:(BOOL)aDefault; - (id)objectForKey:(id)aKey orInt:(BOOL)aDefault; - (id)objectForKey:(id)aKey defaultValue:(id)aDefault; + (id)dictionaryWithColor:(NSColor *)color; - (NSColor *)color; - (NSColor *)colorForKey:(id)key; @end // ---------------------------------------------------------------------------------------- #pragma mark - // ---------------------------------------------------------------------------------------- @interface NSMutableDictionary (DSDictionaryCategories) - (void)setBool:(BOOL)value forKey:(id)key; - (void)setInteger:(int)value forKey:(id)key; - (void)setFloat:(float)value forKey:(id)key; - (void)setColor:(NSColor *)color forKey:(id)key; - (void)setObject:(id)anObject forKey:(id)aKey defaultValue:(id)aDefault; - (void)setObject:(id)anObject forKey:(id)aKey removeIfNil:(BOOL)removeIfNil; @end