trunk 20080912
[gitenigma.git] / include / lib / system / econfig.h
blobc3c41becf0b12b8f1baf87bdf5d7a90620b1dc2b
1 #ifndef __econfig_h
2 #define __econfig_h
4 // #include <lib/system/nconfig.h>
6 #include <map>
7 #include <lib/base/estring.h>
9 class eConfig // : public NConfig
11 static eConfig *instance;
12 int ppin;
14 std::map<eString, int> keys_int;
15 std::map<eString, eString> keys_string;
16 std::map<eString, unsigned int> keys_uint;
17 std::map<eString, double> keys_double;
19 public:
20 int locked;
21 static eConfig *getInstance() { return instance; }
22 void setParentalPin( int pin )
24 ppin = pin;
25 setKey("/elitedvb/pins/parentallock", ppin );
27 int getParentalPin() { return ppin; }
28 int pLockActive()
30 int tmp = ppin && locked;
31 if ( tmp )
33 int hidelocked=0;
34 if (eConfig::getInstance()->getKey("/elitedvb/hidelocked", hidelocked ))
35 hidelocked=0;
36 if ( hidelocked )
37 tmp |= 2;
39 return tmp;
43 int getKey(const char *, int &);
44 int getKey(const char *, unsigned int &);
45 int getKey(const char *, double &);
46 int getKey(const char *, char * &string);
48 int setKey(const char *, const int &);
49 int setKey(const char *, const unsigned int &);
50 int setKey(const char *, const double &);
51 int setKey(const char *, const char *);
53 void delKey(const char *);
55 void flush();
57 eConfig();
58 ~eConfig();
61 class eSimpleConfigFile
63 protected:
64 std::map<eString, eString> config;
66 public:
67 eSimpleConfigFile(const char *filename);
68 eString getInfo(const char *info);
69 void setInfo(const char *info, const char* value);
70 void Save(const char *filename);
73 #endif