diff options
author | David Robillard <d@drobilla.net> | 2011-12-19 03:04:05 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-12-19 03:04:05 +0000 |
commit | e3055432b6c845f9dc4d9060a747c3dfc0da2860 (patch) | |
tree | 69fc91f6c5e0be9e27a682bd46d92d28c641bb9e | |
parent | 09dd2f25f888633280234c60c86bc0cb3213bb69 (diff) | |
download | raul-e3055432b6c845f9dc4d9060a747c3dfc0da2860.tar.gz raul-e3055432b6c845f9dc4d9060a747c3dfc0da2860.tar.bz2 raul-e3055432b6c845f9dc4d9060a747c3dfc0da2860.zip |
Remove locale smashing kludges and use new serd functions for converting nodes
to/from numbers.
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@3891 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | raul/AtomRDF.hpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/raul/AtomRDF.hpp b/raul/AtomRDF.hpp index ec3a638..71b9c79 100644 --- a/raul/AtomRDF.hpp +++ b/raul/AtomRDF.hpp @@ -20,7 +20,6 @@ #include <cmath> #include <cstring> -#include <sstream> #include <string> #include <utility> @@ -76,25 +75,25 @@ atom_to_node(Sord::Model& model, const Atom& atom) { Sord::World& world = model.world(); - std::ostringstream os; std::string str; SordNode* type = NULL; SordNode* node = NULL; + SerdNode snode; switch (atom.type()) { case Atom::INT: - os << atom.get_int32(); - str = os.str(); + snode = serd_node_new_integer(atom.get_int32()); + str = (const char*)snode.buf; + serd_node_free(&snode); // xsd:integer -> pretty integer literals in Turtle type = sord_new_uri(world.world(), CUC(RAUL_NS_XSD "integer")); break; case Atom::FLOAT: if (std::isnan(atom.get_float()) || std::isinf(atom.get_float())) break; - os.precision(8); - os << std::fixed << std::showpoint; - os << atom.get_float(); - str = os.str(); + snode = serd_node_new_decimal(atom.get_float(), 8); + str = (const char*)snode.buf; + serd_node_free(&snode); // xsd:decimal -> pretty decimal (float) literals in Turtle type = sord_new_uri(world.world(), CUC(RAUL_NS_XSD "decimal")); break; |