Repo-Init
 
Loading...
Searching...
No Matches
ConfigParser.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <unordered_map>
5
11 private:
12 std::string _configPath;
13 std::unordered_map<std::string, std::string> _configMap;
14
15 // JSON helpers
16 void readJson();
17 void writeJson() const;
18
19 public:
24 explicit ConfigParser(std::string configPath);
25
33 std::string get(const std::string &key) const;
34
39 const std::unordered_map<std::string, std::string> &getConfigMap() const { return _configMap; }
40
47 void set(const std::string &key, const std::string_view &value);
48
54 void remove(const std::string &key);
55
59 void save() const;
60
64 void load();
65};
std::unordered_map< std::string, std::string > _configMap
void set(const std::string &key, const std::string_view &value)
std::string get(const std::string &key) const
void writeJson() const
void remove(const std::string &key)
void save() const
std::string _configPath
const std::unordered_map< std::string, std::string > & getConfigMap() const
ConfigParser(std::string configPath)