2 Copyright (C) 2000-2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo 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 OGo 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 OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #ifndef __NGExtensions_NGHashMap_H__
24 #define __NGExtensions_NGHashMap_H__
26 #import <Foundation/NSObject.h>
27 #import <Foundation/NSMapTable.h>
29 @class NSArray, NSDictionary;
31 @interface NGHashMap : NSObject < NSCopying, NSMutableCopying, NSCoding >
38 + (id)hashMapWithHashMap:(NGHashMap *)_hashMap;
39 + (id)hashMapWithObjects:(NSArray *)_objects forKey:(id)_key;
40 + (id)hashMapWithDictionary:(NSDictionary *)_dict;
43 - (id)initWithCapacity:(unsigned int)_size;
44 - (id)initWithObjects:(NSArray *)_objects forKey:(id)_key;
45 - (id)initWithHashMap:(NGHashMap *)_hashMap;
46 - (id)initWithDictionary:(NSDictionary *)_dictionary;
48 - (BOOL)isEqual:(id)anObject;
49 - (BOOL)isEqualToHashMap:(NGHashMap *)_other;
51 - (id)objectForKey:(id)_key;
52 - (NSArray *)objectsForKey:(id)_key;
53 - (id)objectAtIndex:(unsigned int)_index forKey:(id)_key;
56 - (NSArray *)allObjects;
58 - (NSEnumerator *)keyEnumerator;
59 - (NSEnumerator *)objectEnumerator;
60 - (NSEnumerator *)objectEnumeratorForKey:(id)_key;
63 - (NSString *)description;
64 - (NSDictionary *)asDictionary;
65 - (NSDictionary *)asDictionaryWithArraysForValues;
68 - (unsigned int)count; // returns the number of keys
69 - (unsigned int)countObjectsForKey:(id)_key;
73 @interface NGMutableHashMap : NGHashMap
77 + (id)hashMapWithCapacity:(unsigned int)_numItems;
81 - (void)insertObject:(id)_object atIndex:(unsigned int)_index forKey:(id)_key;
82 - (void)insertObjects:(NSArray *)_object
83 atIndex:(unsigned int)_index forKey:(id)_key;
84 - (void)insertObjects:(id*)_objects count:(unsigned int)_count
85 atIndex:(unsigned int)_index forKey:(id)_key;
87 - (void)addObject:(id)_object forKey:(id)_key;
88 - (void)addObjects:(NSArray *)_objects forKey:(id)_key;
89 - (void)addObjects:(id*)_objects count:(unsigned int)_count
92 - (void)setObject:(id)_object forKey:(id)_key;
93 - (void)setObjects:(NSArray *)_objects forKey:(id)_key;
95 - (void)removeAllObjects;
96 - (void)removeAllObjects:(id)_object forKey:(id)_key;
97 - (void)removeAllObjectsForKey:(id)_key;
98 - (void)removeAllObjectsForKeys:(NSArray *)_keyArray;
102 #endif /* __NGExtensions_NGHashMap_H__ */