summaryrefslogtreecommitdiff
path: root/src/instrumentparser.h
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2016-03-22 00:40:15 +0100
committerAndré Nusser <andre.nusser@googlemail.com>2016-03-29 22:19:49 +0200
commit0930fdc014bf36fb9e2715b3d14bff5fedf354a9 (patch)
tree9136c06ba9311f164e03156312ed449367acf20a /src/instrumentparser.h
parent866b09992668f97af063dcd77dc5dd0e3a512b94 (diff)
Parser refactoring.
* Use new style * Update to C++11 * Use more std::string than char*
Diffstat (limited to 'src/instrumentparser.h')
-rw-r--r--src/instrumentparser.h32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/instrumentparser.h b/src/instrumentparser.h
index e08b54c..3fee916 100644
--- a/src/instrumentparser.h
+++ b/src/instrumentparser.h
@@ -24,37 +24,35 @@
* along with DrumGizmo; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#ifndef __DRUMGIZMO_INSTRUMENTPARSER_H__
-#define __DRUMGIZMO_INSTRUMENTPARSER_H__
+#pragma once
#include "saxparser.h"
#include "instrument.h"
#include <vector>
-class InstrumentParser : public SAXParser {
+class InstrumentParser
+ : public SAXParser
+{
public:
- InstrumentParser(const std::string &instrfile, Instrument &instrument);
- ~InstrumentParser();
+ InstrumentParser(const std::string& instrfile, Instrument &instrument);
+ ~InstrumentParser();
- void startTag(std::string name,
- std::map< std::string, std::string> attributes);
- void endTag(std::string name);
-
- std::vector<InstrumentChannel *> channellist;
+ std::vector<InstrumentChannel*> channellist;
protected:
- int readData(char *data, size_t size);
+ int readData(std::string& data, std::size_t size) override;
+
+ virtual void startTag(const std::string& name, attr_t& attr) override;
+ virtual void endTag(const std::string& name) override;
private:
- FILE *fd{nullptr};
- Instrument &instrument;
- Sample *s{nullptr};
+ FILE* fd{nullptr};
+ Instrument& instrument;
+ Sample* s{nullptr};
- std::string path;
+ std::string path;
level_t lower{0};
level_t upper{0};
};
-
-#endif/*__DRUMGIZMO_INSTRUMENTPARSER_H__*/