|
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 #include "TZNode.h" |
|
19 #include <iostream> |
|
20 |
|
21 //============================================================================ |
|
22 // CTZElement::~CTZElement |
|
23 //============================================================================ |
|
24 CTZElement::~CTZElement() |
|
25 { |
|
26 for (int i = 0; i < NodeList().size();++i) |
|
27 { |
|
28 delete NodeList()[i]; |
|
29 } |
|
30 } |
|
31 //============================================================================ |
|
32 // CTZElement::CheckNode |
|
33 // Checks to see that the node actually contains information and is valid for |
|
34 // assembly. Invalid nodes may be generated if a file contains a comment |
|
35 // on a line beginning with empty tabs. If this happens, a node with empty |
|
36 // tab elements will be generated. |
|
37 //============================================================================ |
|
38 bool CTZElement::CheckNode() const |
|
39 { |
|
40 char startChar; |
|
41 int size = iNodeList.size(); |
|
42 for (int x = 0; x < size;x++) |
|
43 { |
|
44 startChar = iNodeList[x]->iValue[0]; //First character of attribute |
|
45 if ((startChar != '\t') && (startChar != KCharOlsonStartOfComment) && (startChar != ' ')) |
|
46 { |
|
47 return true; |
|
48 } |
|
49 } |
|
50 return false; |
|
51 } |
|
52 |
|
53 bool CTZAttribute::CheckNode() const |
|
54 { |
|
55 char startChar = iValue[0]; //First character of attribute |
|
56 if ((startChar != '\t') && (startChar != KCharOlsonStartOfComment) && (startChar != ' ')) |
|
57 { |
|
58 return true; |
|
59 } |
|
60 return false; |
|
61 } |
|
62 |
|
63 //============================================================================ |
|
64 // CTZElement::AddAttribute |
|
65 // Adds an attribute to the current node |
|
66 //============================================================================ |
|
67 void CTZElement::AddAttribute(const char* aValue) |
|
68 { |
|
69 CTZNode* aAttribute = new CTZAttribute(); |
|
70 aAttribute->iParent = this; |
|
71 aAttribute->iValue = aValue; |
|
72 iNodeList.push_back(aAttribute); |
|
73 } |
|
74 |
|
75 //============================================================================ |
|
76 // CTZElement::AddChildElement |
|
77 // Creates a new CTZElement as a child node of the current element. |
|
78 //============================================================================ |
|
79 CTZNode* CTZElement::CreateChildElement() |
|
80 { |
|
81 CTZElement* childElement = new CTZElement(); |
|
82 childElement->iParent = this; |
|
83 iNodeList.push_back(childElement); |
|
84 return childElement; |
|
85 } |
|
86 //============================================================================ |
|
87 // End of file |
|
88 //============================================================================ |