From e3055432b6c845f9dc4d9060a747c3dfc0da2860 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 19 Dec 2011 03:04:05 +0000 Subject: 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 --- raul/AtomRDF.hpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'raul') 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 #include -#include #include #include @@ -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; -- cgit v1.2.1