D:/Development/Projects/X-Clone/X-Clone/trunk/ConfigOptions.h

Go to the documentation of this file.
00001 #ifndef XCLONE_CONFIGOPTIONS_H
00002 #define XCLONE_CONFIGOPTIONS_H
00003 
00004 #include "includes.h"
00005 #include "Singleton.h"
00006 
00007 enum ConfigOptionName { WIDTH, HEIGHT, COLOR_DEPTH, MAP, FONT };
00008 
00009 class ConfigOptions : public Singleton<ConfigOptions>
00010 {
00011    friend class Singleton<ConfigOptions>;
00012 
00013    public:
00014       void init();
00015       void deinit();
00016       bool load(string filename);
00017 
00018       template <typename T> 
00019       T get(ConfigOptionName option);
00020 
00021    private:
00022       ConfigOptions();
00023       void createOptionsMap();
00024 
00025       po::variables_map _vm;
00026       map<ConfigOptionName, const char*> optionsMap;
00027 };
00028 
00029 template <typename T>
00030 T ConfigOptions::get(ConfigOptionName option)
00031 {
00032    return _vm[optionsMap[option]].as<T>();
00033 }
00034 
00035 #endif

Generated on Fri Sep 22 06:00:26 2006 for X-CLONE by  doxygen 1.4.7