xdgcfg  0.1.0
xdgcfg.hpp
1 /* Public Domain / CC-0
2  * Author: tastytea <tastytea@tastytea.de>
3  */
4 
5 #ifndef XDGCFG_HPP
6 #define XDGCFG_HPP
7 
8 #include <string>
9 #include <cstdint>
10 #include <libconfig.h++>
11 
12 using std::string;
13 using std::uint_fast8_t;
14 
15 class xdgcfg
16 {
17 public:
29  explicit xdgcfg(const string &filename, const string &subdir = "");
30 
36  const uint_fast8_t read();
37 
43  const bool write();
44 
53  libconfig::Config &get_cfg();
54 
58  const string get_filepath() const;
59 
63  const void set_verbose(bool verbose);
64 
68  const bool get_verbose() const;
69 
70 private:
74  libconfig::Config _cfg;
75 
79  string _filepath;
80 
84  bool _verbose;
85 };
86 
91 #endif // XDGCFG_HPP
const string get_filepath() const
Returns the complete filepath.
Definition: xdgcfg.cpp:95
const bool write()
Write the file.
Definition: xdgcfg.cpp:71
Definition: xdgcfg.hpp:15
const void set_verbose(bool verbose)
Sets verbosity.
Definition: xdgcfg.cpp:100
xdgcfg(const string &filename, const string &subdir="")
Checks if subdir is present, creates it if necessary.
Definition: xdgcfg.cpp:23
libconfig::Config & get_cfg()
Returns a reference to the config as libconfig::Config.
Definition: xdgcfg.cpp:90
const uint_fast8_t read()
Read the file.
Definition: xdgcfg.cpp:43
const bool get_verbose() const
Returns verbosity.
Definition: xdgcfg.cpp:105