29 lines
801 B
C++
29 lines
801 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <istream>
|
|
#include <map>
|
|
|
|
class ServerProperties {
|
|
private:
|
|
std::map<std::string, std::string> properties;
|
|
|
|
ServerProperties() = default;
|
|
|
|
public:
|
|
ServerProperties(const ServerProperties&) = delete;
|
|
ServerProperties& operator=(const ServerProperties&) = delete;
|
|
|
|
static ServerProperties& instance() {
|
|
static ServerProperties instance;
|
|
return instance;
|
|
}
|
|
|
|
void load(std::istream& stream);
|
|
|
|
std::string getString(const std::string& name, const std::string& def = "");
|
|
int getInt(const std::string& name, int def = 0);
|
|
long long getLong(const std::string& name, long long def = 0);
|
|
float getFloat(const std::string& name, float def = 0.f);
|
|
bool getBool(const std::string& name, bool def = false);
|
|
}; |