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 xmldomnode *getParent() const; 00185 00188 xmldomnode *getPreviousSibling() const; 00189 00193 xmldomnode *getPreviousTagSibling() const; 00194 00198 xmldomnode *getPreviousTagSibling(const char *name) const; 00199 00209 xmldomnode *getPreviousTagSibling(const char *name, 00210 const char *attributename, 00211 const char *attributevalue) const; 00212 00215 xmldomnode *getNextSibling() const; 00216 00220 xmldomnode *getNextTagSibling() const; 00221 00225 xmldomnode *getNextTagSibling(const char *name) const; 00226 00236 xmldomnode *getNextTagSibling(const char *name, 00237 const char *attributename, 00238 const char *attributevalue) const; 00239 00240 00242 uint64_t getChildCount() const; 00243 00246 xmldomnode *getChild(const char *name) const; 00247 00250 xmldomnode *getChild(uint64_t position) const; 00251 00260 xmldomnode *getChild(const char *name, 00261 const char *attributename, 00262 const char *attributevalue) 00263 const; 00264 00268 xmldomnode *getFirstTagChild() const; 00269 00273 xmldomnode *getFirstTagChild(const char *name) const; 00274 00284 xmldomnode *getFirstTagChild(const char *name, 00285 const char *attributename, 00286 const char *attributevalue) 00287 const; 00288 00289 00291 uint64_t getAttributeCount() const; 00292 00295 xmldomnode *getAttribute(const char *name) const; 00296 00299 xmldomnode *getAttribute(uint64_t position) const; 00300 00303 const char *getAttributeValue(const char *name) const; 00304 00308 const char *getAttributeValue(uint64_t position) const; 00309 00317 constnamevaluepairs *getAttributes() const; 00318 00322 void setAttributeValue(const char *name, 00323 const char *value); 00324 00328 void setAttributeValue(const char *name, 00329 int64_t value); 00330 00334 void setAttributeValue(const char *name, 00335 uint64_t value); 00336 00338 xmldomnode *getNullNode() const; 00339 00342 bool isNullNode() const; 00343 00344 00346 void setType(xmldomnodetype type); 00347 00349 void setName(const char *name); 00350 00352 void setValue(const char *value); 00353 00355 void setParent(xmldomnode *parent); 00356 00358 void setPreviousSibling(xmldomnode *previous); 00359 00361 void setNextSibling(xmldomnode *next); 00362 00366 bool insertChild(xmldomnode *child, uint64_t position); 00367 00369 bool appendChild(xmldomnode *child); 00370 00373 bool moveChild(xmldomnode *child, 00374 xmldomnode *parent, uint64_t position); 00375 00379 bool deleteChild(uint64_t position); 00380 00384 bool deleteChild(xmldomnode *child); 00385 00390 bool insertText(const char *value, uint64_t position); 00391 00394 bool appendText(const char *value); 00395 00399 bool insertAttribute(xmldomnode *attribute, 00400 uint64_t position); 00401 00403 bool appendAttribute(xmldomnode *attribute); 00404 00409 bool insertAttribute(const char *name, const char *value, 00410 uint64_t position); 00411 00414 bool appendAttribute(const char *name, const char *value); 00415 00419 bool deleteAttribute(uint64_t position); 00420 00425 bool deleteAttribute(const char *name); 00426 00430 bool deleteAttribute(xmldomnode *attribute); 00431 00432 00438 stringbuffer *xml() const; 00439 00449 stringbuffer *getPath() const; 00450 00457 xmldomnode *getChildByPath(const char *path) const; 00458 00467 xmldomnode *getAttributeByPath(const char *path, 00468 uint64_t position) const; 00469 00477 xmldomnode *getAttributeByPath(const char *path, 00478 const char *name) const; 00479 00488 const char *getAttributeValueByPath(const char *path, 00489 uint64_t position) const; 00490 00499 const char *getAttributeValueByPath(const char *path, 00500 const char *name) const; 00501 00502 #include <rudiments/private/xmldomnode.h> 00503 }; 00504 00505 #ifdef RUDIMENTS_NAMESPACE 00506 } 00507 #endif 00508 00509 #endif