Store the file path when constructing MidiNameDocument
authorTim Mayberry <mojofunk@gmail.com>
Mon, 19 Oct 2015 10:18:16 +0000 (20:18 +1000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 22 Oct 2015 15:51:03 +0000 (11:51 -0400)
This is so we can compare and see if we have already parsed the file

libs/midi++2/midi++/midnam_patch.h
libs/midi++2/midnam_patch.cc

index e252e76fe19cde4974d44a4d2864cd2f9fd8e654..683f52f84d9f9c6b4ec9edda8a1aedd130423712 100644 (file)
@@ -465,9 +465,11 @@ public:
        typedef std::map<std::string, boost::shared_ptr<MasterDeviceNames> > 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;
index 2205e5e2a0178686aa01cd8aaf6aed56f0f35aaf..cb1e28508b93eecb397b011c8ad6219579551e85 100644 (file)
@@ -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());
 }