Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
CFileIni.hpp
Go to the documentation of this file.
1#ifndef LIBS_FILESIO_CFILEINI_HPP_
2#define LIBS_FILESIO_CFILEINI_HPP_
3
4#include "third_party/simpleini/SimpleIni.h"
5
6#include <set>
7#include <string>
8
10{
11public:
13 explicit CFileIni(std::string pathFile);
14 CFileIni(const CFileIni &other) = delete;
15 CFileIni(CFileIni &&other) = delete;
16 virtual ~CFileIni();
17
18 CFileIni &operator=(const CFileIni &other) = delete;
19 CFileIni &operator=(CFileIni &&other) = delete;
20
21 bool readFile();
22 [[nodiscard]] bool saveFile() const;
23 bool deleteKey(const std::string &section, const std::string &key);
24 bool deleteSection(const std::string &section);
25
26 [[nodiscard]] bool getValueBoolean(std::string_view section, std::string_view key, bool defaultValue = false) const;
27 [[nodiscard]] double getValueDouble(std::string_view section, std::string_view key,
28 double defaultValue = 0.0) const;
29 [[nodiscard]] std::set<std::string> getValueList(std::string_view section, std::string_view key,
30 std::string_view defaultValue, char delimiter) const;
31 [[nodiscard]] int64_t getValueLong(std::string_view section, std::string_view key, int64_t defaultValue = 0) const;
32 [[nodiscard]] std::string getValueString(std::string_view section, std::string_view key,
33 const std::string &defaultValue = "") const;
34
35 bool setValueBoolean(std::string_view section, std::string_view key, bool value);
36 bool setValueDouble(std::string_view section, std::string_view key, double value);
37 bool setValueList(std::string_view section, std::string_view key, const std::set<std::string> &list,
38 char delimiter);
39 bool setValueLong(std::string_view section, std::string_view key, int64_t value);
40 bool setValueString(std::string_view section, std::string_view key, const std::string &value);
41
42 bool existsSection(std::string_view section);
43
44private:
45 std::string m_pathFile;
46 CSimpleIniA m_ini;
47};
48
49#endif /* LIBS_FILESIO_CFILEINI_HPP_ */
Definition CFileIni.hpp:10
CFileIni & operator=(CFileIni &&other)=delete
bool setValueDouble(std::string_view section, std::string_view key, double value)
Definition CFileIni.cpp:150
CFileIni(const CFileIni &other)=delete
bool saveFile() const
Definition CFileIni.cpp:76
bool setValueLong(std::string_view section, std::string_view key, int64_t value)
Definition CFileIni.cpp:181
bool readFile()
Definition CFileIni.cpp:64
bool deleteSection(const std::string &section)
Definition CFileIni.cpp:92
bool setValueBoolean(std::string_view section, std::string_view key, bool value)
Definition CFileIni.cpp:139
bool deleteKey(const std::string &section, const std::string &key)
Definition CFileIni.cpp:87
std::set< std::string > getValueList(std::string_view section, std::string_view key, std::string_view defaultValue, char delimiter) const
Definition CFileIni.cpp:109
virtual ~CFileIni()
Definition CFileIni.cpp:58
std::string m_pathFile
Definition CFileIni.hpp:45
bool getValueBoolean(std::string_view section, std::string_view key, bool defaultValue=false) const
Definition CFileIni.cpp:97
std::string getValueString(std::string_view section, std::string_view key, const std::string &defaultValue="") const
Definition CFileIni.cpp:133
CFileIni & operator=(const CFileIni &other)=delete
bool existsSection(std::string_view section)
Definition CFileIni.cpp:203
CSimpleIniA m_ini
Definition CFileIni.hpp:46
CFileIni(CFileIni &&other)=delete
bool setValueString(std::string_view section, std::string_view key, const std::string &value)
Definition CFileIni.cpp:192
double getValueDouble(std::string_view section, std::string_view key, double defaultValue=0.0) const
Definition CFileIni.cpp:103
bool setValueList(std::string_view section, std::string_view key, const std::set< std::string > &list, char delimiter)
Definition CFileIni.cpp:161
int64_t getValueLong(std::string_view section, std::string_view key, int64_t defaultValue=0) const
Definition CFileIni.cpp:127