2 * Copyright 2017 Google
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #import <Foundation/Foundation.h>
19 /// A mutable dictionary that provides atomic accessor and mutators.
20 @interface GULMutableDictionary : NSObject
22 /// Returns an object given a key in the dictionary or nil if not found.
23 - (id)objectForKey:(id)key;
25 /// Updates the object given its key or adds it to the dictionary if it is not in the dictionary.
26 - (void)setObject:(id)object forKey:(id<NSCopying>)key;
28 /// Removes the object given its session ID from the dictionary.
29 - (void)removeObjectForKey:(id)key;
31 /// Removes all objects.
32 - (void)removeAllObjects;
34 /// Returns the number of current objects in the dictionary.
37 /// Returns an object given a key in the dictionary or nil if not found.
38 - (id)objectForKeyedSubscript:(id<NSCopying>)key;
40 /// Updates the object given its key or adds it to the dictionary if it is not in the dictionary.
41 - (void)setObject:(id)obj forKeyedSubscript:(id<NSCopying>)key;
43 /// Returns the immutable dictionary.
44 - (NSDictionary *)dictionary;