template class mrpt::config::simpleini::SI_ConvertA

Null conversion class for MBCS/UTF-8 to char (or equivalent).

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

template <class SI_CHAR>
class SI_ConvertA
{
public:
    // construction

    SI_ConvertA();
    SI_ConvertA(const SI_ConvertA& rhs);

    //
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
        );
};

// direct descendants

struct MRPT_IniFileParser;

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,
    SI_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.