Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
NSDictionary(OOExtensions) Category Reference

#include <NSDictionaryOOExtensions.h>

Instance Methods

(NSDictionary *) - dictionaryByAddingObject:forKey:
 
(NSDictionary *) - dictionaryByRemovingObjectForKey:
 
(NSDictionary *) - dictionaryByAddingEntriesFromDictionary:
 

Detailed Description

Definition at line 33 of file NSDictionaryOOExtensions.h.

Method Documentation

◆ dictionaryByAddingEntriesFromDictionary:

- (NSDictionary *) dictionaryByAddingEntriesFromDictionary: (NSDictionary *) dictionary

Definition at line 1 of file NSDictionaryOOExtensions.m.

61 :(NSDictionary *)dictionary
62{
63 // Note: object lifetime issues aside, we need to copy and autorelease so that the right thing happens for mutable dictionaries.
64 if (dictionary == nil) return [[self copy] autorelease];
65
66 NSMutableDictionary *temp = [self mutableCopy];
67 [temp addEntriesFromDictionary:dictionary];
68 NSDictionary *result = [[temp copy] autorelease];
69 [temp release];
70
71 return result;
72}
return nil

References nil.

◆ dictionaryByAddingObject:forKey:

- (NSDictionary *) dictionaryByAddingObject: (id) object
forKey: (id) key 

Definition at line 1 of file NSDictionaryOOExtensions.m.

33 :(id)object forKey:(id)key
34{
35 // Note: object lifetime issues aside, we need to copy and autorelease so that the right thing happens for mutable dictionaries.
36 if (object == nil || key == nil) return [[self copy] autorelease];
37
38 NSMutableDictionary *temp = [self mutableCopy];
39 [temp setObject:object forKey:key];
40 NSDictionary *result = [[temp copy] autorelease];
41 [temp release];
42
43 return result;
44}

◆ dictionaryByRemovingObjectForKey:

- (NSDictionary *) dictionaryByRemovingObjectForKey: (id) key

Definition at line 1 of file NSDictionaryOOExtensions.m.

47 :(id)key
48{
49 // Note: object lifetime issues aside, we need to copy and autorelease so that the right thing happens for mutable dictionaries.
50 if (key == nil) return [[self copy] autorelease];
51
52 NSMutableDictionary *temp = [self mutableCopy];
53 [temp removeObjectForKey:key];
54 NSDictionary *result = [[temp copy] autorelease];
55 [temp release];
56
57 return result;
58}

The documentation for this category was generated from the following files: