This is a built-in record type that can be used to equip custom enumeration types with ALib Enum Records.
This record has two members, EnumElementName and MinimumRecognitionLength which usually determines an element's name in a human readable format, respectively how many starting characters are to be read to recognize the element when parsed.
Basic versions of such serialization and de-serialization is implemented with this module and documented with chapter 4.3.1 Serialization/Deserialization of the Programmer's Manual of this ALib Module . This functionality is likewise available for enumerations equipped with a custom record type that derives from this type. For this reason, all built-in record types of various ALib Modules derive from this type.
If deserialization is not of importance, a derived type may choose to not parse member MinimumRecognitionLength from a (resourced) string, but initialize it to fixed 0
value. This behavior is for example implemented with record ERException and various types found in module ALib CLI .
Definition at line 688 of file records.hpp.
#include <records.hpp>
Public Field Index: | |
String | EnumElementName |
int | MinimumRecognitionLength |
Public Method Index: | |
ERSerializable () noexcept=default | |
ERSerializable (const String &name, int minLength=0) noexcept | |
ALIB_API void | Parse () |
String EnumElementName |
The name of the enum element.
Definition at line 691 of file records.hpp.
int MinimumRecognitionLength |
Built-in basic de-serialization functions Parse , ParseBitwise and ParseEnumOrTypeBool interpret this value as the minimum length (abbreviation) to accept when an enum element name is parsed. If 0
or negative, the complete EnumElementName is expected.
Definition at line 699 of file records.hpp.
|
defaultnoexcept |
Defaulted constructor leaving the record undefined.
|
inlinenoexcept |
Constructor. This is either called by descendants or by user code that omits the preferred option of parsing resourced strings for the creation of enum records.
Note that parameter name has to be of "static nature", which means the buffer and contents of the string is deemed to survive the life-cycle of an application. With direct invocation, usually, C++ string literals are passed.
name | The name of this element. |
minLength | The minimum length to recognise an element when de-serialized. (Assigned to field MinimumRecognitionLength.) |
Definition at line 717 of file records.hpp.
ALIB_API void Parse | ( | ) |
Parses the fields of this record from the Substring parser given as reference. In case of error an ALib exception is raised, as parsing has to succeed.