BloombergLP::bdlde::HexEncoder::convert

Encode input characters to hexadecimal output with limits.

Synopsis

Declared in <bdlde_hexencoder.h>

template<
    class OUTPUT_ITERATOR,
    class INPUT_ITERATOR>
int
convert(
    OUTPUT_ITERATOR out,
    int* numOut,
    int* numIn,
    INPUT_ITERATOR begin,
    INPUT_ITERATOR end,
    int maxNumOut = -1);

Description

Append to the buffer addressed by the specified out any pending character up to the optionally specified maxNumOut limit (default is negative, meaning no limit). When there is no pending output and maxNumOut is still not reached, begin to consume and encode a sequence of input characters starting at the specified begin position, up to but not including the specified end position. Any resulting output is written to the out buffer up to the (cumulative) maxNumOut limit. Load into the (optionally) specified numOut and numIn the number of output bytes produced and input bytes consumed, respectively. Return a non-negative value on success and a negative value otherwise.

Return Value

a non-negative value on success, and a negative value otherwise

Parameters

NameDescription
outdestination iterator for encoded output
numOutnumber of output bytes produced
numInnumber of input bytes consumed
beginbeginning of the input range to encode
endend of the input range (one past the last element)
maxNumOutmaximum output bytes to write; negative means no limit