summaryrefslogtreecommitdiffstats
path: root/src/libs/client/Serializer.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-05-01 04:01:04 +0000
committerDavid Robillard <d@drobilla.net>2007-05-01 04:01:04 +0000
commit3e5fef2e59776923f175a4260adf18c559ab861f (patch)
tree5c83291c595830ac472e5661de83d4560513a9d6 /src/libs/client/Serializer.h
parent71b5ad39baceacb5d7aa75050fd8c76bfb16fb76 (diff)
downloadingen-3e5fef2e59776923f175a4260adf18c559ab861f.tar.gz
ingen-3e5fef2e59776923f175a4260adf18c559ab861f.tar.bz2
ingen-3e5fef2e59776923f175a4260adf18c559ab861f.zip
Converted Raul (and thus Ingen and Machina) to use Redland over Raptor/Rasqal independently.
Fixed patch loading for Ingen (local only, still something wrong with remote...). git-svn-id: http://svn.drobilla.net/lad/ingen@486 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/client/Serializer.h')
-rw-r--r--src/libs/client/Serializer.h54
1 files changed, 26 insertions, 28 deletions
diff --git a/src/libs/client/Serializer.h b/src/libs/client/Serializer.h
index 83e85bf8..ad91afac 100644
--- a/src/libs/client/Serializer.h
+++ b/src/libs/client/Serializer.h
@@ -23,18 +23,13 @@
#include <string>
#include <stdexcept>
#include <cassert>
-#include <boost/optional/optional.hpp>
-#include <raptor.h>
-#include "raul/SharedPtr.h"
-#include "raul/Path.h"
-#include "raul/Atom.h"
-#include "raul/RDFWriter.h"
+#include <raul/SharedPtr.h>
+#include <raul/Path.h>
+#include <raul/Atom.h>
+#include <raul/RDFWorld.h>
+#include <raul/RDFModel.h>
#include "ObjectModel.h"
-using std::string;
-using boost::optional;
-using Raul::RdfId;
-
namespace Ingen {
namespace Client {
@@ -47,11 +42,6 @@ class PresetModel;
class ModelEngineInterface;
-/** Namespace prefix macros. */
-#define NS_RDF(x) RdfId(RdfId::RESOURCE, "http://www.w3.org/1999/02/22-rdf-syntax-ns#" x)
-#define NS_INGEN(x) RdfId(RdfId::RESOURCE, "http://drobilla.net/ns/ingen#" x)
-
-
/** Serializes Ingen objects (patches, nodes, etc) to RDF.
*
* \ingroup IngenClient
@@ -59,28 +49,36 @@ class ModelEngineInterface;
class Serializer
{
public:
- Serializer();
+ Serializer(Raul::RDF::World& world);
+
+ void start_to_filename(const string& filename);
+ void start_to_string();
- void start_to_filename(const string& filename) throw (std::logic_error);
- void start_to_string() throw (std::logic_error);
void serialize(SharedPtr<ObjectModel> object) throw (std::logic_error);
void serialize_connection(SharedPtr<ConnectionModel> c) throw (std::logic_error);
- string finish() throw (std::logic_error);
+
+ string finish();
private:
+ enum Mode { TO_FILE, TO_STRING };
+
+ void setup_prefixes();
void serialize_plugin(SharedPtr<PluginModel> p);
- void serialize_patch(SharedPtr<PatchModel> p, const Raul::RdfId& id);
- void serialize_node(SharedPtr<NodeModel> n, const Raul::RdfId& id);
- void serialize_port(SharedPtr<PortModel> p, const Raul::RdfId& id);
+ void serialize_patch(SharedPtr<PatchModel> p, const Raul::RDF::Node& id);
+ void serialize_node(SharedPtr<NodeModel> n, const Raul::RDF::Node& id);
+ void serialize_port(SharedPtr<PortModel> p, const Raul::RDF::Node& id);
- Raul::RdfId path_to_node_id(const Path& path);
-
- typedef std::map<Path, RdfId> IDMap;
- IDMap _id_map;
- string _base_uri;
- Raul::RDFWriter _writer;
+ Raul::RDF::Node path_to_node_id(const Path& path);
+
+ typedef std::map<Path, Raul::RDF::Node> NodeMap;
+ Mode _mode;
+ std::string _filename;
+ NodeMap _node_map;
+ string _base_uri;
+ Raul::RDF::World& _world;
+ Raul::RDF::Model* _model;
};