2013-06-17 19:01:03 +00:00
|
|
|
#ifndef _SETTINGS_H_
|
|
|
|
#define _SETTINGS_H_
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <map>
|
2013-09-17 21:50:49 +00:00
|
|
|
#include "scrapers/Scraper.h"
|
2013-06-17 19:01:03 +00:00
|
|
|
|
|
|
|
//This is a singleton for storing settings.
|
|
|
|
class Settings
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static Settings* getInstance();
|
|
|
|
|
2013-06-19 21:02:42 +00:00
|
|
|
void loadFile();
|
|
|
|
void saveFile();
|
2013-06-17 19:01:03 +00:00
|
|
|
|
|
|
|
//You will get a warning if you try a get on a key that is not already present.
|
|
|
|
bool getBool(const std::string& name);
|
|
|
|
int getInt(const std::string& name);
|
2013-06-19 21:02:42 +00:00
|
|
|
float getFloat(const std::string& name);
|
2013-06-17 19:01:03 +00:00
|
|
|
|
|
|
|
void setBool(const std::string& name, bool value);
|
|
|
|
void setInt(const std::string& name, int value);
|
2013-06-19 21:02:42 +00:00
|
|
|
void setFloat(const std::string& name, float value);
|
2013-06-17 19:01:03 +00:00
|
|
|
|
2013-10-06 02:56:06 +00:00
|
|
|
std::shared_ptr<Scraper> getScraper();
|
|
|
|
void setScraper(std::shared_ptr<Scraper> scraper);
|
2013-06-17 19:01:03 +00:00
|
|
|
private:
|
|
|
|
static Settings* sInstance;
|
|
|
|
|
|
|
|
Settings();
|
|
|
|
|
|
|
|
//Clear everything and load default values.
|
|
|
|
void setDefaults();
|
|
|
|
|
|
|
|
std::map<std::string, bool> mBoolMap;
|
|
|
|
std::map<std::string, int> mIntMap;
|
2013-06-19 21:02:42 +00:00
|
|
|
std::map<std::string, float> mFloatMap;
|
2013-10-06 02:56:06 +00:00
|
|
|
std::shared_ptr<Scraper> mScraper;
|
2013-06-17 19:01:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|