1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
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
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __TZLOCAL_DATATYPES_H__
17 #define __TZLOCAL_DATATYPES_H__
19 #include <e32base.h> //CBase
22 Encapsulates the correspondence between a time zone ID and a resource ID and
23 facilitates fast finding of resources in the resource file. For internal use only.
30 // Represents an invalid UTC offset of 25 hours and 1 minutes, in minutes
33 ETzInvalidUTCOffset = 1501
37 TTzLocalizedId(const TUint16 aTzId, const TUint aResourceId =0);
40 inline TUint16 TimeZoneId() const;
41 inline TUint ResourceId() const;
42 inline TInt UTCOffset() const;
43 inline void SetUTCOffset(TInt aOffsetInMinutes);
48 TInt iUTCOffset; //UTC offset stored in minutes
52 Encapsulates a localized (exemplar) city.
57 class CTzLocalizedCity : public CBase
60 static CTzLocalizedCity* NewL(
62 const TTzLocalizedId& aTzLocalizedId,
63 const TUint8 aGroupId =0);
64 static CTzLocalizedCity* NewLC(
66 const TTzLocalizedId& aTzLocalizedId,
67 const TUint8 aGroupId =0);
71 IMPORT_C TPtrC Name() const;
72 IMPORT_C TUint16 TimeZoneId() const;
73 IMPORT_C TUint8 GroupId() const;
74 TTzLocalizedId TzLocalizedId() const;
75 TInt UTCOffset() const;
76 void SetUTCOffset(TInt aUTCoffset);
77 void SetCityIndex(TInt aIndex);
78 TInt CityIndex() const;
81 void ConstructL(const TDesC& aName);
82 CTzLocalizedCity(const TUint8 aGroupId, const TTzLocalizedId& aTzLocalizedId);
88 TTzLocalizedId iTzLocalizedId;
93 Encapsulates a localized group of (exemplar) cities.
98 class CTzLocalizedCityGroup : public CBase
101 static CTzLocalizedCityGroup* NewL(const TDesC& aName, const TUint8 aGroupId);
102 static CTzLocalizedCityGroup* NewLC(const TDesC& aName, const TUint8 aGroupId);
103 ~CTzLocalizedCityGroup();
106 IMPORT_C TPtrC Name() const;
107 IMPORT_C TUint8 Id() const;
110 void ConstructL(const TDesC& aName);
111 CTzLocalizedCityGroup(const TUint8 aGroupId);
120 Encapsulates a group of LDML localized timezone names.
121 LDML stands for Locale Data Markup Language. For details, see
122 http://www.openi18n.org/specs/ldml/1.0/ldml-spec.htm.
127 class CTzLocalizedTimeZone : public CBase
131 Flags to identify a cached zone.
135 enum TTzFrequentlyUsedZone
137 /** The current zone. */
139 /** The home zone. */
141 /** The zone of interest. */
143 /** The first recently-used zone. */
145 /** The second recently-used zone. */
147 /** Specifies the number of cached zones. Not to be used as an API argument. */
148 ECachedTimeZones // If new items are added to this enum, this must
149 // left as last item, because it is used to keep
150 // count of the number of cached zones
154 static CTzLocalizedTimeZone* NewL(
155 const TTzLocalizedId& aTzLocalizedId,
156 const TDesC& aStandardName,
157 const TDesC& aDaylightName,
158 const TDesC& aShortStandardName,
159 const TDesC& aShortDaylightName);
161 static CTzLocalizedTimeZone* NewLC(
162 const TTzLocalizedId& aTzLocalizedId,
163 const TDesC& aStandardName,
164 const TDesC& aDaylightName,
165 const TDesC& aShortStandardName,
166 const TDesC& aShortDaylightName);
168 ~CTzLocalizedTimeZone();
171 IMPORT_C TUint16 TimeZoneId() const;
172 IMPORT_C TPtrC StandardName() const;
173 IMPORT_C TPtrC DaylightName() const;
174 IMPORT_C TPtrC ShortStandardName() const;
175 IMPORT_C TPtrC ShortDaylightName() const;
176 TTzLocalizedId TzLocalizedId() const;
177 TInt UTCOffset() const;
178 void SetUTCOffset(TInt aUTCoffset);
182 const TDesC& aStandardName,
183 const TDesC& aDaylightName,
184 const TDesC& aShortStandardName,
185 const TDesC& aShortDaylightName);
186 CTzLocalizedTimeZone(const TTzLocalizedId& aTzLocalizedId);
190 TTzLocalizedId iTzLocalizedId;
191 HBufC* iStandardName;
192 HBufC* iDaylightName;
193 HBufC* iShortStandardName;
194 HBufC* iShortDaylightName;
198 Template for arrays of localized objects. Implemented using a thin template.
199 All functions are inline.
205 class CTzLocalizedArray : public CBase
208 inline ~CTzLocalizedArray();
210 inline T& At(TInt aIndex) const;
211 inline TInt Count() const;
212 inline void AppendL(T* aElement);
213 inline void Remove(TInt aIndex);
214 inline void Sort(TLinearOrder<T> aOrder);
215 inline TInt Find(T* aEntry,TIdentityRelation<T> aIdentityRelation);
217 inline CTzLocalizedArray();
221 RPointerArray<T> iArray;
224 // Assign concrete classes for each of the arrays that will be used
225 // This guards against future BC problems
228 An array of cities. This just passes function calls on to its templated base
229 class, CTzLocalizedArray.
234 class CTzLocalizedCityArray : public CTzLocalizedArray<CTzLocalizedCity>
237 IMPORT_C static CTzLocalizedCityArray* NewL();
238 IMPORT_C static CTzLocalizedCityArray* NewLC();
240 IMPORT_C CTzLocalizedCity& At(TInt aIndex) const;
241 IMPORT_C TInt Count() const;
242 IMPORT_C void AppendL(CTzLocalizedCity* aCity);
243 IMPORT_C void Remove(TInt aIndex);
244 IMPORT_C void Sort(TLinearOrder<CTzLocalizedCity> anOrder);
245 IMPORT_C TInt Find(CTzLocalizedCity* anEntry,TIdentityRelation<CTzLocalizedCity> aIdentityRelation);
249 An array of city groups. This just passes function calls on to its templated base
250 class, CTzLocalizedArray.
255 class CTzLocalizedCityGroupArray : public CTzLocalizedArray<CTzLocalizedCityGroup>
258 IMPORT_C static CTzLocalizedCityGroupArray* NewL();
259 IMPORT_C static CTzLocalizedCityGroupArray* NewLC();
261 IMPORT_C CTzLocalizedCityGroup& At(TInt aIndex) const;
262 IMPORT_C TInt Count() const;
263 IMPORT_C void AppendL(CTzLocalizedCityGroup* aGroup);
264 IMPORT_C void Remove(TInt aIndex);
265 IMPORT_C void Sort(TLinearOrder<CTzLocalizedCityGroup> anOrder);
266 IMPORT_C TInt Find(CTzLocalizedCityGroup* anEntry,TIdentityRelation<CTzLocalizedCityGroup> aIdentityRelation);
270 An array of time zones. This just passes function calls on to its templated base
271 class, CTzLocalizedArray.
276 class CTzLocalizedTimeZoneArray : public CTzLocalizedArray<CTzLocalizedTimeZone>
279 IMPORT_C static CTzLocalizedTimeZoneArray* NewL();
280 IMPORT_C static CTzLocalizedTimeZoneArray* NewLC();
282 IMPORT_C CTzLocalizedTimeZone& At(TInt aIndex) const;
283 IMPORT_C TInt Count() const;
284 IMPORT_C void AppendL(CTzLocalizedTimeZone* aElement);
285 IMPORT_C void Remove(TInt aIndex);
286 IMPORT_C void Sort(TLinearOrder<CTzLocalizedTimeZone> anOrder);
287 IMPORT_C TInt Find(CTzLocalizedTimeZone* anEntry,TIdentityRelation<CTzLocalizedTimeZone> aIdentityRelation);
290 #include <tzlocalizationdatatypes.inl>
292 #endif //__TZLOCAL_DATATYPES_H__
293 //==================================================================
295 //==================================================================