summaryrefslogtreecommitdiffstats
path: root/core/config
diff options
context:
space:
mode:
Diffstat (limited to 'core/config')
-rw-r--r--core/config/boolean.cc86
-rw-r--r--core/config/boolean.hh50
-rw-r--r--core/config/ivalue.hh22
-rw-r--r--core/config/number.hh260
-rw-r--r--core/config/string.cc36
-rw-r--r--core/config/string.hh62
6 files changed, 258 insertions, 258 deletions
diff --git a/core/config/boolean.cc b/core/config/boolean.cc
index 45d5a38..5981b6d 100644
--- a/core/config/boolean.cc
+++ b/core/config/boolean.cc
@@ -1,43 +1,43 @@
-#include "core/pch.hh"
-
-#include "core/config/boolean.hh"
-
-config::Boolean::Boolean(bool default_value)
-{
- m_value = default_value;
-}
-
-void config::Boolean::set(std::string_view value)
-{
- m_value = from_string(value);
-}
-
-std::string_view config::Boolean::get(void) const
-{
- return to_string(m_value);
-}
-
-bool config::Boolean::get_value(void) const
-{
- return m_value;
-}
-
-void config::Boolean::set_value(bool value)
-{
- m_value = value;
-}
-
-std::string_view config::Boolean::to_string(bool value)
-{
- if(value) {
- return "true";
- }
- else {
- return "false";
- }
-}
-
-bool config::Boolean::from_string(std::string_view value)
-{
- return value == "true" && value != "false";
-}
+#include "core/pch.hh"
+
+#include "core/config/boolean.hh"
+
+config::Boolean::Boolean(bool default_value)
+{
+ m_value = default_value;
+}
+
+void config::Boolean::set(std::string_view value)
+{
+ m_value = from_string(value);
+}
+
+std::string_view config::Boolean::get(void) const
+{
+ return to_string(m_value);
+}
+
+bool config::Boolean::get_value(void) const
+{
+ return m_value;
+}
+
+void config::Boolean::set_value(bool value)
+{
+ m_value = value;
+}
+
+std::string_view config::Boolean::to_string(bool value)
+{
+ if(value) {
+ return "true";
+ }
+ else {
+ return "false";
+ }
+}
+
+bool config::Boolean::from_string(std::string_view value)
+{
+ return value == "true" && value != "false";
+}
diff --git a/core/config/boolean.hh b/core/config/boolean.hh
index cfd8b0b..f4d3acd 100644
--- a/core/config/boolean.hh
+++ b/core/config/boolean.hh
@@ -1,25 +1,25 @@
-#pragma once
-
-#include "core/config/ivalue.hh"
-
-namespace config
-{
-class Boolean : public IValue {
-public:
- explicit Boolean(bool default_value = false);
- virtual ~Boolean(void) = default;
-
- virtual void set(std::string_view value) override;
- virtual std::string_view get(void) const override;
-
- bool get_value(void) const;
- void set_value(bool value);
-
-private:
- bool m_value;
-
-public:
- static std::string_view to_string(bool value);
- static bool from_string(std::string_view value);
-};
-} // namespace config
+#pragma once
+
+#include "core/config/ivalue.hh"
+
+namespace config
+{
+class Boolean : public IValue {
+public:
+ explicit Boolean(bool default_value = false);
+ virtual ~Boolean(void) = default;
+
+ virtual void set(std::string_view value) override;
+ virtual std::string_view get(void) const override;
+
+ bool get_value(void) const;
+ void set_value(bool value);
+
+private:
+ bool m_value;
+
+public:
+ static std::string_view to_string(bool value);
+ static bool from_string(std::string_view value);
+};
+} // namespace config
diff --git a/core/config/ivalue.hh b/core/config/ivalue.hh
index 13e9a3a..782da76 100644
--- a/core/config/ivalue.hh
+++ b/core/config/ivalue.hh
@@ -1,11 +1,11 @@
-#pragma once
-
-namespace config
-{
-class IValue {
-public:
- virtual ~IValue(void) = default;
- virtual void set(std::string_view value) = 0;
- virtual std::string_view get(void) const = 0;
-};
-} // namespace config
+#pragma once
+
+namespace config
+{
+class IValue {
+public:
+ virtual ~IValue(void) = default;
+ virtual void set(std::string_view value) = 0;
+ virtual std::string_view get(void) const = 0;
+};
+} // namespace config
diff --git a/core/config/number.hh b/core/config/number.hh
index 45d4773..5533459 100644
--- a/core/config/number.hh
+++ b/core/config/number.hh
@@ -1,130 +1,130 @@
-#pragma once
-
-#include "core/config/ivalue.hh"
-
-#include "core/math/concepts.hh"
-
-namespace config
-{
-template<math::Arithmetic T>
-class Number : public IValue {
-public:
- explicit Number(T default_value = T(0));
- explicit Number(T default_value, T min_value, T max_value);
- virtual ~Number(void) = default;
-
- virtual void set(std::string_view value) override;
- virtual std::string_view get(void) const override;
-
- T get_value(void) const;
- void set_value(T value);
-
- T get_min_value(void) const;
- T get_max_value(void) const;
- void set_limits(T min_value, T max_value);
-
-private:
- T m_value;
- T m_min_value;
- T m_max_value;
- std::string m_string;
-};
-} // namespace config
-
-namespace config
-{
-class Int final : public Number<int> {
-public:
- using Number<int>::Number;
-};
-
-class Float final : public Number<float> {
-public:
- using Number<float>::Number;
-};
-
-class Unsigned final : public Number<unsigned int> {
-public:
- using Number<unsigned int>::Number;
-};
-
-class Unsigned64 final : public Number<std::uint64_t> {
-public:
- using Number<std::uint64_t>::Number;
-};
-
-class SizeType final : public Number<std::size_t> {
-public:
- using Number<std::size_t>::Number;
-};
-} // namespace config
-
-template<math::Arithmetic T>
-inline config::Number<T>::Number(T default_value)
-{
- m_value = default_value;
- m_min_value = std::numeric_limits<T>::lowest();
- m_max_value = std::numeric_limits<T>::max();
- m_string = std::to_string(default_value);
-}
-
-template<math::Arithmetic T>
-inline config::Number<T>::Number(T default_value, T min_value, T max_value)
-{
- m_value = default_value;
- m_min_value = min_value;
- m_max_value = max_value;
- m_string = std::to_string(default_value);
-}
-
-template<math::Arithmetic T>
-inline void config::Number<T>::set(std::string_view value)
-{
- T parsed_value;
- auto result = std::from_chars(value.data(), value.data() + value.size(), parsed_value);
-
- if(result.ec == std::errc()) {
- m_value = std::clamp(parsed_value, m_min_value, m_max_value);
- m_string = std::to_string(m_value);
- }
-}
-
-template<math::Arithmetic T>
-inline std::string_view config::Number<T>::get(void) const
-{
- return m_string;
-}
-
-template<math::Arithmetic T>
-inline T config::Number<T>::get_value(void) const
-{
- return m_value;
-}
-
-template<math::Arithmetic T>
-inline void config::Number<T>::set_value(T value)
-{
- m_value = std::clamp(value, m_min_value, m_max_value);
- m_string = std::to_string(m_value);
-}
-
-template<math::Arithmetic T>
-inline T config::Number<T>::get_min_value(void) const
-{
- return m_min_value;
-}
-
-template<math::Arithmetic T>
-inline T config::Number<T>::get_max_value(void) const
-{
- return m_max_value;
-}
-
-template<math::Arithmetic T>
-inline void config::Number<T>::set_limits(T min_value, T max_value)
-{
- m_min_value = min_value;
- m_max_value = max_value;
- m_value = std::clamp(m_value, m_min_value, m_max_value);
- m_string = std::to_string(m_value);
-}
+#pragma once
+
+#include "core/config/ivalue.hh"
+
+#include "core/math/concepts.hh"
+
+namespace config
+{
+template<math::Arithmetic T>
+class Number : public IValue {
+public:
+ explicit Number(T default_value = T(0));
+ explicit Number(T default_value, T min_value, T max_value);
+ virtual ~Number(void) = default;
+
+ virtual void set(std::string_view value) override;
+ virtual std::string_view get(void) const override;
+
+ T get_value(void) const;
+ void set_value(T value);
+
+ T get_min_value(void) const;
+ T get_max_value(void) const;
+ void set_limits(T min_value, T max_value);
+
+private:
+ T m_value;
+ T m_min_value;
+ T m_max_value;
+ std::string m_string;
+};
+} // namespace config
+
+namespace config
+{
+class Int final : public Number<int> {
+public:
+ using Number<int>::Number;
+};
+
+class Float final : public Number<float> {
+public:
+ using Number<float>::Number;
+};
+
+class Unsigned final : public Number<unsigned int> {
+public:
+ using Number<unsigned int>::Number;
+};
+
+class Unsigned64 final : public Number<std::uint64_t> {
+public:
+ using Number<std::uint64_t>::Number;
+};
+
+class SizeType final : public Number<std::size_t> {
+public:
+ using Number<std::size_t>::Number;
+};
+} // namespace config
+
+template<math::Arithmetic T>
+inline config::Number<T>::Number(T default_value)
+{
+ m_value = default_value;
+ m_min_value = std::numeric_limits<T>::lowest();
+ m_max_value = std::numeric_limits<T>::max();
+ m_string = std::to_string(default_value);
+}
+
+template<math::Arithmetic T>
+inline config::Number<T>::Number(T default_value, T min_value, T max_value)
+{
+ m_value = default_value;
+ m_min_value = min_value;
+ m_max_value = max_value;
+ m_string = std::to_string(default_value);
+}
+
+template<math::Arithmetic T>
+inline void config::Number<T>::set(std::string_view value)
+{
+ T parsed_value;
+ auto result = std::from_chars(value.data(), value.data() + value.size(), parsed_value);
+
+ if(result.ec == std::errc()) {
+ m_value = std::clamp(parsed_value, m_min_value, m_max_value);
+ m_string = std::to_string(m_value);
+ }
+}
+
+template<math::Arithmetic T>
+inline std::string_view config::Number<T>::get(void) const
+{
+ return m_string;
+}
+
+template<math::Arithmetic T>
+inline T config::Number<T>::get_value(void) const
+{
+ return m_value;
+}
+
+template<math::Arithmetic T>
+inline void config::Number<T>::set_value(T value)
+{
+ m_value = std::clamp(value, m_min_value, m_max_value);
+ m_string = std::to_string(m_value);
+}
+
+template<math::Arithmetic T>
+inline T config::Number<T>::get_min_value(void) const
+{
+ return m_min_value;
+}
+
+template<math::Arithmetic T>
+inline T config::Number<T>::get_max_value(void) const
+{
+ return m_max_value;
+}
+
+template<math::Arithmetic T>
+inline void config::Number<T>::set_limits(T min_value, T max_value)
+{
+ m_min_value = min_value;
+ m_max_value = max_value;
+ m_value = std::clamp(m_value, m_min_value, m_max_value);
+ m_string = std::to_string(m_value);
+}
diff --git a/core/config/string.cc b/core/config/string.cc
index 198b448..8fb9d70 100644
--- a/core/config/string.cc
+++ b/core/config/string.cc
@@ -1,18 +1,18 @@
-#include "core/pch.hh"
-
-#include "core/config/string.hh"
-
-config::String::String(std::string_view default_value)
-{
- m_value = default_value;
-}
-
-void config::String::set(std::string_view value)
-{
- m_value = value;
-}
-
-std::string_view config::String::get(void) const
-{
- return m_value;
-}
+#include "core/pch.hh"
+
+#include "core/config/string.hh"
+
+config::String::String(std::string_view default_value)
+{
+ m_value = default_value;
+}
+
+void config::String::set(std::string_view value)
+{
+ m_value = value;
+}
+
+std::string_view config::String::get(void) const
+{
+ return m_value;
+}
diff --git a/core/config/string.hh b/core/config/string.hh
index 8fd3901..d7bbbc1 100644
--- a/core/config/string.hh
+++ b/core/config/string.hh
@@ -1,31 +1,31 @@
-#pragma once
-
-#include "core/config/ivalue.hh"
-
-namespace config
-{
-class String : public IValue {
-public:
- explicit String(std::string_view default_value);
- virtual ~String(void) = default;
-
- virtual void set(std::string_view value) override;
- virtual std::string_view get(void) const override;
-
- constexpr const std::string& get_value(void) const noexcept;
- constexpr const char* c_str(void) const noexcept;
-
-private:
- std::string m_value;
-};
-} // namespace config
-
-constexpr const std::string& config::String::get_value(void) const noexcept
-{
- return m_value;
-}
-
-constexpr const char* config::String::c_str(void) const noexcept
-{
- return m_value.c_str();
-}
+#pragma once
+
+#include "core/config/ivalue.hh"
+
+namespace config
+{
+class String : public IValue {
+public:
+ explicit String(std::string_view default_value);
+ virtual ~String(void) = default;
+
+ virtual void set(std::string_view value) override;
+ virtual std::string_view get(void) const override;
+
+ constexpr const std::string& get_value(void) const noexcept;
+ constexpr const char* c_str(void) const noexcept;
+
+private:
+ std::string m_value;
+};
+} // namespace config
+
+constexpr const std::string& config::String::get_value(void) const noexcept
+{
+ return m_value;
+}
+
+constexpr const char* config::String::c_str(void) const noexcept
+{
+ return m_value.c_str();
+}