123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
#ifndef __UOPCONFIG_H__ #define __UOPCONFIG_H__ #include <SDL/SDL.h> #include <fstream> #include <string> #include <map> class UOPConfig { public: UOPConfig(); virtual ~UOPConfig(); bool keyIsValid(string key); bool getBoolean(string key); Sint32 getDWord(string key); string getString(string key); virtual void loadKeys(); virtual void saveKeys(); // Utility functions string encapDatLoc(string filename) {return getString("DataDir")+"/"+filename;} string serverIP(); Uint16 serverPort(); protected: void initDefaults(); map<string, bool> boolValues; map<string, Sint32> dWordValues; map<string, string> stringValues; }; #ifdef WIN32 #include <windows.h> class WindowsConfig : public UOPConfig { public: void loadKeys(); void saveKeys(); protected: void initRegistry(); void deinitRegistry(); HKEY hKey; }; #else class TextConfig : public UOPConfig { public: void loadKeys(); void saveKeys(); protected: void parseFile(ifstream &configfile); string sourcePath; }; #endif #endif