summaryrefslogtreecommitdiff
path: root/src/xmldocument.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-04-03 03:49:53 +0000
committerMike Buland <eichlan@xagasoft.com>2007-04-03 03:49:53 +0000
commitf4c20290509d7ed3a8fd5304577e7a4cc0b9d974 (patch)
tree13cdf64f7cf134f397a7165b7a3fe0807e37026b /src/xmldocument.h
parent74d4c8cd27334fc7204d5a8773deb3d424565778 (diff)
downloadlibbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.gz
libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.bz2
libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.xz
libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.zip
Ok, no code is left in src, it's all in src/old. We'll gradually move code back
into src as it's fixed and re-org'd. This includes tests, which, I may write a unit test system into libbu++ just to make my life easier.
Diffstat (limited to 'src/xmldocument.h')
-rw-r--r--src/xmldocument.h171
1 files changed, 0 insertions, 171 deletions
diff --git a/src/xmldocument.h b/src/xmldocument.h
deleted file mode 100644
index 6671c41..0000000
--- a/src/xmldocument.h
+++ /dev/null
@@ -1,171 +0,0 @@
1#ifndef XMLDOCUMENT
2#define XMLDOCUMENT
3
4#include "xmlnode.h"
5
6/**
7 * Keeps track of an easily managed set of XmlNode information. Allows simple
8 * operations for logical writing to and reading from XML structures. Using
9 * already formed structures is simply done through the XmlNode structures,
10 * and the getRoot function here. Creation is performed through a simple set
11 * of operations that creates the data in a stream type format.
12 *@author Mike Buland
13 */
14class XmlDocument
15{
16public:
17 /**
18 * Construct either a blank XmlDocuemnt or construct a document around an
19 * existing XmlNode. Be careful, once an XmlNode is passed into a document
20 * the document takes over ownership and will delete it when the XmlDocument
21 * is deleted.
22 *@param pRoot The XmlNode to use as the root of this document, or NULL if
23 * you want to start a new document.
24 */
25 XmlDocument( XmlNode *pRoot=NULL );
26
27 /**
28 * Destroy all contained nodes.
29 */
30 virtual ~XmlDocument();
31
32 /**
33 * Add a new node to the document. The new node is appended to the end of
34 * the current context, i.e. XmlNode, and the new node, provided it isn't
35 * close as part of this operation, will become the current context.
36 *@param sName The name of the new node to add.
37 *@param sContent A content string to be placed inside of the new node.
38 *@param bClose Set this to true to close the node immediately after adding
39 * the node and setting the content and name. If this is set to true the
40 * node is appended, but the context node doesn't change.
41 */
42 void addNode( const char *sName=NULL, const char *sContent=NULL, bool bClose=false );
43
44 /**
45 * Set the name of the current node context.
46 *@param sName The new name of the node.
47 */
48 void setName( const char *sName );
49
50 /**
51 * Close the current node context. This will move the current context to
52 * the parent node of the former current node. If the current node was the
53 * root then the "completed" flag is set and no more operations are allowed.
54 */
55 void closeNode();
56
57 /**
58 * Change the content of the current node at the current position between
59 * nodes.
60 *@param sContent The new content of the current node.
61 */
62 void setContent( const char *sContent );
63
64 /**
65 * Add a named property to the current context node.
66 *@param sName The name of the property to add.
67 *@param sValue The string value of the property.
68 */
69 void addProperty( const char *sName, const char *sValue );
70
71 /**
72 * Add a named property to the current context node, converting the
73 * numerical parameter to text using standrd printf style conversion.
74 *@param sName The name of the property to add.
75 *@param nValue The numerical value to add.
76 */
77 void addProperty( const char *sName, const unsigned char nValue );
78
79 /**
80 * Add a named property to the current context node, converting the
81 * numerical parameter to text using standrd printf style conversion.
82 *@param sName The name of the property to add.
83 *@param nValue The numerical value to add.
84 */
85 void addProperty( const char *sName, const char nValue );
86
87 /**
88 * Add a named property to the current context node, converting the
89 * numerical parameter to text using standrd printf style conversion.
90 *@param sName The name of the property to add.
91 *@param nValue The numerical value to add.
92 */
93 void addProperty( const char *sName, const unsigned short nValue );
94
95 /**
96 * Add a named property to the current context node, converting the
97 * numerical parameter to text using standrd printf style conversion.
98 *@param sName The name of the property to add.
99 *@param nValue The numerical value to add.
100 */
101 void addProperty( const char *sName, const short nValue );
102
103 /**
104 * Add a named property to the current context node, converting the
105 * numerical parameter to text using standrd printf style conversion.
106 *@param sName The name of the property to add.
107 *@param nValue The numerical value to add.
108 */
109 void addProperty( const char *sName, const unsigned long nValue );
110
111 /**
112 * Add a named property to the current context node, converting the
113 * numerical parameter to text using standrd printf style conversion.
114 *@param sName The name of the property to add.
115 *@param nValue The numerical value to add.
116 */
117 void addProperty( const char *sName, const long nValue );
118
119 /**
120 * Add a named property to the current context node, converting the
121 * numerical parameter to text using standrd printf style conversion.
122 *@param sName The name of the property to add.
123 *@param nValue The numerical value to add.
124 */
125 void addProperty( const char *sName, const int nValue );
126
127 /**
128 * Add a named property to the current context node, converting the
129 * numerical parameter to text using standrd printf style conversion.
130 *@param sName The name of the property to add.
131 *@param dValue The numerical value to add.
132 */
133 void addProperty( const char *sName, const double dValue );
134
135 /**
136 * The XmlDocuemnt is considered completed if the root node has been closed.
137 * Once an XmlDocument has been completed, you can no longer perform
138 * operations on it.
139 *@return True if completed, false if still in progress.
140 */
141 bool isCompleted();
142
143 /**
144 * Get a pointer to the root object of this XmlDocument.
145 *@returns A pointer to an internally owned XmlNode. Do not delete this
146 * XmlNode.
147 */
148 XmlNode *getRoot();
149
150 /**
151 * Get a pointer to the root object of this XmlDocument, and remove the
152 * ownership from this object.
153 *@returns A pointer to an internally owned XmlNode. Do not delete this
154 * XmlNode.
155 */
156 XmlNode *detatchRoot();
157
158 /**
159 * Get the current context node, which could be the same as the root node.
160 *@returns A pointer to an internally owned XmlNode. Do not delete this
161 * XmlNode.
162 */
163 XmlNode *getCurrent();
164
165private:
166 XmlNode *pRoot; /**< The root node. */
167 XmlNode *pCurrent; /**< The current node. */
168 bool bCompleted; /**< Is it completed? */
169};
170
171#endif