Rudiments
xmldomnode.h
1 // Copyright (c) 2002 David Muse
2 // See the COPYING file for more information.
3 
4 #ifndef RUDIMENTS_XMLDOMNODE_H
5 #define RUDIMENTS_XMLDOMNODE_H
6 
7 #include <rudiments/private/xmldomnodeincludes.h>
8 
9 #ifdef RUDIMENTS_NAMESPACE
10 namespace rudiments {
11 #endif
12 
13 enum xmldomnodetype {
14  NULL_XMLDOMNODETYPE=0,
15  ROOT_XMLDOMNODETYPE,
16  TAG_XMLDOMNODETYPE,
17  ATTRIBUTE_XMLDOMNODETYPE,
18  TEXT_XMLDOMNODETYPE,
19  COMMENT_XMLDOMNODETYPE,
20  CDATA_XMLDOMNODETYPE
21 };
22 
23 class xmldom;
24 class xmldomnodeprivate;
25 
120 class RUDIMENTS_DLLSPEC xmldomnode {
121  public:
137  xmldomnode(xmldom *dom, xmldomnode *nullnode);
138 
142  xmldomnode(xmldom *dom,
143  xmldomnode *nullnode,
144  xmldomnodetype type,
145  const char *name, const char *value);
146 
149  ~xmldomnode();
150 
151 
159  static xmldomnode *createNullNode(xmldom *dom);
160 
161 
164  void cascadeOnDelete();
165 
169  void dontCascadeOnDelete();
170 
171 
173  xmldomnodetype getType() const;
174 
176  const char *getName() const;
177 
179  const char *getValue() const;
180 
181 
184  xmldomnode *getParent() const;
185 
188  uint64_t getPosition() const;
189 
192  xmldomnode *getPreviousSibling() const;
193 
197  xmldomnode *getPreviousTagSibling() const;
198 
202  xmldomnode *getPreviousTagSibling(const char *name) const;
203 
213  xmldomnode *getPreviousTagSibling(const char *name,
214  const char *attributename,
215  const char *attributevalue) const;
216 
219  xmldomnode *getNextSibling() const;
220 
224  xmldomnode *getNextTagSibling() const;
225 
229  xmldomnode *getNextTagSibling(const char *name) const;
230 
240  xmldomnode *getNextTagSibling(const char *name,
241  const char *attributename,
242  const char *attributevalue) const;
243 
244 
246  uint64_t getChildCount() const;
247 
250  xmldomnode *getChild(const char *name) const;
251 
254  xmldomnode *getChild(uint64_t position) const;
255 
264  xmldomnode *getChild(const char *name,
265  const char *attributename,
266  const char *attributevalue)
267  const;
268 
272  xmldomnode *getFirstTagChild() const;
273 
277  xmldomnode *getFirstTagChild(const char *name) const;
278 
288  xmldomnode *getFirstTagChild(const char *name,
289  const char *attributename,
290  const char *attributevalue)
291  const;
292 
293 
295  uint64_t getAttributeCount() const;
296 
299  xmldomnode *getAttribute(const char *name) const;
300 
303  xmldomnode *getAttribute(uint64_t position) const;
304 
307  const char *getAttributeValue(const char *name) const;
308 
312  const char *getAttributeValue(uint64_t position) const;
313 
321  constnamevaluepairs *getAttributes() const;
322 
326  void setAttributeValue(const char *name,
327  const char *value);
328 
332  void setAttributeValue(const char *name,
333  int64_t value);
334 
338  void setAttributeValue(const char *name,
339  uint64_t value);
340 
342  xmldomnode *getNullNode() const;
343 
346  bool isNullNode() const;
347 
348 
350  void setType(xmldomnodetype type);
351 
353  void setName(const char *name);
354 
356  void setValue(const char *value);
357 
359  void setParent(xmldomnode *parent);
360 
362  void setPreviousSibling(xmldomnode *previous);
363 
365  void setNextSibling(xmldomnode *next);
366 
370  bool insertChild(xmldomnode *child, uint64_t position);
371 
373  bool appendChild(xmldomnode *child);
374 
377  bool moveChild(xmldomnode *child,
378  xmldomnode *parent, uint64_t position);
379 
383  bool deleteChild(uint64_t position);
384 
388  bool deleteChild(xmldomnode *child);
389 
394  bool insertText(const char *value, uint64_t position);
395 
398  bool appendText(const char *value);
399 
403  bool insertAttribute(xmldomnode *attribute,
404  uint64_t position);
405 
407  bool appendAttribute(xmldomnode *attribute);
408 
413  bool insertAttribute(const char *name, const char *value,
414  uint64_t position);
415 
418  bool appendAttribute(const char *name, const char *value);
419 
423  bool deleteAttribute(uint64_t position);
424 
429  bool deleteAttribute(const char *name);
430 
434  bool deleteAttribute(xmldomnode *attribute);
435 
436 
442  stringbuffer *xml() const;
443 
453  stringbuffer *getPath() const;
454 
461  xmldomnode *getChildByPath(const char *path) const;
462 
471  xmldomnode *getAttributeByPath(const char *path,
472  uint64_t position) const;
473 
481  xmldomnode *getAttributeByPath(const char *path,
482  const char *name) const;
483 
492  const char *getAttributeValueByPath(const char *path,
493  uint64_t position) const;
494 
503  const char *getAttributeValueByPath(const char *path,
504  const char *name) const;
505 
506  #include <rudiments/private/xmldomnode.h>
507 };
508 
509 #ifdef RUDIMENTS_NAMESPACE
510 }
511 #endif
512 
513 #endif