You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1004 B

#ifndef CONFIG_H
#define CONFIG_H
#include <string>
#include <map>
#define CONFIG_FILE_NAME "config.cfg"
class ConfigValue;
namespace Config
ConfigValue const& GetValue(std::string key); // Use with implicit conversion
// eg : int ls = GetValue("levelSize")
// float shaderDirectoryPath = GetValue("Shaders")
template<class T>
void SaveValue(std::string key, T* val); // TODO
void LoadConfigFile();
class ConfigValue
public :
// Constructors
ConfigValue(std::string s);
ConfigValue(char const* c);
ConfigValue(int i);
ConfigValue(double d);
ConfigValue(float f);
// For conversion
operator float() const;
operator double() const;
operator int() const;
operator std::string() const;
private :
std::string pureValue; // value taken directly from the config file before any conversion
#endif /* CONFIG_H */