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 enum xmldomnodetype {
10  NULL_XMLDOMNODETYPE=0,
11  ROOT_XMLDOMNODETYPE,
12  TAG_XMLDOMNODETYPE,
13  ATTRIBUTE_XMLDOMNODETYPE,
14  TEXT_XMLDOMNODETYPE,
15  COMMENT_XMLDOMNODETYPE,
16  CDATA_XMLDOMNODETYPE
17 };
18 
19 class xmldom;
20 class xmldomnodeprivate;
21 
116 class RUDIMENTS_DLLSPEC xmldomnode {
117  public:
133  xmldomnode(xmldom *dom, xmldomnode *nullnode);
134 
138  xmldomnode(xmldom *dom,
139  xmldomnode *nullnode,
140  xmldomnodetype type,
141  const char *name, const char *value);
142 
145  ~xmldomnode();
146 
147 
155  static xmldomnode *createNullNode(xmldom *dom);
156 
157 
160  void cascadeOnDelete();
161 
165  void dontCascadeOnDelete();
166 
167 
169  xmldomnodetype getType() const;
170 
172  const char *getName() const;
173 
175  const char *getValue() const;
176 
177 
180  xmldom *getTree() const;
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 
248  xmldomnode *getNextTagSiblingInSet(
249  const char * const *set) const;
250 
251 
253  uint64_t getChildCount() const;
254 
257  xmldomnode *getChild(const char *name) const;
258 
261  xmldomnode *getChild(uint64_t position) const;
262 
271  xmldomnode *getChild(const char *name,
272  const char *attributename,
273  const char *attributevalue)
274  const;
275 
279  xmldomnode *getFirstTagChild() const;
280 
284  xmldomnode *getFirstTagChild(const char *name) const;
285 
295  xmldomnode *getFirstTagChild(const char *name,
296  const char *attributename,
297  const char *attributevalue)
298  const;
299 
304  xmldomnode *getFirstTagChildInSet(
305  const char * const *set) const;
306 
307 
309  uint64_t getAttributeCount() const;
310 
313  xmldomnode *getAttribute(const char *name) const;
314 
317  xmldomnode *getAttribute(uint64_t position) const;
318 
321  const char *getAttributeValue(const char *name) const;
322 
326  const char *getAttributeValue(uint64_t position) const;
327 
335  constnamevaluepairs *getAttributes() const;
336 
340  void setAttributeValue(const char *name,
341  const char *value);
342 
346  void setAttributeValue(const char *name,
347  int64_t value);
348 
352  void setAttributeValue(const char *name,
353  uint64_t value);
354 
356  xmldomnode *getNullNode() const;
357 
360  bool isNullNode() const;
361 
362 
364  void setType(xmldomnodetype type);
365 
367  void setName(const char *name);
368 
370  void setValue(const char *value);
371 
373  void setParent(xmldomnode *parent);
374 
376  void setPreviousSibling(xmldomnode *previous);
377 
379  void setNextSibling(xmldomnode *next);
380 
384  bool insertChild(xmldomnode *child, uint64_t position);
385 
387  bool appendChild(xmldomnode *child);
388 
396  xmldomnode *insertTag(const char *tag, uint64_t position);
397 
403  xmldomnode *appendTag(const char *tag);
404 
407  bool moveChild(xmldomnode *child,
408  xmldomnode *parent, uint64_t position);
409 
413  bool deleteChild(uint64_t position);
414 
417  bool deleteChild(xmldomnode *child);
418 
420  bool deleteChildren();
421 
426  bool insertText(const char *value, uint64_t position);
427 
430  bool appendText(const char *value);
431 
435  bool insertAttribute(xmldomnode *attribute,
436  uint64_t position);
437 
439  bool appendAttribute(xmldomnode *attribute);
440 
445  bool insertAttribute(const char *name, const char *value,
446  uint64_t position);
447 
450  bool appendAttribute(const char *name, const char *value);
451 
455  bool deleteAttribute(uint64_t position);
456 
461  bool deleteAttribute(const char *name);
462 
466  bool deleteAttribute(xmldomnode *attribute);
467 
468 
471  xmldomnode *clone();
472 
473 
479  stringbuffer *xml() const;
480 
483  void print(stringbuffer *strb) const;
484 
487  void print(filedescriptor *fd) const;
488 
498  stringbuffer *getPath() const;
499 
506  xmldomnode *getChildByPath(const char *path) const;
507 
516  xmldomnode *getAttributeByPath(const char *path,
517  uint64_t position) const;
518 
526  xmldomnode *getAttributeByPath(const char *path,
527  const char *name) const;
528 
537  const char *getAttributeValueByPath(const char *path,
538  uint64_t position) const;
539 
548  const char *getAttributeValueByPath(const char *path,
549  const char *name) const;
550 
552  void setData(void *data);
553 
556  void *getData();
557 
558  #include <rudiments/private/xmldomnode.h>
559 };
560 
561 #endif
Definition: xmldomnode.h:116
Definition: stringbuffer.h:22
Definition: filedescriptor.h:14
Definition: xmldom.h:12