// // NSArray+NGAAdditions.m // MBMenuExtra // // Created by Michael Bishop on 1/23/10. // Copyright 2010 Perforce Software. All rights reserved. // #import "NSDictionary+NGAAdditions.h" @implementation NSDictionary (NGAAdditions) -(id)dictionaryByRemovingObjectsForKeys:(NSArray*)keys { NSMutableDictionary * dictionary = [NSMutableDictionary dictionaryWithDictionary:self]; [dictionary removeObjectsForKeys:keys]; return [NSDictionary dictionaryWithDictionary:dictionary]; } -(id)dictionaryByRemovingObjectForKey:(id)key { return [self dictionaryByRemovingObjectsForKeys:[NSArray arrayWithObject:key]]; } -(id)objectConvertingNullToNilForKey:(id)aKey { id object = [self objectForKey:aKey]; if ( [[NSNull null] isEqual:object] ) return nil; return object; } @end @implementation NSMutableDictionary (NGAAdditions) -(void)setObjectConvertingNilToNull:(id)object forKey:(NSString*)key; { id realObject = object? object : [NSNull null]; [self setObject:realObject forKey:key]; } -(void)setObjectIgnoringNil:(id)object forKey:(NSString*)key; { if ( !object ) return; [self setObject:object forKey:key]; } -(void)setObjectRecognizingNil:(id)object forKey:(NSString*)key { if ( !object ) [self removeObjectForKey:key]; else [self setObject:object forKey:key]; } -(void)removeAllEntriesWithValuesEqualTo:(id)object { [self removeObjectsForKeys:[self allKeysForObject:object]]; } @end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 20722 | jdputsch | initial branch, prep for -Zapp= support | ||
//guest/michael_bishop/MacMenu/src/NGAUtilities/Source/NSDictionary+NGAAdditions.m | |||||
#1 | 8331 | Matt Attaway |
Adding initial version of MacMenu for Perforce MacMenu is a helpful Perforce client that sits in your toolbar. It allows you to run standard Perforce operations on the document that is open the currently active editor/viewer. |