diff options
Diffstat (limited to 'src/drumgizmo.cc')
-rw-r--r-- | src/drumgizmo.cc | 46 |
1 files changed, 1 insertions, 45 deletions
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() "</config>"; } -#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<std::string, std::string> values; - std::string *str; -}; bool DrumGizmo::setConfigString(std::string cfg) { |