|
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 __TZNODE_H |
|
19 #define __TZNODE_H |
|
20 |
|
21 #include <string> |
|
22 #include <vector> |
|
23 #include "tzglobals.h" |
|
24 |
|
25 //============================================================================ |
|
26 // CTZNode class definition |
|
27 //============================================================================ |
|
28 class CTZNode |
|
29 { |
|
30 public: |
|
31 virtual ~CTZNode() {}; |
|
32 virtual std::vector<CTZNode*>& NodeList() = 0; |
|
33 virtual bool CheckNode() const = 0; |
|
34 virtual CTZNode* CreateChildElement() = 0; |
|
35 virtual void AddAttribute(const char* aValue) = 0; |
|
36 //From model |
|
37 std::string iValue; //The actual value of the token |
|
38 CTZNode* iParent; //This nodes parent node |
|
39 }; |
|
40 |
|
41 //============================================================================ |
|
42 // CTZElement class Definition |
|
43 // An element is a CTZNode which can contain other CTZNodes (CTZAttributes) |
|
44 // Encapsulates a line of TZ rule specification, such as RULE, LINK, ZONE etc |
|
45 //============================================================================ |
|
46 class CTZElement : public CTZNode |
|
47 { |
|
48 private: |
|
49 ~CTZElement(); |
|
50 void AddAttribute(const char* aValue); |
|
51 CTZNode* CreateChildElement(); |
|
52 std::vector<CTZNode*>& NodeList() { return iNodeList; } |
|
53 bool CheckNode() const; |
|
54 |
|
55 private: |
|
56 std::vector<CTZNode*> iNodeList; //Vector of CTZNode objects |
|
57 }; |
|
58 //============================================================================ |
|
59 // CTZAttribute class definition |
|
60 // An attribute represents a field from a line of the TZ database |
|
61 //============================================================================ |
|
62 class CTZAttribute : public CTZNode |
|
63 { |
|
64 private: |
|
65 CTZNode* CreateChildElement() { throw TzGlobals::ETzAbortInvalidCompilerState; } |
|
66 void AddAttribute(const char* aValue) { throw TzGlobals::ETzAbortInvalidCompilerState; }; |
|
67 std::vector<CTZNode*>& NodeList() { throw TzGlobals::ETzAbortInvalidCompilerState; } |
|
68 bool CheckNode() const; |
|
69 }; |
|
70 |
|
71 #endif //__TZNODE_H |
|
72 //============================================================================ |
|
73 // End of file |
|
74 //============================================================================ |