tzservices/tzserver/Server/Include/tzsystemdata.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 // Copyright (c) 2008-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 "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __TZSYSTEMDATA_H__
       
    17 #define __TZSYSTEMDATA_H__
       
    18 
       
    19 #include <tzlocalizationdatatypes.h>
       
    20 #include <tz.h>
       
    21 #include <barsc.h>
       
    22 #include <barsread.h>
       
    23 #include <f32file.h>
       
    24 
       
    25 /**
       
    26 Reads Localized time zone information and city information from resource files
       
    27 @internalTechnology
       
    28 */
       
    29 class CTzSystemDataDb : public CBase
       
    30 	{
       
    31 		//enums
       
    32 /**
       
    33 Enum to get to the various resources in the resource files. These can be added
       
    34 to the offset returned by RResourceFile::Offset() to get the relevant resource
       
    35 ID
       
    36 */
       
    37 	enum TTzResourceOffset
       
    38 		{
       
    39 /**
       
    40 Offset of the RSS Signature, this is always the first resource, so the enum
       
    41 starts at 1.
       
    42 */
       
    43 		ETzRssSignature = 1,
       
    44 /**
       
    45 Offset of the first localized resource. In the time zones resource file, this
       
    46 is the default cached zones resource, in the groups resource files, this is the
       
    47 first group.
       
    48 */
       
    49 		ETzFirstLocalizedResource,
       
    50 /**
       
    51 Offset of the first localized time zone resource. This simply allows the
       
    52 default cached zones resource to be skipped over in the time zones resource
       
    53 file.
       
    54 */
       
    55 		ETzFirstTimeZoneResource
       
    56 		};
       
    57 
       
    58 public:
       
    59 	CTzLocalizedTimeZoneRecord* ReadTimeZoneL(TInt aTimeZoneId);
       
    60 		void ReadCitiesL(RPointerArray<CTzLocalizedCityRecord>& aCities, TInt aTimeZoneId);
       
    61 		CTzLocalizedCityRecord* ReadDefaultCityL(TInt aTimeZoneId);
       
    62 		CTzLocalizedTimeZoneRecord* ReadFrequentlyUsedZoneL(TInt aFrequentlyUsedZone);
       
    63 		TInt ReadFrequentlyUsedZoneIdL(TInt aFrequentlyUsedZone);
       
    64 		static CTzSystemDataDb* NewLC();
       
    65 		~CTzSystemDataDb();
       
    66 
       
    67 	private:
       
    68 		void ConstructL();
       
    69 		TInt FindTimeZoneResourceIdL(TInt aTimeZoneId);
       
    70 		TInt LocalizedResourceIdL(const RResourceFile& aResourceFile, const TTzResourceOffset aOffset);
       
    71 		TInt FirstTimeZoneResourceIdL();
       
    72 		TInt CachedTimeZoneResourceIdL();
       
    73 		void BufferResourceL(const RResourceFile& aResourceFile, TInt aResourceId);
       
    74 		void ResetResourceBuffer();
       
    75 		CTzLocalizedTimeZoneRecord* DoReadTimeZoneL(TInt aResourceId);
       
    76 		CTzLocalizedTimeZoneRecord* CreateTimeZoneRecordFromResourceL(TInt aResourceId);
       
    77 		void DoReadCitiesL(RPointerArray<CTzLocalizedCityRecord>& aCities, TInt aResourceId);
       
    78 		void AddCityArrayFromResourceL(RPointerArray<CTzLocalizedCityRecord>& aCities, TInt aResourceId);
       
    79 
       
    80 	private:
       
    81 		RFs iFs;
       
    82 		RResourceFile iTimeZoneResourceFile;
       
    83 		RResourceFile iGroupResourceFile;
       
    84 		TBool iGroupResourceFileExists;
       
    85 		TResourceReader iResourceReader;
       
    86 		HBufC8* iResourceBuffer;
       
    87 	};
       
    88 
       
    89 #endif