Store the file path when constructing MidiNameDocument

This is so we can compare and see if we have already parsed the file
This commit is contained in:
Tim Mayberry
2015-10-19 20:18:16 +10:00
committed by Paul Davis
parent 689862cafb
commit efc26a0490
2 changed files with 8 additions and 4 deletions

View 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;

View 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());
}