2016-08-03 20:46:46 +02:00
|
|
|
/****************************************************************************
|
2017-03-30 17:53:36 +02:00
|
|
|
* Copyright (C) 2016,2017 Maschell
|
2016-08-03 20:46:46 +02:00
|
|
|
*
|
|
|
|
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef _ConfigParser_H_
|
|
|
|
#define _ConfigParser_H_
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2017-10-29 09:34:47 +01:00
|
|
|
#include "../ControllerPatcherIncludes.hpp"
|
2016-08-03 20:46:46 +02:00
|
|
|
|
2017-10-29 09:34:47 +01:00
|
|
|
#include <utils/logger.h>
|
2016-08-03 20:46:46 +02:00
|
|
|
|
|
|
|
enum PARSE_TYPE{
|
|
|
|
PARSE_CONTROLLER,
|
|
|
|
PARSE_GAMEPAD,
|
|
|
|
PARSE_MOUSE,
|
|
|
|
PARSE_KEYBOARD
|
|
|
|
};
|
|
|
|
|
2017-03-30 17:53:36 +02:00
|
|
|
class ConfigParser{
|
|
|
|
friend class ConfigReader;
|
|
|
|
friend class ControllerPatcher;
|
|
|
|
private:
|
2016-08-03 20:46:46 +02:00
|
|
|
//!Constructor
|
|
|
|
ConfigParser(std::string configData);
|
|
|
|
//!Destructor
|
|
|
|
~ConfigParser();
|
|
|
|
|
|
|
|
PARSE_TYPE getType();
|
|
|
|
void setType(PARSE_TYPE newType);
|
|
|
|
|
2018-06-20 15:07:15 +02:00
|
|
|
uint16_t getSlot();
|
|
|
|
void setSlot(uint16_t newSlot);
|
2016-08-03 20:46:46 +02:00
|
|
|
|
2018-06-20 15:07:15 +02:00
|
|
|
BOOL parseIni();
|
2016-08-03 20:46:46 +02:00
|
|
|
|
2018-06-20 15:07:15 +02:00
|
|
|
BOOL Init();
|
2016-08-03 20:46:46 +02:00
|
|
|
|
2018-06-20 15:07:15 +02:00
|
|
|
BOOL parseConfigString(std::string content);
|
2016-08-03 20:46:46 +02:00
|
|
|
|
2018-06-20 15:07:15 +02:00
|
|
|
int32_t getSlotController(std::string identify);
|
2016-08-03 20:46:46 +02:00
|
|
|
|
2018-06-20 15:07:15 +02:00
|
|
|
int32_t checkExistingController(int32_t vid, int32_t pid);
|
2016-08-03 20:46:46 +02:00
|
|
|
|
2018-06-20 15:07:15 +02:00
|
|
|
int32_t getValueFromKeyValue(std::string value_pair,std::string expectedKey,std::string delimiter);
|
2016-08-03 20:46:46 +02:00
|
|
|
|
2018-06-20 15:07:15 +02:00
|
|
|
BOOL resetConfig();
|
2016-08-03 20:46:46 +02:00
|
|
|
|
|
|
|
void parseSingleLine(std::string line);
|
2018-06-20 15:07:15 +02:00
|
|
|
uint16_t slot_b;
|
2016-08-03 20:46:46 +02:00
|
|
|
PARSE_TYPE type_b;
|
2017-03-30 17:53:36 +02:00
|
|
|
|
2018-06-20 15:07:15 +02:00
|
|
|
uint16_t vid;
|
|
|
|
uint16_t pid;
|
2017-03-30 17:53:36 +02:00
|
|
|
|
2016-08-03 20:46:46 +02:00
|
|
|
std::string content;
|
|
|
|
std::vector<std::string> contentLines;
|
|
|
|
};
|
|
|
|
#endif
|