diff options
author | David Robillard <d@drobilla.net> | 2008-08-17 06:38:33 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-08-17 06:38:33 +0000 |
commit | 03acefb8271d2abb5160b349d8e70687af6965fb (patch) | |
tree | e377017141707b2a97eeda4adffcfbb56eec88bc /src/libs/serialisation/Parser.hpp | |
parent | 696535322342c56901d4d48641b6f9cf816ac1e1 (diff) | |
download | ingen-03acefb8271d2abb5160b349d8e70687af6965fb.tar.gz ingen-03acefb8271d2abb5160b349d8e70687af6965fb.tar.bz2 ingen-03acefb8271d2abb5160b349d8e70687af6965fb.zip |
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
Diffstat (limited to 'src/libs/serialisation/Parser.hpp')
-rw-r--r-- | src/libs/serialisation/Parser.hpp | 54 |
1 files changed, 46 insertions, 8 deletions
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<Raul::Path> 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<Raul::Path> parent=boost::optional<Raul::Path>(), + boost::optional<Raul::Symbol> symbol=boost::optional<Raul::Symbol>(), + boost::optional<GraphObject::Variables> data=boost::optional<GraphObject::Variables>()); + + 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<Raul::Path> parent=boost::optional<Raul::Path>(), + boost::optional<Raul::Symbol> symbol=boost::optional<Raul::Symbol>(), + boost::optional<GraphObject::Variables> data=boost::optional<GraphObject::Variables>()); + +private: + bool parse( + Ingen::Shared::World* world, + Shared::CommonInterface* target, + Redland::Model& model, + const Glib::ustring& base_uri, + Glib::ustring object_uri, + boost::optional<Raul::Path> parent=boost::optional<Raul::Path>(), + boost::optional<Raul::Symbol> symbol=boost::optional<Raul::Symbol>(), + boost::optional<GraphObject::Variables> data=boost::optional<GraphObject::Variables>()); + + Raul::Path parse_path( + Ingen::Shared::World* world, + Redland::Model& model, + const Glib::ustring& base_uri, + const Glib::ustring& object_uri, + boost::optional<Raul::Path>& parent, + boost::optional<Raul::Symbol>& 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<GraphObject::Variables> data); }; |