epoc32/include/mw/tz.h
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     7 //
     8 // Initial Contributors:
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
    14 //
    14 //
    15 
    15 
    16 #ifndef __TIMEZONE_H__
    16 #ifndef __TIMEZONE_H__
    17 #define __TIMEZONE_H__
    17 #define __TIMEZONE_H__
    18 
    18 
       
    19 
    19 #include <e32base.h>
    20 #include <e32base.h>
    20 #include <s32std.h>
    21 #include <s32std.h>
       
    22 #include <s32strm.h>
    21 #include <tzdefines.h>
    23 #include <tzdefines.h>
       
    24 #include <tzid.h>
    22 #include <tzupdate.h>
    25 #include <tzupdate.h>
    23 
    26 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
    24 class CTzChangeNotifier;
    27 #include <tzlocalizedcityrecord.h> //This should be be included as it is internalTechnology.
       
    28 #include <tzlocalizedtimezonerecord.h> // Same as above and probably should not be exported to the epoc include
       
    29 #endif
       
    30 
       
    31 
       
    32 // Forward class references.
    25 class CTzRules;
    33 class CTzRules;
    26 class CTzRuleHolder;
    34 class CTzRuleHolder;
    27 
    35 class CTzLocalizedCityRecord;
    28 //-------------------------------------------------------------------------
    36 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS // This can be forward declared i.e. it should not be included as it is internal.
       
    37 class CTzLocalizedTimeZoneRecord;
       
    38 #endif
       
    39 
       
    40 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
    29 /**
    41 /**
    30 Encapsulates a time zone identifier.
    42 The CTzUserNames class is used to encapsulate the names for a user-defined
    31 
    43 time zone.
    32 The identifier may be either a name or a number.
    44 
    33 @publishedAll
    45 When creating an instance of this class the client can specify the following
       
    46 names:
       
    47 
       
    48 - Long standard time name, for example "Mountain Standard Time"
       
    49 - Short standard time name, for example "MST"
       
    50 - Long daylight saving time name, for example "Mountain Daylight Time"
       
    51 - Short daylight saving time name, for example "MDT"
       
    52 - City name, for example "Shiprock"
       
    53 - Region name, for example "America"
       
    54 
       
    55 The client can also read these names.  
       
    56 
       
    57 @publishedPartner
    34 @released
    58 @released
    35 @since 9.1
    59 */ 
    36 */
    60 class CTzUserNames : public CBase
    37 class CTzId : public CBase
    61     {
    38 	{
       
    39 public:
    62 public:
    40 
    63     IMPORT_C static CTzUserNames* NewL(const TDesC& aStandardName,
    41 	IMPORT_C ~CTzId();
    64     	const TDesC& aShortStandardName, const TDesC& aDaylightSaveName,
    42 	
    65     	const TDesC& aShortDaylightSaveName, const TDesC& aCityName,
    43 	/** 
    66     	const TDesC& aRegionName);
    44 	@internalComponent 
    67     IMPORT_C static CTzUserNames* NewLC(const TDesC& aStandardName,
    45 	*/
    68     	const TDesC& aShortStandardName, const TDesC& aDayLightSaveName,
    46 	IMPORT_C CTzId* CloneL() const;
    69     	const TDesC& aShortDaylightSaveName, const TDesC& aCityName,
    47 	
    70     	const TDesC& aRegionName);
    48 	IMPORT_C static CTzId* NewL(TUint aNumericId);
    71 	IMPORT_C ~CTzUserNames();
    49 	
    72 	
    50 	IMPORT_C static CTzId* NewL(const TDesC8& aNameIdentity);
    73 	IMPORT_C const TDesC& StandardName() const;
    51 	
    74 	IMPORT_C const TDesC& ShortStandardName() const;
    52 	/** 
    75 	IMPORT_C const TDesC& DaylightSaveName() const;
    53 	@internalComponent 
    76 	IMPORT_C const TDesC& ShortDaylightSaveName() const;
    54 	*/
    77 	IMPORT_C const TDesC& CityName() const;
    55 	IMPORT_C static CTzId* NewL(RReadStream& aStream);
    78 	IMPORT_C const TDesC& RegionName() const;
    56 	
    79 	
    57 	/** 
    80 	IMPORT_C static CTzUserNames* NewL(RReadStream& aStream);
    58 	@internalComponent 
    81 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
    59 	*/
       
    60 	IMPORT_C void SetId(TUint aNumericId);
       
    61 	
       
    62 	/** 
       
    63 	@internalComponent 
       
    64 	*/
       
    65 	IMPORT_C void SetIdL(const TDesC8& aNameIdentity);
       
    66 	
       
    67 	/** 
       
    68 	@internalComponent 
       
    69 	*/
       
    70 	IMPORT_C void InternalizeL(RReadStream& aStream);
    82 	IMPORT_C void InternalizeL(RReadStream& aStream);
    71 	
    83 	IMPORT_C TInt SizeOfObject() const;
    72 	/** 
    84 
    73 	@internalComponent 
    85 private:
    74 	*/
    86     CTzUserNames();
    75 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
    87 	void ConstructL(const TDesC& aStandardName, const TDesC& aShortStandardName,
    76 
    88 		const TDesC& aDayLightSaveName, const TDesC& aShortDayLightSaveName,
    77 	IMPORT_C const TDesC8& TimeZoneNameID() const;
    89 		const TDesC& aCityName, const TDesC& aRegionName);
    78 	
    90 	
    79 	IMPORT_C TUint TimeZoneNumericID() const;
    91 private:
    80 	
    92     HBufC* iStandardName;
    81 	IMPORT_C TBool operator==(const CTzId& aTZId) const;
    93     HBufC* iShortStandardName;
    82 
    94     HBufC* iDaylightName;
    83 	inline TBool operator!=(const CTzId& aTZId) const;
    95     HBufC* iShortDaylightName;	
    84 
    96     HBufC* iCityName;
    85 public:
    97     HBufC* iRegionName;
    86 	static CTzId* NewL(TUint aReferenceId, const TDesC8& aZoneIdentity);
    98     };
    87 	void SetIdL(TUint aNumRefId, const TDesC8& aZoneIdentity);
    99 #else
    88 
   100 class CTzUserNames;
    89 private:
   101 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
    90 	void ConstructL(const TDesC8& aZoneIdentity);
       
    91 	CTzId();
       
    92 	CTzId(TUint aNumericId);
       
    93 
       
    94 private:
       
    95 	HBufC8* iZoneId;
       
    96 	TUint32 iReferenceId;
       
    97 	};
       
    98 
       
    99 
       
   100 /** 
   102 /** 
   101 The client interface to the time zone server. 
   103 The client interface to the time zone server. 
   102 
   104 
   103 This class performs two basic functions:
   105 This class performs two basic functions:
       
   106 
   104 1. Converts between UTC time and local time.
   107 1. Converts between UTC time and local time.
   105 2. Sets the current local time zone.
   108 2. Sets the current local time zone.
   106 
   109 
   107 NOTE: The presence of a time zone server will alter the behaviour of the 
   110 NOTE: The presence of a time zone server will alter the behaviour of the 
   108 time zone related function calls User::SetUTCOffset() and 
   111 time zone related function calls User::SetUTCOffset() and 
   109 User::SetUTCTimeAndOffset(). The time zone server is shutdown when the 
   112 User::SetUTCTimeAndOffset().  The time zone server is shutdown when the last
   110 last session (RTz) is closed. Therefore, to maintain consistent time related behaviour, 
   113 session (RTz) is closed.  Therefore, to maintain consistent time related
   111 licensees may want to keep a system level time zone server session open at all times.
   114 behaviour, licensees may want to keep a system level time zone server session
   112 
   115 open at all times.
   113 @see User
   116 
   114 
   117 Exceptional cases occur when a user requests conversion for a non-existent local
   115 Exceptional cases occur when a user requests conversion 
   118 time or a double local time. 
   116 for a non-existent local time or a double local time. 
   119 
   117 
   120 Non-existent local times occur when the local time changes from winter to summer
   118 Non-existent local times occur when the local time 
   121 for DST.
   119 changes from winter to summer for DST.
   122 
   120 
   123 For example, 01:59 local time is non-existent on the day of a change to BST in
   121 For example, 01:59 local time is non-existent on the day of a change to BST
   124 Europe/London since the time changes directly from 12:59:59 to 2:00.
   122 in Europe/London since the time changes directly from 12:59:59 to 2:00.
   125 
   123 
   126 A double local time occurs when the local time changes from summer to winter. 
   124 A double local time occurs when the local time changes from
   127 
   125 summer to winter. 
   128 For example, if the time changes at 02:00 AM BST to 01:00 AM GMT then local
   126 
   129 times between 01:00 and 01:59 occur twice.
   127 For example, if the time changes at 02:00 AM BST to 01:00 AM GMT
   130 
   128 then local times between 01:00 and 01:59 occur twice.
   131 The conversion applies the DST offset if the local time value is double and
   129 
   132 applies the standard UTC offset if the local time does not exists.
   130 The conversion applies the DST offset if the local time value is double and applies
   133 
   131 the standard UTC offset if the local time does not exists.
   134 This decision makes the conversion process asymmetrical around the discontinuity
   132 
   135 in the local time when there is a DST change.
   133 This decision makes the conversion process asymmetrical around
   136 
   134 the discontinuity in the local time when there is a DST change.
   137 An example conversion from a double local time to UTC and from UTC to a double
   135 
   138 local time is:
   136 An example conversion from a double local time to UTC and 
       
   137 from UTC to a double local time is:
       
   138 
   139 
   139 	01:59 AM BST => 00:59 AM UTC
   140 	01:59 AM BST => 00:59 AM UTC
   140 	01:59 AM UTC => 01:59 AM GMT
   141 	01:59 AM UTC => 01:59 AM GMT
   141 	
   142 	
   142 An example conversion from a non-existent local time to UTC 
   143 An example conversion from a non-existent local time to UTC 
   143 and from UTC to local time is:
   144 and from UTC to local time is:
   144 
   145 
   145     01:59 AM GMT => 01:59 AM UTC
   146     01:59 AM GMT => 01:59 AM UTC
   146     01:59 AM UTC => 02:59 AM BST 	
   147     01:59 AM UTC => 02:59 AM BST 	
   147 	
   148 	
   148 
       
   149 @publishedAll
   149 @publishedAll
   150 @released
   150 @released
   151 @since 9.1
   151 @since 9.1
   152 */
   152 */
   153 class RTz : public RSessionBase
   153 class RTz : public RSessionBase
   154 	{
   154 	{
   155 public:
   155 public:
   156 	/**
   156 	/**
   157 	These enumerators are to describe different modes of the automatic 
   157 	Automatic DST update mode.
   158 	DST event handling.
       
   159 
       
   160 	These are used both as arguments for the API SetAutoUpdateBehaviorL, 
       
   161 	and as notifications for the publish and subscribe.
       
   162 	*/
   158 	*/
   163 	enum TTzAutoDSTUpdateModes
   159 	enum TTzAutoDSTUpdateModes
   164 		{
   160 		{
   165 		/** No auto update notification when a DST event occurs. */
   161 		/** No auto update notification when a DST event occurs. */
   166 		ETZAutoDSTUpdateOff = 0,
   162 		ETZAutoDSTUpdateOff = 0,
   167 
   163 
   168 		/** Automatic time update will occur and the client app will be notified. */
   164 		/** Automatic time update will occur and the client app will be
       
   165 			notified. */
   169 		ETZAutoDSTUpdateOn,
   166 		ETZAutoDSTUpdateOn,
   170 
   167 
   171 		/** Client app needs to confirm that the time should be updated whenever a DST event occurs. */
   168 		/** Client app needs to confirm that the time should be updated whenever
       
   169 			a DST event occurs. */
   172 		ETZAutoDSTNotificationOnly,
   170 		ETZAutoDSTNotificationOnly,
   173 		};
   171 		};
   174 
   172 
       
   173 	/**
       
   174 	Time zone server change events.
       
   175 	*/
   175 	enum TTzChanges
   176 	enum TTzChanges
   176 		{
   177 		{
   177 		/** Used for notifying that the timezone database has changed.*/
   178 		/** Used for notifying that the timezone database has changed.*/
   178 		ETZDatabaseChanged = 1,
   179 		ETZDatabaseChanged = 1,
   179 		/** Used for notifying that the system timezone database has changed.*/
   180 		/** Used for notifying that the system timezone has changed.*/
   180 		ETZSystemTimeZoneChanged,
   181 		ETZSystemTimeZoneChanged,
   181 		/** Used for notifying that the DST rule has changed. */
   182 		/** Used for notifying that the DST rule has changed. */
   182 		ETZDSTRuleChanged,
   183 		ETZDSTRuleChanged,
   183 		/** Used for notifying that an automatic time update has taken place. */
   184 		/** Used for notifying that an automatic time update has taken place. */
   184 		ETZAutomaticTimeUpdate
   185 		ETZAutomaticTimeUpdate,
       
   186 		/** Used for notifying that a change in localization resources has taken
       
   187 			place. */
       
   188 		ETZLocalizationDataChanged
   185 		};
   189 		};
   186 
   190 
       
   191 	/**
       
   192 	Time zone server panic codes.
       
   193 	*/
   187 	enum TPanic
   194 	enum TPanic
   188 		{
   195 		{
   189 		/** This panic indicates that the time zone server has not been found.*/
   196 		/** This panic indicates that the time zone server has not been found.*/
   190 		EPanicServerNotFound = 1,
   197 		EPanicServerNotFound = 1,
   191 		/** This panic indicates that the server has died.*/
   198 		/** This panic indicates that the server has died.*/
   192 		EPanicServerDead,
   199 		EPanicServerDead,
   193 		/** This panic indicates that the time zone ID is not set.*/
   200 		/** This panic indicates that the time zone ID is not set.*/
   194 		EPanicTimeZoneNameIdNotSet,
   201 		EPanicTimeZoneNameIdNotSet,
   195 		/** This panic indicates that an out of range index was accessed.*/
   202 		/** This panic indicates that an out of range index was accessed.*/
   196 		EPanicRulesIndexOutofRange,
   203 		EPanicRulesIndexOutofRange,
   197 		/** This panic indicates that there are no rules present for this time zone.*/
   204 		/** This panic indicates that there are no rules present for this time
       
   205 			zone.*/
   198 		EPanicTimeNotCoveredByRules,
   206 		EPanicTimeNotCoveredByRules,
   199 		/** This panic indicates that the time zone rules are unusable.*/
   207 		/** This panic indicates that the time zone rules are unusable.*/
   200 		EPanicBadTimeZoneRules,
   208 		EPanicBadTimeZoneRules,
   201 		/** This panic indicates  that an unsupported time reference has been accessed.*/
   209 		/** This panic indicates  that an unsupported time reference has been
       
   210 			accessed.*/
   202 		EPanicUnsupportedTimeReference,
   211 		EPanicUnsupportedTimeReference,
   203 		/** This panic indicates that the time zone ID is not supported.*/
   212 		/** This panic indicates that the time zone ID is not supported.*/
   204 		EPanicUnsupportedTimeZoneNoId,
   213 		EPanicUnsupportedTimeZoneNoId,
   205 		/** This panic indicates that a request for notification is already pending from the client.*/
   214 		/** This panic indicates that a request for notification is already
       
   215 			pending from the client.*/
   206 		EPanicNotificationRequestPending,
   216 		EPanicNotificationRequestPending,
   207 		/** This panic indicates that an incorrect data has been sent to the server.*/
   217 		/** This panic indicates that an incorrect data has been sent to the
   208 		EPanicInvalidArgument
   218 			server.*/
       
   219 		EPanicInvalidArgument,
       
   220 		/** This panic indicates that a table in the user-defined time zone
       
   221 			database has not conformed to the declared schema. */
       
   222 		EPanicBadSchema
   209 		};
   223 		};
   210 	
   224 	
       
   225 	/**
       
   226 	The software install observer plugin can distinguish between changes to the
       
   227 	resource files or the rules database.  This enumeration indicates the filter
       
   228 	index that is used for the resource files and rules database filters.
       
   229 	This enum should not be used externally.
       
   230 	*/
       
   231 	enum TSWIObserverFilterIndex
       
   232 		{
       
   233 		/** The index of the Tz private directory filter. */
       
   234 		EFilterTzPrivate=0,
       
   235 		/** The index of the resources filter. */
       
   236 		EFilterResourceTimezonelocalization
       
   237 		};
       
   238 		
       
   239 public:
   211 	/** 
   240 	/** 
   212 	@internalComponent 
   241 	This should not be used externally.
   213 	*/
   242 	*/
   214 	IMPORT_C static void Panic(TPanic aPanic);
   243 	IMPORT_C static void Panic(TPanic aPanic);
   215 	
   244 	
   216 	/** 
   245 	/** 
   217 	@internalTechnology
   246 	This should not be used externally.
   218 	*/
   247 	*/
   219 	IMPORT_C CTzId* GetTimeZoneIdL() const;
   248 	IMPORT_C CTzId* GetTimeZoneIdL() const;
   220 	
   249 	
   221 	/** 
   250 	/** 
   222 	@internalTechnology
   251 	This should not be used externally.
   223 	*/
   252 	*/
   224 	IMPORT_C void SetTimeZoneL(CTzId& aZone) const;
   253 	IMPORT_C void SetTimeZoneL(CTzId& aZone) const;
   225 
   254 
   226 	IMPORT_C void Close();
   255 	IMPORT_C void Close();
   227 	
       
   228 	IMPORT_C TInt Connect();
   256 	IMPORT_C TInt Connect();
   229 
   257 
   230 	IMPORT_C ~RTz();
   258 	IMPORT_C ~RTz();
   231 	
       
   232 	IMPORT_C RTz();
   259 	IMPORT_C RTz();
   233 	
   260 	
   234 	IMPORT_C TInt ConvertToLocalTime(TTime& aTime) const;
   261 	IMPORT_C TInt ConvertToLocalTime(TTime& aTime) const;
   235 	
       
   236 	IMPORT_C TInt ConvertToLocalTime(TTime& aTime, const CTzId& aZone) const;
   262 	IMPORT_C TInt ConvertToLocalTime(TTime& aTime, const CTzId& aZone) const;
   237 
       
   238 	IMPORT_C TInt ConvertToUniversalTime(TTime& aTime) const;
   263 	IMPORT_C TInt ConvertToUniversalTime(TTime& aTime) const;
   239 	
       
   240 	IMPORT_C TInt ConvertToUniversalTime(TTime& aTime, const CTzId& aZone) const;
   264 	IMPORT_C TInt ConvertToUniversalTime(TTime& aTime, const CTzId& aZone) const;
   241 	
   265 	
   242 	IMPORT_C void GetOffsetsForTimeZoneIdsL(const RArray<TInt>& aTzNumericIds, RArray<TInt>& aOffsets) const; 
   266 	IMPORT_C void GetOffsetsForTimeZoneIdsL(const RArray<TInt>& aTzNumericIds,
       
   267 		RArray<TInt>& aOffsets) const; 
   243 	
   268 	
   244 	IMPORT_C TInt AutoUpdateSettingL();
   269 	IMPORT_C TInt AutoUpdateSettingL();
   245 	
       
   246     IMPORT_C void SetAutoUpdateBehaviorL(TTzAutoDSTUpdateModes aUpdateEnabled);
   270     IMPORT_C void SetAutoUpdateBehaviorL(TTzAutoDSTUpdateModes aUpdateEnabled);
   247     
   271     
   248     // Methods for setting the system time.
   272     // Methods for setting the system time.
   249     IMPORT_C TInt SetHomeTime(const TTime& aLocalTime) const;
   273     IMPORT_C TInt SetHomeTime(const TTime& aLocalTime) const;
   250 
   274 
   251     IMPORT_C TBool IsDaylightSavingOnL(CTzId& aZone) const;
   275     IMPORT_C TBool IsDaylightSavingOnL(CTzId& aZone) const;
   252     
       
   253     IMPORT_C TBool IsDaylightSavingOnL(CTzId& aZone, const TTime& aUTCTime) const;
   276     IMPORT_C TBool IsDaylightSavingOnL(CTzId& aZone, const TTime& aUTCTime) const;
   254 
   277 
   255  	// Get Encoded Rules for Current Local Time Zone
   278  	// Get Encoded Rules for Current Local Time Zone
   256 	IMPORT_C CTzRules* GetTimeZoneRulesL(const TTime& aStartTime, const TTime& aEndTime, TTzTimeReference aTimeRef) const;
   279 	IMPORT_C CTzRules* GetTimeZoneRulesL(const TTime& aStartTime,
   257 	
   280 		const TTime& aEndTime, TTzTimeReference aTimeRef) const;
   258 	IMPORT_C CTzRules* GetTimeZoneRulesL(const CTzId& aZone, const TTime& aStartTime, const TTime& aEndTime, TTzTimeReference aTimeRef) const;
   281 	IMPORT_C CTzRules* GetTimeZoneRulesL(const CTzId& aZone,
       
   282 		const TTime& aStartTime, const TTime& aEndTime,
       
   283 		TTzTimeReference aTimeRef) const;
   259 	
   284 	
   260 	void RegisterTzChangeNotifier(TRequestStatus& aStatus) const;
   285 	void RegisterTzChangeNotifier(TRequestStatus& aStatus) const;
   261 	TInt CancelRequestForNotice() const;
   286 	TInt CancelRequestForNotice() const;
   262 	TVersion Version() const;
   287 	TVersion Version() const;
   263 	
   288 	
   264 	IMPORT_C void NotifyHomeTimeZoneChangedL(const NTzUpdate::TTimeZoneChange& aChange) const;
   289 	IMPORT_C void NotifyHomeTimeZoneChangedL(const NTzUpdate::TTimeZoneChange&
   265 	
   290 		aChange) const;
   266 	IMPORT_C void SetUnknownZoneTimeL(const TTime& aUTCTime, const TInt aUTCOffset);
   291 	
   267 	
   292 	IMPORT_C void SetUnknownZoneTimeL(const TTime& aUTCTime,
   268 	IMPORT_C void SetUnknownZoneTimeL(const TTime& aUTCTime, const TInt aUTCOffset, TBool aPersistInCenRep);
   293 		const TInt aUTCOffset);
   269 
   294 	IMPORT_C void SetUnknownZoneTimeL(const TTime& aUTCTime,
       
   295 		const TInt aUTCOffset, TBool aPersistInCenRep);
       
   296 	
       
   297 	IMPORT_C void LocalizationReadCitiesL(RPointerArray<CTzLocalizedCityRecord>&
       
   298 		aCities);
       
   299 	IMPORT_C void LocalizationReadCitiesL(RPointerArray<CTzLocalizedCityRecord>&
       
   300 		aCities, TInt aTimeZoneId);
       
   301 	IMPORT_C void LocalizationReadCitiesInGroupL(RPointerArray<CTzLocalizedCityRecord>&
       
   302 		aCities, TUint8 aGroupId);
       
   303 	IMPORT_C CTzLocalizedTimeZoneRecord* LocalizationReadFrequentlyUsedZoneL(
       
   304 		TInt aFrequentlyUsedZone);
       
   305 	IMPORT_C CTzLocalizedCityRecord* LocalizationReadCachedTimeZoneCityL(
       
   306 		TInt aFrequentlyUsedZone);
       
   307 	IMPORT_C void LocalizationCloseDbL();
       
   308 	IMPORT_C void LocalizationOpenDbL();
       
   309 	IMPORT_C void LocalizationWriteCityL(const TDesC& aCityName, TInt aCityTzId,
       
   310 		TUint8 aCityGroupId, TUint aCityTzResourceId);
       
   311 	IMPORT_C void LocalizationDeleteCityL(const TDesC& aCityName,
       
   312 		TInt aCityTzId);
       
   313 	IMPORT_C void LocalizationWriteFrequentlyUsedZoneL(const CTzLocalizedTimeZoneRecord&
       
   314 		aTimeZone, const CTzLocalizedCityRecord& aCity,
       
   315 		TInt aFrequentlyUsedZone);
       
   316 	IMPORT_C void LocalizationWriteAllFrequentlyUsedZonesL(const RPointerArray<CTzLocalizedTimeZoneRecord>& aTimeZones,
       
   317 		const RPointerArray<CTzLocalizedCityRecord>& aCities);
       
   318 	
       
   319 	// Debug only methods.
       
   320 	IMPORT_C void SwiObsBeginL();
       
   321 	IMPORT_C void SwiObsFileChangedL(TSWIObserverFilterIndex aType);
       
   322 	IMPORT_C void SwiObsEndL();
       
   323 
       
   324 	// Debug only methods.
   270 	IMPORT_C void __dbgClearCacheL(TBool aRestartCaching);
   325 	IMPORT_C void __dbgClearCacheL(TBool aRestartCaching);
       
   326 	IMPORT_C TInt __dbgRequestAllocatedCellsL(TInt aHeapSizeInBytes);
       
   327 	IMPORT_C void __dbgSetHeapFailL(RAllocator::TAllocFail aType, TInt aRate);
       
   328 	IMPORT_C void __dbgResetHeapL();
   271 
   329 
   272     TBool StartCachingL();
   330     TBool StartCachingL();
   273     TUint16 CurrentCachedTzId();
   331     TUint16 CurrentCachedTzId();
   274 
   332 
       
   333 	// User-defined time zone access.
       
   334     CTzId* CreateUserTimeZoneL(const CTzRules& aTzUserRules, const CTzUserNames& aTzUserNames);
       
   335     CTzUserNames* GetUserTimeZoneNamesL(const CTzId& aTzId) const;
       
   336     void UpdateUserTimeZoneL(const CTzId& aTzId, const CTzRules& aTzUserRules, const CTzUserNames& aTzUserNames);
       
   337     void DeleteUserTimeZoneL(const CTzId& aTzId);
       
   338 	void GetUserTimeZoneIdsL(RPointerArray<CTzId>& aTzIds) const;
       
   339 	
   275 private:
   340 private:
   276 	static TInt StartServer();
   341 	static TInt StartServer();
   277 	TInt DoConnect();
   342 	TInt DoConnect();
   278 	void doConvertL(const CTzId& aZone, TTime& aTime,
   343 	void doConvertL(const CTzId& aZone, TTime& aTime,
   279 					TTzTimeReference aTimerRef) const;
   344 					TTzTimeReference aTimerRef) const;
   280 	void doConvertL(TTime& aTime, 
   345 	void doConvertL(TTime& aTime, 
   281 					TTzTimeReference aTimerRef) const;
   346 					TTzTimeReference aTimerRef) const;
       
   347 					
       
   348 	
       
   349 
   282 private:
   350 private:
   283 	CTzRuleHolder* iRulesHolder;
   351 	CTzRuleHolder* iRulesHolder;
   284 	};
   352 	};
   285 
   353 
       
   354 
   286 /**
   355 /**
   287 Encapsulates a TTime and a TTzTimeReference.
   356 Encapsulates a TTime and a TTzTimeReference.
   288 Use, for example, for iCalendar's DTSTART.
       
   289 
   357 
   290 @publishedAll
   358 @publishedAll
   291 @released
   359 @released
   292 */
   360 */
   293 class TTimeWithReference
   361 class TTimeWithReference
   294 	{
   362 	{
   295 public:
   363 public:
   296 	static inline TTimeWithReference Max();
   364 	static inline TTimeWithReference Max();
       
   365 
   297 	inline TTimeWithReference();
   366 	inline TTimeWithReference();
   298 	inline TTimeWithReference(TTime aTime, TTzTimeReference aTimeReference=ETzUtcTimeReference);
   367 	inline TTimeWithReference(TTime aTime, TTzTimeReference aTimeReference=ETzUtcTimeReference);
   299 	inline TTimeWithReference(TDateTime aTime, TTzTimeReference aTimeReference=ETzUtcTimeReference);
   368 	inline TTimeWithReference(TDateTime aTime, TTzTimeReference aTimeReference=ETzUtcTimeReference);
       
   369 
   300 	inline bool operator==(const TTimeWithReference& aTime) const;
   370 	inline bool operator==(const TTimeWithReference& aTime) const;
   301 	inline bool operator!=(const TTimeWithReference& aTime) const;
   371 	inline bool operator!=(const TTimeWithReference& aTime) const;
   302 
   372 
   303 	TTime iTime;
   373 	TTime iTime;
   304 	TTzTimeReference iTimeReference;
   374 	TTzTimeReference iTimeReference;
   305 	};
   375 	};
   306 
   376 
   307 /** Inequality operator.
   377 
   308 
       
   309 @param aTZId The time zone ID to compare with this one.
       
   310 @return True if the two IDs are different. False if they are the same.
       
   311 */
       
   312 inline TBool CTzId::operator!=(const CTzId& aTZId) const
       
   313 	{
       
   314 	return (!operator==(aTZId));
       
   315 	}
       
   316 
       
   317 //////////////////////////////////
       
   318 // TTimeWithReference
       
   319 //////////////////////////////////
       
   320 inline TTimeWithReference TTimeWithReference::Max()
   378 inline TTimeWithReference TTimeWithReference::Max()
   321 	{
   379 	{
   322 	return TTimeWithReference(
   380 	return TTimeWithReference(
   323 		TDateTime(9999,EDecember,30,23,59,59,0), 
   381 		TDateTime(9999,EDecember,30,23,59,59,0), 
   324 		ETzUtcTimeReference);
   382 		ETzUtcTimeReference);
   325 	}
   383 	}
   326 
   384 
       
   385 
   327 inline TTimeWithReference::TTimeWithReference() 
   386 inline TTimeWithReference::TTimeWithReference() 
   328 		: iTime(0), iTimeReference(ETzUtcTimeReference)
   387 	: iTime(0), iTimeReference(ETzUtcTimeReference)
   329 	{
   388 	{
   330 	}
   389 	}
       
   390 
       
   391 
   331 inline TTimeWithReference::TTimeWithReference(TTime aTime, TTzTimeReference aTimeReference)
   392 inline TTimeWithReference::TTimeWithReference(TTime aTime, TTzTimeReference aTimeReference)
   332 		: iTime(aTime), iTimeReference(aTimeReference)
   393 	: iTime(aTime), iTimeReference(aTimeReference)
   333 	{
   394 	{
   334 	}
   395 	}
       
   396 
       
   397 
   335 inline TTimeWithReference::TTimeWithReference(TDateTime aTime, TTzTimeReference aTimeReference)
   398 inline TTimeWithReference::TTimeWithReference(TDateTime aTime, TTzTimeReference aTimeReference)
   336 		: iTime(aTime), iTimeReference(aTimeReference)
   399 	: iTime(aTime), iTimeReference(aTimeReference)
   337 	{
   400 	{
   338 	}
   401 	}
       
   402 
       
   403 
   339 inline bool TTimeWithReference::operator==(const TTimeWithReference& aTime) const
   404 inline bool TTimeWithReference::operator==(const TTimeWithReference& aTime) const
   340 	{
   405 	{
   341 	return(aTime.iTime == iTime && aTime.iTimeReference == iTimeReference);
   406 	return(aTime.iTime == iTime && aTime.iTimeReference == iTimeReference);
   342 	}
   407 	}
       
   408 
       
   409 
   343 inline bool TTimeWithReference::operator!=(const TTimeWithReference& aTime) const
   410 inline bool TTimeWithReference::operator!=(const TTimeWithReference& aTime) const
   344 	{
   411 	{
   345 	return(!(*this == aTime));
   412 	return(!(*this == aTime));
   346 	}
   413 	}
       
   414 
       
   415 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
   416 /**
       
   417 The CTzUserData class allows the client to create, read, update or delete
       
   418 user-defined time zones. 
       
   419 
       
   420 A user-defined time zone is comprised of time zone rules (encapsulated in a
       
   421 CTzRules object) and time zone names (encapsulated in a CTzUserNames object).
       
   422 
       
   423 A time zone identifier (encapsulated in a CTzId object) is used to uniquely
       
   424 identify a user-defined time zone.
       
   425 
       
   426 The CTzUserData class also allows the time zone identifiers for all existing
       
   427 user-defined time zones to be determined. 
       
   428 
       
   429 @publishedPartner
       
   430 @released
       
   431 */
       
   432 class CTzUserData : public CBase
       
   433     {
       
   434 public:
       
   435     IMPORT_C static CTzUserData* NewL(RTz& aTzServer);
       
   436     IMPORT_C ~CTzUserData();
       
   437 
       
   438     IMPORT_C CTzId* CreateL(const CTzRules& aTzUserRules, const CTzUserNames&
       
   439     	aTzUserNames);
       
   440     IMPORT_C CTzRules* ReadRulesL(const CTzId& aTzId) const;
       
   441 	IMPORT_C CTzUserNames* ReadNamesL(const CTzId& aTzId) const;
       
   442     IMPORT_C void UpdateL(const CTzId& aTzId, const CTzRules& aTzUserRules,
       
   443     	const CTzUserNames& aTzUserNames);
       
   444     IMPORT_C void DeleteL(const CTzId& aTzId);
       
   445     IMPORT_C void GetTzIdsL(RPointerArray<CTzId>& aTzIds) const;
       
   446 
       
   447 private:
       
   448     CTzUserData(RTz& aTzServer);
       
   449 	
       
   450 private:
       
   451     RTz& iTzServer;
       
   452 	};
       
   453 	
       
   454 #endif // SYMBIAN_ENABLE_SPLIT_HEADERS
       
   455 
   347 #endif
   456 #endif