ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::enumrecords::ERSerializable Struct Reference

Description:

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.

See also
For more information, see:

Definition at line 463 of file records.inl.

Inheritance diagram for alib::enumrecords::ERSerializable:
[legend]
Collaboration diagram for alib::enumrecords::ERSerializable:
[legend]

Public Field Index:

String EnumElementName
 The name of the enum element.
 
int MinimumRecognitionLength
 

Public Method Index:

 ERSerializable () noexcept=default
 Defaulted constructor leaving the record undefined.
 
 ERSerializable (const String &name, int minLength=0) noexcept
 
ALIB_DLL void Parse ()
 

Field Details:

◆ EnumElementName

String alib::enumrecords::ERSerializable::EnumElementName

The name of the enum element.

Definition at line 466 of file records.inl.

◆ MinimumRecognitionLength

int alib::enumrecords::ERSerializable::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 472 of file records.inl.

Constructor(s) / Destructor Details:

◆ ERSerializable()

alib::enumrecords::ERSerializable::ERSerializable ( const String & name,
int minLength = 0 )
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.

Parameters
nameThe name of this element.
minLengthThe minimum length to recognise an element when de-serialized. (Assigned to field MinimumRecognitionLength.)

Definition at line 488 of file records.inl.

Here is the call graph for this function:

Method Details:

◆ Parse()

void alib::enumrecords::ERSerializable::Parse ( )

Parses the fields of this record from the Substring parser given as reference. In case of an error, an ALib exception is raised, as parsing has to succeed.

See also
This is the implementation of a method needed with template programming, as described in EnumRecordPrototype::Parse.

Definition at line 106 of file records.cpp.

Here is the call graph for this function:

The documentation for this struct was generated from the following files: