ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
No Matches
XTernalizer Class Reference


This virtual class is used by classes derived from ConfigurationPlugin to convert external string to internal values and vice versa, and for parsing lists of values from an external string.

Class ConfigurationPlugin owns a default object with field defaultStringConverter which by default points to field StringConverter .

Replacing the converters is deemed to be an advanced usage of ALib . Consult the source code for detailed information about how to implement an application specific converter.

This default implementation proceeds as follows:

  • "Externalizing" a value:
    • Value is surrounded by quotes if it starts or ends with spaces or if it includes the delimiter token.
    • A few characters are escaped using '\'. Those are \n, \r, \t , \a, \b, \v, \f, \e and also the double quotation marks \" and the backslash itself (\c \\\\‍). - "Internalizing" a value: - If (non-escaped) quote \c " characters are found, those are removed and whitespaces within such quotes are kept.
    • Escaped characters are converted to their original value.
  • Loading variables from external strings:
    • If provided variable has a valid delimiter set, this character is used to tokenize the external string.
    • Values are trimmed, unless quoted. Quotes characters themselves are removed.
    • Delimiters found within a pair of quotes are ignored.
    • Each value found is internalized separately

Definition at line 64 of file config/plugins.hpp.

#include <plugins.hpp>

Public Method Index:

virtual ~XTernalizer ()
virtual ALIB_API void ExternalizeValue (const String &src, AString &dest, character delim)
virtual ALIB_API void InternalizeValue (const String &src, AString &dest)
virtual ALIB_API void LoadFromString (Variable &variable, const String &src)

Constructor(s) / Destructor Details::

◆ ~XTernalizer()

virtual ~XTernalizer ( )

Virtual destructor

Definition at line 71 of file config/plugins.hpp.

Method Details:

◆ ExternalizeValue()

void ExternalizeValue ( const String & src,
AString & dest,
character delim )

Converts the given src string to an external representation.

srcThe source string
destThe destination string
delimIf this character is found in the string, the value is quoted

Definition at line 76 of file plugins.cpp.

Here is the call graph for this function:

◆ InternalizeValue()

void InternalizeValue ( const String & src,
AString & dest )

Trims src , removes surrounding quotes and , un-escapes characters.

srcThe source string
destThe destination string

Definition at line 32 of file plugins.cpp.

Here is the call graph for this function:

◆ LoadFromString()

void LoadFromString ( Variable & variable,
const String & src )

If field Variable::Delim is '\0', just invokes InternalizeValue. Otherwise, parses values using the delimiter. Quotes are removed and parts within quotes are kept as is. Also, delimiters in quotes are ignored.

variableThe destination variable.
srcThe source string

Definition at line 112 of file plugins.cpp.

Here is the call graph for this function:

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