From a7a285eb61dd83afc892bc1d64ffe14b9f1426a3 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 27 Sep 2009 23:51:34 +0200 Subject: Completely migrate to Unicode String class --- src/Common/XmlData.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/Common/XmlData.h') diff --git a/src/Common/XmlData.h b/src/Common/XmlData.h index 1861b71..4f566fa 100644 --- a/src/Common/XmlData.h +++ b/src/Common/XmlData.h @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -56,12 +57,13 @@ class MAD_COMMON_EXPORT XmlData { friend class Entry; enum Type { - NONE, BINARY, + NONE, BINARY, TIME, INT, UINT, INT64, UINT64, FLOAT, DOUBLE, LONGDOUBLE, STRING }; - typedef boost::variant > Variant; + typedef boost::variant, boost::posix_time::ptime> Variant; xmlNodePtr elementNode; @@ -128,6 +130,10 @@ class MAD_COMMON_EXPORT XmlData { void set(const std::vector &val) { set(val, BINARY); } + + void set(const boost::posix_time::ptime &val) { + set(val, TIME); + } }; public: @@ -151,7 +157,7 @@ class MAD_COMMON_EXPORT XmlData { return 0; xmlNodePtr newNode = xmlNewTextChild(entryNode, 0, (xmlChar*)"value", (xmlChar*)""); - xmlSetProp(newNode, (xmlChar*)"name", (xmlChar*)name.extractUTF8().c_str()); + xmlSetProp(newNode, (xmlChar*)"name", (xmlChar*)name.toUTF8().c_str()); xmlSetProp(newNode, (xmlChar*)"type", (xmlChar*)""); Element* newElement = new Element(newNode); @@ -227,7 +233,7 @@ class MAD_COMMON_EXPORT XmlData { return 0; xmlNodePtr newNode = xmlNewChild(entryNode, 0, (xmlChar*)"list", 0); - xmlSetProp(newNode, (xmlChar*)"name", (xmlChar*)name.extractUTF8().c_str()); + xmlSetProp(newNode, (xmlChar*)"name", (xmlChar*)name.toUTF8().c_str()); List *newList = new List(newNode); @@ -507,6 +513,8 @@ template <> MAD_COMMON_EXPORT const Core::String& XmlData::Entry::get MAD_COMMON_EXPORT std::vector XmlData::Entry::get >(const Core::String &name) const; template <> MAD_COMMON_EXPORT const std::vector& XmlData::Entry::get&>(const Core::String &name) const; +template <> MAD_COMMON_EXPORT boost::posix_time::ptime XmlData::Entry::get(const Core::String &name) const; + } } -- cgit v1.2.3