Chira Engine
A customizable MIT-licensed game engine.
ISettingsLoader.h
1 #pragma once
2 
3 #include <string>
4 #include <string_view>
5 
6 namespace chira {
7 
9 public:
10  explicit ISettingsLoader(std::string_view filename, std::string_view path, bool relative = false);
11  virtual ~ISettingsLoader() = default;
12 
13  virtual void getValue(const std::string& name, int* value) const = 0;
14  virtual void getValue(const std::string& name, double* value) const = 0;
15  virtual void getValue(const std::string& name, std::string* value) const = 0;
16  virtual void getValue(const std::string& name, bool* value) const = 0;
17 
18  virtual void setValue(const std::string& name, int value, bool overwrite, bool save) = 0;
19  virtual void setValue(const std::string& name, double value, bool overwrite, bool save) = 0;
20  virtual void setValue(const std::string& name, const std::string& value, bool overwrite, bool save) = 0;
21  virtual void setValue(const std::string& name, bool value, bool overwrite, bool save) = 0;
22 
23  [[nodiscard]] virtual bool hasValue(const std::string& name) const = 0;
24 
25  virtual void load() = 0;
26  virtual void save() = 0;
27 
28  [[nodiscard]] std::string_view getFilePath() const {
29  return this->filepath;
30  }
31 private:
32  std::string filepath;
33 };
34 
35 } // namespace chira