This is the reference documentation of sub-namespace enums
of the ALib C++ Library, which holds types of library module ALib Enums.
Extensive documentation for this module is provided with ALib Module Enums - Programmer's Manual.
Nested namespaces | |
arithmetical | |
bitwise | |
detail | |
iterable | |
Classes | |
struct | EnumIterator |
struct | EnumRecordParser |
struct | EnumRecordPrototype |
struct | EnumRecords |
struct | ERSerializable |
struct | T_EnumIsArithmetical |
struct | T_EnumIsBitwise |
struct | T_EnumIsIterable |
struct | T_EnumRecords |
Functions | |
ALIB_API void | Bootstrap () |
template<typename TEnum > | |
const T_EnumRecords< TEnum >::Type & | GetRecord (TEnum element) |
template<typename TEnum , typename TChar , Case TSensitivity = Case::Ignore, Whitespaces TTrimBeforeConsume = Whitespaces::Trim> | |
bool | Parse (strings::TSubstring< TChar > &input, TEnum &result) |
template<typename TEnum , typename TChar , Case TSensitivity = Case::Ignore, Whitespaces TTrimBeforeConsume = Whitespaces::Trim, TChar delimiter = ',', bool keepLastDelim = true> | |
bool | ParseBitwise (strings::TSubstring< TChar > &input, TEnum &result) |
template<typename TEnum , typename TChar , Case TSensitivity = Case::Ignore, Whitespaces TTrimBeforeConsume = Whitespaces::Trim> | |
bool | ParseEnumOrTypeBool (strings::TSubstring< TChar > &input, TEnum &result, TEnum falseValue, TEnum trueValue) |
template<typename TEnum > | |
const T_EnumRecords< TEnum >::Type * | TryRecord (TEnum element) |
template<typename TEnum > | |
constexpr std::underlying_type< TEnum >::type | UnderlyingIntegral (TEnum element) noexcept(true) |
ALIB_API void aworx::lib::enums::Bootstrap | ( | ) |
This method initializes enum records, of built-in types i.e. those of the enumerations found in header file alib/lib/fs_commonenums/commonenums.hpp.
This method needs to be called with bootstrapping a software. The standard bootstrap code of ALib will perform this. Only if fileset Modules is not included in the ALib Distribution, this function has to be invoked "manually".
Multiple invocations of this method are ignored.
This method needs to be called with bootstrapping a software. It mainly registers default and type-specific implementations of the built-in box-functions. In addition, in debug-compilations, static vtables are registered.
The standard bootstrap code of ALib will perform this. Only if fileset Modules is not included in the ALib Distribution, this function has to be invoked "manually".
Multiple invocations of this method are ignored.
Initializes ALib thread logic. Multiple invocations of this method are ignored.
The standard bootstrap code of ALib will invoke this function. Only if fileset Modules is not included in the ALib Distribution, this function has to be invoked "manually".
Initializes ALib time logic. Multiple invocations of this method are ignored.
The standard bootstrap code of ALib will perform this. Only if fileset fileset Modules is not included in the ALib Distribution, this function has to be invoked "manually".
Definition at line 732 of file boxing.cpp.
|
inline |
Returns the enum record for element element of enumeration type TEnum . In debug-compilations an ALib assertion is raised, if no enum record was defined for element.
Internally, references to enum records are stored in a hash map. With that, this method executes in constant time O(1) in the average case.
nullptr
if no record was defined for element.TEnum | The enumeration type. Deduced from given argument. |
element | The enum element to search for. |
|
inline |
Consumes an element value of a C++ enumeration that is equipped with ALib Enum Records of type ERSerializable (or of a derived type) from a given Substring.
In debug builds, the method asserts that at least one record is defined for TEnum.
For more information consult chapter 4.3.1 Serialization/Deserialization of the Programmer's Manual of module ALib Enums.
TEnum | The enumeration type equipped with ALib Enum Recorss of type ERSerializable. |
TChar | The character type of the input substring. Deduced by the compiler. |
TSensitivity | The sensitivity of the comparison. Defaults to Case::Sensitive. |
TTrimBeforeConsume | Determines if the sub string should be (left-) trimmed before the consume operation. If so, in case of parsing failure, trimming is not restored. Defaults to Whitespaces::Trim. |
[in,out] | input | The substring to parse. Passed as reference. On success, the substring will be shortened by the characters consumed. On failure only trimmed characters are consumed. |
[out] | result | The result enum element given as reference. |
true
if an enum element was successfuly recognized, false
otherwise.This method is only available if ALib Strings is included in the ALib Distribution.
|
inline |
Repeatedly invokes sibling function Parse until delim is not found. The enum element values are or'ed in result.
In debug builds, the method asserts that at least one record is defined for TEnum.
TEnum | The enumeration type equipped with ALib Enum Records of (derived) type ERSerializable and furthermore with a specialization of T_EnumIsBitwise. |
TChar | The character type of the input substring. Deduced by the compiler. |
TSensitivity | The sensitivity of the comparison. Defaults to Case::Ignore. |
TTrimBeforeConsume | Determines if the substring should be (left-) trimmed before and after each consume operation. If so, in case of parsing failure, trimming is not restored. Defaults to Whitespaces::Trim. |
delimiter | The delimiter character of the enum elements. Defaults to ',' . |
keepLastDelim | If true , the delimiter will be kept in this sub-string, if after the delimiter no further enum element was found. If false , the delimiter will be kept.Defaults to true . |
[in,out] | input | The substring to parse. Passed as reference. On success, the substring will be shortened by the characters consumed. On failure only trimmed characters are consumed. |
[out] | result | The result enum element given as reference. |
true
if an enum element was successfuly recognized, false
otherwise.This method is only available if ALib Strings is included in the ALib Distribution.
|
inline |
Convenience method that first uses Parse to try and read an element of a C++ enum. If this is not successful, an enum of type Bool is tried to be read. If this is successful, depending on the value read, the TEnum values given as parameters falseValue and trueValue are assigned. Otherwise false is returned.
In debug builds, the method asserts that at least one record is defined for TEnum.
This function is available only if fileset "Common Enums" is included in the ALib Distribution.
TEnum | The enumeration type equipped with ALib Enum Records of (derived) type ERSerializable. |
TChar | The character type of the input substring. Deduced by the compiler. |
TSensitivity | The sensitivity of the comparison. Defaults to Case::Ignore. |
TTrimBeforeConsume | Determines if the substring should be (left-) trimmed before and after each consume operation. If so, in case of parsing failure, trimming is not restored. Defaults to Whitespaces::Trim. |
trueValue | The TEnum value to use in case of Bool::True was read. | |
falseValue | The TEnum value to use in case of Bool::False was read. | |
[in,out] | input | The substring to parse. Passed as reference. On success, the substring will be shortened by the characters consumed. On failure only trimmed characters are consumed. |
[out] | result | The result enum element given as reference. |
true
if an element of TEnum or Bool could be read, false
otherwise.
|
inline |
If defined, returns a pointer to the enum record for element element of enumeration type TEnum . If no enum record was defined, nullptr
is returned.
TEnum | The enumeration type. Deduced from given argument. |
element | The enum element to search for. |
nullptr
if no record was defined.
|
constexprnoexcept |
Simple alias to nested statment static_cast
and type traits std::underlying_type
, which is
aworx::lib::enums
in fact this function resides in namespace aworx.TEnum | Enumeration type. Deduced by the compiler. |
element | The enumeration element. |
true
if all bits of testFor are set in tested.