This sub-namespace holds entities of the module ALib EnumRecords, which are accessed by including ALib.EnumRecords.Bootstrap.H.
|
| template<typename TEnum> |
| void | Bootstrap (camp::Camp &camp, const NString &name, character innerDelim=',', character outerDelim=',') |
| template<typename TEnum> |
| void | Bootstrap (character innerDelim=',', character outerDelim=',') |
| template<typename TEnum> |
| void | Bootstrap (const String &input, character innerDelim=',', character outerDelim=',') |
| template<typename TEnum> |
| void | Bootstrap (resources::ResourcePool &pool, const NString &category, const NString &name, character innerDelim=',', character outerDelim=',') |
| template<typename TEnum> |
| void | Bootstrap (std::initializer_list< Initializer< TEnum > > definitions) |
| template<typename TEnum, typename... TArgs> |
| void | Bootstrap (TEnum element, TArgs &&... args) noexcept |
◆ Bootstrap() [1/6]
This method can be used if a set of enum records is resourced using an ALib Camp's resource instance.
Invokes Bootstrap, const NString&, const NString&, character, character) accepting a Camp and using its ResourcePool and the inherited field NCString ResourceCategory.
- Note
- This is the preferred overload taken with ALib to load built-in enum records. The only exception is the use of overload Bootstrap, character) for enum record types that require a specialization of ResourcedTraits to perform "recursive" acquisition of other resources defined by fields of the records.
- Availability
- This namespace function is available only if the module ALib Camp is included in the ALib Build.
- See also
- Chapters 4.4.3 Using the Type Trait ResourcedTraits and 4.4.4 Using Resources In ALib Modules for more information.
- Template Parameters
-
| TEnum | The enumeration type to load resourced records for. |
- Parameters
-
| camp | The module to use the resource pool and category name from. |
| name | The resource name of the externalized name. In the case that a resource with that name does not exist, it is tried to load a resource with index number 0 appended to this name, aiming to parse a single record. On success, the index is incremented until no consecutive resource is found. |
| innerDelim | The delimiter used for separating the fields of a record. Defaults to ','. |
| outerDelim | The character delimiting enum records. Defaults to ','. |
Definition at line 265 of file camp.inl.
◆ Bootstrap() [2/6]
template<typename TEnum>
| void alib::enumrecords::bootstrap::Bootstrap |
( |
character | innerDelim = ',', |
|
|
character | outerDelim = ',' ) |
This namespace function is available if the type trait ResourcedTraits is specialized for the enum type TEnum.
Invokes Bootstrap(ResourcePool&, const NString&, const NString&, character, character)
- Availability
- This method is available only if ALib Resources is included in the ALib Build.
- See also
- Chapter 4.4.3 Using the Type Trait ResourcedTraits of the Programmer's Manual of this module.
- Template Parameters
-
| TEnum | The enumeration type to load resourced records for. |
- Parameters
-
| innerDelim | The delimiter used for separating the fields of a record. Defaults to ','. |
| outerDelim | The character delimiting enum records. Defaults to ','. |
Definition at line 724 of file resources.inl.
◆ Bootstrap() [3/6]
template<typename TEnum>
| void alib::enumrecords::bootstrap::Bootstrap |
( |
const String & | input, |
|
|
character | innerDelim = ',', |
|
|
character | outerDelim = ',' ) |
Reads a list of enum data records from given string input.
The contents (buffer) of the given substring have to be of a static nature (by contract). This means that parsing will not create copies of portions of the string but still use them later. Consequently, the given string's buffer has to survive the life-cycle of an application.
This is due to the static nature of ALib Enum Records and their creation during bootstrap, either from C++ string literals or ALib Externalized Resources, which comply to the same contract.
- Availability
- This method is available only if ALib Strings is included in the ALib Build.
- See also
- Chapter 4.4.1 Parsing Enum Records From Strings for a sample of how this method can be invoked.
- Parameters
-
| input | The string used for parsing the enum records to store. |
| innerDelim | The delimiter used for separating the fields of a record. Defaults to ','. |
| outerDelim | The character delimiting enum records. Defaults to ','. |
Definition at line 139 of file recordbootstrap.inl.
◆ Bootstrap() [4/6]
Reads a list of enum data records from an (externalized) resource string.
It is possible to provide the record data in two ways:
- In one resource string: In this case, parameter outerDelim has to specify the delimiter that separates the records.
- In an array of resource strings: If the resource string as given is not defined, this method appends an integral index starting with
0 to the resource name, parses a single record and increments the index. Parsing ends when a resource with a next higher index is not found.
The second option is recommended for larger enum sets. While the separation causes some overhead in a resource backend, the external (!) management (translation, manipulation, etc.) is most probably simplified with this approach.
- Availability
- This namespace function is available only if ALib EnumRecords is included in the ALib Build.
- See also
- Chapter 4.4 Resourced/Externalized Enum Records for a sample of how this method can be invoked.
- Template Parameters
-
| TEnum | The enumeration type to load resourced records for. |
- Parameters
-
| pool | The resource pool to receive the string to parse the records from. |
| category | The resource category of the externalized string. |
| name | The resource name of the externalized name. In the case that a resource with that name does not exist, it is tried to load a resource with index number 0 appended to this name, aiming to parse a single record. On success, the index is incremented until no consecutive resource is found. |
| innerDelim | The delimiter used for separating the fields of a record. Defaults to ','. |
| outerDelim | The character delimiting enum records. Defaults to ','. |
Definition at line 652 of file resources.inl.
◆ Bootstrap() [5/6]
template<typename TEnum>
| void alib::enumrecords::bootstrap::Bootstrap |
( |
std::initializer_list< Initializer< TEnum > > | definitions | ) |
|
Associates elements of TEnum with records, as specified by the given list of definitions.
The use of struct template <typename TEnum> Initializer allows placing the enumeration element together with the construction parameters of the custom record type into one comma-separated argument list, without the need to place extra curly braces around the arguments of the record. (Such would have been necessary if, for example, std::pair had been used).
- Note
- It is preferred to use overloaded versions that parse definitions from static string data. This is more efficient in respect to the footprint of an application, and - if strings are resourced - far more flexible.
- See also
- Chapter 4.1.3 Step 3/3: Initializing The Data for a sample of how this method can be invoked.
- Parameters
-
| definitions | List of static enum records to store. |
Definition at line 95 of file recordbootstrap.inl.
◆ Bootstrap() [6/6]
template<typename TEnum, typename... TArgs>
| void alib::enumrecords::bootstrap::Bootstrap |
( |
TEnum | element, |
|
|
TArgs &&... | args ) |
|
noexcept |
Defines a record for a single element of TEnum.
- Note
- This method is rather provided for completeness, than for actual use, because it is preferred to bootstrap enum records as "bulk" data. Furthermore, it is preferred to use overloaded versions that accept static string data used to parse the data from. This is more efficient in respect to the footprint of an application, and - if strings are resourced - far more flexible.
- See also
- Chapter 4.1.3 Step 3/3: Initializing The Data for a sample of how this method can be invoked.
- Template Parameters
-
| TArgs | Types of the variadic arguments args. |
| TEnum | The enum type to define records for. |
- Parameters
-
| element | The enum element. |
| args | Variadic arguments forwarded to constructor of the custom record to create and store. |
Definition at line 58 of file recordbootstrap.inl.