mirror of
https://github.com/obsqrbtz/clrsync.git
synced 2026-04-09 04:29:04 +03:00
init
This commit is contained in:
31
src/core/io/toml_file.hpp
Normal file
31
src/core/io/toml_file.hpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef CLRSYNC_CORE_IO_TOML_FILE_HPP
|
||||
#define CLRSYNC_CORE_IO_TOML_FILE_HPP
|
||||
#include <core/io/file.hpp>
|
||||
#include <string>
|
||||
#include <toml/toml.hpp>
|
||||
|
||||
namespace clrsync::core::io
|
||||
{
|
||||
class toml_file : public file
|
||||
{
|
||||
public:
|
||||
explicit toml_file(std::string path);
|
||||
bool parse() override;
|
||||
const std::string get_string_value(const std::string §ion,
|
||||
const std::string &key) const override;
|
||||
uint32_t get_uint_value(const std::string §ion, const std::string &key) const override;
|
||||
uint32_t get_bool_value(const std::string §ion, const std::string &key) const override;
|
||||
std::map<std::string, value_type> get_table(const std::string §ion_path) const override;
|
||||
void insert_or_update_value(const std::string §ion, const std::string &key,
|
||||
const value_type &value) override;
|
||||
void save_file() override;
|
||||
|
||||
private:
|
||||
toml::parse_result m_file{};
|
||||
std::string m_path{};
|
||||
|
||||
std::vector<std::string> split(const std::string &s, char delim) const;
|
||||
};
|
||||
} // namespace clrsync::core::io
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user