From 0f9c8151d5b42b243a499bb31a1e1f0b2e8c5f6f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 8 Feb 2015 07:02:59 +0000 Subject: Server-side copy paste with LV2 state support. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5541 a436a847-0d15-0410-975c-d299462d15a1 --- ingen/serialisation/Parser.hpp | 10 +++++----- ingen/serialisation/Serialiser.hpp | 38 ++++++++++++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 13 deletions(-) (limited to 'ingen/serialisation') diff --git a/ingen/serialisation/Parser.hpp b/ingen/serialisation/Parser.hpp index 6ece6965..446b3988 100644 --- a/ingen/serialisation/Parser.hpp +++ b/ingen/serialisation/Parser.hpp @@ -25,10 +25,10 @@ #include #include -#include #include "ingen/Node.hpp" #include "raul/Path.hpp" +#include "raul/URI.hpp" namespace Ingen { @@ -53,16 +53,16 @@ public: virtual bool parse_file( World* world, Interface* target, - Glib::ustring path, + const std::string& path, boost::optional parent = boost::optional(), boost::optional symbol = boost::optional(), boost::optional data = boost::optional()); - virtual bool parse_string( + virtual boost::optional parse_string( World* world, Interface* target, - const Glib::ustring& str, - const Glib::ustring& base_uri, + const std::string& str, + const std::string& base_uri, boost::optional parent = boost::optional(), boost::optional symbol = boost::optional(), boost::optional data = boost::optional()); diff --git a/ingen/serialisation/Serialiser.hpp b/ingen/serialisation/Serialiser.hpp index d0b65893..80a01b89 100644 --- a/ingen/serialisation/Serialiser.hpp +++ b/ingen/serialisation/Serialiser.hpp @@ -46,27 +46,49 @@ public: explicit Serialiser(World& world); virtual ~Serialiser(); - typedef Node::Properties Properties; - - virtual void to_file(SPtr object, - const std::string& filename); - + /** Write a graph and all its contents as a complete bundle. */ virtual void write_bundle(SPtr graph, const std::string& path); - virtual std::string to_string(SPtr object, - const std::string& base_uri); - + /** 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) + */ virtual void start_to_string(const Raul::Path& root, const std::string& base_uri); + /** Begin a serialization to a file. + * + * This must be called before any serializing methods. + * + * All serialized paths will have the root path chopped from their prefix + * (therefore all serialized paths must be descendants of the root) + */ + virtual void start_to_file(const Raul::Path& root, + const std::string& filename); + + /** Serialize an object (graph, block, or port). */ virtual void serialise(SPtr object) throw (std::logic_error); + /** Serialize an arc. */ virtual void serialise_arc(const Sord::Node& parent, SPtr arc) throw (std::logic_error); + /** Finish serialization. + * + * If this is a file serialization, this must be called to finish and close + * the output file, and the empty string is returned. + * + * If this is a string serialization, the serialized result is returned. + */ virtual std::string finish(); private: -- cgit v1.2.1