aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/basetypes/MCHashMap.h
blob: b6ac6d2f8fab0b8a70b481230e5f19ae0463a053 (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
53
#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 MAILCORE_EXPORT 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);
        virtual bool isEqual(Object * otherObject);

    private:
        unsigned int mAllocated;
        unsigned int mCount;
        void ** mCells;
        HashMapIter * iteratorBegin();
        HashMapIter * iteratorNext(HashMapIter * iter);
        void allocate(unsigned int size);
        void init();
    };

}

#endif

#endif