clock/clockmw/clocktimezone/src/timezoneclient.cpp
branchGCC_SURGE
changeset 54 e6894b852bc6
parent 50 579cc610882e
child 58 ef813d54df51
equal deleted inserted replaced
40:4b686cfad39d 54:e6894b852bc6
    29 
    29 
    30 // User includes
    30 // User includes
    31 #include "timezoneclient.h"
    31 #include "timezoneclient.h"
    32 #include "clockcommon.h"
    32 #include "clockcommon.h"
    33 #include "clockserverclt.h"
    33 #include "clockserverclt.h"
       
    34 #include "clockprivatecrkeys.h"
    34 
    35 
    35 const int KDaysInWeek(7);
    36 const int KDaysInWeek(7);
    36 const int KZerothRule(0);
    37 const int KZerothRule(0);
    37 const int KOneHour(1);
    38 const int KOneHour(1);
    38 const int KNoDifference(0);
    39 const int KNoDifference(0);
    43 	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
    44 	tzserver and timezonelocalization.
    45 	tzserver and timezonelocalization.
    45  */
    46  */
    46 
    47 
    47 TimezoneClient* TimezoneClient::mTimezoneClient = 0;
    48 TimezoneClient* TimezoneClient::mTimezoneClient = 0;
    48 int TimezoneClient::mReferenceCount = 0;
    49 bool TimezoneClient::mReferenceCount = false;
    49 /*!
    50 /*!
    50 	Call this funtion to instantiate the TimezoneClient class.
    51 	Call this funtion to instantiate the TimezoneClient class.
    51  */
    52  */
    52 TimezoneClient* TimezoneClient::getInstance()
    53 TimezoneClient* TimezoneClient::getInstance()
    53 {
    54 {
    54 	if (!mTimezoneClient) {
    55 	if (!mTimezoneClient) {
    55 		mTimezoneClient = new TimezoneClient();
    56 		mTimezoneClient = new TimezoneClient();
    56 	}
    57 		mReferenceCount = true;
    57 
    58 	}
    58 	mReferenceCount++;
    59 
    59 	return mTimezoneClient;
    60 	return mTimezoneClient;
    60 }
    61 }
    61 
    62 
    62 /*!
    63 /*!
    63 	Call this function to clean up the instance of TimezoneClient class.
    64 	Call this function to clean up the instance of TimezoneClient class.
    64  */
    65  */
    65 void TimezoneClient::deleteInstance()
    66 void TimezoneClient::deleteInstance()
    66 {
    67 {
    67 	mReferenceCount--;
    68 	if (mReferenceCount) {
    68 
       
    69 	if (0 == mReferenceCount) {
       
    70 		delete mTimezoneClient;
    69 		delete mTimezoneClient;
    71 		mTimezoneClient = 0;
    70 		mTimezoneClient = 0;
    72 	}
    71 	}
    73 }
    72 }
    74 
    73 
    75 /*!
    74 /*!
    76 	Call this function to check if the object is NULL.
    75 	Call this function to check if the object is NULL.
    77  */
    76  */
    78 bool TimezoneClient::isNull()
    77 bool TimezoneClient::isNull()
    79 {
    78 {
    80 	bool deleted = false;
    79 	return !mReferenceCount;
    81 	if (0 == mReferenceCount) {
       
    82 		deleted = true;
       
    83 	}
       
    84 	return deleted;
       
    85 }
    80 }
    86 
    81 
    87 /*!
    82 /*!
    88 	The constructor.
    83 	The constructor.
    89  */
    84  */