2 Copyright (C) 2000-2005 SKYRIX Software AG
4 This file is part of SOPE.
6 SOPE is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #ifndef __NGExtensions_NGHashMap_H__
23 #define __NGExtensions_NGHashMap_H__
25 #import <Foundation/NSObject.h>
26 #import <Foundation/NSMapTable.h>
28 @class NSArray, NSDictionary;
30 @interface NGHashMap : NSObject < NSCopying, NSMutableCopying, NSCoding >
37 + (id)hashMapWithHashMap:(NGHashMap *)_hashMap;
38 + (id)hashMapWithObjects:(NSArray *)_objects forKey:(id)_key;
39 + (id)hashMapWithDictionary:(NSDictionary *)_dict;
42 - (id)initWithCapacity:(unsigned int)_size;
43 - (id)initWithObjects:(NSArray *)_objects forKey:(id)_key;
44 - (id)initWithHashMap:(NGHashMap *)_hashMap;
45 - (id)initWithDictionary:(NSDictionary *)_dictionary;
47 - (BOOL)isEqual:(id)anObject;
48 - (BOOL)isEqualToHashMap:(NGHashMap *)_other;
50 - (id)objectForKey:(id)_key;
51 - (NSArray *)objectsForKey:(id)_key;
52 - (id)objectAtIndex:(unsigned int)_index forKey:(id)_key;
55 - (NSArray *)allObjects;
57 - (NSEnumerator *)keyEnumerator;
58 - (NSEnumerator *)objectEnumerator;
59 - (NSEnumerator *)objectEnumeratorForKey:(id)_key;
62 - (NSString *)description;
63 - (NSDictionary *)asDictionary;
64 - (NSDictionary *)asDictionaryWithArraysForValues;
67 - (unsigned int)count; // returns the number of keys
68 - (unsigned int)countObjectsForKey:(id)_key;
72 @interface NGMutableHashMap : NGHashMap
76 + (id)hashMapWithCapacity:(unsigned int)_numItems;
80 - (void)insertObject:(id)_object atIndex:(unsigned int)_index forKey:(id)_key;
81 - (void)insertObjects:(NSArray *)_object
82 atIndex:(unsigned int)_index forKey:(id)_key;
83 - (void)insertObjects:(id*)_objects count:(unsigned int)_count
84 atIndex:(unsigned int)_index forKey:(id)_key;
86 - (void)addObject:(id)_object forKey:(id)_key;
87 - (void)addObjects:(NSArray *)_objects forKey:(id)_key;
88 - (void)addObjects:(id*)_objects count:(unsigned int)_count
91 - (void)setObject:(id)_object forKey:(id)_key;
92 - (void)setObjects:(NSArray *)_objects forKey:(id)_key;
94 - (void)removeAllObjects;
95 - (void)removeAllObjects:(id)_object forKey:(id)_key;
96 - (void)removeAllObjectsForKey:(id)_key;
97 - (void)removeAllObjectsForKeys:(NSArray *)_keyArray;
101 #endif /* __NGExtensions_NGHashMap_H__ */