summaryrefslogtreecommitdiffstats
path: root/raul/Atom.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-01-06 21:55:17 +0000
committerDavid Robillard <d@drobilla.net>2008-01-06 21:55:17 +0000
commit966dbecf3e8dd13bd8af6de129a0af5b8dc83b8f (patch)
treeb6f015589464b7dad703595ea0555ba1233504d6 /raul/Atom.hpp
parent2747087c382445ad7c1b891993679fb299a73151 (diff)
downloadraul-966dbecf3e8dd13bd8af6de129a0af5b8dc83b8f.tar.gz
raul-966dbecf3e8dd13bd8af6de129a0af5b8dc83b8f.tar.bz2
raul-966dbecf3e8dd13bd8af6de129a0af5b8dc83b8f.zip
Remove raul dependency on liblo and redlandmm.
git-svn-id: http://svn.drobilla.net/lad/raul@1025 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'raul/Atom.hpp')
-rw-r--r--raul/Atom.hpp80
1 files changed, 2 insertions, 78 deletions
diff --git a/raul/Atom.hpp b/raul/Atom.hpp
index c1ca366..b9d81ec 100644
--- a/raul/Atom.hpp
+++ b/raul/Atom.hpp
@@ -26,10 +26,6 @@
#include <iostream>
#include CONFIG_H_PATH
-#ifdef HAVE_REDLANDMM
-#include <redlandmm/Node.hpp>
-#include <redlandmm/World.hpp>
-#endif
#define CUC(x) ((const unsigned char*)(x))
@@ -62,30 +58,7 @@ public:
Atom(void* val) : _type(BLOB), _blob_size(sizeof(val)), _blob_val(malloc(_blob_size))
{ memcpy(_blob_val, val, sizeof(_blob_size)); }
-#ifdef HAVE_REDLANDMM
- Atom(const Redland::Node& node)
- {
- if (node.type() == Redland::Node::RESOURCE) {
- _type = STRING;
- _string_val = strdup(node.to_c_string());
- } else if (node.is_float()) {
- _type = FLOAT;
- _float_val = node.to_float();
- } else if (node.is_int()) {
- _type = INT;
- _int_val = node.to_int();
- } else if (node.is_bool()) {
- _type = BOOL;
- _bool_val = node.to_bool();
- } else {
- _type = STRING;
- _string_val = strdup(node.to_c_string());
- }
- }
-#endif
-
- ~Atom()
- {
+ ~Atom() {
if (_type == STRING)
free(_string_val);
else if (_type == BLOB)
@@ -113,8 +86,7 @@ public:
}
}
- Atom& operator=(const Atom& other)
- {
+ Atom& operator=(const Atom& other) {
if (_type == BLOB)
free(_blob_val);
else if (_type == STRING)
@@ -152,54 +124,6 @@ public:
inline operator bool() const { return (_type != NIL); }
-
-#ifdef HAVE_REDLANDMM
- Redland::Node to_rdf_node(Redland::World& world) const
- {
- std::ostringstream os;
- std::string str;
- librdf_uri* type = NULL;
- librdf_node* node = NULL;
-
- switch (_type) {
- case Atom::INT:
- os << get_int32();
- str = os.str();
- // xsd:integer -> pretty integer literals in Turtle
- type = librdf_new_uri(world.world(), CUC("http://www.w3.org/2001/XMLSchema#integer"));
- break;
- case Atom::FLOAT:
- os.precision(20);
- os << get_float();
- str = os.str();
- // xsd:decimal -> pretty decimal (float) literals in Turtle
- type = librdf_new_uri(world.world(), CUC("http://www.w3.org/2001/XMLSchema#decimal"));
- break;
- case Atom::BOOL:
- // xsd:boolean -> pretty boolean literals in Turtle
- if (get_bool())
- str = "true";
- else
- str = "false";
- type = librdf_new_uri(world.world(), CUC("http://www.w3.org/2001/XMLSchema#boolean"));
- break;
- case Atom::STRING:
- str = get_string();
- break;
- case Atom::BLOB:
- case Atom::NIL:
- default:
- std::cerr << "WARNING: Unserializable Atom!" << std::endl;
- }
-
- if (str != "")
- node = librdf_new_node_from_typed_literal(world.world(), CUC(str.c_str()), NULL, type);
-
- return Redland::Node(world, node);
- }
-#endif
-
-
private:
Type _type;