aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/basetypes/MCObject.h
blob: 018121916d76482d0d9ea27dc4114c4d60286261 (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_MCOBJECT_H_

#define __MAILCORE_MCOBJECT_H_

#include <pthread.h>

#ifdef __cplusplus

#define MC_PROPERTY(mcType, setter, getter) \
    virtual void setter(mcType * getter); \
    virtual mcType * getter();

namespace mailcore {

    extern bool zombieEnabled;
    
	class String;

	class Object {
	public:
		Object();
		virtual ~Object();

		virtual int retainCount();
		virtual Object * retain();
		virtual void release();
		virtual Object * autorelease();
		virtual String * description();
		virtual String * className();
        
		virtual bool isEqual(Object * otherObject);
		virtual unsigned int hash();
		
		// optional
		virtual Object * copy();
		
		typedef void (Object::*Method) (void *);
		virtual void performMethod(Method method, void * context);
		virtual void performMethodOnMainThread(Method method, void * context, bool waitUntilDone = false);
		virtual void performMethodAfterDelay(Method method, void * context, double delay);
		virtual void cancelDelayedPerformMethod(Method method, void * context);
        
	private:
		pthread_mutex_t mLock;
		int mCounter;
		void init();
	};

}

#endif

#endif