cpp-toolbox  0.0.1
A toolbox library for C++
Loading...
Searching...
No Matches
ini_config.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <unordered_map>
5#include <filesystem>
6#include <cpp-toolbox/cpp-toolbox_export.hpp>
7
8namespace toolbox::utils
9{
10class CPP_TOOLBOX_EXPORT ini_config_t
11{
12public:
13 bool load(const std::filesystem::path& file_path);
14 bool has(const std::string& section, const std::string& key) const;
15 std::string get_string(const std::string& section,
16 const std::string& key,
17 const std::string& default_value = "") const;
18
19private:
20 using section_map_t =
21 std::unordered_map<std::string, std::unordered_map<std::string, std::string>>;
22 section_map_t data_;
23};
24} // namespace toolbox::utils
Definition ini_config.hpp:11
bool load(const std::filesystem::path &file_path)
bool has(const std::string &section, const std::string &key) const
std::string get_string(const std::string &section, const std::string &key, const std::string &default_value="") const
< 用于 std::out_of_range/For std::out_of_range
Definition click.hpp:11