diff options
Diffstat (limited to '')
-rw-r--r-- | src/old/xmldocument.cpp | 145 |
1 files changed, 0 insertions, 145 deletions
diff --git a/src/old/xmldocument.cpp b/src/old/xmldocument.cpp deleted file mode 100644 index 95b9788..0000000 --- a/src/old/xmldocument.cpp +++ /dev/null | |||
@@ -1,145 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | #include "xmldocument.h" | ||
4 | |||
5 | XmlDocument::XmlDocument( XmlNode *pRoot ) | ||
6 | { | ||
7 | this->pRoot = pRoot; | ||
8 | pCurrent = NULL; | ||
9 | bCompleted = (pRoot!=NULL); | ||
10 | } | ||
11 | |||
12 | XmlDocument::~XmlDocument() | ||
13 | { | ||
14 | if( pRoot ) | ||
15 | { | ||
16 | delete pRoot; | ||
17 | } | ||
18 | } | ||
19 | |||
20 | void XmlDocument::addNode( const Bu::FString &sName ) | ||
21 | { | ||
22 | if( pRoot == NULL ) | ||
23 | { | ||
24 | // This is the first node, so ignore position and just insert it. | ||
25 | pCurrent = pRoot = new XmlNode( sName ); | ||
26 | } | ||
27 | else | ||
28 | { | ||
29 | pCurrent = pCurrent->addChild( sName ); | ||
30 | } | ||
31 | } | ||
32 | /* | ||
33 | void XmlDocument::setName( const char *sName ) | ||
34 | { | ||
35 | pCurrent->setName( sName ); | ||
36 | }*/ | ||
37 | |||
38 | bool XmlDocument::isCompleted() | ||
39 | { | ||
40 | return bCompleted; | ||
41 | } | ||
42 | |||
43 | XmlNode *XmlDocument::getRoot() | ||
44 | { | ||
45 | return pRoot; | ||
46 | } | ||
47 | |||
48 | XmlNode *XmlDocument::detatchRoot() | ||
49 | { | ||
50 | XmlNode *pTemp = pRoot; | ||
51 | pRoot = NULL; | ||
52 | return pTemp; | ||
53 | } | ||
54 | |||
55 | XmlNode *XmlDocument::getCurrent() | ||
56 | { | ||
57 | return pCurrent; | ||
58 | } | ||
59 | |||
60 | void XmlDocument::closeNode() | ||
61 | { | ||
62 | if( pCurrent != NULL ) | ||
63 | { | ||
64 | pCurrent = pCurrent->getParent(); | ||
65 | |||
66 | if( pCurrent == NULL ) | ||
67 | { | ||
68 | bCompleted = true; | ||
69 | } | ||
70 | } | ||
71 | } | ||
72 | |||
73 | void XmlDocument::addProperty( const char *sName, const char *sValue ) | ||
74 | { | ||
75 | if( pCurrent ) | ||
76 | { | ||
77 | pCurrent->addProperty( sName, sValue ); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | void XmlDocument::addProperty( const char *sName, const unsigned char nValue ) | ||
82 | { | ||
83 | char buf[12]; | ||
84 | sprintf( buf, "%hhi", nValue ); | ||
85 | addProperty( sName, buf ); | ||
86 | } | ||
87 | |||
88 | void XmlDocument::addProperty( const char *sName, const char nValue ) | ||
89 | { | ||
90 | char buf[12]; | ||
91 | sprintf( buf, "%hhi", nValue ); | ||
92 | addProperty( sName, buf ); | ||
93 | } | ||
94 | |||
95 | void XmlDocument::addProperty( const char *sName, const unsigned short nValue ) | ||
96 | { | ||
97 | char buf[12]; | ||
98 | sprintf( buf, "%hi", nValue ); | ||
99 | addProperty( sName, buf ); | ||
100 | } | ||
101 | |||
102 | void XmlDocument::addProperty( const char *sName, const short nValue ) | ||
103 | { | ||
104 | char buf[12]; | ||
105 | sprintf( buf, "%hi", nValue ); | ||
106 | addProperty( sName, buf ); | ||
107 | } | ||
108 | |||
109 | void XmlDocument::addProperty( const char *sName, const int nValue ) | ||
110 | { | ||
111 | char buf[12]; | ||
112 | sprintf( buf, "%d", nValue ); | ||
113 | addProperty( sName, buf ); | ||
114 | } | ||
115 | |||
116 | void XmlDocument::addProperty( const char *sName, const unsigned long nValue ) | ||
117 | { | ||
118 | char buf[12]; | ||
119 | sprintf( buf, "%li", nValue ); | ||
120 | addProperty( sName, buf ); | ||
121 | } | ||
122 | |||
123 | void XmlDocument::addProperty( const char *sName, const long nValue ) | ||
124 | { | ||
125 | char buf[12]; | ||
126 | sprintf( buf, "%li", nValue ); | ||
127 | addProperty( sName, buf ); | ||
128 | } | ||
129 | |||
130 | void XmlDocument::addProperty( const char *sName, const double dValue ) | ||
131 | { | ||
132 | char buf[40]; | ||
133 | sprintf( buf, "%f", dValue ); | ||
134 | addProperty( sName, buf ); | ||
135 | } | ||
136 | |||
137 | void XmlDocument::setContent( const char *sContent ) | ||
138 | { | ||
139 | if( pCurrent ) | ||
140 | { | ||
141 | printf("XmlDocument::setContent: not yet implemented.\n"); | ||
142 | //pCurrent->setContent( sContent ); | ||
143 | } | ||
144 | } | ||
145 | |||