75 template <setting_type ST>
95 #define define_setting_type(T) using neolib::setting_type_name; template<> struct setting_type_name<T> { static const neolib::string& name() { static neolib::string sTypeName = #T; return sTypeName; } };
96 #define define_setting_type_as(T, Name) using neolib::setting_type_name; template<> struct setting_type_name<T> { static const neolib::string& name() { static neolib::string sTypeName = #Name; return sTypeName; } };
120 struct not_set : std::logic_error {
not_set() : std::logic_error{
"neolib::i_setting_value::not_set" } {} };
132 virtual void const* data()
const = 0;
133 virtual void* data() = 0;
137 return !(*
this == aRhs);
139 template <
typename T>
146 if constexpr (std::is_same_v<T, i_enum>)
147 return *
static_cast<i_enum const*
>(data());
148 else if constexpr (std::is_scalar_v<T>)
149 return static_cast<i_enum const*
>(data())->value<T>();
154 template <
typename T>
155 void set(T
const& aNewValue)
161 if constexpr (std::is_same_v<T, i_enum>)
162 *
static_cast<i_enum*
>(data()) = aNewValue;
163 else if constexpr (std::is_scalar_v<T>)
164 static_cast<i_enum*
>(data())->set_value<T>(aNewValue);
virtual bool operator==(const i_setting_value &aRhs) const =0
virtual bool operator<(const i_setting_value &aRhs) const =0
bool operator!=(const i_setting_value &aRhs) const
i_setting_value abstract_type
void set(T const &aNewValue)
virtual ~i_setting_value()=default
abstract_return_t< T const > get() const
virtual i_string const & type_name() const =0
virtual bool is_set() const =0
virtual setting_type type() const =0
#define define_setting_type(T)
typename detail::abstract_type< T >::type abstract_t
typename detail::abstract_return_type< T >::type abstract_return_t
constexpr setting_type setting_type_v< int16_t >
constexpr setting_type setting_type_v< bool >
constexpr setting_type setting_type_v< int8_t >
constexpr setting_type setting_type_v< int32_t >
constexpr setting_type setting_type_v< uint16_t >
constexpr setting_type setting_type_v< string >
constexpr setting_type setting_type_v< float >
typename get_setting_type< ST >::type setting_type_t
constexpr setting_type setting_type_v
constexpr setting_type setting_type_v< int64_t >
constexpr setting_type setting_type_v< double >
constexpr setting_type setting_type_v< uint64_t >
constexpr setting_type setting_type_v< uint8_t >
constexpr setting_type setting_type_v< uint32_t >
const string setting_type_name_v