Rudiments
|
00001 // Copyright (c) 2002 David Muse 00002 // See the COPYING file for more information. 00003 00004 #ifndef RUDIMENTS_XMLDOMNODE_H 00005 #define RUDIMENTS_XMLDOMNODE_H 00006 00007 #include <rudiments/private/xmldomnodeincludes.h> 00008 00009 #ifdef RUDIMENTS_NAMESPACE 00010 namespace rudiments { 00011 #endif 00012 00013 enum xmldomnodetype { 00014 NULL_XMLDOMNODETYPE=0, 00015 ROOT_XMLDOMNODETYPE, 00016 TAG_XMLDOMNODETYPE, 00017 ATTRIBUTE_XMLDOMNODETYPE, 00018 TEXT_XMLDOMNODETYPE, 00019 COMMENT_XMLDOMNODETYPE, 00020 CDATA_XMLDOMNODETYPE 00021 }; 00022 00023 class xmldom; 00024 class xmldomnodeprivate; 00025 00120 class RUDIMENTS_DLLSPEC xmldomnode { 00121 public: 00137 xmldomnode(xmldom *dom, xmldomnode *nullnode); 00138 00142 xmldomnode(xmldom *dom, 00143 xmldomnode *nullnode, 00144 xmldomnodetype type, 00145 const char *name, const char *value); 00146 00149 ~xmldomnode(); 00150 00151 00159 static xmldomnode *createNullNode(xmldom *dom); 00160 00161 00164 void cascadeOnDelete(); 00165 00169 void dontCascadeOnDelete(); 00170 00171 00173 xmldomnodetype getType() const; 00174 00176 const char *getName() const; 00177 00179 const char *getValue() const; 00180 00181 00184 xmldom *getTree() const; 00185 00188 xmldomnode *getParent() const; 00189 00192 uint64_t getPosition() const; 00193 00196 xmldomnode *getPreviousSibling() const; 00197 00201 xmldomnode *getPreviousTagSibling() const; 00202 00206 xmldomnode *getPreviousTagSibling(const char *name) const; 00207 00217 xmldomnode *getPreviousTagSibling(const char *name, 00218 const char *attributename, 00219 const char *attributevalue) const; 00220 00223 xmldomnode *getNextSibling() const; 00224 00228 xmldomnode *getNextTagSibling() const; 00229 00233 xmldomnode *getNextTagSibling(const char *name) const; 00234 00244 xmldomnode *getNextTagSibling(const char *name, 00245 const char *attributename, 00246 const char *attributevalue) const; 00247 00248 00250 uint64_t getChildCount() const; 00251 00254 xmldomnode *getChild(const char *name) const; 00255 00258 xmldomnode *getChild(uint64_t position) const; 00259 00268 xmldomnode *getChild(const char *name, 00269 const char *attributename, 00270 const char *attributevalue) 00271 const; 00272 00276 xmldomnode *getFirstTagChild() const; 00277 00281 xmldomnode *getFirstTagChild(const char *name) const; 00282 00292 xmldomnode *getFirstTagChild(const char *name, 00293 const char *attributename, 00294 const char *attributevalue) 00295 const; 00296 00297 00299 uint64_t getAttributeCount() const; 00300 00303 xmldomnode *getAttribute(const char *name) const; 00304 00307 xmldomnode *getAttribute(uint64_t position) const; 00308 00311 const char *getAttributeValue(const char *name) const; 00312 00316 const char *getAttributeValue(uint64_t position) const; 00317 00325 constnamevaluepairs *getAttributes() const; 00326 00330 void setAttributeValue(const char *name, 00331 const char *value); 00332 00336 void setAttributeValue(const char *name, 00337 int64_t value); 00338 00342 void setAttributeValue(const char *name, 00343 uint64_t value); 00344 00346 xmldomnode *getNullNode() const; 00347 00350 bool isNullNode() const; 00351 00352 00354 void setType(xmldomnodetype type); 00355 00357 void setName(const char *name); 00358 00360 void setValue(const char *value); 00361 00363 void setParent(xmldomnode *parent); 00364 00366 void setPreviousSibling(xmldomnode *previous); 00367 00369 void setNextSibling(xmldomnode *next); 00370 00374 bool insertChild(xmldomnode *child, uint64_t position); 00375 00377 bool appendChild(xmldomnode *child); 00378 00381 bool moveChild(xmldomnode *child, 00382 xmldomnode *parent, uint64_t position); 00383 00387 bool deleteChild(uint64_t position); 00388 00392 bool deleteChild(xmldomnode *child); 00393 00398 bool insertText(const char *value, uint64_t position); 00399 00402 bool appendText(const char *value); 00403 00407 bool insertAttribute(xmldomnode *attribute, 00408 uint64_t position); 00409 00411 bool appendAttribute(xmldomnode *attribute); 00412 00417 bool insertAttribute(const char *name, const char *value, 00418 uint64_t position); 00419 00422 bool appendAttribute(const char *name, const char *value); 00423 00427 bool deleteAttribute(uint64_t position); 00428 00433 bool deleteAttribute(const char *name); 00434 00438 bool deleteAttribute(xmldomnode *attribute); 00439 00440 00446 stringbuffer *xml() const; 00447 00457 stringbuffer *getPath() const; 00458 00465 xmldomnode *getChildByPath(const char *path) const; 00466 00475 xmldomnode *getAttributeByPath(const char *path, 00476 uint64_t position) const; 00477 00485 xmldomnode *getAttributeByPath(const char *path, 00486 const char *name) const; 00487 00496 const char *getAttributeValueByPath(const char *path, 00497 uint64_t position) const; 00498 00507 const char *getAttributeValueByPath(const char *path, 00508 const char *name) const; 00509 00511 static void print(xmldomnode *node); 00512 00513 #include <rudiments/private/xmldomnode.h> 00514 }; 00515 00516 #ifdef RUDIMENTS_NAMESPACE 00517 } 00518 #endif 00519 00520 #endif