diff options
author | André Nusser <andre.nusser@googlemail.com> | 2016-03-23 15:59:41 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-03-29 22:43:31 +0200 |
commit | 390f6f094d43f0d8cfca4efff13d002eb4cf6f19 (patch) | |
tree | 1e8644e553d349eb26bba373354f751717b8a598 /src/drumkitparser.cc | |
parent | eaf8c01ac99f9561870528ff608a073166be2163 (diff) |
Make attr a const ref.
Diffstat (limited to 'src/drumkitparser.cc')
-rw-r--r-- | src/drumkitparser.cc | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/drumkitparser.cc b/src/drumkitparser.cc index b3f3b99..2d0262d 100644 --- a/src/drumkitparser.cc +++ b/src/drumkitparser.cc @@ -76,19 +76,18 @@ DrumKitParser::~DrumKitParser() } -void DrumKitParser::startTag(const std::string& name, - attr_t& attr) +void DrumKitParser::startTag(const std::string& name, const attr_t& attr) { if(name == "drumkit") { if(attr.find("name") != attr.end()) { - kit._name = attr["name"]; + kit._name = attr.at("name"); } if(attr.find("samplerate") != attr.end()) { - kit._samplerate = std::stoi(attr["samplerate"]); + kit._samplerate = std::stoi(attr.at("samplerate")); } else { @@ -99,14 +98,14 @@ void DrumKitParser::startTag(const std::string& name, if(attr.find("description") != attr.end()) { - kit._description = attr["description"]; + kit._description = attr.at("description"); } if(attr.find("version") != attr.end()) { try { - kit._version = VersionStr(attr["version"]); + kit._version = VersionStr(attr.at("version")); } catch(const char *err) { @@ -134,7 +133,7 @@ void DrumKitParser::startTag(const std::string& name, return; } - Channel c(attr["name"]); + Channel c(attr.at("name")); c.num = kit.channels.size(); kit.channels.push_back(c); } @@ -157,11 +156,11 @@ void DrumKitParser::startTag(const std::string& name, return; } - instr_name = attr["name"]; - instr_file = attr["file"]; + instr_name = attr.at("name"); + instr_file = attr.at("file"); if(attr.find("group") != attr.end()) { - instr_group = attr["group"]; + instr_group = attr.at("group"); } else { @@ -183,7 +182,7 @@ void DrumKitParser::startTag(const std::string& name, return; } - channelmap[attr["in"]] = attr["out"]; + channelmap[attr.at("in")] = attr.at("out"); } } |