From 61e5bcef2629e2d68b805a956a96fff264d4f74d Mon Sep 17 00:00:00 2001 From: untodesu Date: Sat, 28 Jun 2025 01:59:49 +0500 Subject: Restructure dependencies and update to C++20 - Nuked static_assert from almost everywhere in the project - Nuked binary dependency support. Might add one later though - Separated dependency headers into a separate include subdirectory - Grafted a thirdpartylegalnotices.txt generator from RITEG - Pushed development snapshot version to 2126 (26th week of 2025) --- core/config.hh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'core/config.hh') diff --git a/core/config.hh b/core/config.hh index 3df0870..efb2ef0 100644 --- a/core/config.hh +++ b/core/config.hh @@ -2,6 +2,8 @@ #define CORE_CONFIG_HH 1 #pragma once +#include "core/concepts.hh" + class IConfigValue { public: virtual ~IConfigValue(void) = default; @@ -29,10 +31,8 @@ public: static bool from_string(const char* value); }; -template +template class ConfigNumber : public IConfigValue { - static_assert(std::is_arithmetic_v); - public: explicit ConfigNumber(T default_value = T(0)); explicit ConfigNumber(T default_value, T min_value, T max_value); @@ -112,7 +112,7 @@ private: std::unordered_map m_values; }; -template +template inline ConfigNumber::ConfigNumber(T default_value) { m_value = default_value; @@ -121,7 +121,7 @@ inline ConfigNumber::ConfigNumber(T default_value) m_string = std::to_string(default_value); } -template +template inline ConfigNumber::ConfigNumber(T default_value, T min_value, T max_value) { m_value = default_value; @@ -130,7 +130,7 @@ inline ConfigNumber::ConfigNumber(T default_value, T min_value, T max_value) m_string = std::to_string(default_value); } -template +template inline void ConfigNumber::set(const char* value) { std::istringstream(value) >> m_value; @@ -138,38 +138,38 @@ inline void ConfigNumber::set(const char* value) m_string = std::to_string(m_value); } -template +template inline const char* ConfigNumber::get(void) const { return m_string.c_str(); } -template +template inline T ConfigNumber::get_value(void) const { return m_value; } -template +template inline void ConfigNumber::set_value(T value) { m_value = std::clamp(value, m_min_value, m_max_value); m_string = std::to_string(m_value); } -template +template inline T ConfigNumber::get_min_value(void) const { return m_min_value; } -template +template inline T ConfigNumber::get_max_value(void) const { return m_max_value; } -template +template inline void ConfigNumber::set_limits(T min_value, T max_value) { m_min_value = min_value; -- cgit