Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

SysConfig.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                    (C) SuSE Linux AG |
00011 \----------------------------------------------------------------------/
00012 
00013    File:       SysConfig.h
00014 
00015    Author:     Cornelius Schumacher <cschum@suse.de>
00016    Maintainer: Cornelius Schumacher <cschum@suse.de>
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

Generated on Thu Feb 23 23:56:10 2006 for liby2util by doxygen 1.3.6