tzpcside/tzcompiler/Include/TZDocument.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     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 "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 // DST TZ Database Compiler 
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __TZDOCUMENT_H
       
    19 #define __TZDOCUMENT_H
       
    20 
       
    21 #include <vector>
       
    22 #include <string>
       
    23 #include "MCompiler.h"
       
    24 #include "MDocument.h"
       
    25 #include "TZNode.h"
       
    26 #include "TZTables.h"
       
    27 //============================================================================
       
    28 // Forward declarations
       
    29 //============================================================================
       
    30 class MScanner;
       
    31 class CTzCpStringTable;
       
    32 class CTzCpStringTable;
       
    33 class CTzCpRuleSetsTable;
       
    34 class CTzCpRuleUsesTable;
       
    35 class CTzCpRuleDefinitionsTable;
       
    36 class CTzCpRegionsTable;
       
    37 class CTzCpZonesTable;
       
    38 class CTzCpLinksTable;
       
    39 class CTzCpStdTimeAlignmentsTable;
       
    40 //============================================================================
       
    41 // CTZDocument class definition
       
    42 //============================================================================
       
    43 class CTZDocument : public MCompiler , public MDocument
       
    44 	{
       
    45 public:
       
    46 	CTZDocument(MScanner& aScanner);
       
    47 	~CTZDocument();
       
    48 
       
    49 	//New methods
       
    50 	void ExternaliseL();
       
    51 	TUint16 GetDefaultZoneOffset() const;
       
    52 	void AssignZoneIds();
       
    53 	void VerifyZoneIds();
       
    54 	void Exclude();								//Remove unwanted entities
       
    55 	void LogScanningError(int aLineNum,int aColNum,int aType);
       
    56 
       
    57 	//helper functions
       
    58 	void CopyDatabaseFileToOutputDirectory() const;
       
    59 	void DisplayData() const;
       
    60 
       
    61 	//From MCompiler
       
    62 	int Scan(const char* aFileName);
       
    63 	void AssembleL();
       
    64 	void Link();
       
    65 	
       
    66 	CTzCpStringTable* StringTable()			{ return iStringTable; }
       
    67 	CTzCpRuleSetsTable* RuleSetTable()		{ return iRuleSetTable;}
       
    68 	CTzCpRuleUsesTable* RuleUseTable()		{ return iRuleUseTable;}
       
    69 	CTzCpRuleDefinitionsTable* RuleDefinitionTable() { return iRuleDefinitionTable;}
       
    70 	CTzCpRegionsTable* RegionsTable()		{ return iRegionsTable;}
       
    71 	CTzCpZonesTable* ZonesTable()			{ return iZonesTable; }
       
    72 	CTzCpLinksTable* LinkTable()			{ return iLinkTable;	}
       
    73 	CTzCpStdTimeAlignmentsTable* StdTimeAlignmentTable() { return iStdTimeAlignmentTable; }
       
    74 
       
    75 	//Header
       
    76 	TTzHeader* DbHeader()					{ return &iDbHeader; }
       
    77 
       
    78 private:
       
    79 	// helper functions
       
    80 	std::string GetCommaSeparatedString(std::vector<std::string>& aStringVector);
       
    81 	void DisplayNodeList() const;
       
    82 	void DisplayRegionsTable() const;
       
    83 	void DisplayZonesTable() const;
       
    84 	void DisplayRuleSetTable() const;
       
    85 	void DisplayRuleDefinitionTable() const;
       
    86 	void DisplayStringTable() const;
       
    87 	void DisplayTimeAlignmentTable() const;
       
    88 
       
    89 	//From MDocument
       
    90 	void CreateChildElement();
       
    91 	void CreateRootChildElement();
       
    92 	void CloseElement();
       
    93 	void AddAttribute(const char* aValue);
       
    94 	void HandleScanError(const char* aFileName,int aLine,int aCol,char aChar);
       
    95 
       
    96 	void ReadConfigurationFile();				//Call on construction
       
    97 	void WriteConfigurationFile();				//Call on destruction
       
    98 
       
    99 	void AssembleRuleL(CTZNode& aNode);
       
   100 	void AssembleZoneL(CTZNode& aNode);
       
   101 
       
   102 
       
   103 public:
       
   104 	//Scanning errors
       
   105 	std::vector<std::string> iErrors;
       
   106 
       
   107 private:
       
   108 	//Data tables
       
   109 	CTzCpStringTable* iStringTable;
       
   110 	CTzCpRuleSetsTable* iRuleSetTable;
       
   111 	CTzCpRuleUsesTable* iRuleUseTable;
       
   112 	CTzCpRuleDefinitionsTable* iRuleDefinitionTable;
       
   113 	CTzCpRegionsTable* iRegionsTable;
       
   114 	CTzCpZonesTable* iZonesTable;
       
   115 	CTzCpLinksTable* iLinkTable;
       
   116 	CTzCpStdTimeAlignmentsTable* iStdTimeAlignmentTable;
       
   117 
       
   118 	//Header
       
   119 	TTzHeader iDbHeader;
       
   120 
       
   121 	MScanner& iScanner;							//Handles the actual parsing
       
   122 	CTZNode* iRoot;								//Root node
       
   123 	CTZNode* iOpenedElement;					//Current node
       
   124 	};
       
   125 
       
   126 #endif //__TZDOCUMENT_H
       
   127 //============================================================================
       
   128 // End of file
       
   129 //============================================================================