#include <bdlde_base64encoder.h>
This class implements a mechanism capable of converting data of arbitrary length to its corresponding Base64 representation.
See bdlde_base64encoder
|
| | BSLS_DEPRECATE_FEATURE ("bdl", "encodedLength", "use overload with 'options'") static int encodedLength(int inputLength) |
| |
| | BSLS_DEPRECATE_FEATURE ("bdl", "encodedLength", "use overload with 'options'") static int encodedLength(int inputLength |
| |
| | BSLS_DEPRECATE_FEATURE ("bdl", "encodedLines", "use overload with 'options'") static int encodedLines(int inputLength) |
| |
| | BSLS_DEPRECATE_FEATURE ("bdl", "encodedLines", "use overload with 'options'") static int encodedLines(int inputLength |
| |
| | Base64Encoder (const EncoderOptions &options=EncoderOptions::mime()) |
| |
| | BSLS_DEPRECATE_FEATURE ("bdl", "Base64Encoder", "use overload with 'options'") explicit Base64Encoder(Alphabet alphabet) |
| |
| | BSLS_DEPRECATE_FEATURE ("bdl", "Base64Encoder", "use overload with 'options'") explicit Base64Encoder(int maxLineLength |
| |
| | ~Base64Encoder () |
| |
| 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 |
| |
| bool | isAcceptable () const |
| |
| bool | isDone () const |
| |
| bool | isError () const |
| |
| bool | isInitialState () const |
| |
| bool | isPadded () const |
| |
| int | maxLineLength () const |
| |
| EncoderOptions | options () const |
| |
| int | outputLength () const |
| |
◆ Alphabet
◆ Base64Encoder()
Create a Base64 encoder in the initial state, defaulting the state of the maximum allowable line-length, the padding, and the alphabet according to the values of the specified options.
◆ ~Base64Encoder()
| bdlde::Base64Encoder::~Base64Encoder |
( |
| ) |
|
◆ alphabet()
| Alphabet bdlde::Base64Encoder::alphabet |
( |
| ) |
const |
Return the alphabet supplied at construction of this object.
◆ BSLS_DEPRECATE_FEATURE() [1/6]
| bdlde::Base64Encoder::BSLS_DEPRECATE_FEATURE |
( |
"bdl" |
, |
|
|
"Base64Encoder" |
, |
|
|
"use overload with 'options'" |
|
|
) |
| |
Create a Base64 encoder in the initial state, with the 'isPadded' option set, a 'maxLineLength' of 76, and the specified 'alphabet'.
- Deprecated:
- Create and pass an
options object instead, equivalent to
true));
static Base64EncoderOptions custom(int maxLineLength, Base64Alphabet::Enum alphabet, bool padded)
Definition bdlde_base64encoderoptions.h:485
@ k_MIME_MAX_LINE_LENGTH
Definition bdlde_base64encoderoptions.h:326
Alphabet alphabet
Definition bdlde_base64encoder.h:707
◆ BSLS_DEPRECATE_FEATURE() [2/6]
| bdlde::Base64Encoder::BSLS_DEPRECATE_FEATURE |
( |
"bdl" |
, |
|
|
"Base64Encoder" |
, |
|
|
"use overload with 'options'" |
|
|
) |
| |
Create a Base64 encoder in the initial state, with the 'isPadded' option set and the two specified options.
- Deprecated:
- Create and pass an
options object instead, equivalent to
true));
Definition bdlde_base64encoder.h:497
◆ BSLS_DEPRECATE_FEATURE() [3/6]
| bdlde::Base64Encoder::BSLS_DEPRECATE_FEATURE |
( |
"bdl" |
, |
|
|
"encodedLength" |
, |
|
|
"use overload with 'options'" |
|
|
) |
| |
Return the exact number of encoded bytes that would result from an input byte sequence of the specified inputLength provided to the convert method of an encoder configured with the specified maxLineLength.
- Precondition
- The behavior is undefined unless
0 <= inputLength and 0 <= maxLineLength.
- Note
- Note that if
maxLineLength is 0, no CRLF characters will appear in the output. Note also that the number of encoded bytes need not be the number of output bytes.
- Deprecated:
- use the overload with
options instead.
◆ BSLS_DEPRECATE_FEATURE() [4/6]
| bdlde::Base64Encoder::BSLS_DEPRECATE_FEATURE |
( |
"bdl" |
, |
|
|
"encodedLength" |
, |
|
|
"use overload with 'options'" |
|
|
) |
| |
Return the exact number of encoded bytes that would result from an input byte sequence of the specified inputLength provided to the convert method of an encoder with the maximum allowable line-length of the output being 76 characters (as recommended by the MIME standard).
- Precondition
- The behavior is undefined unless
0 <= inputLength.
- Deprecated:
- use the overload with
options instead.
◆ BSLS_DEPRECATE_FEATURE() [5/6]
| bdlde::Base64Encoder::BSLS_DEPRECATE_FEATURE |
( |
"bdl" |
, |
|
|
"encodedLines" |
, |
|
|
"use overload with 'options'" |
|
|
) |
| |
Return the exact number of encoded lines that would result from an input byte sequence of the specified inputLength provided to the convert method of an encoder configured with the specified maxLineLength.
- Precondition
- The behavior is undefined unless
0 <= inputLength and 0 <= maxLineLength.
- Note
- Note that if
maxLineLength is 0, no CRLF characters will appear in the output. Note also that the number of encoded bytes need not be the number of output bytes.
- Deprecated:
- use the overload with
options instead.
◆ BSLS_DEPRECATE_FEATURE() [6/6]
| bdlde::Base64Encoder::BSLS_DEPRECATE_FEATURE |
( |
"bdl" |
, |
|
|
"encodedLines" |
, |
|
|
"use overload with 'options'" |
|
|
) |
| |
Return the exact number of encoded lines that would result from an input byte sequence of the specified inputLength provided to the convert method of an encoder with the maximum allowable line-length of the output being 76 characters (as recommended by the MIME standard).
- Precondition
- The behavior is undefined unless
0 <= inputLength. Note also that the number of encoded bytes need not be the number of output bytes.
- Deprecated:
- use the overload with
options instead.
◆ convert() [1/2]
template<class OUTPUT_ITERATOR , class INPUT_ITERATOR >
| int bdlde::Base64Encoder::convert |
( |
OUTPUT_ITERATOR |
out, |
|
|
INPUT_ITERATOR |
begin, |
|
|
INPUT_ITERATOR |
end |
|
) |
| |
Encode 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 and a negative value otherwise. A positive return status indicates the number of valid processed output bytes retained by this encoder 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
- Note that calling this method after
endConvert has been invoked without an intervening resetState call will place this instance in an error state, and return an error status. Note also 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() [2/2]
template<class OUTPUT_ITERATOR , class INPUT_ITERATOR >
| int bdlde::Base64Encoder::convert |
( |
OUTPUT_ITERATOR |
out, |
|
|
int * |
numOut, |
|
|
int * |
numIn, |
|
|
INPUT_ITERATOR |
begin, |
|
|
INPUT_ITERATOR |
end, |
|
|
int |
maxNumOut = -1 |
|
) |
| |
◆ encodedLength()
| int bdlde::Base64Encoder::encodedLength |
( |
const EncoderOptions & |
options, |
|
|
bsl::size_t |
inputLength |
|
) |
| |
|
inlinestatic |
Return the exact number of encoded bytes that would result from an input byte sequence of the specified inputLength provided to the convert method of an encoder configured with the specified options.
- Precondition
- The behavior is undefined if
inputLength is large enough for the result to overflow a size_t.
◆ encodedLines()
| int bdlde::Base64Encoder::encodedLines |
( |
const EncoderOptions & |
options, |
|
|
bsl::size_t |
inputLength |
|
) |
| |
|
inlinestatic |
Return the exact number of encoded lines that would result from an input byte sequence of the specified inputLength provided to the convert method of an encoder configured with the specified options.
- Precondition
- The behavior is undefined if
inputLength is large enough to overflow the result.
◆ endConvert() [1/2]
template<class OUTPUT_ITERATOR >
| int bdlde::Base64Encoder::endConvert |
( |
OUTPUT_ITERATOR |
out | ) |
|
Terminate encoding for this encoder; write any retained output (e.g., from a previous call to convert) 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. Load into the (optionally) specified numOut the number of output bytes produced. Return 0 if output was successfully completed and a non-zero 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 encoder in the error state, and return an error status.
◆ endConvert() [2/2]
template<class OUTPUT_ITERATOR >
| int bdlde::Base64Encoder::endConvert |
( |
OUTPUT_ITERATOR |
out, |
|
|
int * |
numOut, |
|
|
int |
maxNumOut = -1 |
|
) |
| |
◆ isAcceptable()
| bool bdlde::Base64Encoder::isAcceptable |
( |
| ) |
const |
|
inline |
Return true if the input read so far is considered syntactically complete and all resulting output has been emitted to out, and false otherwise.
- Note
- Note that
endConvert must be called if the total length of all data processed is not divisible by 3.
◆ isDone()
| bool bdlde::Base64Encoder::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
- Note that if this decoder
isDone then all resulting output has been emitted to out.
◆ isError()
| bool bdlde::Base64Encoder::isError |
( |
| ) |
const |
|
inline |
Return true if there is no possibility of achieving an "acceptable" result, and false otherwise.
◆ isInitialState()
| bool bdlde::Base64Encoder::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.
◆ isPadded()
| bool bdlde::Base64Encoder::isPadded |
( |
| ) |
const |
|
inline |
Return true if padding by = characters was specified at construction of this object.
◆ maxLineLength()
| int bdlde::Base64Encoder::maxLineLength |
( |
| ) |
const |
Return the currently installed value for the maximum line length.
◆ options()
Return an options object reflecting the options this object was configured with.
◆ outputLength()
| int bdlde::Base64Encoder::outputLength |
( |
| ) |
const |
|
inline |
Return the total length of the output emitted thus far (including soft line breaks where appropriate).
◆ resetState()
| void bdlde::Base64Encoder::resetState |
( |
| ) |
|
|
inline |
Reset this instance to its initial state (i.e., as if no input had been consumed).
◆ alphabet
◆ e_BASIC
| const Alphabet bdlde::Base64Encoder::e_BASIC = Base64Alphabet::e_BASIC |
|
static |
◆ e_URL
| const Alphabet bdlde::Base64Encoder::e_URL = Base64Alphabet::e_URL |
|
static |
◆ maxLineLength
| int bdlde::Base64Encoder::maxLineLength |
|
inline |
The documentation for this class was generated from the following file: