ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
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 688 of file records.hpp.

#include <records.hpp>

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

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 ()
 

Field Details:

◆ EnumElementName

String EnumElementName

The name of the enum element.

Definition at line 691 of file records.hpp.

◆ MinimumRecognitionLength

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.

Constructor(s) / Destructor Details::

◆ ERSerializable() [1/2]

ERSerializable ( )
defaultnoexcept

Defaulted constructor leaving the record undefined.

◆ ERSerializable() [2/2]

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 717 of file records.hpp.

Method Details:

◆ Parse()

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.

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

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