From 77cd7380d951b136c7c505ef9ca580643fcfc9e1 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 29 Jun 2013 22:04:47 +0200 Subject: Move ConfigParser to its own file. --- src/drumgizmo.cc | 46 +--------------------------------------------- 1 file changed, 1 insertion(+), 45 deletions(-) (limited to 'src/drumgizmo.cc') diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc index cd0196c..4732c27 100644 --- a/src/drumgizmo.cc +++ b/src/drumgizmo.cc @@ -39,6 +39,7 @@ #include "drumkitparser.h" #include "audioinputenginemidi.h" #include "configuration.h" +#include "configparser.h" DrumGizmo::DrumGizmo(AudioOutputEngine *o, AudioInputEngine *i) : MessageReceiver(MSGRCV_ENGINE), @@ -448,51 +449,6 @@ std::string DrumGizmo::configString() ""; } -#include "saxparser.h" - -class ConfigParser : public SAXParser { -public: - ConfigParser() - { - str = NULL; - } - - void characterData(std::string &data) - { - if(str) str->append(data); - } - - void startTag(std::string name, attr_t attr) - { - if(name == "value" && attr.find("name") != attr.end()) { - values[attr["name"]] = ""; - str = &values[attr["name"]]; - } - } - - void endTag(std::string name) - { - if(name == "value") str = NULL; - } - - std::string value(std::string name, std::string def = "") - { - if(values.find(name) == values.end()) return def; - return values[name]; - } - - void parseError(char *buf, size_t len, std::string error, int lineno) - { - std::string buffer; - buffer.append(buf, len); - ERR(configparser, "sax parser error '%s' at line %d. " - "Buffer: [%d bytes]<%s>\n", - error.c_str(), lineno, len, buffer.c_str()); - } - - std::map values; - std::string *str; -}; bool DrumGizmo::setConfigString(std::string cfg) { -- cgit v1.2.3