44 This class is the QObject based client interface for services offered by |
44 This class is the QObject based client interface for services offered by |
45 tzserver and timezonelocalization. |
45 tzserver and timezonelocalization. |
46 */ |
46 */ |
47 |
47 |
48 TimezoneClient* TimezoneClient::mTimezoneClient = 0; |
48 TimezoneClient* TimezoneClient::mTimezoneClient = 0; |
49 int TimezoneClient::mReferenceCount = 0; |
49 bool TimezoneClient::mReferenceCount = false; |
50 /*! |
50 /*! |
51 Call this funtion to instantiate the TimezoneClient class. |
51 Call this funtion to instantiate the TimezoneClient class. |
52 */ |
52 */ |
53 TimezoneClient* TimezoneClient::getInstance() |
53 TimezoneClient* TimezoneClient::getInstance() |
54 { |
54 { |
55 if (!mTimezoneClient) { |
55 if (!mTimezoneClient) { |
56 mTimezoneClient = new TimezoneClient(); |
56 mTimezoneClient = new TimezoneClient(); |
57 } |
57 mReferenceCount = true; |
58 |
58 } |
59 mReferenceCount++; |
59 |
60 return mTimezoneClient; |
60 return mTimezoneClient; |
61 } |
61 } |
62 |
62 |
63 /*! |
63 /*! |
64 Call this function to clean up the instance of TimezoneClient class. |
64 Call this function to clean up the instance of TimezoneClient class. |
65 */ |
65 */ |
66 void TimezoneClient::deleteInstance() |
66 void TimezoneClient::deleteInstance() |
67 { |
67 { |
68 mReferenceCount--; |
68 if (mReferenceCount) { |
69 |
|
70 if (0 == mReferenceCount) { |
|
71 delete mTimezoneClient; |
69 delete mTimezoneClient; |
72 mTimezoneClient = 0; |
70 mTimezoneClient = 0; |
73 } |
71 } |
74 } |
72 } |
75 |
73 |
76 /*! |
74 /*! |
77 Call this function to check if the object is NULL. |
75 Call this function to check if the object is NULL. |
78 */ |
76 */ |
79 bool TimezoneClient::isNull() |
77 bool TimezoneClient::isNull() |
80 { |
78 { |
81 bool deleted = false; |
79 return !mReferenceCount; |
82 if (0 == mReferenceCount) { |
|
83 deleted = true; |
|
84 } |
|
85 return deleted; |
|
86 } |
80 } |
87 |
81 |
88 /*! |
82 /*! |
89 The constructor. |
83 The constructor. |
90 */ |
84 */ |