#include <TzLocalizer.h>
Link against:
timezonelocalization.lib
class CTzLocalizer : public CBase;
Description
Retrieves localized time zone information based on a time zone ID.
Time
zone information is available in the following forms:
-
Standard Name, for instance Greenwich Mean Time
,
-
Short Standard Name, for instance GMT,
-
Daylight Savings Name, for instance British Summer Time
,
-
Short Daylight Savings Name, for instance BST.
This information is encapsulated in a CTzLocalizedTimeZone
object.
A collection of localizable cities for a specific time zone can also be returned. New cities can be added to a time zone.
Cities may also be added to groups, but a city may only be a member of one group.
Derivation
CBase
-
Base class for all classes to be instantiated on the heap.
CTzLocalizer
- Retrieves localized time zone information based on a time zone ID.
Members
Defined in CTzLocalizer
:
AddCityL(TInt,const TDesC &,TInt)
Creates a user defined city, specifying the time zone and optionally the group t...
CheckLanguage()
Tests whether the language of the loaded static data is still correct. If it is ...
ETzAlphaDaylightNameAscending
Sort by daylight savings name from A-Z.
ETzAlphaDaylightNameDescending
Sort by daylight savings name from Z-A.
ETzAlphaNameAscending
Sort by name (city name/group name/standard time zone name), from A-Z.
ETzAlphaNameDescending
Sort by name (city name/group name/standard time zone name), from Z-A.
ETzAlphaShortDaylightNameAscending
Sort by short daylight savings name from A-Z.
ETzAlphaShortDaylightNameDescending
Sort by short daylight savings name from Z-A.
ETzAlphaShortStandardNameAscending
Sort by short standard name from A-Z.
ETzAlphaShortStandardNameDescending
Sort by short standard name from Z-A.
ETzAlphaStandardNameAscending
Sort by standard name from A-Z.
ETzAlphaStandardNameDescending
Sort by standard name from Z-A.
ETzLocalizerPanicResourceFileNotFound
A resource file was not found.
ETzLocalizerPanicTimeZoneServerNotFound
The time zone server was not found.
ETzUTCAscending
Sort by UTC offset starting with the lowest.
ETzUTCDescending
Sort by UTC offset starting with the highest.
ETzUnsorted
Unsorted. This is the fastest way to get localized data.
FindCityByNameL(const TDesC &,const TInt)
Searches for a city with the specified name. If a time Zone ID is also specified...
FindCityGroupByNameL(const TDesC &)
Searches for a city group with the specified name.
FindTimeZoneByNameL(const TDesC &)
Searches for a time zone with the specified name. All text fields of the time zo...
GetAllCityGroupsL(const TTzSortOrder)const
Gets a list of all the existing city groups. The calling function takes ownershi...
GetAllTimeZonesL(const TTzSortOrder)
Gets an array of all available localizable time zones, sorted according to aSort...
GetCitiesInGroupL(TInt,const TTzSortOrder)
Returns all cities defined in the static and persisted data that are members of ...
GetCitiesInGroupL(const CTzLocalizedCity &,const TTzSortOrder)
Returns all cities defined in the static and persisted data that are members of ...
GetCitiesInGroupL(const CTzLocalizedCityGroup &,const TTzSortOrder)
Returns all cities defined in the static and persisted data that are members of ...
GetCitiesL(TInt,const TTzSortOrder)
Gets all the cities defined in the static and persisted data that belong to the ...
GetCitiesL(const CTzLocalizedCity &,const TTzSortOrder)
Gets all the cities defined in the static and persisted data that belong to the ...
GetCitiesL(const CTzLocalizedTimeZone &,const TTzSortOrder)
Gets all the cities defined in the static and persisted data that belong to aTim...
GetCitiesL(const TTzSortOrder)
Returns all cities defined in the static and persisted data. The calling functio...
GetCitiesWithUTCOffsetL(TInt,const TTzSortOrder)
Returns all cities defined in the static and persisted data that have the specif...
GetCityGroupL(TInt)const
Gets the city group with the specified ID. The calling function takes ownership ...
GetCityGroupL(const CTzLocalizedCity &)const
Gets the city group to which the specified city belongs. The calling function ta...
GetDefaultCityL(TInt)const
Gets the default city for the specified time zone. The calling function takes ow...
GetDefaultCityL(const CTzLocalizedCity &)const
Gets the default city for the time zone the specified city is a member of. The c...
GetDefaultCityL(const CTzLocalizedTimeZone &)const
Gets the default city for the specified time zone. The calling function takes ow...
GetLocalizedTimeZoneL(TInt)const
Gets the localized time zone that matches the time zone ID specified. The callin...
GetLocalizedTimeZoneL(const CTzLocalizedCity &)const
Gets the localized time zone that aCity is a member of. The calling function tak...
GetTimeZonesWithUTCOffsetL(TInt,const TTzSortOrder)
Returns all the time zones defined in the static data that have the specified UT...
NewL()
Allocates and constructs a new CTzLocalizer object.
NewLC()
Allocates and constructs a new CTzLocalizer object. The pointer to the new objec...
RemoveCityL(CTzLocalizedCity *)
Removes a city from the user defined city collection. The calling function loses...
SetTimeZoneL(TInt)
Sets the time zone in the time zone server to be that of the supplied time zone ...
TTzLocalizerPanics
Panic reasons for the time zone localization component.
TTzSortOrder
Used to specify the sort order of localized time zone information.
~CTzLocalizer()
Destructor.
Inherited from CBase
:
Related Topics
»
Symbian OS v9.4 »
Examples »
Application Services example code »
timezonelocalisation: Using time zone localisation
Construction and destruction
IMPORT_C static CTzLocalizer* NewL();
Description
Allocates and constructs a new CTzLocalizer object.
Return value
IMPORT_C static CTzLocalizer* NewLC();
Description
Allocates and constructs a new CTzLocalizer object. The pointer to the new object is left on the cleanup stack.
Return value
IMPORT_C ~CTzLocalizer();
Description
Destructor.
GetLocalizedTimeZoneL(TInt)const
IMPORT_C CTzLocalizedTimeZone* GetLocalizedTimeZoneL(TInt aTimeZoneId) const;
Description
Gets the localized time zone that matches the time zone ID specified. The calling function takes ownership of the returned
localized time zone.
Parameters
TInt aTimeZoneId |
A positive time zone ID of the localized time zone to return.
|
|
Return value
GetLocalizedTimeZoneL(const CTzLocalizedCity &)const
IMPORT_C CTzLocalizedTimeZone* GetLocalizedTimeZoneL(const CTzLocalizedCity &aCity) const;
Description
Gets the localized time zone that aCity is a member of. The calling function takes ownership of the returned localized time
zone.
Parameters
Return value
GetAllTimeZonesL(const TTzSortOrder)
IMPORT_C CTzLocalizedTimeZoneArray* GetAllTimeZonesL(const TTzSortOrder aSortOrder=ETzUnsorted);
Description
Gets an array of all available localizable time zones, sorted according to aSortOrder. The calling function takes ownership
of the returned array.
Parameters
Return value
IMPORT_C void SetTimeZoneL(TInt aTimeZoneId);
Description
Sets the time zone in the time zone server to be that of the supplied time zone id. The current cached zone is also updated.
Parameters
TInt aTimeZoneId |
A positive time zone ID of the new time zone.
|
|
GetDefaultCityL(TInt)const
IMPORT_C CTzLocalizedCity* GetDefaultCityL(TInt aTimeZoneId) const;
Description
Gets the default city for the specified time zone. The calling function takes ownership of the returned city.
Parameters
TInt aTimeZoneId |
A positive time zone ID of the default city to return.
|
|
Return value
GetDefaultCityL(const CTzLocalizedCity &)const
IMPORT_C CTzLocalizedCity* GetDefaultCityL(const CTzLocalizedCity &aCity) const;
Description
Gets the default city for the time zone the specified city is a member of. The calling function takes ownership of the returned
city.
Parameters
Return value
GetDefaultCityL(const CTzLocalizedTimeZone &)const
IMPORT_C CTzLocalizedCity* GetDefaultCityL(const CTzLocalizedTimeZone &aTimeZone) const;
Description
Gets the default city for the specified time zone. The calling function takes ownership of the returned city.
Parameters
Return value
GetCitiesL(const TTzSortOrder)
IMPORT_C CTzLocalizedCityArray* GetCitiesL(const TTzSortOrder aSortOrder=ETzUnsorted);
Description
Returns all cities defined in the static and persisted data. The calling function takes ownership of the returned array.
Parameters
const CTzLocalizer::TTzSortOrder aSortOrder |
Specifies the order in which the returned array will be sorted. It can have one of the following values: ETzUnsorted, ETzUTCAscending,
ETzUTCDescending, ETzAlphaNameAscending, or ETzAlphaNameDescending.
|
|
Return value
GetCitiesL(TInt,const TTzSortOrder)
IMPORT_C CTzLocalizedCityArray* GetCitiesL(TInt aTimeZoneId, const TTzSortOrder aSortOrder=ETzUnsorted);
Description
Gets all the cities defined in the static and persisted data that belong to the time zone identified by aTimeZoneId. The calling
function takes ownership of the returned array.
Parameters
TInt aTimeZoneId |
A positive time zone ID that identifies the time zone of the cities to return.
|
const CTzLocalizer::TTzSortOrder aSortOrder |
Defines the order in which the returned array will be sorted. It can have one of the following values: ETzUnsorted, ETzAlphaNameAscending,
ETzAlphaNameDescending.
|
|
Return value
Leave codes
KErrArgument |
An invalid sort order is specified.
|
|
GetCitiesL(const CTzLocalizedTimeZone &,const TTzSortOrder)
IMPORT_C CTzLocalizedCityArray* GetCitiesL(const CTzLocalizedTimeZone &aTimeZone, const TTzSortOrder aSortOrder=ETzUnsorted);
Description
Gets all the cities defined in the static and persisted data that belong to aTimeZone. The calling function takes ownership
of the array.
Parameters
Return value
GetCitiesL(const CTzLocalizedCity &,const TTzSortOrder)
IMPORT_C CTzLocalizedCityArray* GetCitiesL(const CTzLocalizedCity &aCity, const TTzSortOrder aSortOrder=ETzUnsorted);
Description
Gets all the cities defined in the static and persisted data that belong to the same time zone as aCity. The calling function
takes ownership of the returned array.
Parameters
Return value
AddCityL(TInt,const TDesC &,TInt)
IMPORT_C CTzLocalizedCity* AddCityL(TInt aTimeZoneId, const TDesC &aCityName, TInt aGroupId=0);
Description
Creates a user defined city, specifying the time zone and optionally the group to which it belongs.
Parameters
TInt aTimeZoneId |
A positive time zone ID of the city to add.
|
const TDesC16 &aCityName |
The name of the city to add.
|
TInt aGroupId |
The ID of the city group to add the city to. Zero if the city doesn't belong to a group. Currently supports up to 255 groups
|
|
Return value
CTzLocalizedCity *
|
The newly created city. The calling function takes ownership.
|
|
Leave codes
KErrAlreadyExists |
The specified city already exists in the time zone.
|
KErrNotFound |
aTimeZoneId or aGroupId is not found.
|
KErrArgument |
aGroupId is invalid
|
|
RemoveCityL(CTzLocalizedCity *)
IMPORT_C void RemoveCityL(CTzLocalizedCity *aCity);
Description
Removes a city from the user defined city collection. The calling function loses ownership of aCity.
Parameters
GetAllCityGroupsL(const TTzSortOrder)const
IMPORT_C CTzLocalizedCityGroupArray* GetAllCityGroupsL(const TTzSortOrder aSortOrder=ETzUnsorted) const;
Description
Gets a list of all the existing city groups. The calling function takes ownership of the returned array.
Parameters
const CTzLocalizer::TTzSortOrder aSortOrder |
Specifies the order in which the returned array will be sorted. Possible values are ETzAlphaNameAscending or ETzAlphaNameDescending.
|
|
Return value
IMPORT_C CTzLocalizedCityGroup* GetCityGroupL(TInt aGroupId) const;
Description
Gets the city group with the specified ID. The calling function takes ownership of the returned CTzLocalizedCityGroup
.
Parameters
TInt aGroupId |
The ID of the city group to get.
|
|
Return value
Leave codes
KErrArgument |
aGroupId is invalid
|
|
GetCityGroupL(const CTzLocalizedCity &)const
IMPORT_C CTzLocalizedCityGroup* GetCityGroupL(const CTzLocalizedCity &aCity) const;
Description
Gets the city group to which the specified city belongs. The calling function takes ownership of the returned CTzLocalizedCityGroup
.
Parameters
Return value
GetCitiesInGroupL(TInt,const TTzSortOrder)
IMPORT_C CTzLocalizedCityArray* GetCitiesInGroupL(TInt aGroupId, const TTzSortOrder aSortOrder=ETzUnsorted);
Description
Returns all cities defined in the static and persisted data that are members of the group with the specified group ID. The
calling function takes ownership of the array.
Parameters
TInt aGroupId |
The group ID.
|
const CTzLocalizer::TTzSortOrder aSortOrder |
Specifies the order in which the returned array will be sorted. The following sort orders are supported: ETzUnsorted, ETzUTCAscending,
ETzUTCDescending, ETzAlphaNameAscending, ETzAlphaNameDescending.
|
|
Return value
Leave codes
KErrArgument |
aGroupId is invalid
|
|
GetCitiesInGroupL(const CTzLocalizedCity &,const TTzSortOrder)
IMPORT_C CTzLocalizedCityArray* GetCitiesInGroupL(const CTzLocalizedCity &aCity, const TTzSortOrder aSortOrder=ETzUnsorted);
Description
Returns all cities defined in the static and persisted data that are members of the same group as the specified city. The
calling function takes ownership of the array.
Parameters
const CTzLocalizedCity &aCity |
Any city in the desired city group.
|
const CTzLocalizer::TTzSortOrder aSortOrder |
Specifies the order in which the returned array will be sorted. The following sort orders are supported: ETzUnsorted, ETzUTCAscending,
ETzUTCDescending, ETzAlphaNameAscending, ETzAlphaNameDescending.
|
|
Return value
GetCitiesInGroupL(const CTzLocalizedCityGroup &,const TTzSortOrder)
IMPORT_C CTzLocalizedCityArray* GetCitiesInGroupL(const CTzLocalizedCityGroup &aCityGroup, const TTzSortOrder aSortOrder=ETzUnsorted);
Description
Returns all cities defined in the static and persisted data that are members of the specified city group. The calling function
takes ownership of the array.
Parameters
const CTzLocalizedCityGroup &aCityGroup |
The city group of interest.
|
const CTzLocalizer::TTzSortOrder aSortOrder |
Specifies the order in which the returned array will be sorted. The following sort orders are supported: ETzUnsorted, ETzUTCAscending,
ETzUTCDescending, ETzAlphaNameAscending, ETzAlphaNameDescending.
|
|
Return value
GetFrequentlyUsedZoneL(const CTzLocalizedTimeZone::TTzFrequentlyUsedZone)
IMPORT_C CTzLocalizedTimeZone* GetFrequentlyUsedZoneL(const CTzLocalizedTimeZone::TTzFrequentlyUsedZone aFrequentlyUsedZone);
Description
Gets the cached time zone identified by aFrequentlyUsedZone. The calling function takes ownership of the returned zone. When
retrieving the current zone (CTzLocalizedTimeZone::ECurrentZone
), the time zone server is queried to make sure that the system's current time zone has not been updated since the current
zone was cached. If the system's time zone has been updated, the new localised zone is stored in the database.
Parameters
Return value
GetFrequentlyUsedZoneCityL(const CTzLocalizedTimeZone::TTzFrequentlyUsedZone)
IMPORT_C CTzLocalizedCity* GetFrequentlyUsedZoneCityL(const CTzLocalizedTimeZone::TTzFrequentlyUsedZone aFrequentlyUsedZone);
Description
Gets the city that was used to set the specified cached time zone. The calling function takes ownership of the returned city.
If a city was not used to set the cached zone, the default city for the zone is returned.
Parameters
Return value
SetFrequentlyUsedZoneL(TInt,const CTzLocalizedTimeZone::TTzFrequentlyUsedZone)
IMPORT_C void SetFrequentlyUsedZoneL(TInt aTimeZoneId, const CTzLocalizedTimeZone::TTzFrequentlyUsedZone aFrequentlyUsedZone);
Description
Sets the ID of the specified cached time zone.
Parameters
SetFrequentlyUsedZoneL(const CTzLocalizedTimeZone &,const CTzLocalizedTimeZone::TTzFrequentlyUsedZone)
IMPORT_C void SetFrequentlyUsedZoneL(const CTzLocalizedTimeZone &aTimeZone, const CTzLocalizedTimeZone::TTzFrequentlyUsedZone
aFrequentlyUsedZone);
Description
Sets the value of the specified cached time zone.
Parameters
SetFrequentlyUsedZoneL(const CTzLocalizedCity &,const CTzLocalizedTimeZone::TTzFrequentlyUsedZone)
IMPORT_C void SetFrequentlyUsedZoneL(const CTzLocalizedCity &aCity, const CTzLocalizedTimeZone::TTzFrequentlyUsedZone aFrequentlyUsedZone);
Description
Sets the value of the specified cached zone to be the zone which aCity is located in. Setting a cached zone by city also stores
the city used to select the time zone.
Parameters
FindCityByNameL(const TDesC &,const TInt)
IMPORT_C CTzLocalizedCity* FindCityByNameL(const TDesC &aCityName, const TInt aTimeZoneId=0);
Description
Searches for a city with the specified name. If a time Zone ID is also specified, then the search only covers cities in that
time zone. Otherwise, all time zones are searched. The first matching city is returned.
Parameters
const TDesC16 &aCityName |
Name of the city to search for.
|
const TInt aTimeZoneId |
(Optional) A positive time zone ID of the city to search for. Specify zero to omit.
|
|
Return value
CTzLocalizedCity *
|
If successful, a pointer to a CTzLocalizedCity . The calling function takes ownership of the returned pointer. If the search string is not found, NULL is returned.
|
|
Leave codes
KErrNotFound |
The specified time zone ID does not exist.
|
|
FindTimeZoneByNameL(const TDesC &)
IMPORT_C CTzLocalizedTimeZone* FindTimeZoneByNameL(const TDesC &aTimeZoneName);
Description
Searches for a time zone with the specified name. All text fields of the time zone are searched.
Parameters
const TDesC16 &aTimeZoneName |
the name of the time zone to search for.
|
|
Return value
FindCityGroupByNameL(const TDesC &)
IMPORT_C CTzLocalizedCityGroup* FindCityGroupByNameL(const TDesC &aCityGroupName);
Description
Searches for a city group with the specified name.
Parameters
const TDesC16 &aCityGroupName |
The name of the city group to search for.
|
|
Return value
IMPORT_C TBool CheckLanguage();
Description
Tests whether the language of the loaded static data is still correct. If it is not, the static data is reloaded. Method could
leave while creating a data reader.
Return value
See also:
GetCitiesWithUTCOffsetL(TInt,const TTzSortOrder)
IMPORT_C CTzLocalizedCityArray* GetCitiesWithUTCOffsetL(TInt aUTCOffsetInMinutes, const TTzSortOrder aSortOrder=ETzUnsorted);
Description
Returns all cities defined in the static and persisted data that have the specified UTC offset. The calling function takes
ownership of the array.
Parameters
TInt aUTCOffsetInMinutes |
The offset in minutes.
|
const CTzLocalizer::TTzSortOrder aSortOrder |
Specifies the order in which the returned array will be sorted. Only ETzUnsorted, ETzAlphaNameAscending and ETzAlphaNameDescending
will have any effect, as all elements in the returned array will have the same UTC offset.
|
|
Return value
GetTimeZonesWithUTCOffsetL(TInt,const TTzSortOrder)
IMPORT_C CTzLocalizedTimeZoneArray* GetTimeZonesWithUTCOffsetL(TInt aUTCOffsetInMinutes, const TTzSortOrder aSortOrder=ETzUnsorted);
Description
Returns all the time zones defined in the static data that have the specified UTC offset. The calling function takes ownership
of the array.
Parameters
TInt aUTCOffsetInMinutes |
The UTC offset in minutes.
|
const CTzLocalizer::TTzSortOrder aSortOrder |
Specifies the order in which the returned array will be sorted. Sort orders ETzUTCAscending and ETzUTCDescending will not
have any effect as all elements in the returned array will have the same UTC offset.
|
|
Return value
TTzLocalizerPanics
Description
Panic reasons for the time zone localization component.
TTzSortOrder
Description
Used to specify the sort order of localized time zone information.