2017-03-30 17:53:36 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Copyright (C) 2016,2017 Maschell
|
|
|
|
*
|
|
|
|
* 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 _ConfigReader_H_
|
|
|
|
#define _ConfigReader_H_
|
|
|
|
|
2017-05-07 14:44:09 +02:00
|
|
|
#include <gctypes.h>
|
2017-03-30 17:53:36 +02:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "./ControllerPatcher.hpp"
|
|
|
|
|
|
|
|
class ConfigReader{
|
|
|
|
friend class ControllerPatcher;
|
|
|
|
friend class ConfigParser;
|
|
|
|
private:
|
|
|
|
static ConfigReader *getInstance() {
|
|
|
|
if(!instance){
|
|
|
|
instance = new ConfigReader();
|
|
|
|
}
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void destroyInstance() {
|
|
|
|
if(instance){
|
|
|
|
delete instance;
|
|
|
|
instance = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-10 11:00:55 +02:00
|
|
|
static s32 getNumberOfLoadedFiles(){
|
2017-03-30 17:53:36 +02:00
|
|
|
return ConfigReader::numberValidFiles;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void increaseNumberOfLoadedFiles(){
|
|
|
|
ConfigReader::numberValidFiles++;
|
|
|
|
}
|
2017-10-14 15:45:45 +02:00
|
|
|
bool ReadConfigs(std::string path);
|
2017-04-10 11:00:55 +02:00
|
|
|
static s32 numberValidFiles;
|
2017-03-30 17:53:36 +02:00
|
|
|
|
|
|
|
//!Constructor
|
|
|
|
ConfigReader();
|
|
|
|
//!Destructor
|
|
|
|
~ConfigReader();
|
|
|
|
|
2017-04-10 11:00:55 +02:00
|
|
|
s32 InitSDCard();
|
2017-03-30 17:53:36 +02:00
|
|
|
|
|
|
|
static ConfigReader *instance;
|
|
|
|
|
|
|
|
std::string loadFileToString(std::string path);
|
|
|
|
void processFileList(std::vector<std::string> path);
|
|
|
|
|
2017-10-14 15:45:45 +02:00
|
|
|
std::vector<std::string> ScanFolder(std::string path);
|
2017-03-30 17:53:36 +02:00
|
|
|
};
|
|
|
|
#endif
|