ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Fields | Public Methods | List of all members
ERSerializable Struct Reference

#include <records.hpp>

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

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

Public Fields

String EnumElementName
 
int MinimumRecognitionLength
 

Public Methods

 ERSerializable () noexcept=default
 
 ERSerializable (const String &name, int minLength=0) noexcept
 
ALIB_API void Parse ()
 

Constructor & Destructor Documentation

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

Member Function Documentation

◆ 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.

Member Data Documentation

◆ EnumElementName

String EnumElementName

The name of the enum element.

Definition at line 708 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 716 of file records.hpp.


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