BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlde::HexDecoder Class Reference

#include <bdlde_hexdecoder.h>

Public Member Functions

 HexDecoder ()
 Create a Hex decoder in the initial state.
 
 ~HexDecoder ()=default
 Destroy this object.
 
template<class OUTPUT_ITERATOR , class INPUT_ITERATOR >
int convert (OUTPUT_ITERATOR out, INPUT_ITERATOR begin, INPUT_ITERATOR end)
 
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)
 
int endConvert ()
 
void reset ()
 
bool isAcceptable () const
 
bool isDone () const
 
bool isError () const
 
bool isInitialState () const
 
bool isMaximal () const
 
int outputLength () const
 

Detailed Description

This class implements a mechanism capable of converting data of arbitrary length from its corresponding Hex representation.

See bdlde_hexdecoder

Constructor & Destructor Documentation

◆ HexDecoder()

bdlde::HexDecoder::HexDecoder ( )

◆ ~HexDecoder()

bdlde::HexDecoder::~HexDecoder ( )
default

Member Function Documentation

◆ convert() [1/2]

template<class OUTPUT_ITERATOR , class INPUT_ITERATOR >
int bdlde::HexDecoder::convert ( OUTPUT_ITERATOR  out,
INPUT_ITERATOR  begin,
INPUT_ITERATOR  end 
)

Append to the buffer addressed by the specified out all pending output (if there is any) up to the optionally specified maxNumOut limit (default is negative, meaning no limit). When there is no pending output and the maxNumOut is still not reached, begin to consume and decode 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. If maxNumOut limit is reached, no further input will be consumed. Load into the (optionally) specified numOut and numIn the number of output bytes produced and input bytes consumed, respectively. Return 0 on success and a negative value otherwise. Note that calling this method after endConvert has been invoked without an intervening reset call will place this instance in an error state, and return an error status.

◆ convert() [2/2]

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

◆ endConvert()

int bdlde::HexDecoder::endConvert ( )

Terminate encoding for this decoder. Return 0 on success, and a negative value otherwise.

◆ isAcceptable()

bool bdlde::HexDecoder::isAcceptable ( ) const
inline

Return true if the input read so far by this decoder is considered syntactically complete and all resulting output has been emitted; return false otherwise. Note that there must not be any unprocessed characters accumulated in the input buffer of this decoder.

◆ isDone()

bool bdlde::HexDecoder::isDone ( ) const
inline

Return true if this decoder is in the done state (i.e., endConvert has been called and any additional input will result in an error), and if there is no pending output; return false otherwise.

◆ isError()

bool bdlde::HexDecoder::isError ( ) const
inline

Return true if this decoder has encountered an irrecoverable error and false otherwise. An irrecoverable error is one for which there is no subsequent possibility of achieving an "acceptable" result (as defined by the isAcceptable method).

◆ isInitialState()

bool bdlde::HexDecoder::isInitialState ( ) const
inline

Return true if this decoder is in the initial state (i.e., as if no input had been consumed) and false otherwise.

◆ isMaximal()

bool bdlde::HexDecoder::isMaximal ( ) const
inline

Return true if the input to this decoder is maximal (i.e., the input contains an end-of-input sentinel, signaling that no further input should be expected). Always returns false for Hex decoders since the encoding scheme does not specify an end-of-input sentinel.

◆ outputLength()

int bdlde::HexDecoder::outputLength ( ) const
inline

Return the total length of the output emitted by this decoder (possibly after several calls to the convert or the input methods) since its initial construction or the latest reset.

◆ reset()

void bdlde::HexDecoder::reset ( )
inline

Reset this decoder to its initial state (i.e., as if no input had been consumed).


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