+/*
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
#include <sstream>
#include <iostream>
#include <boost/lexical_cast.hpp>
+/*
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
#ifndef LIBCXML_CXML_H
#define LIBCXML_CXML_H
#include <stdint.h>
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
-#include <boost/lexical_cast.hpp>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string/erase.hpp>
#include <glibmm.h>
{
std::string s = string_child (c);
boost::erase_all (s, " ");
- return boost::lexical_cast<T> (s);
+ std::stringstream t;
+ t.imbue (std::locale::classic ());
+ t << s;
+ T n;
+ t >> n;
+ return n;
}
template <class T>
std::string t = s.get ();
boost::erase_all (t, " ");
- return boost::optional<T> (boost::lexical_cast<T> (t));
+ std::stringstream u;
+ u.imbue (std::locale::classic ());
+ u << t;
+ T n;
+ u >> n;
+ return n;
}
/** This will mark a child as to be ignored when calling done() */
{
std::string s = string_attribute (c);
boost::erase_all (s, " ");
- return boost::lexical_cast<T> (s);
+ std::stringstream t;
+ t.imbue (std::locale::classic ());
+ t << s;
+ T n;
+ t >> n;
+ return n;
}
template <class T>
std::string t = s.get ();
boost::erase_all (t, " ");
- return boost::optional<T> (boost::lexical_cast<T> (t));
+ std::stringstream u;
+ u.imbue (std::locale::classic ());
+ u << t;
+ T n;
+ t >> n;
+ return n;
}
/** @return The content of this node */