8#ifndef HPP_ALIB_CONFIG_VMETA
9#define HPP_ALIB_CONFIG_VMETA 1
20 class ConfigurationPlugin;
25namespace alib::config::detail {
31template<
typename T>
struct VData
39 template<
typename TRe
interpret>
inline TReinterpret&
As()
46 template<
typename TRe
interpret>
inline const TReinterpret&
As()
const
173#define ALIB_CONFIG_VARIABLE_DEFINE_TYPE( Namespace, CPPName,CfgTypeString) \
174namespace alib::config::detail { \
175struct VMeta_ ## CPPName : public VMeta \
177 ALIB_API String typeName () const override { return CfgTypeString; } \
178ALIB_DBG(ALIB_API const std::type_info& dbgTypeID() override { return typeid(Namespace CPPName); } ) \
179 ALIB_API void construct(void* obj, PoolAllocator&) override { new (obj) Namespace CPPName(); } \
180 ALIB_API void destruct (void* obj, PoolAllocator&) override { reinterpret_cast<Namespace CPPName*>(obj)->~CPPName(); } \
181 ALIB_API size_t size () override { static_assert(alignof(Namespace CPPName) <= alib::PoolAllocator::MAX_ALIGNMENT); return (std::max)( sizeof(Namespace CPPName), sizeof(void*) ); } \
182 ALIB_API void imPort (VDATA*, Configuration&, const StringEscaper&, const String&) override;\
183 ALIB_API void exPort (VDATA*, Configuration&, const StringEscaper&, AString&) override;\
186#define ALIB_CONFIG_VARIABLE_DEFINE_TYPE_WITH_POOL_CONSTRUCTOR( Namespace, CPPName,CfgTypeString) \
187namespace alib::config::detail { \
188struct VMeta_ ## CPPName : public VMeta \
190 ALIB_API String typeName () const override { return CfgTypeString; } \
191ALIB_DBG(ALIB_API const std::type_info& dbgTypeID() override { return typeid(Namespace CPPName); } ) \
192 ALIB_API void construct(void* obj, PoolAllocator& pool) override { new (obj) Namespace CPPName(pool); } \
193 ALIB_API void destruct (void* obj, PoolAllocator&) override { reinterpret_cast<Namespace CPPName*>(obj)->~CPPName(); } \
194 ALIB_API size_t size () override { static_assert(alignof(Namespace CPPName) <= alib::PoolAllocator::MAX_ALIGNMENT); return (std::max)( sizeof(Namespace CPPName), sizeof(void*) ); } \
195 ALIB_API void imPort (VDATA*, Configuration&, const StringEscaper&, const String&) override;\
196 ALIB_API void exPort (VDATA*, Configuration&, const StringEscaper&, AString&) override;\
200#define ALIB_CONFIG_VARIABLE_REGISTER_TYPE(CPPName) \
201 GetConfig().RegisterType<alib::config::detail::VMeta_ ## CPPName>();
237 operator bool()
const {
return Value;}
267namespace alib::config::detail {
270struct VMeta_integer :
public VMeta
274 ALIB_API const std::type_info& dbgTypeID()
override {
return typeid(
integer); }
283struct VMeta_float :
public VMeta
287 ALIB_API const std::type_info& dbgTypeID()
override {
return typeid(double); }
289 ALIB_API void construct(
void* dest, PoolAllocator&)
override {
new (dest)
double(); }
290 ALIB_API void destruct (
void* , PoolAllocator&)
override {}
291 ALIB_API size_t size()
override {
return sizeof(double); }
292 ALIB_API void imPort( VDATA*, Configuration&,
const StringEscaper&,
const String& )
override;
293 ALIB_API void exPort( VDATA*, Configuration&,
const StringEscaper&, AString& )
override;
296struct VMeta_String :
public VMeta
300 ALIB_API const std::type_info& dbgTypeID()
override {
return typeid(
AStringPA); }
302 ALIB_API void construct(
void* dest, PoolAllocator& pool)
override
304 ALIB_API void destruct (
void* dest, PoolAllocator&)
override
307 ALIB_API void imPort( VDATA*, Configuration&,
const StringEscaper&,
const String& )
override;
308 ALIB_API void exPort( VDATA*, Configuration&,
const StringEscaper&, AString& )
override;
#define ALIB_CONFIG_VARIABLE_DEFINE_TYPE_WITH_POOL_CONSTRUCTOR(Namespace, CPPName, CfgTypeString)
#define ALIB_CONFIG_VARIABLE_DEFINE_TYPE(Namespace, CPPName, CfgTypeString)
config::Configuration Configuration
Type alias in namespace alib.
strings::util::TStringVector< character, PoolAllocator > StringVectorPA
Type alias in namespace alib.
config::Declaration Declaration
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
config::Variable Variable
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
strings::TAString< character, PoolAllocator > AStringPA
Type alias in namespace alib.
bool operator=(bool newValue)
bool Value
The boolean value. Defaults to false.
const TReinterpret & As() const
T custom
The custom data that this object stores.