summaryrefslogtreecommitdiff
path: root/src/drumkitparser.cc
diff options
context:
space:
mode:
authorChristian Glöckner <cgloeckner@freenet.de>2016-05-09 11:09:06 +0200
committerChristian Glöckner <cgloeckner@freenet.de>2016-05-26 17:52:21 +0200
commit52b37cac974eb150d49eee1f0b5ba3654f6d7716 (patch)
tree353daa0524c2f918caeac17b704b016e651af6e2 /src/drumkitparser.cc
parent355f9e4e2ebace6cce52a277cbaf1d1bfc904d61 (diff)
Instrument Vector using UniquePtr
Diffstat (limited to 'src/drumkitparser.cc')
-rw-r--r--src/drumkitparser.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/drumkitparser.cc b/src/drumkitparser.cc
index 073d240..cd1c32d 100644
--- a/src/drumkitparser.cc
+++ b/src/drumkitparser.cc
@@ -30,6 +30,7 @@
#include <stdio.h>
#include <hugin.hpp>
+#include "cpp11fix.h"
#include "instrumentparser.h"
#include "path.h"
#include "drumgizmo.h"
@@ -184,14 +185,14 @@ void DrumKitParser::endTag(const std::string& name)
{
if(name == "instrument")
{
- Instrument* instrument = new Instrument(settings, rand);
- instrument->setGroup(instr_group);
-
- InstrumentParser parser(*instrument);
+ auto ptr = std::make_unique<Instrument>(settings, rand);
+ ptr->setGroup(instr_group);
+
+ InstrumentParser parser(*ptr);
parser.parseFile(path + "/" + instr_file);
// Transfer ownership to the DrumKit object.
- kit.instruments.push_back(instrument);
+ kit.instruments.push_back(std::move(ptr));
// Assign kit channel numbers to instruments channels.
std::vector<InstrumentChannel*>::iterator ic = parser.channellist.begin();
@@ -216,7 +217,7 @@ void DrumKitParser::endTag(const std::string& name)
if(c->num == NO_CHANNEL)
{
ERR(kitparser, "Missing channel '%s' in instrument '%s'\n",
- c->name.c_str(), instrument->getName().c_str());
+ c->name.c_str(), ptr->getName().c_str());
}
else
{