Mass++ Common Libraries v2.7.5
 All Classes Namespaces Files Functions Variables Enumerations Macros
IniFile.h
Go to the documentation of this file.
1 
12 #ifndef __KOME_CORE_INI_FILE_H__
13 #define __KOME_CORE_INI_FILE_H__
14 
15 
16 #include "Properties.h"
17 
18 #include <string>
19 #include <vector>
20 #include <map>
21 
22 
23 namespace kome {
24  namespace core {
25 
30  class CORE_TOOLKITS_CLASS IniFile {
31  protected:
36  IniFile();
37 
42  virtual ~IniFile();
43 
44  public:
50  const char* getFilePath();
51 
52  protected:
54  std::string m_filePath;
55 
57  std::vector< std::string > m_sections;
58 
60  std::map< std::string, Properties > m_sectionMap;
61 
62  public:
71  bool decryptPassword( const char* pcPassword, char* pcDecrypt, const size_t szDecrypt );
72 
81  bool encryptPassword( const char* pcPassword, char* pcEncrypt, const size_t szEncrypt );
82 
83  public:
84 
92  void setString( const char* section, const char* key, const char* value );
93 
103  const char* getString( const char* section, const char* key, const char* defaultValue );
104 
112  void setBool( const char* section, const char* key, const bool value );
113 
124  bool getBool( const char* section, const char* key, const bool defaultValue );
125 
133  void setInt( const char* section, const char* key, const int value );
134 
145  int getInt( const char* section, const char* key, const int defaultValue );
146 
154  void setDouble( const char* section, const char* key, const double value );
155 
166  double getDouble( const char* section, const char* key, const double defaultValue );
167 
174  void deleteValue( const char* section, const char* key );
175 
176  protected:
184  Properties* getProperties( const char* section );
185 
186  public:
192  unsigned int getNumberOfSections();
193 
200  const char* getSection( const unsigned int index );
201 
208  unsigned int getNumberOfParameters( const char* section );
209 
218  const char* getParameterName( const char* section, const unsigned int index );
219 
228  const char* getParameterValue( const char* section, const unsigned int index );
229 
230  public:
237  bool load( const char* path );
238 
245  bool save( const char* path = NULL );
246 
253  static IniFile* loadIniFile( const char* path );
254 
261  static IniFile* getIniFile( const char* path );
262 
267  static void saveAllIniFiles();
268 
269  protected:
275  public:
280  IniFileManager();
281 
286  virtual ~IniFileManager();
287 
288  protected:
290  std::map< std::string, IniFile* > m_fileMap;
291 
292  public:
298  void setFile( IniFile* file );
299 
306  IniFile* getFile( const char* path );
307 
312  void save();
313 
314  public:
320  static IniFileManager& getInstance();
321  };
322  };
323  }
324 }
325 
326 #endif // __KOME_CORE_INI_FILE_H__
std::map< std::string, IniFile * > m_fileMap
Definition: IniFile.h:290
keys and values management class
Definition: Properties.h:29
IniFile object management class.
Definition: IniFile.h:274
std::string m_filePath
Definition: IniFile.h:54
std::map< std::string, Properties > m_sectionMap
Definition: IniFile.h:60
#define NULL
Definition: CoreMacros.h:18
interfaces of Properties class
ini file management class
Definition: IniFile.h:30
std::vector< std::string > m_sections
Definition: IniFile.h:57