diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-08-29 15:35:22 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-08-29 15:35:22 +0000 |
commit | 7b4141582d9390bf951f211a561b53cea3aa1705 (patch) | |
tree | 0198501cc657d94e3839d3e333459a5c18e1e623 /src/pugixml.hpp | |
parent | 5442ff6abaec9fa28c73b8b1c4fbf9fbecf686b0 (diff) |
XPath: Added variable interface and implementation
git-svn-id: http://pugixml.googlecode.com/svn/trunk@676 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src/pugixml.hpp')
-rw-r--r-- | src/pugixml.hpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/pugixml.hpp b/src/pugixml.hpp index b31e251..7e09551 100644 --- a/src/pugixml.hpp +++ b/src/pugixml.hpp @@ -1805,6 +1805,68 @@ namespace pugi }; /** + * A class that holds XPath variable + */ + class xpath_variable + { + friend class xpath_variable_set; + + protected: + // Non-copyable semantics + xpath_variable(const xpath_variable&); + xpath_variable& operator=(const xpath_variable&); + + xpath_value_type _type; + xpath_variable* _next; + + xpath_variable() {} + ~xpath_variable() {} + + public: + const char_t* name() const; + xpath_value_type type() const; + + bool get_boolean() const; + double get_number() const; + const char_t* get_string() const; + const xpath_node_set& get_node_set() const; + + bool set(bool value); + bool set(double value); + bool set(const char_t* value); + bool set(const xpath_node_set& value); + }; + + /** + * A class that holds XPath variables + */ + class xpath_variable_set + { + private: + // Non-copyable semantics + xpath_variable_set(const xpath_variable_set&); + xpath_variable_set& operator=(const xpath_variable_set&); + + xpath_variable* _data[64]; + + xpath_variable* find(const char_t* name) const; + + public: + xpath_variable_set(); + ~xpath_variable_set(); + + xpath_variable* add(const char_t* name, xpath_value_type type); + + bool set(const char_t* name, bool value); + bool set(const char_t* name, double value); + bool set(const char_t* name, const char_t* value); + bool set(const char_t* name, const xpath_node_set& value); + + xpath_variable* get(const char_t* name); + const xpath_variable* get(const char_t* name) const; + }; + + /** * A class that holds compiled XPath query and allows to evaluate query result */ class PUGIXML_CLASS xpath_query |