[Base] Add function to convert IConfigVar to ConfigVar<T>

This commit is contained in:
Satori 2020-10-09 23:02:58 +01:00
parent 2a7f03028d
commit 90520e57e6
1 changed files with 8 additions and 0 deletions

View File

@ -29,6 +29,9 @@ namespace toml {
std::string EscapeString(const std::string_view view);
}
template <typename T>
class ConfigVar;
class ICommandVar {
public:
virtual ~ICommandVar() = default;
@ -47,6 +50,11 @@ class IConfigVar : virtual public ICommandVar {
virtual std::string config_value() const = 0;
virtual void LoadConfigValue(std::shared_ptr<cpptoml::base> result) = 0;
virtual void LoadGameConfigValue(std::shared_ptr<cpptoml::base> result) = 0;
template <typename T>
ConfigVar<T>* as() {
return dynamic_cast<ConfigVar<T>*>(this);
}
};
template <class T>