struct mrpt::config::simpleini::MRPT_IniFileParser

MRPT custom INI file parser to allow minimal file preprocessing:

  • multiline entries via an end-of-line backslash (‘')

#include </home/jlblanco/mrpt/libs/config/src/simpleini/SimpleIni.h>

struct MRPT_IniFileParser: public mrpt::config::simpleini::SI_ConvertA
{
    // structs

    struct ParseContext;

    // construction

    MRPT_IniFileParser();
    MRPT_IniFileParser(const MRPT_IniFileParser& rhs);

    //
methods

    MRPT_IniFileParser& operator = (const MRPT_IniFileParser& rhs);
    virtual size_t SizeFromStore(const char* a_pInputData, size_t a_uInputDataLen);

    virtual bool ConvertFromStore(
        const char* a_pInputData,
        size_t a_uInputDataLen,
        char* a_pOutputData,
        size_t a_uOutputDataSize
        );

    size_t SizeToStore(const char* a_pInputData);
    bool ConvertToStore(const char* a_pInputData, char* a_pOutputData, size_t a_uOutputDataSize);
};

Inherited Members

public:
    //
methods

    SI_ConvertA& operator = (const SI_ConvertA& rhs);
    virtual size_t SizeFromStore(const char* a_pInputData, size_t a_uInputDataLen);

    virtual bool ConvertFromStore(
        const char* a_pInputData,
        size_t a_uInputDataLen,
        SI_CHAR* a_pOutputData,
        size_t a_uOutputDataSize
        );

Methods

virtual size_t SizeFromStore(const char* a_pInputData, size_t a_uInputDataLen)

Calculate the number of SI_CHAR required for converting the input from the storage format.

The storage format is always UTF-8 or MBCS.

Parameters:

a_pInputData

Data in storage format to be converted to SI_CHAR.

a_uInputDataLen

Length of storage format data in bytes. This must be the actual length of the data, including nullptr byte if nullptr terminated string is required.

Returns:

Number of SI_CHAR required by the string when converted. If there are embedded nullptr bytes in the input data, only the string up and not including the nullptr byte will be converted.

-1 cast to size_t on a conversion error.

virtual bool ConvertFromStore(
    const char* a_pInputData,
    size_t a_uInputDataLen,
    char* a_pOutputData,
    size_t a_uOutputDataSize
    )

Convert the input string from the storage format to SI_CHAR.

The storage format is always UTF-8 or MBCS.

Parameters:

a_pInputData

Data in storage format to be converted to SI_CHAR.

a_uInputDataLen

Length of storage format data in bytes. This must be the actual length of the data, including nullptr byte if nullptr terminated string is required.

a_pOutputData

Pointer to the output buffer to received the converted data.

a_uOutputDataSize

Size of the output buffer in SI_CHAR.

Returns:

true if all of the input data was successfully converted.

size_t SizeToStore(const char* a_pInputData)

Calculate the number of char required by the storage format of this data.

The storage format is always UTF-8 or MBCS.

Parameters:

a_pInputData

nullptr terminated string to calculate the number of bytes required to be converted to storage format.

Returns:

Number of bytes required by the string when converted to storage format. This size always includes space for the terminating nullptr character.

-1 cast to size_t on a conversion error.

bool ConvertToStore(
    const char* a_pInputData,
    char* a_pOutputData,
    size_t a_uOutputDataSize
    )

Convert the input string to the storage format of this data.

The storage format is always UTF-8 or MBCS.

Parameters:

a_pInputData

nullptr terminated source string to convert. All of the data will be converted including the terminating nullptr character.

a_pOutputData

Pointer to the buffer to receive the converted string.

a_uOutputDataSize

Size of the output buffer in char.

Returns:

true if all of the input data, including the terminating nullptr character was successfully converted.