252 std::equal_to<String> ,
273 std::equal_to<String> ,
288 template<
typename TVMeta>
292 types.EmplaceUnique( meta );
322 const String& variableName,
324 const String& pathSubstring );
333 const String& variablePath,
430 template<
typename TVMeta>
491 template<
typename TEnum>
517 Priority priority= Priority::DefaultValues)
528 Priority priority= Priority::DefaultValues )
587 "Event::Creation will never be invoked with this listener-registration-type.")
606 const String& variableName ) {
649 const String& pathPrefix ) {
671 const String& pathSubstring ) {
690{ node.name.storage.Allocate(
static_cast<Configuration&
>(tree).Pool, node.name.key ); }
782 :
Cursor(cursor) { Cursor::Value().declaration=
nullptr;
create( typeName, defaultValue); }
803 :
Cursor(cfg.Root()) {
Declare( name, typeName, defaultValue ); }
820 template<
typename TEnum>
835 template<
typename TEnum>
836 requires std::is_enum_v<TEnum>
890 template<
typename TEnum>
906 template<
typename TEnum>
928 bool IsDeclared()
const {
return Cursor::Value().data !=
nullptr; }
946 {
return Cursor::GoToRoot().GoTo( name ).IsEmpty() &&
IsDeclared(); }
1022 bool Define(
Priority requestedPriority= Priority::Standard );
1070 return Cursor::Value().priority != Priority::NONE;
1138 escaper= &nonEscaper;
1169 template<
typename T> T&
Get() {
1171 "Requesting value from undeclared variable \"{}\"",
this )
1173 "Requesting value from undefined variable \"{}\".\n"
1174 "Use 'var.Define();' to mitigate this error.",
this )
1176 "Wrong variable type requested for variable: \"{}\".\n"
1179 this, &
getMeta()->dbgTypeID(), &
typeid(T) )
1181 return Cursor::Value().data->As<T>();
1188 template<
typename T>
const T&
Get()
const {
1190 "Requested value from unset variable: ", *
this )
1192 "Requesting value from undefined variable. Use 'var.Define();' to mitigate\n"
1193 "this error. Variable: ", *
this )
1195 "Wrong variable type requested for variable: \"{}\".\n"
1198 *
this,
getMeta()->dbgTypeID(),
typeid(T) )
1200 return Cursor::Value().data->As<T>();
1222 float operator= (
float val) {
Get<double>()= double(val);
return val; }
1278template<
typename TEnum>
1312template<
typename TLock>
1344 unsigned bufferGrowthInPercent = 200,
1346 :
Base(initialBufferSizeInKB, bufferGrowthInPercent) {
1373 template<
typename TRequires=
typename Base::LockType>
1374 requires (!std::same_as<TRequires, void>)
1376 #if ALIB_DEBUG_CRITICAL_SECTIONS
1379 else Base::Self().NodeTable().dcs.DCSLock=
nullptr;
1386 template<
typename TRequires=
typename Base::LockType>
1387 requires std::same_as<TRequires, void>
1413#if !ALIB_SINGLE_THREADED || DOXYGEN
1433namespace APPENDABLES {
#define ALIB_ASSERT_WARNING(cond, domain,...)
#define ALIB_ASSERT_ERROR(cond, domain,...)
#define ALIB_BOXING_VTABLE_DECLARE(TMapped, Identifier)
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
virtual bool Get(const String &name, AString &target)=0
StringEscaperStandard stringEscaper
virtual const StringEscaper & GetEscaper() const
virtual ~ConfigurationPlugin()
Virtual Destructor.
ConfigurationPlugin(Priority pPriority)
bool DeletePath(const String &path)
String SubstitutionVariableStart
StringTree< MonoAllocator, detail::Entry, detail::ConfigNodeHandler > base
Alias to the StringTree-parent.
void notifyListeners(int event, const Variable &variable, const String &variablePath, Priority previousPriority)
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.
AString & WriteBooleanToken(bool value, int8_t index, AString &dest)
ConfigurationPlugin * cliPlugin
A default plugin created and inserted with construction.
ListMA< std::pair< Token, Token >, Recycling::None > BooleanTokens
HashTable< MonoAllocator, ValueDescriptorRD, std::hash< String >, std::equal_to< String >, lang::Caching::Disabled, Recycling::None > RDHashTable
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.
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
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.
void MonitorDistinctVariable(lang::ContainerOp insertOrRemove, ConfigurationListener *listener, ConfigurationListener::Event event, const Variable &variable)
ListMA< ListenerRecord > listeners
The list of registered listeners.
~Configuration()
Destructor.
void presetImportString(const String &name, const String &value, const StringEscaper *escaper, Priority priority)
void MonitorPathSubstring(lang::ContainerOp insertOrRemove, ConfigurationListener *listener, ConfigurationListener::Event event, const String &pathSubstring)
Configuration(MonoAllocator &allocator, lang::CreateDefaults createDefaults=lang::CreateDefaults::Yes)
std::pair< bool, int8_t > ParseBooleanToken(const String &src)
StringEscaperStandard Escaper
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)
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.
TSharedConfiguration(size_t initialBufferSizeInKB, unsigned bufferGrowthInPercent=200, lang::CreateDefaults createDefaults=lang::CreateDefaults::Yes)
void DbgCriticalSections(lang::Switch onOff)
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
void create(const String &typeName, const String &defaultValue)
Variable & Declare(TEnum Enum)
const Cursor & AsCursor() const
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)
Variable(Configuration &cfg, TEnum Enum, const Box replacements)
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 & Declare(TEnum Enum, const Box &replacements)
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)
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.
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".
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
strings::TNumberFormat< character > NumberFormat
Type alias in namespace #"%alib".
constexpr String NULL_STRING
A nulled string of the default character type.
strings::TCString< character > CString
Type alias in namespace #"%alib".
variables::Variable Variable
Type alias in namespace #"%alib".
strings::TAString< character, PoolAllocator > AStringPA
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".
strings::util::StringEscaperStandard StringEscaperStandard
Type alias in namespace #"%alib".
containers::List< T, MonoAllocator, TRecycling > ListMA
Type alias in namespace #"%alib".
variables::ConfigurationListener ConfigurationListener
Type alias in namespace #"%alib".
variables::Configuration Configuration
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
boxing::Box Box
Type alias in namespace #"%alib".
strings::util::TStringVector< character, PoolAllocator > StringVectorPA
Type alias in namespace #"%alib".
enumrecords::EnumRecords< TEnum > EnumRecords
Type alias in namespace #"%alib".
strings::util::StringEscaper StringEscaper
Type alias in namespace #"%alib".
variables::TSharedConfiguration< SharedLock > SharedConfiguration
Type alias in namespace #"%alib".
strings::TString< character > String
Type alias in namespace #"%alib".
strings::TSubstring< character > Substring
Type alias in namespace #"%alib".
characters::nchar nchar
Type alias in namespace #"%alib".
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace #"%alib".
characters::character character
Type alias in namespace #"%alib".
variables::Declaration Declaration
Type alias in namespace #"%alib".
boxing::Enum Enum
Type alias in namespace #"%alib".
String EnumElementName
The name of the enum element.
static ForwardIterator begin()
static constexpr ForwardIterator end()
void operator()(TAString< nchar, lang::HeapAllocator > &target, const variables::Variable &variable)
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
strings::TString< character > NameStringType
static void FreeNode(TTree::Node &node, TTree &tree)
static void InitializeNode(TTree::Node &node, TTree &tree)
character CharacterType
The character type that the #"%StringTree" uses for child name and path strings.