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