aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/basetypes/MCHashMap.h
blob: 41e0be4ce42be0798a209499621744b4e839bac1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef __MAILCORE_MCHASHMAP_H_

#define __MAILCORE_MCHASHMAP_H_

#include <MailCore/MCObject.h>

#ifdef __cplusplus

namespace mailcore {

	class String;
	class Array;
	struct HashMapCell;
	typedef HashMapCell HashMapIter;

	class HashMap : public Object {
	public:
		HashMap();
		virtual ~HashMap();
		
		static HashMap * hashMap();

		virtual unsigned int count();
		virtual void setObjectForKey(Object * key, Object * value);
		virtual void removeObjectForKey(Object * key);
		virtual Object * objectForKey(Object * key);
		virtual Array * allKeys();
		virtual Array * allValues();
		virtual void removeAllObjects();
        
    public: // subclass behavior
		HashMap(HashMap * o);
		virtual String * description();
		virtual Object * copy();
		virtual HashMap * serializable();
        virtual void importSerializable(HashMap * serializable);
        
	private:
		unsigned int mAllocated;
		unsigned int mCount;
		void ** mCells;
		HashMapIter * iteratorBegin();
		HashMapIter * iteratorNext(HashMapIter * iter);
		void allocate(unsigned int size);
		void init();
	};

}

#endif

#endif