GULMutableDictionary.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright 2017 Google
  3. *
  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
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  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.
  15. */
  16. #import <Foundation/Foundation.h>
  17. /// A mutable dictionary that provides atomic accessor and mutators.
  18. @interface GULMutableDictionary : NSObject
  19. /// Returns an object given a key in the dictionary or nil if not found.
  20. - (id)objectForKey:(id)key;
  21. /// Updates the object given its key or adds it to the dictionary if it is not in the dictionary.
  22. - (void)setObject:(id)object forKey:(id<NSCopying>)key;
  23. /// Removes the object given its session ID from the dictionary.
  24. - (void)removeObjectForKey:(id)key;
  25. /// Removes all objects.
  26. - (void)removeAllObjects;
  27. /// Returns the number of current objects in the dictionary.
  28. - (NSUInteger)count;
  29. /// Returns an object given a key in the dictionary or nil if not found.
  30. - (id)objectForKeyedSubscript:(id<NSCopying>)key;
  31. /// Updates the object given its key or adds it to the dictionary if it is not in the dictionary.
  32. - (void)setObject:(id)obj forKeyedSubscript:(id<NSCopying>)key;
  33. /// Returns the immutable dictionary.
  34. - (NSDictionary *)dictionary;
  35. @end