diff options
author | Andreas Volz <andreas.volz@tux-style.com> | 2011-11-28 12:44:11 +0100 |
---|---|---|
committer | Andreas Volz <andreas.volz@tux-style.com> | 2011-11-28 12:44:11 +0100 |
commit | 1c8e43e6d60205b427c2c7540254c6d6fb9c2682 (patch) | |
tree | c0cb9512c6b607c5885c637b9630fb9f5e570c8e /tools/xml.h | |
parent | b100e9d32a45b6173a8c9b1963f60bccc793afbe (diff) | |
download | dbus-c++-1c8e43e6d60205b427c2c7540254c6d6fb9c2682.tar.gz |
- NO FUNCTIONAL CODE CHANGES!!!!
- changed code formating from tabs to spaces and others
- used astyle with this option:
--style=ansi --indent=spaces=2 -M --pad-oper --unpad-paren --pad-header --align-pointer=name --lineend=linux
Diffstat (limited to 'tools/xml.h')
-rw-r--r-- | tools/xml.h | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/tools/xml.h b/tools/xml.h index 6a8e69c..736a0dd 100644 --- a/tools/xml.h +++ b/tools/xml.h @@ -36,27 +36,29 @@ #include <iostream> #include <sstream> -namespace DBus { +namespace DBus +{ -namespace Xml { +namespace Xml +{ class Error : public std::exception { public: - Error(const char *error, int line, int column); + Error(const char *error, int line, int column); - ~Error() throw() - {} + ~Error() throw() + {} - const char *what() const throw() - { - return _error.c_str(); - } + const char *what() const throw() + { + return _error.c_str(); + } private: - std::string _error; + std::string _error; }; class Node; @@ -65,71 +67,71 @@ class Nodes : public std::vector<Node *> { public: - Nodes operator[](const std::string &key); + Nodes operator[](const std::string &key); - Nodes select(const std::string &attr, const std::string &value); + Nodes select(const std::string &attr, const std::string &value); }; class Node { public: - typedef std::map<std::string, std::string> Attributes; + typedef std::map<std::string, std::string> Attributes; - typedef std::vector<Node> Children; + typedef std::vector<Node> Children; - std::string name; - std::string cdata; - Children children; + std::string name; + std::string cdata; + Children children; - Node(std::string &n, Attributes &a) - : name(n), _attrs(a) - {} + Node(std::string &n, Attributes &a) + : name(n), _attrs(a) + {} - Node(const char *n, const char ** a = NULL); + Node(const char *n, const char **a = NULL); - Nodes operator[](const std::string &key); + Nodes operator[](const std::string &key); - std::string get(const std::string &attribute); + std::string get(const std::string &attribute); - void set(const std::string &attribute, std::string value); + void set(const std::string &attribute, std::string value); - std::string to_xml() const; + std::string to_xml() const; - Node &add(Node child) - { - children.push_back(child); - return children.back(); - } + Node &add(Node child) + { + children.push_back(child); + return children.back(); + } private: - void _raw_xml(std::string &xml, int &depth) const; + void _raw_xml(std::string &xml, int &depth) const; - Attributes _attrs; + Attributes _attrs; }; class Document { public: - struct Expat; + struct Expat; - Node *root; + Node *root; - Document(); + Document(); - Document(const std::string &xml); + Document(const std::string &xml); - ~Document(); + ~Document(); - void from_xml(const std::string &xml); + void from_xml(const std::string &xml); - std::string to_xml() const; + std::string to_xml() const; private: - int _depth; + int _depth; }; } /* namespace Xml */ |