limal-ca-mgm
CAConfig.hpp
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | |
3 | _ _ _ _ __ _ |
4 | | | | | | \_/ | / \ | | |
5 | | | | | | |_| | / /\ \ | | |
6 | | |__ | | | | | | / ____ \ | |__ |
7 | |____||_| |_| |_|/ / \ \|____| |
8 | |
9 | ca-mgm library |
10 | |
11 | (C) SUSE Linux Products GmbH |
12 \----------------------------------------------------------------------/
13 
14  File: CAConfig.hpp
15 
16  Author: <Michael Calmer> <mc@suse.de>
17  Maintainer: <Michael Calmer> <mc@suse.de>
18 
19  Purpose:
20 
21 /-*/
22 
27 #ifndef LIMAL_CA_CONFIG_HPP
28 #define LIMAL_CA_CONFIG_HPP
29 
30 #include <limal/ca-mgm/config.h>
32 #include <blocxx/COWIntrusiveReference.hpp>
33 
34 
35 namespace LIMAL_NAMESPACE
36 {
37 namespace CA_MGM_NAMESPACE
38 {
39 
40  class CAConfigImpl;
41 
45  class CAConfig
46  {
47  public:
48 
52  CAConfig(const String &file);
53  ~CAConfig();
54 
58  void
59  setValue(const String &section, const String &key, const String &value);
60 
64  void
65  deleteValue(const String &section, const String &key);
66 
70  String
71  getValue(const String &section, const String &key) const;
72 
76  bool
77  exists(const String &section, const String &key) const;
78 
82  blocxx::List<blocxx::String>
83  getKeylist(const String &section) const;
84 
89  void
90  copySection(const String &srcSection, const String &destSection);
91 
97  CAConfig*
98  clone(const String &file);
99 
103  String
104  filename() const;
105 
106  void dump();
107 
108 
109  private:
110  blocxx::COWIntrusiveReference<CAConfigImpl> m_impl;
111 
112  CAConfig();
113  CAConfig(const CAConfig&);
114  CAConfig& operator=(const CAConfig&);
115 
116  class CASection;
117  void dumpTree(CASection *section, int level = 0);
118 
123  void validateAndFix();
124  };
125 
126 }
127 }
128 
129 #endif //LIMAL_CA_CONFIG_HPP