#include <bdlde_base64decoder.h>
|
| | Base64Decoder (const Base64DecoderOptions &options) |
| |
| | Base64Decoder (bool unrecognizedNonWhitespaceIsErrorFlag, Alphabet alphabet=e_BASIC) |
| |
| | ~Base64Decoder () |
| | 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) |
| |
| template<class OUTPUT_ITERATOR > |
| int | endConvert (OUTPUT_ITERATOR out) |
| |
| template<class OUTPUT_ITERATOR > |
| int | endConvert (OUTPUT_ITERATOR out, int *numOut, int maxNumOut=-1) |
| |
| void | resetState () |
| |
| Alphabet | alphabet () const |
| | Return the alphabet supplied at construction of this object.
|
| |
| IgnoreMode::Enum | ignoreMode () const |
| | Return the ignoreMode state of this decoder.
|
| |
| bool | isAcceptable () const |
| |
| bool | isDone () const |
| |
| bool | isError () const |
| |
| bool | isInitialState () const |
| |
| bool | isMaximal () const |
| |
| bool | isPadded () const |
| |
| bool | isUnrecognizedAnError () const |
| |
| DecoderOptions | options () const |
| |
| int | outputLength () const |
| | Return the total length of the output emitted thus far.
|
| |
| template<> |
| int | convert (char *out, int *numOut, int *numIn, const char *begin, const char *end, int maxNumOut) |
| |
| template<> |
| int | convert (unsigned char *out, int *numOut, int *numIn, const unsigned char *begin, const unsigned char *end, int maxNumOut) |
| |
This class implements a mechanism capable of converting data of arbitrary length from its corresponding Base64 representation.
See bdlde_base64decoder
◆ Alphabet
◆ Base64Decoder() [1/2]
◆ Base64Decoder() [2/2]
| bdlde::Base64Decoder::Base64Decoder |
( |
bool |
unrecognizedNonWhitespaceIsErrorFlag, |
|
|
Alphabet |
alphabet = e_BASIC |
|
) |
| |
|
explicit |
Create a Base64 decoder with options determined by the specfied options. Create a Base64 decoder in the initial state. Unrecognized characters (i.e., non-base64 characters other than whitespace) will be treated as errors if the specified unrecognizedNonWhitespaceIsErrorFlag is true, and ignored otherwise. Optionally specify an alphabet used to decode input characters. If alphabet is not specified, then the basic alphabet, "base64", is used. Padded input is assumed.
- Deprecated:
- Use the overload that takes
options instead.
◆ ~Base64Decoder()
| bdlde::Base64Decoder::~Base64Decoder |
( |
| ) |
|
◆ alphabet()
◆ convert() [1/4]
template<>
| int bdlde::Base64Decoder::convert |
( |
char * |
out, |
|
|
int * |
numOut, |
|
|
int * |
numIn, |
|
|
const char * |
begin, |
|
|
const char * |
end, |
|
|
int |
maxNumOut |
|
) |
| |
|
inline |
◆ convert() [2/4]
template<class OUTPUT_ITERATOR , class INPUT_ITERATOR >
| int bdlde::Base64Decoder::convert |
( |
OUTPUT_ITERATOR |
out, |
|
|
INPUT_ITERATOR |
begin, |
|
|
INPUT_ITERATOR |
end |
|
) |
| |
Decode the sequence of input characters starting at the specified begin position up to, but not including, the specified end position, writing any resulting output characters to the specified out buffer. Optionally specify the maxNumOut limit on the number of bytes to output; if maxNumOut is negative, no limit is imposed. If the 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 a non-negative value on success, -1 on an input error, and -2 if the endConvert method has already been called without an intervening resetState call. A return status of -1 indicates that the data at begin + numIn constitutes an irrecoverably undecodable input sequence (i.e., the data cannot be extended to form any valid encoding). A positive return status indicates the number of valid processed output bytes retained by this decoder and not written to out because maxNumOut has been reached; these bytes are available for output if this method is called with appropriate input. Note that it is recommended that after all calls to convert are finished, the endConvert method be called to complete the encoding of any unprocessed input characters that do not complete a 3-byte sequence.
◆ convert() [3/4]
template<class OUTPUT_ITERATOR , class INPUT_ITERATOR >
| int bdlde::Base64Decoder::convert |
( |
OUTPUT_ITERATOR |
out, |
|
|
int * |
numOut, |
|
|
int * |
numIn, |
|
|
INPUT_ITERATOR |
begin, |
|
|
INPUT_ITERATOR |
end, |
|
|
int |
maxNumOut = -1 |
|
) |
| |
◆ convert() [4/4]
template<>
| int bdlde::Base64Decoder::convert |
( |
unsigned char * |
out, |
|
|
int * |
numOut, |
|
|
int * |
numIn, |
|
|
const unsigned char * |
begin, |
|
|
const unsigned char * |
end, |
|
|
int |
maxNumOut |
|
) |
| |
|
inline |
◆ endConvert() [1/2]
template<class OUTPUT_ITERATOR >
| int bdlde::Base64Decoder::endConvert |
( |
OUTPUT_ITERATOR |
out | ) |
|
Terminate decoding for this decoder; write any retained output (e.g., from a previous call to convert with a non-zero optionally specified maxNumOut argument) to the specified out buffer; encode any unprocessed input characters that do not complete a 3-byte sequence. The argument maxNumOut is the limit on the number of bytes to output; if maxNumOut is negative, no limit is imposed. Load into the (optionally) specified numOut the number of output bytes produced. Return 0 on success, the positive number of bytes still retained by this decoder if the maxNumOut limit was reached, and a negative value otherwise. Any retained bytes are available on a subsequent call to endConvert. Once this method is called, no additional input may be supplied without an intervening call to resetState; once this method returns a zero status, a subsequent call will place this decoder in the error state, and return an error status.
◆ endConvert() [2/2]
template<class OUTPUT_ITERATOR >
| int bdlde::Base64Decoder::endConvert |
( |
OUTPUT_ITERATOR |
out, |
|
|
int * |
numOut, |
|
|
int |
maxNumOut = -1 |
|
) |
| |
◆ ignoreMode()
◆ isAcceptable()
| bool bdlde::Base64Decoder::isAcceptable |
( |
| ) |
const |
|
inline |
Return true if the input read so far is considered syntactically complete, and false otherwise. Note that the number of relevant input characters must be divisible by 4.
◆ isDone()
| bool bdlde::Base64Decoder::isDone |
( |
| ) |
const |
|
inline |
Return true if the current input is acceptable and any additional input (including endConvert) would be an error, and false otherwise. Note that if this decoder isDone then all resulting output has been emitted to out.
◆ isError()
| bool bdlde::Base64Decoder::isError |
( |
| ) |
const |
|
inline |
Return true if there is no possibility of achieving an "acceptable" result, and false otherwise.
◆ isInitialState()
| bool bdlde::Base64Decoder::isInitialState |
( |
| ) |
const |
|
inline |
Return true if this instance is in the initial state (i.e., as if no input had been consumed), and false otherwise.
◆ isMaximal()
| bool bdlde::Base64Decoder::isMaximal |
( |
| ) |
const |
|
inline |
Return true if the current input is acceptable and any additional input (other than endConvert) would be an error, and false otherwise.
◆ isPadded()
| bool bdlde::Base64Decoder::isPadded |
( |
| ) |
const |
|
inline |
Return true if this object is configured for padded input and false otherwise.
◆ isUnrecognizedAnError()
| bool bdlde::Base64Decoder::isUnrecognizedAnError |
( |
| ) |
const |
|
inline |
Return true if this mechanism is currently configured to report an error when an unrecognized character (i.e., a character other than one of the 64 "numeric" base-64 characters, =, or whitespace) is encountered, and false otherwise.
- Deprecated:
- use the
ignoreMode accessor instead.
◆ maxDecodedLength()
| int bdlde::Base64Decoder::maxDecodedLength |
( |
int |
inputLength | ) |
|
|
inlinestatic |
Return the maximum number of decoded bytes that could result from an input byte sequence of the specified inputLength provided to the convert and endConvert methods of this decoder. The behavior is undefined unless 0 <= inputLength. Note that the result is independent of which options are provided to the decoder.
◆ options()
◆ outputLength()
| int bdlde::Base64Decoder::outputLength |
( |
| ) |
const |
|
inline |
◆ resetState()
| void bdlde::Base64Decoder::resetState |
( |
| ) |
|
|
inline |
Reset this instance to its initial state (i.e., as if no input had been consumed).
◆ e_BASIC
| const Alphabet bdlde::Base64Decoder::e_BASIC = Base64Alphabet::e_BASIC |
|
static |
◆ e_URL
| const Alphabet bdlde::Base64Decoder::e_URL = Base64Alphabet::e_URL |
|
static |
The documentation for this class was generated from the following file: