summaryrefslogtreecommitdiff
path: root/src/instrumentparser.cc
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2016-03-23 18:24:29 +0100
committerAndré Nusser <andre.nusser@googlemail.com>2016-03-29 22:19:49 +0200
commit8c585aa006741b95c1175afcdb01cdd3d8d2d7db (patch)
tree66c482877189c0d63708caffa0e614caf1b8f228 /src/instrumentparser.cc
parent01e216f82e24e7668a892e5a912ccbf1369ae255 (diff)
Do the file related actions in SAXParser.
Diffstat (limited to 'src/instrumentparser.cc')
-rw-r--r--src/instrumentparser.cc32
1 files changed, 5 insertions, 27 deletions
diff --git a/src/instrumentparser.cc b/src/instrumentparser.cc
index 8c3c737..268f8f3 100644
--- a/src/instrumentparser.cc
+++ b/src/instrumentparser.cc
@@ -35,26 +35,17 @@
#include "nolocale.h"
-InstrumentParser::InstrumentParser(const std::string& file, Instrument& i)
+InstrumentParser::InstrumentParser(Instrument& i)
: instrument(i)
{
- // DEBUG(instrparser,"Parsing instrument in %s\n", file.c_str());
- path = getPath(file);
- fd = fopen(file.c_str(), "r");
- if(!fd)
- {
- ERR(instrparser, "The following instrument file could not be opened: %s\n", file.c_str());
- return;
- }
}
-InstrumentParser::~InstrumentParser()
+int InstrumentParser::parseFile(const std::string& filename)
{
- if(fd)
- {
- fclose(fd);
- }
+ path = getPath(filename);
+
+ return SAXParser::parseFile(filename);
}
void InstrumentParser::startTag(const std::string& name, const attr_t& attr)
@@ -233,16 +224,3 @@ void InstrumentParser::endTag(const std::string& name)
instrument.finalise();
}
}
-
-int InstrumentParser::readData(std::string& data, std::size_t size)
-{
- if(!fd)
- {
- return -1;
- }
-
- data.resize(size);
- auto nr_of_bytes_read = fread((void*)data.data(), 1, size, fd);
- data.resize(nr_of_bytes_read);
- return nr_of_bytes_read;
-}