2025-02-15 19:36:43 -05:00

29 lines
794 B
C++

#pragma once
#include <string>
#include <map>
#include <vector>
struct ServerProperty {
static std::vector<const ServerProperty *> &get_all();
const std::string key;
const std::string def;
const std::string comment;
ServerProperty(const std::string &key_, const std::string &def_, const std::string &comment_):
key(key_),
def(def_),
comment(comment_)
{
get_all().push_back(this);
}
};
struct ServerProperties {
void load(std::istream &stream);
[[nodiscard]] std::string get_string(const ServerProperty &property) const;
[[nodiscard]] int get_int(const ServerProperty &property) const;
[[nodiscard]] bool get_bool(const ServerProperty &property) const;
private:
std::map<std::string, std::string> properties;
};