This repository has been archived on 2024-06-01. You can view files and clone it, but cannot push or open issues or pull requests.
nullifiedcat 579b4b6f58 stuff
2018-07-29 14:53:08 +03:00

48 lines
786 B
C++

/*
Created on 01.07.18.
*/
#pragma once
#include "Settings.hpp"
namespace settings
{
template<>
class Variable<int>: public ArithmeticVariable<int>
{
public:
~Variable() override = default;
VariableType getType() override
{
return VariableType::INT;
}
void fromString(const std::string& string) override
{
errno = 0;
auto result = std::strtol(string.c_str(), nullptr, 10);
if (result == 0 && errno)
return;
set(result);
}
inline Variable<int>& operator=(const std::string& string)
{
fromString(string);
}
inline Variable<int>& operator=(const int& next)
{
set(next);
}
inline explicit operator bool() const
{
return value != 0;
}
};
}