From 03acefb8271d2abb5160b349d8e70687af6965fb Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 17 Aug 2008 06:38:33 +0000 Subject: Clean up parser into generic form that can parse anything (rather than just the root patch from a document). Support for parsing from a string. Fix serialisation to a string. git-svn-id: http://svn.drobilla.net/lad/ingen@1414 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/serialisation/Parser.hpp | 54 +++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 8 deletions(-) (limited to 'src/libs/serialisation/Parser.hpp') diff --git a/src/libs/serialisation/Parser.hpp b/src/libs/serialisation/Parser.hpp index 18d59bf2..2aaf3bfb 100644 --- a/src/libs/serialisation/Parser.hpp +++ b/src/libs/serialisation/Parser.hpp @@ -27,7 +27,7 @@ #include "interface/GraphObject.hpp" #include "module/World.hpp" -namespace Redland { class World; } +namespace Redland { class World; class Model; } namespace Ingen { namespace Shared { class CommonInterface; } } using namespace Ingen::Shared; @@ -40,13 +40,51 @@ class Parser { public: virtual ~Parser() {} - virtual bool parse(Ingen::Shared::World* world, - Ingen::Shared::CommonInterface* target, - const Glib::ustring& uri, - boost::optional parent, - std::string patch_name, - Glib::ustring patch_uri = "", - GraphObject::Variables data = GraphObject::Variables()); + virtual bool parse_document( + Ingen::Shared::World* world, + Shared::CommonInterface* target, + const Glib::ustring& document_uri, + Glib::ustring object_uri, + 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, + const Glib::ustring& str, + const Glib::ustring& base_uri, + Glib::ustring object_uri, + boost::optional parent=boost::optional(), + boost::optional symbol=boost::optional(), + boost::optional data=boost::optional()); + +private: + bool parse( + Ingen::Shared::World* world, + Shared::CommonInterface* target, + Redland::Model& model, + const Glib::ustring& base_uri, + Glib::ustring object_uri, + boost::optional parent=boost::optional(), + boost::optional symbol=boost::optional(), + boost::optional data=boost::optional()); + + Raul::Path parse_path( + Ingen::Shared::World* world, + Redland::Model& model, + const Glib::ustring& base_uri, + const Glib::ustring& object_uri, + boost::optional& parent, + boost::optional& symbol); + + bool parse_patch( + Ingen::Shared::World* world, + Ingen::Shared::CommonInterface* target, + Redland::Model& model, + const Glib::ustring& object_uri, + Raul::Path path, + boost::optional data); }; -- cgit v1.2.1