summaryrefslogtreecommitdiffstats
path: root/src/serialisation
diff options
context:
space:
mode:
Diffstat (limited to 'src/serialisation')
-rw-r--r--src/serialisation/Parser.cpp22
-rw-r--r--src/serialisation/Parser.hpp89
-rw-r--r--src/serialisation/Serialiser.cpp48
-rw-r--r--src/serialisation/Serialiser.hpp60
4 files changed, 111 insertions, 108 deletions
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index 5b4df2f1..f66cd38f 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -136,7 +136,7 @@ Parser::find_patches(Ingen::Shared::World* world,
*/
bool
Parser::parse_file(Ingen::Shared::World* world,
- Ingen::Shared::CommonInterface* target,
+ Ingen::CommonInterface* target,
Glib::ustring file_uri,
boost::optional<Raul::Path> parent,
boost::optional<Raul::Symbol> symbol,
@@ -190,7 +190,7 @@ Parser::parse_file(Ingen::Shared::World* world,
bool
Parser::parse_string(Ingen::Shared::World* world,
- Ingen::Shared::CommonInterface* target,
+ Ingen::CommonInterface* target,
const Glib::ustring& str,
const Glib::ustring& base_uri,
boost::optional<Raul::Path> parent,
@@ -216,7 +216,7 @@ Parser::parse_string(Ingen::Shared::World* world,
boost::optional<Path>
Parser::parse(Ingen::Shared::World* world,
- Ingen::Shared::CommonInterface* target,
+ Ingen::CommonInterface* target,
Sord::Model& model,
Glib::ustring document_uri,
boost::optional<Raul::Path> data_path,
@@ -350,7 +350,7 @@ get_port(Ingen::Shared::World* world,
boost::optional<Path>
Parser::parse_patch(Ingen::Shared::World* world,
- Ingen::Shared::CommonInterface* target,
+ Ingen::CommonInterface* target,
Sord::Model& model,
const Sord::Node& subject_node,
boost::optional<Raul::Path> parent,
@@ -468,7 +468,7 @@ Parser::parse_patch(Ingen::Shared::World* world,
boost::optional<Path>
Parser::parse_node(Ingen::Shared::World* world,
- Ingen::Shared::CommonInterface* target,
+ Ingen::CommonInterface* target,
Sord::Model& model,
const Sord::Node& subject,
const Raul::Path& path,
@@ -524,11 +524,11 @@ Parser::parse_node(Ingen::Shared::World* world,
}
bool
-Parser::parse_connections(Ingen::Shared::World* world,
- Ingen::Shared::CommonInterface* target,
- Sord::Model& model,
- const Sord::Node& subject,
- const Raul::Path& parent)
+Parser::parse_connections(Ingen::Shared::World* world,
+ Ingen::CommonInterface* target,
+ Sord::Model& model,
+ const Sord::Node& subject,
+ const Raul::Path& parent)
{
Sord::URI ingen_connection(*world->rdf_world(), NS_INGEN "connection");
Sord::URI ingen_source(*world->rdf_world(), NS_INGEN "source");
@@ -574,7 +574,7 @@ Parser::parse_connections(Ingen::Shared::World* world,
bool
Parser::parse_properties(Ingen::Shared::World* world,
- Ingen::Shared::CommonInterface* target,
+ Ingen::CommonInterface* target,
Sord::Model& model,
const Sord::Node& subject,
const Raul::URI& uri,
diff --git a/src/serialisation/Parser.hpp b/src/serialisation/Parser.hpp
index 1d7d36dd..b5e2db63 100644
--- a/src/serialisation/Parser.hpp
+++ b/src/serialisation/Parser.hpp
@@ -30,38 +30,39 @@
#include "ingen/GraphObject.hpp"
namespace Sord { class World; class Model; class Node; }
-namespace Ingen { namespace Shared { class CommonInterface; } }
namespace Ingen {
+class CommonInterface;
+
namespace Shared { class World; }
namespace Serialisation {
class Parser {
public:
- Parser(Ingen::Shared::World& world);
+ Parser(Shared::World& world);
virtual ~Parser() {}
- typedef Shared::GraphObject::Properties Properties;
+ typedef GraphObject::Properties Properties;
virtual bool parse_file(
- Ingen::Shared::World* world,
- Shared::CommonInterface* target,
+ Shared::World* world,
+ CommonInterface* target,
Glib::ustring document_uri,
- boost::optional<Raul::Path> parent=boost::optional<Raul::Path>(),
- boost::optional<Raul::Symbol> symbol=boost::optional<Raul::Symbol>(),
- boost::optional<Properties> data=boost::optional<Properties>());
+ boost::optional<Raul::Path> parent = boost::optional<Raul::Path>(),
+ boost::optional<Raul::Symbol> symbol = boost::optional<Raul::Symbol>(),
+ boost::optional<Properties> data = boost::optional<Properties>());
virtual bool parse_string(
- Ingen::Shared::World* world,
- Shared::CommonInterface* target,
+ Shared::World* world,
+ CommonInterface* target,
const Glib::ustring& str,
const Glib::ustring& base_uri,
- boost::optional<Raul::Path> parent=boost::optional<Raul::Path>(),
- boost::optional<Raul::Symbol> symbol=boost::optional<Raul::Symbol>(),
- boost::optional<Properties> data=boost::optional<Properties>());
+ boost::optional<Raul::Path> parent = boost::optional<Raul::Path>(),
+ boost::optional<Raul::Symbol> symbol = boost::optional<Raul::Symbol>(),
+ boost::optional<Properties> data = boost::optional<Properties>());
struct PatchRecord {
PatchRecord(const Raul::URI& u, const Glib::ustring& f)
@@ -73,51 +74,51 @@ public:
typedef std::list<PatchRecord> PatchRecords;
- virtual PatchRecords find_patches(Ingen::Shared::World* world,
+ virtual PatchRecords find_patches(Shared::World* world,
const Glib::ustring& manifest_uri);
private:
boost::optional<Raul::Path> parse(
- Ingen::Shared::World* world,
- Shared::CommonInterface* target,
+ Shared::World* world,
+ CommonInterface* target,
Sord::Model& model,
Glib::ustring document_uri,
- boost::optional<Raul::Path> data_path=boost::optional<Raul::Path>(),
- boost::optional<Raul::Path> parent=boost::optional<Raul::Path>(),
- boost::optional<Raul::Symbol> symbol=boost::optional<Raul::Symbol>(),
- boost::optional<Properties> data=boost::optional<Properties>());
+ boost::optional<Raul::Path> data_path = boost::optional<Raul::Path>(),
+ boost::optional<Raul::Path> parent = boost::optional<Raul::Path>(),
+ boost::optional<Raul::Symbol> symbol = boost::optional<Raul::Symbol>(),
+ boost::optional<Properties> data = boost::optional<Properties>());
boost::optional<Raul::Path> parse_patch(
- Ingen::Shared::World* world,
- Ingen::Shared::CommonInterface* target,
- Sord::Model& model,
- const Sord::Node& subject,
- boost::optional<Raul::Path> parent=boost::optional<Raul::Path>(),
- boost::optional<Raul::Symbol> symbol=boost::optional<Raul::Symbol>(),
- boost::optional<Properties> data=boost::optional<Properties>());
+ Shared::World* world,
+ CommonInterface* target,
+ Sord::Model& model,
+ const Sord::Node& subject,
+ boost::optional<Raul::Path> parent = boost::optional<Raul::Path>(),
+ boost::optional<Raul::Symbol> symbol = boost::optional<Raul::Symbol>(),
+ boost::optional<Properties> data = boost::optional<Properties>());
boost::optional<Raul::Path> parse_node(
- Ingen::Shared::World* world,
- Ingen::Shared::CommonInterface* target,
- Sord::Model& model,
- const Sord::Node& subject,
- const Raul::Path& path,
- boost::optional<Properties> data=boost::optional<Properties>());
+ Shared::World* world,
+ CommonInterface* target,
+ Sord::Model& model,
+ const Sord::Node& subject,
+ const Raul::Path& path,
+ boost::optional<Properties> data = boost::optional<Properties>());
bool parse_properties(
- Ingen::Shared::World* world,
- Ingen::Shared::CommonInterface* target,
- Sord::Model& model,
- const Sord::Node& subject,
- const Raul::URI& uri,
- boost::optional<Properties> data = boost::optional<Properties>());
+ Shared::World* world,
+ CommonInterface* target,
+ Sord::Model& model,
+ const Sord::Node& subject,
+ const Raul::URI& uri,
+ boost::optional<Properties> data = boost::optional<Properties>());
bool parse_connections(
- Ingen::Shared::World* world,
- Ingen::Shared::CommonInterface* target,
- Sord::Model& model,
- const Sord::Node& subject,
- const Raul::Path& patch);
+ Shared::World* world,
+ CommonInterface* target,
+ Sord::Model& model,
+ const Sord::Node& subject,
+ const Raul::Path& patch);
};
} // namespace Serialisation
diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp
index 8b42de34..37d80e0d 100644
--- a/src/serialisation/Serialiser.cpp
+++ b/src/serialisation/Serialiser.cpp
@@ -76,8 +76,8 @@ Serialiser::Serialiser(Shared::World& world, SharedPtr<Shared::Store> store)
}
void
-Serialiser::to_file(SharedPtr<Shared::GraphObject> object,
- const std::string& filename)
+Serialiser::to_file(SharedPtr<GraphObject> object,
+ const std::string& filename)
{
_root_path = object->path();
start_to_filename(filename);
@@ -95,9 +95,9 @@ uri_to_symbol(const std::string& uri)
}
void
-Serialiser::write_manifest(const std::string& bundle_path,
- SharedPtr<Shared::Patch> patch,
- const std::string& patch_symbol)
+Serialiser::write_manifest(const std::string& bundle_path,
+ SharedPtr<Patch> patch,
+ const std::string& patch_symbol)
{
const string manifest_path(Glib::build_filename(bundle_path, "manifest.ttl"));
const string binary_path(Glib::Module::build_path("", "ingen_lv2"));
@@ -146,8 +146,8 @@ normal_bundle_uri(const std::string& uri)
}
void
-Serialiser::write_bundle(SharedPtr<Shared::Patch> patch,
- const std::string& uri)
+Serialiser::write_bundle(SharedPtr<Patch> patch,
+ const std::string& uri)
{
Glib::ustring path = "";
try {
@@ -158,7 +158,7 @@ Serialiser::write_bundle(SharedPtr<Shared::Patch> patch,
}
if (Glib::file_test(path, Glib::FILE_TEST_EXISTS)
- && !Glib::file_test(path, Glib::FILE_TEST_IS_DIR)) {
+ && !Glib::file_test(path, Glib::FILE_TEST_IS_DIR)) {
path = Glib::path_get_dirname(path);
}
@@ -277,21 +277,21 @@ Serialiser::serialise(SharedPtr<GraphObject> object) throw (std::logic_error)
if (!_model)
throw std::logic_error("serialise called without serialization in progress");
- SharedPtr<Shared::Patch> patch = PtrCast<Shared::Patch>(object);
+ SharedPtr<Patch> patch = PtrCast<Patch>(object);
if (patch) {
const Sord::URI patch_id(_model->world(), "");
serialise_patch(patch, patch_id);
return;
}
- SharedPtr<Shared::Node> node = PtrCast<Shared::Node>(object);
+ SharedPtr<Node> node = PtrCast<Node>(object);
if (node) {
const Sord::URI plugin_id(_model->world(), node->plugin()->uri().str());
serialise_node(node, plugin_id, path_rdf_node(node->path()));
return;
}
- SharedPtr<Shared::Port> port = PtrCast<Shared::Port>(object);
+ SharedPtr<Port> port = PtrCast<Port>(object);
if (port) {
serialise_port(port.get(), Resource::DEFAULT, path_rdf_node(port->path()));
return;
@@ -302,7 +302,7 @@ Serialiser::serialise(SharedPtr<GraphObject> object) throw (std::logic_error)
}
void
-Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch, const Sord::Node& patch_id)
+Serialiser::serialise_patch(SharedPtr<Patch> patch, const Sord::Node& patch_id)
{
assert(_model);
Sord::World& world = _model->world();
@@ -348,8 +348,8 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch, const Sord::Node& pa
if (n->first.parent() != patch->path())
continue;
- SharedPtr<Shared::Patch> subpatch = PtrCast<Shared::Patch>(n->second);
- SharedPtr<Shared::Node> node = PtrCast<Shared::Node>(n->second);
+ SharedPtr<Patch> subpatch = PtrCast<Patch>(n->second);
+ SharedPtr<Node> node = PtrCast<Node>(n->second);
if (subpatch) {
SerdURI base_uri;
serd_uri_parse((const uint8_t*)_base_uri.c_str(), &base_uri);
@@ -406,16 +406,16 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch, const Sord::Node& pa
serialise_port(p, Resource::INTERNAL, port_id);
}
- for (Shared::Patch::Connections::const_iterator c = patch->connections().begin();
+ for (Patch::Connections::const_iterator c = patch->connections().begin();
c != patch->connections().end(); ++c) {
serialise_connection(patch_id, c->second);
}
}
void
-Serialiser::serialise_node(SharedPtr<Shared::Node> node,
- const Sord::Node& class_id,
- const Sord::Node& node_id)
+Serialiser::serialise_node(SharedPtr<Node> node,
+ const Sord::Node& class_id,
+ const Sord::Node& node_id)
{
_model->add_statement(node_id,
Sord::Curie(_model->world(), "rdf:type"),
@@ -440,9 +440,9 @@ Serialiser::serialise_node(SharedPtr<Shared::Node> node,
}
void
-Serialiser::serialise_port(const Port* port,
- Shared::Resource::Graph context,
- const Sord::Node& port_id)
+Serialiser::serialise_port(const Port* port,
+ Resource::Graph context,
+ const Sord::Node& port_id)
{
Sord::World& world = _model->world();
@@ -522,9 +522,9 @@ skip_property(const Sord::Node& predicate)
}
void
-Serialiser::serialise_properties(const Shared::GraphObject* o,
- Shared::Resource::Graph context,
- Sord::Node id)
+Serialiser::serialise_properties(const GraphObject* o,
+ Ingen::Resource::Graph context,
+ Sord::Node id)
{
const GraphObject::Properties props = o->properties(context);
diff --git a/src/serialisation/Serialiser.hpp b/src/serialisation/Serialiser.hpp
index 90c49c55..fc26c387 100644
--- a/src/serialisation/Serialiser.hpp
+++ b/src/serialisation/Serialiser.hpp
@@ -34,15 +34,14 @@
namespace Ingen {
-namespace Shared {
class Plugin;
class GraphObject;
class Patch;
class Node;
class Port;
class Connection;
-class World;
-}
+
+namespace Shared { class World; }
namespace Serialisation {
@@ -55,22 +54,25 @@ class Serialiser
public:
Serialiser(Shared::World& world, SharedPtr<Shared::Store> store);
- typedef Shared::GraphObject::Properties Properties;
+ typedef GraphObject::Properties Properties;
+
+ void to_file(SharedPtr<GraphObject> object,
+ const std::string& filename);
+
+ void write_bundle(SharedPtr<Patch> patch,
+ const std::string& uri);
- void to_file(SharedPtr<Shared::GraphObject> object,
- const std::string& filename);
+ std::string to_string(SharedPtr<GraphObject> object,
+ const std::string& base_uri,
+ const Properties& extra_rdf);
- void write_bundle(SharedPtr<Shared::Patch> patch,
- const std::string& uri);
+ void start_to_string(const Raul::Path& root,
+ const std::string& base_uri);
- std::string to_string(SharedPtr<Shared::GraphObject> object,
- const std::string& base_uri,
- const Properties& extra_rdf);
+ void serialise(SharedPtr<GraphObject> object) throw (std::logic_error);
- void start_to_string(const Raul::Path& root, const std::string& base_uri);
- void serialise(SharedPtr<Shared::GraphObject> object) throw (std::logic_error);
- void serialise_connection(const Sord::Node& parent,
- SharedPtr<Shared::Connection> c) throw (std::logic_error);
+ void serialise_connection(const Sord::Node& parent,
+ SharedPtr<Connection> c) throw (std::logic_error);
std::string finish();
@@ -79,26 +81,26 @@ private:
void start_to_filename(const std::string& filename);
- void serialise_patch(SharedPtr<Shared::Patch> p,
- const Sord::Node& id);
+ void serialise_patch(SharedPtr<Patch> p,
+ const Sord::Node& id);
- void serialise_node(SharedPtr<Shared::Node> n,
- const Sord::Node& class_id,
- const Sord::Node& id);
+ void serialise_node(SharedPtr<Node> n,
+ const Sord::Node& class_id,
+ const Sord::Node& id);
- void serialise_port(const Shared::Port* p,
- Shared::Resource::Graph context,
- const Sord::Node& id);
+ void serialise_port(const Port* p,
+ Resource::Graph context,
+ const Sord::Node& id);
- void serialise_properties(const Shared::GraphObject* o,
- Shared::Resource::Graph context,
- Sord::Node id);
+ void serialise_properties(const GraphObject* o,
+ Resource::Graph context,
+ Sord::Node id);
Sord::Node path_rdf_node(const Raul::Path& path);
- void write_manifest(const std::string& bundle_path,
- SharedPtr<Shared::Patch> patch,
- const std::string& patch_symbol);
+ void write_manifest(const std::string& bundle_path,
+ SharedPtr<Patch> patch,
+ const std::string& patch_symbol);
Raul::Path _root_path;
SharedPtr<Shared::Store> _store;