ALib C++ Library
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
resources.inl
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header-file is part of module \alib_resources of the \aliblong.
4///
5/// \emoji :copyright: 2013-2025 A-Worx GmbH, Germany.
6/// Published under \ref mainpage_license "Boost Software License".
7//==================================================================================================
8ALIB_EXPORT namespace alib { namespace resources {
9//==================================================================================================
10/// This purely abstract class provides an interface to store and retrieve "resourced" string data
11/// which are organized in a two-level key hierarchy named <em>"resource category"</em>
12/// and <em>"resource name"</em>. The latter are of narrow string-type.
13///
14/// \see
15/// For detailed documentation on when and how this interface is used, please consult the
16/// \ref alib_mod_resources "Programmer's Manual" of this module \alib_resources_nl.
17///
18/// \see
19/// Two built-in implementations of this pure abstract interface are provided with
20/// \alib{resources;LocalResourcePool} and \alib{variables;ConfigResourcePool}.
21/// Please consult their reference documentation for further details.
22//==================================================================================================
24{
25 public:
26
27 /// Virtual destructor.
28 virtual ~ResourcePool() =default;
29
30 /// Used to store a resource string.
31 ///
32 /// In the context of \alibmods, which usually are the only areas where instances of this
33 /// type are available (used), this method must only be invoked during the process of
34 /// \ref alib_mod_bs "bootstrapping" \alib (and corresponding custom modules).
35 ///
36 /// \attention
37 /// The life-cycle of the given string's buffers, have to survive this resource instance.
38 /// Usually the strings passed here are constant C++ string literals, residing in the data
39 /// segment of an executable
40 ///
41 /// \note
42 /// Usually, the method #Bootstrap should be preferred, which asserts in debug-compilations
43 /// if a resource already existed.
44 /// The use of this method is for special cases, for example, to replace (patch) resources
45 /// of dependent modules.
46 ///
47 /// @param category Category string of the resource to add.
48 /// @param name Name string of the resource.
49 /// @param data The resource data.
50 /// @return \c true if the resource did exist and was replaced, \c false if it was an insertion.
51 virtual
52 bool BootstrapAddOrReplace(const NString& category, const NString& name, const String& data) =0;
53
54 /// Simple inline method that invokes virtual method #BootstrapAddOrReplace.
55 /// In debug-compilations, it is asserted that a resource with the given key did not exist
56 /// already.
57 ///
58 /// The use of this method is preferred over a direct invocation of #BootstrapAddOrReplace.
59 ///
60 /// @param category Category string of the resource to add.
61 /// @param name Name string of the resource.
62 /// @param data The resource data.
63 inline
64 void Bootstrap( const NString& category, const NString& name, const String& data ) {
65 #if ALIB_DEBUG
66 bool result=
67 #endif
68 BootstrapAddOrReplace(category, name, data);
69
70 ALIB_ASSERT_ERROR( result, "RESOURCES",
71 "Doubly defined resource \"{}\" in category \"{}\".", category, name )
72 }
73
74 /// Same as #Bootstrap but accepts an array of name/value pairs to be filled into
75 /// the given parameter \p{category}.
76 ///
77 /// \attention
78 /// <b>The given list has to be finished with a final \c nullptr argument for the next
79 /// name!</b>
80 ///
81 /// In the context of \alibmods, which usually are the only areas where instances of this
82 /// type are available (used), this method must only invoked during the process of
83 /// \ref alib_mod_bs "bootstrapping" \alib (and corresponding custom modules).
84 ///
85 /// \attention
86 /// The life-cycle of the given string's buffers, have to survive this resource instance.
87 /// Usually the strings passed here are constant C++ string literals, residing an the data
88 /// segment of an executable
89 ///
90 /// \note
91 /// The use of variadic C-style arguments <c>"..."</c> in general is \b not recommended
92 /// to be used.
93 /// We still do it here, because this method is usually used with implementations
94 /// of \alib{camp;Camp::Bootstrap} to load static default values.
95 /// This approach saves a lot of otherwise needed single invocations (reduces code size) and
96 /// allows a clean code for the init methods.<br>
97 /// For technical reasons, parameter \p{category } is declared as type <c>const nchar*</c>.
98 ///
99 ///
100 /// @param category The category of the resources given.
101 /// @param ... A list of pairs of <b>const nchar*</b> and <b>const character*</b>
102 /// keys and data, including a terminating \c nullptr value.
103 virtual
104 void BootstrapBulk( const nchar* category, ... ) =0;
105
106#if DOXYGEN
107 //==============================================================================================
108 /// Returns a resource.
109 /// On failure (resource not found), a \e nulled string is returned.
110 ///
111 /// \note
112 /// Usually resource pools are associated with \alib{camp;Camp} objects and resources should be
113 /// loaded using its "shortcut methods" \alib{camp::Camp;TryResource}
114 /// and \alib{camp::Camp;GetResource}.
115 /// If used directly, the argument \p{dbgAssert} has to be enclosed in macro \ref ALIB_DBG
116 /// (including the separating comma).
117 ///
118 /// @param category Category string of the resource.
119 /// @param name Name string of the resource
120 /// @param dbgAssert This parameter is available (and to be passed) only in debug mode.
121 /// If \c true, an \ref alib_mod_assert "error is raised" if the resource
122 /// was not found.
123 /// @return The resource string, respectively a \e nulled string on failure.
124 //==============================================================================================
125 virtual
126 const String& Get( const NString& category, const NString& name, bool dbgAssert ) = 0;
127#else
128 virtual
129 const String& Get( const NString& category, const NString& name ALIB_DBG(,bool dbgAssert)) =0;
130#endif
131
132#if DOXYGEN
133 //==============================================================================================
134 /// Convenience inlined method that accepts parameter name as \alib{characters;character}
135 /// instead of \alib{characters;nchar} based string-type. The rationale for this is that often,
136 /// resource name keys are read from other resourced strings and need conversion if used.
137 /// This avoids external conversion before invoking this method.
138 ///
139 /// This method is available only when \alib is compiled with type \alib{characters;character}
140 /// not being equivalent to \alib{characters;nchar}.
141 ///
142 /// After the string conversion, this method simply returns the result of virtual method
143 /// #Get(const NString&, const NString&, bool).
144 ///
145 /// @param category Category string of the resource.
146 /// @param name Name string of the resource
147 /// @param dbgAssert This parameter is available (and to be passed) only in debug mode.
148 /// If \c true, an \ref alib_mod_assert "error is raised" if the resource
149 /// was not found.
150 /// @return The resource string, respectively a \e nulled string on failure.
151 //==============================================================================================
152 const String& Get( const NString& category, const String& name, bool dbgAssert );
153#else
154 #if ALIB_CHARACTERS_WIDE
155 const String& Get( const NString& category, const String& name ALIB_DBG(,bool dbgAssert) )
156 {
157 NString128 nName( name );
158 return Get( category, nName ALIB_DBG(, dbgAssert ) );
159 }
160 #endif
161#endif
162
163 #if ALIB_DEBUG_RESOURCES
164 //==========================================================================================
165 /// Returns a vector of tuples for each resourced element. Each tuple contains:
166 /// 0. The category name
167 /// 1. The resource name
168 /// 2. The resource value
169 /// 3. The number of requests for the resource performed by a using data.
170 ///
171 /// While being useful to generaly inspect the resources, a high number of requests
172 /// might indicate a performance penalty for a using software. Such can usually be
173 /// mitigated in a very simple fashion by "caching" a resource string in a local
174 /// or global/static string variable.
175 ///
176 /// \par Availability
177 /// Available only if the compiler-symbol \ref ALIB_DEBUG_RESOURCES is set.
178 ///
179 /// \attention
180 /// This method is implemented only with the default pool instance of type
181 /// \alib{resources;LocalResourcePool}.
182 /// Other implementations raise an \alib_warning and return an empty vector.
183 ///
184 /// \see
185 /// Methods #DbgGetCategories and #DbgDump.
186 ///
187 /// @return The externalized resource string.
188 //==========================================================================================
190 virtual
191 std::vector<std::tuple<NString, NString, String, integer>> DbgGetList();
192
193 //==========================================================================================
194 /// Implements abstract method \alib{resources;ResourcePool::DbgGetCategories}.
195 ///
196 /// \par Availability
197 /// Available only if the compiler-symbol \ref ALIB_DEBUG_RESOURCES is set.
198 ///
199 /// \attention
200 /// This method is implemented only with the default pool instance of type
201 /// \alib{resources;LocalResourcePool}.
202 /// Other implementations raise an \alib_warning and return an empty vector.
203 ///
204 /// \see
205 /// Methods #DbgGetList and #DbgDump.
206 ///
207 /// @return The externalized resource string.
208 //==========================================================================================
210 virtual
211 std::vector<std::pair<NString, integer>> DbgGetCategories();
212 #endif //ALIB_DEBUG_RESOURCES
213}; // class ResourcePool
214
215//==================================================================================================
216/// Simple the type trait that associates resource information to the given type \p{T} .
217///
218/// Extends <c>std::false_type</c> by default to indicate that it is not specialized for a specific
219/// type. Specializations need to extend <c>std::true_type</c> instead.
220///
221/// \see
222/// - Helper macros \ref ALIB_RESOURCED and ALIB_RESOURCED_IN_MODULE that specialize this struct.
223/// - Helper-type \alib{resources;ResourcedType}.
224/// - Manual chapter \ref alib_resources_t_resourced "3.5. Indirect Resource Access"
225/// of the Programmer's Manual of this module.
226///
227/// @tparam T The type to define resource information for.
228//==================================================================================================
229template<typename T>
230struct ResourcedTraits : std::false_type
231{
232 /// Returns a pointer to the resource pool associated with \p{T}.
233 /// @return The resource pool of \p{T}.
234 static constexpr ResourcePool* Pool() { return nullptr; }
235
236 /// Returns a resource category associated with \p{T}.
237 /// @return The resource category.
238 static constexpr NString Category() { return NULL_NSTRING; }
239
240 /// Returns a resource name associated with \p{T}.
241 /// @return The resource category.
242 static constexpr NString Name() { return NULL_NSTRING; }
243};
244
246
247/// A concept to identify whether resources are associated with type \p{T}.
248/// These are types for which a specialization of type trait \alib{resources;ResourcedTraits}
249/// is defined.
250/// @tparam T The type to be tested.
251template <typename T>
253
255
256//==================================================================================================
257/// Static helper-struct used to access resources of types that dispose of a specialization of
258/// the type trait \alib{resources;ResourcedTraits}.
259///
260/// @see
261/// - Type trait \alib{resources;ResourcedTraits}
262/// - Manual chapter \ref alib_resources_t_resourced_resourced of the
263/// Programmer's Manual of this module.
264///
265/// @tparam T A type equipped with resource information by a specialization of
266/// \alib{resources;ResourcedTraits}.
267//==================================================================================================
268template<typename T>
270{
271 /// Static method that receives a resource string for a type which has a specialization
272 /// of \alib{resources;ResourcedTraits} defined.
273 ///
274 /// @tparam TRequires Not to be specified.
275 /// Used by the compiler to select the availability of this method.
276 /// @return The externalized resource string.
277 template<typename TRequires= T>
279 static const String& Get() {
282 ALIB_DBG(, true) );
283 }
284
285 #if DOXYGEN
286 /// Variant of the parameterless version \alib{resources::ResourcedType;Get();Get} that
287 /// ignores the resource name given for a type with a specialization of
288 /// \alib{resources;ResourcedTraits}, but instead uses the name provided.
289 ///
290 /// @tparam TRequires Not to be specified. Used by the compiler to select the availability
291 /// of this method.
292 /// @param name The resource name to use, given as string of narrow character width.
293 /// @param dbgAssert This parameter is available (and to be passed) only in debug mode.
294 /// If \c true, an \ref alib_mod_assert "error is raised" if the resource
295 /// was not found.
296 /// Use macro ALIB_DBG with calls to this method.
297 /// @return The externalized resource string.
298 template<typename TRequires= T>
300 static const String& Get( const NString& name, bool dbgAssert );
301 #else
302 template<typename TRequires= T>
304 static const String& Get( const NString& name ALIB_DBG(, bool dbgAssert) ) {
306 name
307 ALIB_DBG(, dbgAssert) );
308 }
309 #endif
310
311 #if DOXYGEN
312 /// Variant of method \alib{resources::ResourcedType;Get(const NString&; bool)} that
313 /// accepts a character string of standard character width instead of a narrow type.
314 ///
315 /// \par Availability
316 /// Available only if \ref ALIB_CHARACTERS_WIDE evaluates to \c true.
317 ///
318 /// @tparam TRequires Not to be specified. Used by the compiler to select the availability
319 /// of this method.
320 /// @param resourceName The resource name to use, given as a string of standard character width.
321 /// @param dbgAssert This parameter is available (and to be passed) only in debug mode.
322 /// If \c true, an \ref alib_mod_assert "error is raised" if the resource
323 /// was not found.
324 /// @return The externalized resource string.
325 template<typename TRequires= T>
327 static const String& Get( const String& resourceName, bool dbgAssert );
328 #else
329 #if ALIB_CHARACTERS_WIDE
330 template<typename TRequires= T>
332 static const String& Get( const String& resourceName ALIB_DBG(, bool dbgAssert) ) {
334 resourceName
335 ALIB_DBG(, dbgAssert) );
336 }
337 #endif
338 #endif
339
340 /// Together with sibling method #TypeNamePostfix, this method may be used to receive the
341 /// first portion of a type's human-readable name.
342 ///
343 /// The method tries to standardize resourcing names of C++ types along with the resource string
344 /// that is defined with the type trait \alib{resources;ResourcedTraits} for a type.
345 ///
346 /// The prefix is tried to be retrieved by extending the resource name returned by the method
347 /// \alib{resources;ResourcedTraits::Name} by character <c>'<'</c>.
348 ///
349 /// \alib uses this method internally, for example, with specializations
350 /// \alib{strings::APPENDABLES;AppendableTraits<TEnum,TChar,TAllocator>;AppendableTraits<TEnum,TChar,TAllocator>}
351 /// \alib{strings::APPENDABLES;AppendableTraits<TBitwiseEnum,TChar,TAllocator>;AppendableTraits<TBitwiseEnum,TChar,TAllocator>}
352 /// used to write element names of enum types.
353 ///
354 /// If either \alib{resources;ResourcedTraits} is \e not specialized for \p{TEnum},
355 /// or a resource named \"\p{name}<b>></b>\" is not found, an empty string is returned.<br>
356 ///
357 /// @return The prefix string.
358 static const String& TypeNamePrefix() {
359 if constexpr( HasResources<T> ) {
360 NString256 resourceName( ResourcedTraits<T>::Name() );
361 resourceName << "<";
362 auto& pf= ResourcedTraits<T>::Pool()->Get( ResourcedTraits<T>::Category(), resourceName
363 ALIB_DBG(, false) );
364 if( pf.IsNotNull() )
365 return pf;
366 }
367
368 return EMPTY_STRING;
369 }
370
371 /// Same as #TypeNamePrefix but for the postfix string of a types name.
372 /// Consequently, extends the resource string's name searched by character <c>'>'</c>.
373 ///
374 /// @return The postfix string.
375 static const String& TypeNamePostfix() {
377 if constexpr( HasResources<T> ) {
378 NString256 resourceName( ResourcedTraits<T>::Name() );
379 resourceName << ">";
380 auto& pf= ResourcedTraits<T>::Pool()->Get( ResourcedTraits<T>::Category(), resourceName
381 ALIB_DBG(, false) );
382 if( pf.IsNotNull() )
383 return pf;
384 }
386
387 return EMPTY_STRING;
388 }
389
390}; // struct ResourcedType
391
392/// Utility type that may be used to store resourcing information.
393///
394/// Besides constructor #ResourceInfo(ResourcePool*, NString, NString) and corresponding #Set method,
395/// templated alternatives exist, which are applicable if \alib{resources;ResourcedTraits}
396/// is specialized for the template type.
398{
399 /// The resource pool.
401
402 /// The resource category within #Pool.
404
405 /// The resource category within #Pool.
407
408 /// Defaulted constructor leaving the fields uninitialized.
409 ResourceInfo() noexcept =default;
410
411 /// Constructor setting the fields of this object as given.
412 ///
413 /// @param pool The resource pool.
414 /// @param category The resource category.
415 /// @param name The resource name.
416 template<typename T>
418 : Pool (pool )
419 , Category(category)
420 , Name (name ) {}
421
422 /// Templated constructor which sets the fields of this object according to the values provided
423 /// with a specialization of \alib{resources;ResourcedTraits} for type \p{T}.
424 ///
425 /// @tparam T Type that disposes of a specialization of \b ResourcedTraits.
426 /// Deduced by the compiler
427 /// @param sample A sample instance of type \p{T}. Exclusively used to have the compiler
428 /// deduce type \p{T} (otherwise ignored).
429 template<typename T>
430 ResourceInfo(const T& sample) { Set( sample ); }
431
432 /// Sets the fields of this object as given.
433 ///
434 /// @param pool The resource pool.
435 /// @param category The resource category.
436 /// @param name The resource name.
437 void Set( resources::ResourcePool* pool, NString category, NString name ) {
438 Pool = pool;
439 Category = category;
440 Name = name;
441 }
442
443 /// Sets the fields of this object according to the values provided with a specialization of
444 /// \alib{resources;ResourcedTraits} for type \p{T}.
445 ///
446 /// @tparam T Type that disposes of a specialization of \b ResourcedTraits.
447 /// Deduced by the compiler
448 /// @param sample A sample instance of type \p{T}. Exclusively used to have the compiler
449 /// deduce type \p{T} (otherwise ignored).
450 template<typename T>
452 void Set(const T& sample) {
453 (void) sample;
457 }
458
459 /// Receives the resource string according to this info object.
460 /// @return The externalized resource string.
461 const String& Get() { return Pool->Get( Category, Name ALIB_DBG(, true) ); }
462
463
464 #if DOXYGEN
465 /// Variant of parameterless version #Get() that ignores field #Name and instead uses given
466 /// argument \p{name} .
467 ///
468 /// @param name The resource name to use, given as string of narrow character width.
469 /// @param dbgAssert This parameter is available (and to be passed) only in debug mode.
470 /// If \c true, an \ref alib_mod_assert "error is raised" if the resource
471 /// was not found.
472 /// @return The externalized resource string.
473 inline
474 const String& Get( const NString& name, bool dbgAssert );
475 #else
476 const String& Get( const NString& name ALIB_DBG(, bool dbgAssert) )
477 { return Pool->Get( Category, name ALIB_DBG(, dbgAssert) ); }
478 #endif
479
480
481 #if DOXYGEN
482 /// Variant of mehtod Get(const NString&, bool) that accepts a character string of standard
483 /// character width instead of a narrow type.
484 ///
485 /// \par Availability
486 /// Available only if \ref ALIB_CHARACTERS_WIDE evaluates to \c true.
487 ///
488 /// @param name The resource name to use, given as string of standard character width.
489 /// @param dbgAssert This parameter is available (and to be passed) only in debug mode.
490 /// If \c true, an \ref alib_mod_assert "error is raised" if the
491 /// resource was not found.
492 /// @return The externalized resource string.
493 inline
494 const String& Get( const String& name, bool dbgAssert );
495 #else
496 #if ALIB_CHARACTERS_WIDE
497 const String& Get( const String& name ALIB_DBG(, bool dbgAssert) )
498 { return Pool->Get( Category, name ALIB_DBG(, dbgAssert) ); }
499 #endif
500 #endif
501}; // ResourceInfo
502
503
504} // namespace alib[::resources]
505
506/// Type alias in namespace \b alib.
508
509/// Type alias in namespace \b alib.
510template<typename T>
512
513/// Type alias in namespace \b alib.
515
516} // namespace [alib]
517
518
519#if ALIB_ENUMRECORDS
520//==================================================================================================
521//==== enumrecords::Bootstrap() functions
522//==================================================================================================
525
526/// Reads a list of enum data records from an (externalized) resource string.
527///
528/// It is possible to provide the record data in two ways:
529/// - In one resource string: In this case, parameter \p{outerDelim} has to specify
530/// the delimiter that separates the records.
531/// - In an array of resource strings: If the resource string as given is not defined, this
532/// method appends an integral index starting with \c 0 to the resource name, parses
533/// a single record and increments the index.
534/// Parsing ends when a resource with a next higher index is not found.
535///
536/// The second option is recommended for larger enum sets. While the separation causes
537/// some overhead in a resource backend, the external (!) management (translation,
538/// manipulation, etc.) is most probably simplified with this approach.
539///
540/// \par Availability
541/// This namespace function is available only if \alib_enumrecords is included in the \alibbuild.
542///
543/// \see Chapter \ref alib_enums_records_resourced for a sample of how this method
544/// can be invoked.
545///
546/// @tparam TEnum The enumeration type to load resourced records for.
547/// @param pool The resource pool to receive the string to parse the records from.
548/// @param category The resource category of the externalized string.
549/// @param name The resource name of the externalized name. In the case that a
550/// resource with that name does not exist, it is tried to load
551/// a resource with index number \c 0 appended to this name, aiming to
552/// parse a single record. On success, the index is incremented until
553/// no consecutive resource is found.
554/// @param innerDelim The delimiter used for separating the fields of a record.
555/// Defaults to <c>','</c>.
556/// @param outerDelim The character delimiting enum records.
557/// Defaults to <c>','</c>.
558template<typename TEnum>
561 const NString& category,
562 const NString& name,
563 character innerDelim= ',',
564 character outerDelim= ',' ) {
565 // resources given in the standard, non-indexed way?
566 String input= pool.Get( category, name ALIB_DBG(, false) );
567 if( input.IsNotNull() ) {
568 // Note:
569 // The parser is initialized here already. The "inner" call to Bootstrap() will not have
570 // the resource information otherwise.
571 // Double initialization is checked inside the parser's initialize method.
572 // (A little crude but OK!)
573 EnumRecordParser::Initialize(input, innerDelim, outerDelim, category, name );
574 Bootstrap<TEnum>( input, innerDelim, outerDelim );
575 return;
576 }
577
578 // resources given as name0, name1, name2...
579 NString64 nameNr( name);
580 int nr= 0;
582 auto** lastP = records.getPointerToLast();
583 while( (input= pool.Get( category, nameNr.Reset( name)._(nr) ALIB_DBG(, false))).IsNotNull()
584 || nr== 0 )
585 {
586 EnumRecordParser::Initialize(input, innerDelim, outerDelim, category, nameNr );
587
588 auto* element= (*lastP= monomem::GLOBAL_ALLOCATOR().New<typename detail::EnumRecordHook<TEnum>::Node>());
589
590 EnumRecordParser::Get( element->integral );
591 element->record.Parse();
592
593 detail::setEnumRecord( typeid(TEnum), integer(element->integral), &element->record );
594
596 // next
597 lastP= &element->next;
598 ++nr;
599 }
600 (*lastP)= nullptr;
601
602 // check if there are more coming (a gap in numbered definition)
603 #if ALIB_DEBUG
604 for( int i= 0 ; i < 35 ; ++i ) {
605 ++nr;
606 if( pool.Get( category, nameNr.Reset( name)._( nr) ALIB_DBG(, false)).IsNotNull() ) {
607 ALIB_ERROR( "ENUMS",
608 "Detected a \"gap\" in numbering of enum records for type <{}>: "
609 "From index {} to {}.\n Resource: {}/{}",
610 &typeid(TEnum), nr - i - 1, nr - 1, category, name )
611 } }
612 #endif
613}
614
615/// This namespace function is available if the type trait \alib{resources;ResourcedTraits}
616/// is specialized for the enum type \p{TEnum}.<br>
617/// Invokes #Bootstrap(ResourcePool&, const NString&, const NString&, character, character)
618///
619/// \par Availability
620/// This method is available only if \alib_resources is included in the \alibbuild.
621///
622/// \see Chapter \ref alib_enums_records_resourced_tresourced of the Programmer's Manual
623/// of this module.
624///
625/// @tparam TEnum The enumeration type to load resourced records for.
626/// @param innerDelim The delimiter used for separating the fields of a record.
627/// Defaults to <c>','</c>.
628/// @param outerDelim The character delimiting enum records.
629/// Defaults to <c>','</c>.
630template<typename TEnum>
632void Bootstrap( character innerDelim=',', character outerDelim= ',' ) {
633 static_assert( resources::HasResources<TEnum>,
634 "No specialization for ResourcedTraits<TEnum> given. Method not applicable." );
635
639 innerDelim, outerDelim );
640}
641#include "ALib.Lang.CIMethods.H"
642} // namespace [alib::enumrecords::bootstrap]
643#endif // ALIB_ENUMRECORDS
virtual bool BootstrapAddOrReplace(const NString &category, const NString &name, const String &data)=0
virtual ALIB_DLL std::vector< std::pair< NString, integer > > DbgGetCategories()
void Bootstrap(const NString &category, const NString &name, const String &data)
Definition resources.inl:64
const String & Get(const NString &category, const String &name, bool dbgAssert)
virtual ~ResourcePool()=default
Virtual destructor.
virtual const String & Get(const NString &category, const NString &name, bool dbgAssert)=0
virtual void BootstrapBulk(const nchar *category,...)=0
virtual ALIB_DLL std::vector< std::tuple< NString, NString, String, integer > > DbgGetList()
TAString & _(const TAppendable &src)
constexpr bool IsNotNull() const
Definition string.inl:355
#define ALIB_DLL
Definition alib.inl:503
#define ALIB_WARNINGS_RESTORE
Definition alib.inl:719
#define ALIB_ERROR(domain,...)
Definition alib.inl:1062
#define ALIB_WARNINGS_IGNORE_DOCS
Definition alib.inl:702
#define ALIB_WARNINGS_ALLOW_NULL_POINTER_PASSING
Definition alib.inl:619
#define ALIB_EXPORT
Definition alib.inl:497
#define ALIB_DBG(...)
Definition alib.inl:853
#define ALIB_ASSERT_ERROR(cond, domain,...)
Definition alib.inl:1066
void Bootstrap(camp::Camp &camp, const NString &name, character innerDelim=',', character outerDelim=',')
Definition camp.inl:324
void setEnumRecord(const std::type_info &rtti, integer elementValue, const void *record)
Definition records.cpp:62
ALIB_DLL TMonoAllocator< lang::HeapAllocator > GLOBAL_ALLOCATOR
NLocalString< 128 > NString128
Type alias name for TLocalString<nchar,128>.
constexpr NString NULL_NSTRING
A nulled string of the narrow character type.
Definition string.inl:2280
NLocalString< 64 > NString64
Type alias name for TLocalString<nchar,64>.
constexpr const String EMPTY_STRING
An empty string of the default character type.
Definition string.inl:2251
lang::integer integer
Type alias in namespace alib.
Definition integers.inl:149
strings::TString< nchar > NString
Type alias in namespace alib.
Definition string.inl:2198
resources::ResourcePool ResourcePool
Type alias in namespace alib.
characters::nchar nchar
Type alias in namespace alib.
resources::ResourceInfo ResourceInfo
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
Definition string.inl:2189
NLocalString< 256 > NString256
Type alias name for TLocalString<nchar,256>.
resources::ResourcedType< T > ResourcedType
Type alias in namespace alib.
characters::character character
Type alias in namespace alib.
static ALIB_DLL void Get(String &result, bool isLastField=false)
static ALIB_DLL void Initialize(const String &input, character innerDelim, character outerDelim, const NString &resourceCategory, const NString &resourceName)
A node of the forward list that contains the custom record data.
Definition records.inl:110
ResourceInfo(const T &sample)
NString Category
The resource category within Pool.
void Set(const T &sample)
ResourcePool * Pool
The resource pool.
ResourceInfo() noexcept=default
Defaulted constructor leaving the fields uninitialized.
NString Name
The resource category within Pool.
const String & Get(const String &name, bool dbgAssert)
void Set(resources::ResourcePool *pool, NString category, NString name)
const String & Get(const NString &name, bool dbgAssert)
static constexpr NString Category()
static constexpr NString Name()
static constexpr ResourcePool * Pool()
static const String & Get()
static const String & Get(const String &resourceName, bool dbgAssert)
static const String & TypeNamePostfix()
static const String & Get(const NString &name, bool dbgAssert)
static const String & TypeNamePrefix()