/* This file is part of EqualizerAPO, a system-wide equalizer. Copyright (C) 2014 Jonas Thedering This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "helpers/LogHelper.h" #include "helpers/StringHelper.h" #include "FilterEngine.h" #include "DeviceFilterFactory.h" using namespace std; void DeviceFilterFactory::initialize(FilterEngine* engine) { deviceString = engine->getDeviceName() + L" " + engine->getConnectionName() + L" " + engine->getDeviceGuid(); mup::ParserX* parser = engine->getParser(); parser->DefineConst(L"deviceName", engine->getDeviceName()); parser->DefineConst(L"connectionName", engine->getConnectionName()); parser->DefineConst(L"deviceGuid", engine->getDeviceGuid()); } vector DeviceFilterFactory::startOfConfiguration() { deviceMatches = true; return vector(); } vector DeviceFilterFactory::createFilter(const wstring& configPath, wstring& command, wstring& parameters) { if(command == L"Device") { wstring value = StringHelper::trim(parameters) + L";"; vector> fullList; vector currentList; wstring currentWord; for(unsigned i=0; i 0) { currentList.push_back(currentWord); currentWord.clear(); } if(c == L';' && currentList.size() > 0) { fullList.push_back(currentList); currentList.clear(); } } else { currentWord += c; } } bool matches = false; for(unsigned i=0; i(); } std::vector DeviceFilterFactory::endOfFile(const std::wstring& configPath) { // in outer file, the device must have matched, otherwise the inner file would not have been included deviceMatches = true; return vector(); }