aboutsummaryrefslogtreecommitdiff
path: root/sxml.h
diff options
context:
space:
mode:
Diffstat (limited to 'sxml.h')
-rw-r--r--sxml.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/sxml.h b/sxml.h
index 6bd727a..c2ac7e8 100644
--- a/sxml.h
+++ b/sxml.h
@@ -34,6 +34,8 @@
namespace sxml {
class node;
+class element;
+class comment;
typedef std::vector<node *> node_list;
@@ -52,13 +54,20 @@ class node
//! Destructor. Frees the children of this node.
virtual ~node();
+ //! Returns a string representation of this node. Derived classes should
+ //! implement this.
+ virtual std::string to_string(bool nice , int indent = 0) const;
+
//! Adds a child node to this node. Takes the ownership of the given
//! node. Returns a pointer to the child.
node *add_child(node *child);
- //! Returns a string representation of this node. Derived classes should
- //! implement this.
- virtual std::string to_string(bool nice , int indent = 0) const;
+ //! Adds an element with the given tag to this node. Returns a pointer to
+ //! the element node.
+ element *add_element(const std::string &tag);
+
+ //! Adds a comment to this node. Returns a pointer to the comment node.
+ comment *add_comment(const std::string &text);
protected:
@@ -128,10 +137,6 @@ class element: public node
//! and newlines.
virtual std::string to_string(bool nice = false, int indent = 0) const;
- //! Adds a child with the given tag to this element. Returns a pointer
- //! to the child.
- element *add_element(const std::string &tag);
-
//! Set the text for this element. An element can either have text
//! or children. If an element has both, children take precedence
//! when calling to_string(). Returns a pointer to this element.