summaryrefslogtreecommitdiffstats
path: root/ingen/serialisation
diff options
context:
space:
mode:
Diffstat (limited to 'ingen/serialisation')
-rw-r--r--ingen/serialisation/Parser.hpp10
-rw-r--r--ingen/serialisation/Serialiser.hpp38
2 files changed, 35 insertions, 13 deletions
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 <list>
#include <boost/optional.hpp>
-#include <glibmm/ustring.h>
#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<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(
+ virtual boost::optional<Raul::URI> 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<Raul::Path> parent = boost::optional<Raul::Path>(),
boost::optional<Raul::Symbol> symbol = boost::optional<Raul::Symbol>(),
boost::optional<Properties> data = boost::optional<Properties>());
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<const Node> object,
- const std::string& filename);
-
+ /** Write a graph and all its contents as a complete bundle. */
virtual void write_bundle(SPtr<const Node> graph,
const std::string& path);
- virtual std::string to_string(SPtr<const Node> 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<const Node> object)
throw (std::logic_error);
+ /** Serialize an arc. */
virtual void serialise_arc(const Sord::Node& parent,
SPtr<const Arc> 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: