From 8ba6bb943889bfdd58cf4a971a152041c1199cfe Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 18 Apr 2011 12:47:15 +0000 Subject: Put engine code in new Ingen::Engine namespace. Put core interfaces in Ingen namespace (not Ingen::Shared). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3159 a436a847-0d15-0410-975c-d299462d15a1 --- src/serialisation/Parser.cpp | 22 +++++----- src/serialisation/Parser.hpp | 89 ++++++++++++++++++++-------------------- src/serialisation/Serialiser.cpp | 48 +++++++++++----------- src/serialisation/Serialiser.hpp | 60 ++++++++++++++------------- 4 files changed, 111 insertions(+), 108 deletions(-) (limited to 'src/serialisation') 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 parent, boost::optional 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 parent, @@ -216,7 +216,7 @@ Parser::parse_string(Ingen::Shared::World* world, boost::optional Parser::parse(Ingen::Shared::World* world, - Ingen::Shared::CommonInterface* target, + Ingen::CommonInterface* target, Sord::Model& model, Glib::ustring document_uri, boost::optional data_path, @@ -350,7 +350,7 @@ get_port(Ingen::Shared::World* world, boost::optional Parser::parse_patch(Ingen::Shared::World* world, - Ingen::Shared::CommonInterface* target, + Ingen::CommonInterface* target, Sord::Model& model, const Sord::Node& subject_node, boost::optional parent, @@ -468,7 +468,7 @@ Parser::parse_patch(Ingen::Shared::World* world, boost::optional 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 parent=boost::optional(), - boost::optional symbol=boost::optional(), - boost::optional data=boost::optional()); + boost::optional parent = boost::optional(), + boost::optional symbol = boost::optional(), + boost::optional data = boost::optional()); 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 parent=boost::optional(), - boost::optional symbol=boost::optional(), - boost::optional data=boost::optional()); + boost::optional parent = boost::optional(), + boost::optional symbol = boost::optional(), + boost::optional data = boost::optional()); struct PatchRecord { PatchRecord(const Raul::URI& u, const Glib::ustring& f) @@ -73,51 +74,51 @@ public: typedef std::list PatchRecords; - virtual PatchRecords find_patches(Ingen::Shared::World* world, + virtual PatchRecords find_patches(Shared::World* world, const Glib::ustring& manifest_uri); private: boost::optional parse( - Ingen::Shared::World* world, - Shared::CommonInterface* target, + Shared::World* world, + CommonInterface* target, Sord::Model& model, Glib::ustring document_uri, - boost::optional data_path=boost::optional(), - boost::optional parent=boost::optional(), - boost::optional symbol=boost::optional(), - boost::optional data=boost::optional()); + boost::optional data_path = boost::optional(), + boost::optional parent = boost::optional(), + boost::optional symbol = boost::optional(), + boost::optional data = boost::optional()); boost::optional parse_patch( - Ingen::Shared::World* world, - Ingen::Shared::CommonInterface* target, - Sord::Model& model, - const Sord::Node& subject, - boost::optional parent=boost::optional(), - boost::optional symbol=boost::optional(), - boost::optional data=boost::optional()); + Shared::World* world, + CommonInterface* target, + Sord::Model& model, + const Sord::Node& subject, + boost::optional parent = boost::optional(), + boost::optional symbol = boost::optional(), + boost::optional data = boost::optional()); boost::optional parse_node( - Ingen::Shared::World* world, - Ingen::Shared::CommonInterface* target, - Sord::Model& model, - const Sord::Node& subject, - const Raul::Path& path, - boost::optional data=boost::optional()); + Shared::World* world, + CommonInterface* target, + Sord::Model& model, + const Sord::Node& subject, + const Raul::Path& path, + boost::optional data = boost::optional()); bool parse_properties( - Ingen::Shared::World* world, - Ingen::Shared::CommonInterface* target, - Sord::Model& model, - const Sord::Node& subject, - const Raul::URI& uri, - boost::optional data = boost::optional()); + Shared::World* world, + CommonInterface* target, + Sord::Model& model, + const Sord::Node& subject, + const Raul::URI& uri, + boost::optional data = boost::optional()); 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 store) } void -Serialiser::to_file(SharedPtr object, - const std::string& filename) +Serialiser::to_file(SharedPtr 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 patch, - const std::string& patch_symbol) +Serialiser::write_manifest(const std::string& bundle_path, + SharedPtr 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 patch, - const std::string& uri) +Serialiser::write_bundle(SharedPtr patch, + const std::string& uri) { Glib::ustring path = ""; try { @@ -158,7 +158,7 @@ Serialiser::write_bundle(SharedPtr 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 object) throw (std::logic_error) if (!_model) throw std::logic_error("serialise called without serialization in progress"); - SharedPtr patch = PtrCast(object); + SharedPtr patch = PtrCast(object); if (patch) { const Sord::URI patch_id(_model->world(), ""); serialise_patch(patch, patch_id); return; } - SharedPtr node = PtrCast(object); + SharedPtr node = PtrCast(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 port = PtrCast(object); + SharedPtr port = PtrCast(object); if (port) { serialise_port(port.get(), Resource::DEFAULT, path_rdf_node(port->path())); return; @@ -302,7 +302,7 @@ Serialiser::serialise(SharedPtr object) throw (std::logic_error) } void -Serialiser::serialise_patch(SharedPtr patch, const Sord::Node& patch_id) +Serialiser::serialise_patch(SharedPtr patch, const Sord::Node& patch_id) { assert(_model); Sord::World& world = _model->world(); @@ -348,8 +348,8 @@ Serialiser::serialise_patch(SharedPtr patch, const Sord::Node& pa if (n->first.parent() != patch->path()) continue; - SharedPtr subpatch = PtrCast(n->second); - SharedPtr node = PtrCast(n->second); + SharedPtr subpatch = PtrCast(n->second); + SharedPtr node = PtrCast(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 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 node, - const Sord::Node& class_id, - const Sord::Node& node_id) +Serialiser::serialise_node(SharedPtr 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 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 store); - typedef Shared::GraphObject::Properties Properties; + typedef GraphObject::Properties Properties; + + void to_file(SharedPtr object, + const std::string& filename); + + void write_bundle(SharedPtr patch, + const std::string& uri); - void to_file(SharedPtr object, - const std::string& filename); + std::string to_string(SharedPtr object, + const std::string& base_uri, + const Properties& extra_rdf); - void write_bundle(SharedPtr patch, - const std::string& uri); + void start_to_string(const Raul::Path& root, + const std::string& base_uri); - std::string to_string(SharedPtr object, - const std::string& base_uri, - const Properties& extra_rdf); + void serialise(SharedPtr object) throw (std::logic_error); - void start_to_string(const Raul::Path& root, const std::string& base_uri); - void serialise(SharedPtr object) throw (std::logic_error); - void serialise_connection(const Sord::Node& parent, - SharedPtr c) throw (std::logic_error); + void serialise_connection(const Sord::Node& parent, + SharedPtr 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 p, - const Sord::Node& id); + void serialise_patch(SharedPtr p, + const Sord::Node& id); - void serialise_node(SharedPtr n, - const Sord::Node& class_id, - const Sord::Node& id); + void serialise_node(SharedPtr 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 patch, - const std::string& patch_symbol); + void write_manifest(const std::string& bundle_path, + SharedPtr patch, + const std::string& patch_symbol); Raul::Path _root_path; SharedPtr _store; -- cgit v1.2.1