00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef SysConfig_h
00020 #define SysConfig_h
00021
00022 #include <y2util/Pathname.h>
00023
00024 #include <string>
00025 #include <map>
00026
00037 class SysConfig
00038 {
00039 public:
00046 SysConfig( const char *path );
00053 SysConfig( const std::string &path );
00060 SysConfig( const Pathname &path );
00061
00062 ~SysConfig();
00063
00068 bool load();
00069
00075 bool save();
00076
00083 std::string readEntry( const std::string &key,
00084 const std::string &defaultValue = std::string() );
00085
00093 bool readBoolEntry( const std::string &key, bool defaultValue = false );
00094
00102 int readIntEntry( const std::string &key, int defaultValue = 0 );
00103
00110 void writeEntry( const std::string &key, const char *value );
00111
00118 void writeEntry( const std::string &key, const std::string &value );
00119
00126 void writeEntry( const std::string &key, bool value );
00127
00134 void writeEntry( const std::string &key, int value );
00135
00136 protected:
00137 std::string SysConfig::createLine( const std::string &key,
00138 const std::string &value );
00139
00140 private:
00141 Pathname _path;
00142 typedef std::map<std::string, std::string> EntryMap;
00143 EntryMap _entryMap;
00144 bool mDirty;
00145 };
00146
00147 #endif