summaryrefslogtreecommitdiff
path: root/src/pugixml.hpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-04-15 23:22:31 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-04-15 23:22:31 -0700
commitcbf3807ad4e93441d4a4324d1c21099ca644fac7 (patch)
treeca3e09459efe631e37d01afa196c54a165124d96 /src/pugixml.hpp
parent70a78b2fa5553931cb8e90457440f671ca1afc06 (diff)
Implement copy ctor/assignment for xpath_variable_set
xpath_variable_set is essentially an associative container; it's about time it became copyable. Implementation is slightly tricky due to out of memory handling. Both copy ctor and assignment operator have strong exception guarantee (even if exceptions are disabled! which translates to "roll back on allocation errors").
Diffstat (limited to 'src/pugixml.hpp')
-rw-r--r--src/pugixml.hpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/pugixml.hpp b/src/pugixml.hpp
index a7154f1..b8b8946 100644
--- a/src/pugixml.hpp
+++ b/src/pugixml.hpp
@@ -1075,17 +1075,22 @@ namespace pugi
private:
xpath_variable* _data[64];
- // Non-copyable semantics
- xpath_variable_set(const xpath_variable_set&);
- xpath_variable_set& operator=(const xpath_variable_set&);
+ void _assign(const xpath_variable_set& rhs);
+ void _swap(xpath_variable_set& rhs);
+
+ xpath_variable* _find(const char_t* name) const;
- xpath_variable* find(const char_t* name) const;
+ static bool _clone(xpath_variable* var, xpath_variable** out_result);
public:
// Default constructor/destructor
xpath_variable_set();
~xpath_variable_set();
+ // Copy constructor/assignment operator
+ xpath_variable_set(const xpath_variable_set& rhs);
+ xpath_variable_set& operator=(const xpath_variable_set& rhs);
+
// Add a new variable or get the existing one, if the types match
xpath_variable* add(const char_t* name, xpath_value_type type);