diff options
Diffstat (limited to 'src/serialisation/Serialiser.cpp')
-rw-r--r-- | src/serialisation/Serialiser.cpp | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index dd1be2b4..3cd05ef4 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -54,6 +54,8 @@ namespace Ingen { namespace Serialisation { struct Serialiser::Impl { + typedef Resource::Properties Properties; + explicit Impl(World& world) : _root_path("/") , _world(world) @@ -116,16 +118,6 @@ Serialiser::~Serialiser() } void -Serialiser::to_file(SPtr<const Node> object, - const std::string& filename) -{ - me->_root_path = object->path(); - me->start_to_filename(filename); - serialise(object); - finish(); -} - -void Serialiser::Impl::write_manifest(const std::string& bundle_path, SPtr<const Node> graph, const std::string& graph_symbol) @@ -196,15 +188,6 @@ Serialiser::Impl::write_bundle(SPtr<const Node> graph, write_manifest(path, graph, symbol); } -string -Serialiser::to_string(SPtr<const Node> object, - const string& base_uri) -{ - start_to_string(object->path(), base_uri); - serialise(object); - return finish(); -} - /** Begin a serialization to a file. * * This must be called before any serializing methods. @@ -223,16 +206,6 @@ Serialiser::Impl::start_to_filename(const string& filename) _mode = Mode::TO_FILE; } -/** Begin a serialization to a string. - * - * This must be called before any serializing methods. - * - * The results of the serialization will be returned by the finish() method after - * the desired objects have been serialised. - * - * All serialized paths will have the root path chopped from their prefix - * (therefore all serialized paths must be descendants of the root) - */ void Serialiser::start_to_string(const Raul::Path& root, const string& base_uri) { @@ -242,6 +215,13 @@ Serialiser::start_to_string(const Raul::Path& root, const string& base_uri) me->_mode = Impl::Mode::TO_STRING; } +void +Serialiser::start_to_file(const Raul::Path& root, const string& filename) +{ + me->_root_path = root; + me->start_to_filename(filename); +} + std::string Serialiser::finish() { @@ -274,7 +254,6 @@ Serialiser::Impl::path_rdf_node(const Raul::Path& path) { assert(_model); assert(path == _root_path || path.is_child_of(_root_path)); - // FIXME: if path == root_path() then "/" ? return Sord::URI(_model->world(), path.substr(_root_path.base().length()), _base_uri); |