Quick Links:

bal | bbl | bdl | bsl

Public Member Functions

bdlde::HexDecoder Class Reference

#include <bdlde_hexdecoder.h>

List of all members.

Public Member Functions

 HexDecoder ()
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 Component bdlde_hexdecoder


Constructor & Destructor Documentation

bdlde::HexDecoder::HexDecoder (  ) 

Create a Hex decoder in the initial state.


Member Function Documentation

template<class OUTPUT_ITERATOR , class INPUT_ITERATOR >
int bdlde::HexDecoder::convert ( OUTPUT_ITERATOR  out,
INPUT_ITERATOR  begin,
INPUT_ITERATOR  end 
)
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 
)

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.

int bdlde::HexDecoder::endConvert (  ) 

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

void bdlde::HexDecoder::reset (  ) 

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

bool bdlde::HexDecoder::isAcceptable (  )  const

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.

bool bdlde::HexDecoder::isDone (  )  const

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.

bool bdlde::HexDecoder::isError (  )  const

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).

bool bdlde::HexDecoder::isInitialState (  )  const

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

bool bdlde::HexDecoder::isMaximal (  )  const

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.

int bdlde::HexDecoder::outputLength (  )  const

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.


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