limal-ca-mgm
CAConfig.hpp
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                     _     _   _   _     __     _                     |
00004 |                    | |   | | | \_/ |   /  \   | |                    |
00005 |                    | |   | | | |_| |  / /\ \  | |                    |
00006 |                    | |__ | | | | | | / ____ \ | |__                  |
00007 |                    |____||_| |_| |_|/ /    \ \|____|                 |
00008 |                                                                      |
00009 |                             ca-mgm library                           |
00010 |                                                                      |
00011 |                                         (C) SUSE Linux Products GmbH |
00012 \----------------------------------------------------------------------/
00013 
00014   File:       CAConfig.hpp
00015 
00016   Author:     <Michael Calmer>     <mc@suse.de>
00017   Maintainer: <Michael Calmer>     <mc@suse.de>
00018 
00019   Purpose:
00020 
00021 /-*/
00022 
00027 #ifndef    LIMAL_CA_CONFIG_HPP
00028 #define    LIMAL_CA_CONFIG_HPP
00029 
00030 #include  <limal/ca-mgm/config.h>
00031 #include  <limal/ca-mgm/CommonData.hpp>
00032 #include  <blocxx/COWIntrusiveReference.hpp>
00033 
00034 
00035 namespace LIMAL_NAMESPACE
00036 {
00037 namespace CA_MGM_NAMESPACE
00038 {
00039 
00040         class CAConfigImpl;
00041         
00045         class CAConfig
00046         {
00047         public:
00048 
00052                 CAConfig(const String &file);
00053                 ~CAConfig();
00054 
00058                 void
00059                 setValue(const String &section, const String &key, const String &value);
00060 
00064                 void
00065                 deleteValue(const String &section, const String &key);
00066 
00070                 String
00071                 getValue(const String &section, const String &key) const;
00072 
00076                 bool
00077                 exists(const String &section, const String &key) const;
00078 
00082                 blocxx::List<blocxx::String>
00083                 getKeylist(const String &section) const;
00084 
00089                 void
00090                 copySection(const String &srcSection, const String &destSection);
00091 
00097                 CAConfig*
00098                 clone(const String &file);
00099 
00103                 String
00104                 filename() const;
00105                 
00106                 void     dump();
00107 
00108 
00109         private:
00110                 blocxx::COWIntrusiveReference<CAConfigImpl> m_impl;
00111 
00112                 CAConfig();
00113                 CAConfig(const CAConfig&);
00114                 CAConfig& operator=(const CAConfig&);
00115         
00116                 class CASection;
00117                 void dumpTree(CASection *section, int level = 0);
00118 
00123                 void validateAndFix();
00124         };
00125     
00126 }
00127 }
00128 
00129 #endif  //LIMAL_CA_CONFIG_HPP