Rudiments
/home/dmuse/src/rudiments/include/rudiments/xmldomnode.h
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                 uint64_t        getPosition() const;
00189 
00192                 xmldomnode      *getPreviousSibling() const;
00193 
00197                 xmldomnode      *getPreviousTagSibling() const;
00198 
00202                 xmldomnode      *getPreviousTagSibling(const char *name) const;
00203 
00213                 xmldomnode      *getPreviousTagSibling(const char *name,
00214                                         const char *attributename,
00215                                         const char *attributevalue) const;
00216 
00219                 xmldomnode      *getNextSibling() const;
00220 
00224                 xmldomnode      *getNextTagSibling() const;
00225 
00229                 xmldomnode      *getNextTagSibling(const char *name) const;
00230 
00240                 xmldomnode      *getNextTagSibling(const char *name,
00241                                         const char *attributename,
00242                                         const char *attributevalue) const;
00243 
00244 
00246                 uint64_t        getChildCount() const;
00247 
00250                 xmldomnode      *getChild(const char *name) const;
00251 
00254                 xmldomnode      *getChild(uint64_t position) const;
00255 
00264                 xmldomnode      *getChild(const char *name,
00265                                                 const char *attributename,
00266                                                 const char *attributevalue)
00267                                                 const;
00268 
00272                 xmldomnode      *getFirstTagChild() const;
00273 
00277                 xmldomnode      *getFirstTagChild(const char *name) const;
00278 
00288                 xmldomnode      *getFirstTagChild(const char *name,
00289                                                 const char *attributename,
00290                                                 const char *attributevalue)
00291                                                 const;
00292 
00293 
00295                 uint64_t        getAttributeCount() const;
00296 
00299                 xmldomnode      *getAttribute(const char *name) const;
00300 
00303                 xmldomnode      *getAttribute(uint64_t position) const;
00304 
00307                 const char      *getAttributeValue(const char *name) const;
00308 
00312                 const char      *getAttributeValue(uint64_t position) const;
00313 
00321                 constnamevaluepairs     *getAttributes() const;
00322 
00326                 void            setAttributeValue(const char *name,
00327                                                         const char *value);
00328 
00332                 void            setAttributeValue(const char *name,
00333                                                         int64_t value);
00334 
00338                 void            setAttributeValue(const char *name,
00339                                                         uint64_t value);
00340 
00342                 xmldomnode      *getNullNode() const;
00343 
00346                 bool            isNullNode() const;
00347 
00348 
00350                 void    setType(xmldomnodetype type);
00351 
00353                 void    setName(const char *name);
00354 
00356                 void    setValue(const char *value);
00357 
00359                 void    setParent(xmldomnode *parent);
00360 
00362                 void    setPreviousSibling(xmldomnode *previous);
00363 
00365                 void    setNextSibling(xmldomnode *next);
00366 
00370                 bool    insertChild(xmldomnode *child, uint64_t position);
00371 
00373                 bool    appendChild(xmldomnode *child);
00374 
00377                 bool    moveChild(xmldomnode *child,
00378                                         xmldomnode *parent, uint64_t position);
00379 
00383                 bool    deleteChild(uint64_t position);
00384 
00388                 bool    deleteChild(xmldomnode *child);
00389 
00394                 bool    insertText(const char *value, uint64_t position);
00395 
00398                 bool    appendText(const char *value);
00399 
00403                 bool    insertAttribute(xmldomnode *attribute,
00404                                                         uint64_t position);
00405 
00407                 bool    appendAttribute(xmldomnode *attribute);
00408 
00413                 bool    insertAttribute(const char *name, const char *value,
00414                                                         uint64_t position);
00415 
00418                 bool    appendAttribute(const char *name, const char *value);
00419 
00423                 bool    deleteAttribute(uint64_t position);
00424 
00429                 bool    deleteAttribute(const char *name);
00430 
00434                 bool    deleteAttribute(xmldomnode *attribute);
00435 
00436 
00442                 stringbuffer    *xml() const;
00443 
00453                 stringbuffer    *getPath() const;
00454 
00461                 xmldomnode      *getChildByPath(const char *path) const;
00462 
00471                 xmldomnode      *getAttributeByPath(const char *path,
00472                                                 uint64_t position) const;
00473 
00481                 xmldomnode      *getAttributeByPath(const char *path,
00482                                                         const char *name) const;
00483 
00492                 const char      *getAttributeValueByPath(const char *path,
00493                                                 uint64_t position) const;
00494 
00503                 const char      *getAttributeValueByPath(const char *path,
00504                                                         const char *name) const;
00505 
00506         #include <rudiments/private/xmldomnode.h>
00507 };
00508 
00509 #ifdef RUDIMENTS_NAMESPACE
00510 }
00511 #endif
00512 
00513 #endif