260 std::equal_to<String> ,
282 std::equal_to<String> ,
297 template<
typename TVMeta>
301 types.EmplaceUnique( meta );
329 const String& variableName,
331 const String& pathSubstring );
340 const String& variablePath,
437 template<
typename TVMeta>
497 template<
typename TEnum>
523 Priority priority= Priority::DefaultValues)
535 Priority priority= Priority::DefaultValues )
597 "Event::Creation will never be invoked with this listener-registration-type.")
616 const String& variableName )
661 const String& pathPrefix )
684 const String& pathSubstring )
705 node.name.storage.Allocate(
static_cast<Configuration&
>(tree).Pool, node.name.key );
800 :
Cursor(cursor) { Cursor::Value().declaration=
nullptr;
create( typeName, defaultValue); }
839 template<
typename TEnum>
854 template<
typename TEnum>
855 requires std::is_enum_v<TEnum>
908 template<
typename TEnum>
923 template<
typename TEnum>
945 bool IsDeclared()
const {
return Cursor::Value().data !=
nullptr; }
963 {
return Cursor::GoToRoot().GoTo( name ).IsEmpty() &&
IsDeclared(); }
1040 bool Define(
Priority requestedPriority= Priority::Standard );
1088 return Cursor::Value().priority != Priority::NONE;
1139 escaper= &nonEscaper;
1173 "Requesting value from undeclared variable \"{}\"",
this )
1175 "Requesting value from undefined variable \"{}\".\n"
1176 "Use 'var.Define();' to mitigate this error.",
this )
1178 "Wrong variable type requested for variable: \"{}\".\n"
1181 this, &
getMeta()->dbgTypeID(), &
typeid(T) )
1183 return Cursor::Value().data->As<T>();
1190 template<
typename T>
const T&
Get()
const
1193 "Requested value from unset variable: ", *
this )
1195 "Requesting value from undefined variable. Use 'var.Define();' to mitigate\n"
1196 "this error. Variable: ", *
this )
1198 "Wrong variable type requested for variable: \"{}\".\n"
1201 *
this,
getMeta()->dbgTypeID(),
typeid(T) )
1203 return Cursor::Value().data->As<T>();
1225 float operator= (
float val) {
Get<double>()= double(val);
return val; }
1286template<
typename TEnum>
1322template<
typename TLock>
1355 unsigned int bufferGrowthInPercent = 200,
1357 :
Base(initialBufferSizeInKB, bufferGrowthInPercent)
1385 template<
typename TRequires=
typename Base::LockType>
1386 requires (!std::same_as<TRequires, void>)
1389 #if ALIB_DEBUG_CRITICAL_SECTIONS
1393 else Base::Self().NodeTable().dcs.DCSLock=
nullptr;
1400 template<
typename TRequires=
typename Base::LockType>
1401 requires std::same_as<TRequires, void>
1428#if !ALIB_SINGLE_THREADED || DOXYGEN
1448namespace APPENDABLES {
TCursor< true > ConstCursor
AllocatorType & GetAllocator() noexcept
StringTree(AllocatorType &allocator, CharacterType pathSeparator)
Plugin(PrioritiesType pPriority)
bool IsNulled() const noexcept
void ConstructT(TArgs &&... args)
TLock & GetLock() const noexcept
void Reset(TArgs &&... args)
AllocatorType & GetAllocator() noexcept
integer IndexOf(TChar needle, integer startIdx=0) const
constexpr bool IsNotEmpty() const
virtual String Name() const =0
StringEscaperStandard stringEscaper
virtual const StringEscaper & GetEscaper() const
virtual ~ConfigurationPlugin()
Virtual Destructor.
ConfigurationPlugin(Priority pPriority)
virtual ALIB_DLL bool Get(const String &name, AString &target)=0
HashTable< MonoAllocator, ValueDescriptorTypes, std::hash< String >, std::equal_to< String >, lang::Caching::Enabled, Recycling::None > TypesHashTable
A hashtable for the registered types. Key is the type name, value is the VMeta singleton.
ALIB_DLL bool DeletePath(const String &path)
String SubstitutionVariableStart
StringTree< MonoAllocator, detail::Entry, detail::ConfigNodeHandler > base
Alias to the StringTree-parent.
ALIB_DLL void notifyListeners(int event, const Variable &variable, const String &variablePath, Priority previousPriority)
ALIB_DLL AString & WriteBooleanToken(bool value, int8_t index, AString &dest)
ConfigurationPlugin * cliPlugin
A default plugin created and inserted with construction.
void PresetImportString(const String &name, const String &value, StringEscaper *escaper, Priority priority=Priority::DefaultValues)
CString SubstitutionVariableDelimiters
TypesHashTable types
A hashtable for the registered types. Key is the type name, value is the VMeta singleton.
ALIB_DLL const Declaration * StoreDeclaration(const Declaration *orig, const Box &replacements)
void MonitorPath(lang::ContainerOp insertOrRemove, ConfigurationListener *listener, ConfigurationListener::Event event, const Configuration::Cursor &cursor)
alib::NumberFormat NumberFormat
void MonitorPathPrefix(lang::ContainerOp insertOrRemove, ConfigurationListener *listener, ConfigurationListener::Event event, const String &pathPrefix)
RDHashTable replacementDeclarations
ALIB_DLL int MonitorStop(ConfigurationListener *listener)
void PresetImportString(const String &name, const String &value, Priority priority=Priority::DefaultValues)
void MonitorVariablesByName(lang::ContainerOp insertOrRemove, ConfigurationListener *listener, ConfigurationListener::Event event, const String &variableName)
String SubstitutionVariableEnd
ConfigurationPlugin * environmentPlugin
A default plugin created and inserted with construction.
friend class Variable
Type alias in namespace alib.
void MonitorDistinctVariable(lang::ContainerOp insertOrRemove, ConfigurationListener *listener, ConfigurationListener::Event event, const Variable &variable)
ALIB_DLL ~Configuration()
Destructor.
ALIB_DLL void presetImportString(const String &name, const String &value, const StringEscaper *escaper, Priority priority)
List< MonoAllocator, ListenerRecord > listeners
The list of registered listeners.
void MonitorPathSubstring(lang::ContainerOp insertOrRemove, ConfigurationListener *listener, ConfigurationListener::Event event, const String &pathSubstring)
ALIB_DLL Configuration(MonoAllocator &allocator, lang::CreateDefaults createDefaults=lang::CreateDefaults::Yes)
List< MonoAllocator, std::pair< Token, Token >, Recycling::None > BooleanTokens
ALIB_DLL std::pair< bool, int8_t > ParseBooleanToken(const String &src)
StringEscaperStandard Escaper
ALIB_DLL void registerListener(ConfigurationListener *listener, lang::ContainerOp insertOrRemove, int event, const Variable *variable, const StringTree::Cursor *subTree, const String &variableName, const String &pathPrefix, const String &pathSubstring)
HashTable< MonoAllocator, ValueDescriptorRD, std::hash< String >, std::equal_to< String >, lang::Caching::Disabled, Recycling::None > RDHashTable
static const Declaration * Get(TEnum element)
const String & Name() const
monomem::TSharedMonoVal< Configuration, HeapAllocator, TLock > Base
Exposed shortcut to the base type.
TSharedConfiguration(std::nullptr_t) noexcept
TSharedConfiguration & operator=(const TSharedConfiguration &)=default
TSharedConfiguration(const TSharedConfiguration &)=default
Defaulted copy-constructor.
void Reset(lang::CreateDefaults createDefaults=lang::CreateDefaults::Yes)
TSharedConfiguration()=default
Constructs an empty instance, hence a cleared automatic pointer.
void DbgCriticalSections(lang::Switch onOff)
TSharedConfiguration(size_t initialBufferSizeInKB, unsigned int bufferGrowthInPercent=200, lang::CreateDefaults createDefaults=lang::CreateDefaults::Yes)
ALIB_DLL bool Define(Priority requestedPriority=Priority::Standard)
bool GetOrSetDefault(bool value, Priority priority=Priority::DefaultValues)
Variable(Configuration &cfg, const Declaration *decl)
AString & Export(AString &dest, const StringEscaper *escaper=nullptr) const
bool IsNotDefined() const
AString & Name(AString &target) const
Variable & Declare(TEnum Enum, const Box &replacements)
void create(const String &typeName, const String &defaultValue)
const Cursor & AsCursor() const
Variable(Configuration &cfg, TEnum Enum, const Box replacements)
String & GetString(int idx)
Priority GetPriority() const
String & GetOrSetDefault(const String &value, Priority priority=Priority::DefaultValues)
bool Try(const String &name)
Variable(Configuration &cfg, const String &name, const String &typeName, const String &defaultValue=NULL_STRING)
ALIB_DLL Variable & Declare(const String &name, const String &typeName, const String &defaultValue=NULL_STRING)
Variable(const Cursor &cursor)
const Declaration * GetDeclaration() const
Configuration::Cursor Cursor
Variable(Configuration &cfg, TEnum Enum)
Variable(Configuration &cfg)
Variable(const Cursor &cursor, const String &typeName, const String &defaultValue=NULL_STRING)
StringVectorPA & GetStrings()
Configuration & GetConfiguration() const
bool GetOrSetDefault(integer value, Priority priority=Priority::DefaultValues)
const String & substitute(const String &importString, AString &buf, const StringEscaper *escaper)
Variable & Declare(TEnum Enum)
bool IsDefinedExternally() const
Entry(Entry &&)=delete
Deleted move-constructor.
VMeta * meta
The virtual handler instance for this variable.
const Declaration * declaration
Entry()
Defaulted default constructor.
VDATA * data
The list hook of values.
Priority priority
The priority level of this data element.
Entry(const Entry &)=delete
Deleted copy-constructor.
#define ALIB_ASSERT_WARNING(cond, domain,...)
#define ALIB_BOXING_VTABLE_DECLARE(TMapped, Identifier)
#define ALIB_ASSERT_ERROR(cond, domain,...)
ContainerOp
Denotes standard container operations.
Switch
Denotes if sth. is switched on or off.
@ On
Switch it on, switched on, etc.
@ Off
Switch it off, switched off, etc.
@ Keep
Chooses not no clear existing data.
CreateDefaults
Denotes whether default entities should be created or not.
@ Yes
Create default values.
@ Enabled
Caching is enabled.
@ Disabled
Caching is disabled.
containers::detail::StringTreeBase< MonoAllocator, Entry, ConfigNodeHandler, Recycling::Private > TTree
A shortcut to the base class of the base class of class Configuration.
strings::util::StringEscaper StringEscaper
Type alias in namespace alib.
variables::Declaration Declaration
Type alias in namespace alib.
constexpr String NULL_STRING
A nulled string of the default character type.
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
variables::Variable Variable
Type alias in namespace alib.
containers::HashTable< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling > HashTable
Type alias in namespace alib. See type definition alib::containers::HashSet.
variables::ConfigurationListener ConfigurationListener
Type alias in namespace alib.
variables::Configuration Configuration
Type alias in namespace alib.
strings::TCString< character > CString
Type alias in namespace alib.
characters::wchar wchar
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
monomem::TPoolAllocator< MonoAllocator > PoolAllocator
strings::TNumberFormat< character > NumberFormat
Type alias in namespace alib.
strings::util::TStringVector< character, PoolAllocator > StringVectorPA
Type alias in namespace alib.
variables::TSharedConfiguration< SharedLock > SharedConfiguration
Type alias in namespace alib.
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
enumrecords::EnumRecords< TEnum > EnumRecords
Type alias in namespace alib.
characters::nchar nchar
Type alias in namespace alib.
boxing::Enum Enum
Type alias in namespace alib.
boxing::Box Box
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
strings::util::StringEscaperStandard StringEscaperStandard
Type alias in namespace alib.
strings::TAString< character, PoolAllocator > AStringPA
Type alias in namespace alib.
characters::character character
Type alias in namespace alib.
strings::TSubstring< character > Substring
Type alias in namespace alib.
containers::List< TAllocator, T, TRecycling > List
Type alias in namespace alib.
String EnumElementName
The name of the enum element.
static ForwardIterator begin()
static constexpr ForwardIterator end()
ALIB_DLL void operator()(TAString< nchar, lang::HeapAllocator > &target, const variables::Variable &variable)
ALIB_DLL void operator()(TAString< wchar, lang::HeapAllocator > &target, const variables::Variable &variable)
virtual ~ConfigurationListener()
Virtual destructor.
virtual void Notify(const Variable &variable, Event event, Priority previousPriority)=0
Event
The type of change that imposes the notification of a listener.
@ Definition
A variable was defined or re-defined with the same or a higher priority.
@ Creation
A variable was declared for the first time.
Record used to manage registered listeners.
ConstCursorHandle subTree
If given, the subtree of variables to listen to.
ConfigurationListener * listener
The listener to register or dispose.
AStringPA variableName
If given, the variable's name to listen to.
int event
The event to listen to.
AStringPA pathPrefix
If given, the start string of the file path to monitor.
ConstCursorHandle variable
If given, the variable to listen to.
Helper-struct used for implementing field replacementDeclarations.
const String & Key(const Declaration *src) const
Helper-struct used for implementing field types.
const String Key(const VMeta *src) const
static void InitializeNode(TTree &tree, TTree::Node &node)
static ALIB_DLL void FreeNode(TTree &tree, TTree::Node &node)
character CharacterType
The character type that the StringTree uses for child name and path strings.
strings::TString< character > NameStringType