summaryrefslogtreecommitdiffstats
path: root/src/serialisation
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-05-13 02:57:36 +0000
committerDavid Robillard <d@drobilla.net>2011-05-13 02:57:36 +0000
commit198560d5fd499ab14eb4e130ee74e21fa86674a4 (patch)
treeeb7bd2ae2d19b6db2c28c79d1c7663fe5b1f49de /src/serialisation
parent981c7950a6f5fc9f22decaee261556d20b641d5c (diff)
downloadingen-198560d5fd499ab14eb4e130ee74e21fa86674a4.tar.gz
ingen-198560d5fd499ab14eb4e130ee74e21fa86674a4.tar.bz2
ingen-198560d5fd499ab14eb4e130ee74e21fa86674a4.zip
Make models const in client code.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3259 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/serialisation')
-rw-r--r--src/serialisation/Serialiser.cpp34
-rw-r--r--src/serialisation/Serialiser.hpp36
2 files changed, 35 insertions, 35 deletions
diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp
index 04b4c692..b7a16d4b 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<GraphObject> object,
- const std::string& filename)
+Serialiser::to_file(SharedPtr<const 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<Patch> patch,
- const std::string& patch_symbol)
+Serialiser::write_manifest(const std::string& bundle_path,
+ SharedPtr<const 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<Patch> patch,
- const std::string& uri)
+Serialiser::write_bundle(SharedPtr<const Patch> patch,
+ const std::string& uri)
{
Glib::ustring path = "";
try {
@@ -181,7 +181,7 @@ Serialiser::write_bundle(SharedPtr<Patch> patch,
}
string
-Serialiser::to_string(SharedPtr<GraphObject> object,
+Serialiser::to_string(SharedPtr<const GraphObject> object,
const string& base_uri,
const GraphObject::Properties& extra_rdf)
{
@@ -272,26 +272,26 @@ Serialiser::path_rdf_node(const Path& path)
}
void
-Serialiser::serialise(SharedPtr<GraphObject> object) throw (std::logic_error)
+Serialiser::serialise(SharedPtr<const GraphObject> object) throw (std::logic_error)
{
if (!_model)
throw std::logic_error("serialise called without serialization in progress");
- SharedPtr<Patch> patch = PtrCast<Patch>(object);
+ SharedPtr<const Patch> patch = PtrCast<const Patch>(object);
if (patch) {
const Sord::URI patch_id(_model->world(), "");
serialise_patch(patch, patch_id);
return;
}
- SharedPtr<Node> node = PtrCast<Node>(object);
+ SharedPtr<const Node> node = PtrCast<const 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<Port> port = PtrCast<Port>(object);
+ SharedPtr<const Port> port = PtrCast<const 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<Patch> patch, const Sord::Node& patch_id)
+Serialiser::serialise_patch(SharedPtr<const Patch> patch, const Sord::Node& patch_id)
{
assert(_model);
Sord::World& world = _model->world();
@@ -412,9 +412,9 @@ Serialiser::serialise_patch(SharedPtr<Patch> patch, const Sord::Node& patch_id)
}
void
-Serialiser::serialise_node(SharedPtr<Node> node,
- const Sord::Node& class_id,
- const Sord::Node& node_id)
+Serialiser::serialise_node(SharedPtr<const Node> node,
+ const Sord::Node& class_id,
+ const Sord::Node& node_id)
{
_model->add_statement(node_id,
Sord::Curie(_model->world(), "rdf:type"),
@@ -491,7 +491,7 @@ Serialiser::serialise_port(const Port* port,
void
Serialiser::serialise_connection(const Sord::Node& parent,
- SharedPtr<Connection> connection) throw (std::logic_error)
+ SharedPtr<const Connection> connection) throw (std::logic_error)
{
Sord::World& world = _model->world();
diff --git a/src/serialisation/Serialiser.hpp b/src/serialisation/Serialiser.hpp
index fc26c387..fdc7b423 100644
--- a/src/serialisation/Serialiser.hpp
+++ b/src/serialisation/Serialiser.hpp
@@ -56,23 +56,23 @@ public:
typedef GraphObject::Properties Properties;
- void to_file(SharedPtr<GraphObject> object,
- const std::string& filename);
+ void to_file(SharedPtr<const GraphObject> object,
+ const std::string& filename);
- void write_bundle(SharedPtr<Patch> patch,
- const std::string& uri);
+ void write_bundle(SharedPtr<const Patch> patch,
+ const std::string& uri);
- std::string to_string(SharedPtr<GraphObject> object,
- const std::string& base_uri,
- const Properties& extra_rdf);
+ std::string to_string(SharedPtr<const GraphObject> object,
+ const std::string& base_uri,
+ const Properties& extra_rdf);
void start_to_string(const Raul::Path& root,
const std::string& base_uri);
- void serialise(SharedPtr<GraphObject> object) throw (std::logic_error);
+ void serialise(SharedPtr<const GraphObject> object) throw (std::logic_error);
- void serialise_connection(const Sord::Node& parent,
- SharedPtr<Connection> c) throw (std::logic_error);
+ void serialise_connection(const Sord::Node& parent,
+ SharedPtr<const Connection> c) throw (std::logic_error);
std::string finish();
@@ -81,12 +81,12 @@ private:
void start_to_filename(const std::string& filename);
- void serialise_patch(SharedPtr<Patch> p,
- const Sord::Node& id);
+ void serialise_patch(SharedPtr<const Patch> p,
+ const Sord::Node& id);
- void serialise_node(SharedPtr<Node> n,
- const Sord::Node& class_id,
- const Sord::Node& id);
+ void serialise_node(SharedPtr<const Node> n,
+ const Sord::Node& class_id,
+ const Sord::Node& id);
void serialise_port(const Port* p,
Resource::Graph context,
@@ -98,9 +98,9 @@ private:
Sord::Node path_rdf_node(const Raul::Path& path);
- void write_manifest(const std::string& bundle_path,
- SharedPtr<Patch> patch,
- const std::string& patch_symbol);
+ void write_manifest(const std::string& bundle_path,
+ SharedPtr<const Patch> patch,
+ const std::string& patch_symbol);
Raul::Path _root_path;
SharedPtr<Shared::Store> _store;