GammaLib
2.0.0
|
XML comment node class. More...
#include <GXmlComment.hpp>
Public Member Functions | |
GXmlComment (void) | |
Void constructor. More... | |
GXmlComment (const GXmlComment &node) | |
Copy constructor. More... | |
GXmlComment (const std::string &segment) | |
Segment constructor. More... | |
virtual | ~GXmlComment (void) |
Destructor. More... | |
GXmlComment & | operator= (const GXmlComment &node) |
Assignment operator. More... | |
virtual void | clear (void) |
Clear XML comment. More... | |
virtual GXmlComment * | clone (void) const |
Clone XML comment. More... | |
virtual std::string | classname (void) const |
Return class name. More... | |
virtual void | write (GUrl &url, const int &indent=0) const |
Write comment into URL. More... | |
virtual NodeType | type (void) const |
Return XML node type. More... | |
virtual std::string | print (const GChatter &chatter=NORMAL, const int &indent=0) const |
Print XML comment. More... | |
const std::string & | comment (void) const |
Return comment. More... | |
void | comment (const std::string &comment) |
Set comment. More... | |
Public Member Functions inherited from GXmlNode | |
GXmlNode (void) | |
Void constructor. More... | |
GXmlNode (const GXmlNode &node) | |
Copy constructor. More... | |
virtual | ~GXmlNode (void) |
Destructor. More... | |
GXmlNode & | operator= (const GXmlNode &node) |
Assignment operator. More... | |
GXmlNode * | operator[] (const int &index) |
Return pointer to XML child node. More... | |
const GXmlNode * | operator[] (const int &index) const |
Return pointer to XML child node (const version) More... | |
virtual int | size (void) const |
Return number of child nodes. More... | |
virtual bool | is_empty (void) const |
Signals if node has no child nodes. More... | |
virtual GXmlNode * | set (const int &index, const GXmlNode &node) |
Set XML child node. More... | |
virtual GXmlNode * | append (const GXmlNode &node) |
Append XML child node. More... | |
virtual GXmlElement * | append (const std::string &segment) |
Append XML element child node. More... | |
virtual GXmlNode * | insert (const int &index, const GXmlNode &node) |
Insert XML child node. More... | |
virtual void | remove (const int &index) |
Remove XML child node. More... | |
virtual void | reserve (const int &num) |
Reserve space for child nodes. More... | |
virtual void | extend (const GXmlNode &node) |
Append all XML child nodes from another XML node. More... | |
GXmlNode * | parent (void) const |
Return parent XML node. More... | |
void | parent (GXmlNode *parent) |
Set parent of XML node. More... | |
GFilename | filename (void) const |
Return filename of XML file. More... | |
virtual int | elements (void) const |
Return number of GXMLElement children of node. More... | |
virtual int | elements (const std::string &name) const |
Return number of GXMLElement children with a given name. More... | |
virtual GXmlElement * | element (const int &index) |
Return pointer to GXMLElement child. More... | |
virtual const GXmlElement * | element (const int &index) const |
Return pointer to GXMLElement child (const variant) More... | |
virtual GXmlElement * | element (const std::string &name) |
Return pointer on child walking down a hierarchy of tags. More... | |
virtual const GXmlElement * | element (const std::string &name) const |
Return pointer on child walking down a hierarchy of tags (const version) More... | |
virtual GXmlElement * | element (const std::string &name, const int &index) |
Return pointer on GXMLElement child of a given name. More... | |
virtual const GXmlElement * | element (const std::string &name, const int &index) const |
Return pointer on GXMLElement child of a given name (const variant) More... | |
virtual std::string | print (const GChatter &chatter=NORMAL) const |
Print XML node in string. More... | |
Public Member Functions inherited from GContainer | |
virtual | ~GContainer (void) |
Destructor. More... | |
Public Member Functions inherited from GBase | |
virtual | ~GBase (void) |
Destructor. More... | |
Protected Member Functions | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GXmlComment &node) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | parse (const std::string &segment) |
Parse comment segment string. More... | |
Protected Member Functions inherited from GXmlNode | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GXmlNode &node) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
int | extract_index (std::string &tag) const |
Extract index from tag. More... | |
Protected Attributes | |
std::string | m_comment |
Comment (excluding brackets) More... | |
Protected Attributes inherited from GXmlNode | |
GXmlNode * | m_parent |
Pointer on parent node. More... | |
std::vector< GXmlNode * > | m_nodes |
Pointer to child nodes. More... | |
Additional Inherited Members | |
Public Types inherited from GXmlNode | |
enum | NodeType { NT_DOCUMENT, NT_ELEMENT, NT_COMMENT, NT_UNKNOWN, NT_TEXT, NT_DECLARATION, NT_PI, NT_TYPECOUNT } |
XML comment node class.
This class implements a XML comment. The comment text is stored without the brackets.
Definition at line 44 of file GXmlComment.hpp.
GXmlComment::GXmlComment | ( | void | ) |
Void constructor.
Definition at line 54 of file GXmlComment.cpp.
References init_members().
Referenced by clone().
GXmlComment::GXmlComment | ( | const GXmlComment & | node | ) |
Copy constructor.
[in] | node | XML comment. |
Definition at line 69 of file GXmlComment.cpp.
References copy_members(), and init_members().
|
explicit |
Segment constructor.
[in] | segment | Text segement. |
Constructs a comment from the text given in segment
.
Definition at line 89 of file GXmlComment.cpp.
References init_members(), and parse().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GXmlNode.
Definition at line 87 of file GXmlComment.hpp.
|
virtual |
Clear XML comment.
Resets the XML comment to an clean initial state.
Implements GXmlNode.
Definition at line 162 of file GXmlComment.cpp.
References free_members(), GXmlNode::free_members(), init_members(), and GXmlNode::init_members().
|
virtual |
Clone XML comment.
Implements GXmlNode.
Definition at line 182 of file GXmlComment.cpp.
References GXmlComment().
|
inline |
Return comment.
Definition at line 99 of file GXmlComment.hpp.
References m_comment.
Referenced by comment().
|
inline |
|
protected |
Copy class members.
[in] | node | XML comment. |
Definition at line 265 of file GXmlComment.cpp.
References m_comment.
Referenced by GXmlComment(), and operator=().
|
protected |
Delete class members.
Definition at line 278 of file GXmlComment.cpp.
Referenced by clear(), operator=(), and ~GXmlComment().
|
protected |
Initialise class members.
Definition at line 250 of file GXmlComment.cpp.
References m_comment.
Referenced by clear(), GXmlComment(), and operator=().
GXmlComment & GXmlComment::operator= | ( | const GXmlComment & | node | ) |
Assignment operator.
[in] | node | XML comment. |
Definition at line 127 of file GXmlComment.cpp.
References copy_members(), free_members(), init_members(), and GXmlNode::operator=().
|
protected |
Parse comment segment string.
[in] | segment | Segment string. |
GException::invalid_value | XML syntax error. |
Parse the segment string and extract the comment.
Definition at line 297 of file GXmlComment.cpp.
References G_PARSE, and m_comment.
Referenced by GXmlComment().
|
virtual |
Print XML comment.
[in] | chatter | Chattiness (defaults to NORMAL). |
[in] | indent | Text indentation (default to 0). |
Implements GXmlNode.
Definition at line 219 of file GXmlComment.cpp.
References gammalib::fill(), m_comment, and SILENT.
|
inlinevirtual |
Return XML node type.
Implements GXmlNode.
Definition at line 124 of file GXmlComment.hpp.
References GXmlNode::NT_COMMENT.
|
virtual |
Write comment into URL.
[in] | url | Unified Resource Locator. |
[in] | indent | Text indentation (default = 0). |
Writes the XML comment into a url
object.
Implements GXmlNode.
Definition at line 197 of file GXmlComment.cpp.
References m_comment, and GUrl::printf().
|
protected |
Comment (excluding brackets)
Definition at line 77 of file GXmlComment.hpp.
Referenced by comment(), copy_members(), init_members(), parse(), print(), and write().