diff options
Diffstat (limited to 'project2/sessionXml.cpp')
-rw-r--r-- | project2/sessionXml.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/project2/sessionXml.cpp b/project2/sessionXml.cpp index 9e78aec..f7ff7c4 100644 --- a/project2/sessionXml.cpp +++ b/project2/sessionXml.cpp @@ -1,5 +1,6 @@ #include "sessionXml.h" #include "uuid.h" +#include "genericVisitor.h" #include <libxml++/nodes/element.h> #include <libxml++/parsers/domparser.h> #include <libxml++/nodes/textnode.h> @@ -14,9 +15,9 @@ class SessionXml : public Session { SessionXml(const xmlpp::Element *); virtual ~SessionXml(); - Glib::ustring GetValue(const Glib::ustring & name) const; + const VariableType & GetValue(const Glib::ustring & name) const; Values GetValuesCopy() const; - void SetValue(const Glib::ustring & name, const Glib::ustring & value); + void SetValue(const Glib::ustring & name, const VariableType & value); void ClearValue(const Glib::ustring & name); time_t ExpiryTime() const; void ExpiryTime(time_t); @@ -70,7 +71,7 @@ SessionContainerXml::CleanUp() sess->set_attribute("expires", boost::lexical_cast<Glib::ustring>(currentSession->expires)); BOOST_FOREACH(const SessionXml::Values::value_type & nvp, currentSession->vars) { xmlpp::Element * v = sess->add_child("var"); - v->add_child_text(nvp.second); + LexicalCall<Glib::ustring, void>(boost::bind(&xmlpp::Element::add_child_text, v, _1), nvp.second); v->set_attribute("name", nvp.first); } doc->write_to_file(xmlFile); @@ -118,7 +119,7 @@ SessionXml::SessionXml(const xmlpp::Element * p) : BOOST_FOREACH(const xmlpp::Node * n, xvars) { const xmlpp::Element * e = dynamic_cast<const xmlpp::Element *>(n); if (e) { - vars[e->get_attribute_value("name")] = e->get_child_text()->get_content(); + vars[e->get_attribute_value("name")] = e->get_child_text() ? e->get_child_text()->get_content() : ""; } } } @@ -139,7 +140,7 @@ SessionXml::ExpiryTime() const return expires; } -Glib::ustring +const VariableType & SessionXml::GetValue(const Glib::ustring & name) const { Values::const_iterator i = vars.find(name); @@ -150,7 +151,7 @@ SessionXml::GetValue(const Glib::ustring & name) const } void -SessionXml::SetValue(const Glib::ustring & name, const Glib::ustring & value) +SessionXml::SetValue(const Glib::ustring & name, const VariableType & value) { vars[name] = value; } |