diff options
author | Hans Baier <hansfbaier@googlemail.com> | 2008-12-06 05:00:20 +0000 |
---|---|---|
committer | Hans Baier <hansfbaier@googlemail.com> | 2008-12-06 05:00:20 +0000 |
commit | 72f55cd8b69522c8e05122d5707145a5b60fa1e6 (patch) | |
tree | ecb18a411669cf9c7225969a22de95d70b42e6ea /libs | |
parent | c61283d35ec1e878683ae2d7bdfed7a254942655 (diff) |
* completed MIDI::Name::MIDINameDocument and implemented its set_state-Method, added constructor
git-svn-id: svn://localhost/ardour2/branches/3.0@4295 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/midi++2/midi++/midnam_patch.h | 7 | ||||
-rw-r--r-- | libs/midi++2/midnam_patch.cc | 15 |
2 files changed, 21 insertions, 1 deletions
diff --git a/libs/midi++2/midi++/midnam_patch.h b/libs/midi++2/midi++/midnam_patch.h index 769c605c3f..3abb6c6c54 100644 --- a/libs/midi++2/midi++/midnam_patch.h +++ b/libs/midi++2/midi++/midnam_patch.h @@ -185,14 +185,19 @@ public: typedef std::list<MasterDeviceNames> MasterDeviceNamesList; MIDINameDocument() {}; + MIDINameDocument(const string &filename) : _document(XMLTree(filename)) { set_state(*_document.root()); }; virtual ~MIDINameDocument() {}; + const string& author() const { return _author; } + void set_author(const string an_author) { _author = an_author; } + XMLNode& get_state (void); int set_state (const XMLNode& a_node); private: - string _author; + string _author; MasterDeviceNamesList _master_device_names_list; + XMLTree _document; }; } diff --git a/libs/midi++2/midnam_patch.cc b/libs/midi++2/midnam_patch.cc index b9cacdcd96..758667d909 100644 --- a/libs/midi++2/midnam_patch.cc +++ b/libs/midi++2/midnam_patch.cc @@ -272,6 +272,21 @@ MasterDeviceNames::get_state(void) int MIDINameDocument::set_state(const XMLNode& a_node) { + // Author + boost::shared_ptr<XMLSharedNodeList> author = a_node.find("//Author"); + assert(author->size() == 1); + _author = author->front()->content(); + + // MasterDeviceNames + boost::shared_ptr<XMLSharedNodeList> master_device_names_list = a_node.find("//MasterDeviceNames"); + for (XMLSharedNodeList::iterator i = master_device_names_list->begin(); + i != master_device_names_list->end(); + ++i) { + MasterDeviceNames master_device_names; + master_device_names.set_state(*(*i)); + _master_device_names_list.push_back(master_device_names); + } + return 0; } |