From: Tim Mayberry Date: Mon, 19 Oct 2015 10:18:16 +0000 (+1000) Subject: Store the file path when constructing MidiNameDocument X-Git-Tag: 4.5~579 X-Git-Url: https://main.carlh.net/gitweb/?p=ardour.git;a=commitdiff_plain;h=efc26a049063ec9b7f81ab89fbe9b8fdcfd18233 Store the file path when constructing MidiNameDocument This is so we can compare and see if we have already parsed the file --- diff --git a/libs/midi++2/midi++/midnam_patch.h b/libs/midi++2/midi++/midnam_patch.h index e252e76fe1..683f52f84d 100644 --- a/libs/midi++2/midi++/midnam_patch.h +++ b/libs/midi++2/midi++/midnam_patch.h @@ -465,9 +465,11 @@ public: typedef std::map > MasterDeviceNamesList; MIDINameDocument() {} - MIDINameDocument(const std::string& filename); + MIDINameDocument(const std::string& file_path); virtual ~MIDINameDocument() {}; + const std::string& file_path () const { return _file_path; } + const std::string& author() const { return _author; } void set_author(const std::string& author) { _author = author; } @@ -481,6 +483,7 @@ public: int set_state (const XMLTree&, const XMLNode&); private: + const std::string _file_path; std::string _author; MasterDeviceNamesList _master_device_names_list; MasterDeviceNames::Models _all_models; diff --git a/libs/midi++2/midnam_patch.cc b/libs/midi++2/midnam_patch.cc index 2205e5e2a0..cb1e28508b 100644 --- a/libs/midi++2/midnam_patch.cc +++ b/libs/midi++2/midnam_patch.cc @@ -877,14 +877,15 @@ MasterDeviceNames::get_state(void) return nothing; } -MIDINameDocument::MIDINameDocument (const string& filename) +MIDINameDocument::MIDINameDocument (const string& file_path) + : _file_path(file_path) { XMLTree document; - if (!document.read (filename)) { + if (!document.read (file_path)) { throw failed_constructor (); } - document.set_filename (filename); + document.set_filename (file_path); set_state (document, *document.root()); }