00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __PY_CONFIG_H__
00019 #define __PY_CONFIG_H__
00020
00021 #include <Python.h>
00022 #include <map>
00023 #include <string>
00024
00025 namespace API{
00026 class EnumModule;
00027 }
00028
00029 namespace Config
00030 {
00032 class ConfigModule
00033 {
00034 public:
00035 ConfigModule() {}
00037 ConfigModule( PyObject *parent, char *name );
00039 ConfigModule &add( char *name, PyObject *obj);
00041 ConfigModule &add( char *name, const char *str);
00043 ConfigModule &add( char *name, int value, API::EnumModule *_enum=0);
00045 int getInteger(char *name);
00047 char *getString(char *name);
00049 int setInteger(char *name, int value);
00051 int setString(char *name, char *str);
00053 PyObject *dict();
00055 char *name();
00057 operator PyObject*() { return module; }
00059 API::EnumModule *getEnum(std::string name) { return enum_map[name]; }
00060 private:
00061 PyObject *module;
00062 std::map<std::string, API::EnumModule*> enum_map;
00063 };
00064
00065 extern ConfigModule edit, view, cute, lang;
00066
00067 extern "C" void initconfig();
00068 }
00069
00070 #endif