zorba::base64

Enumerations

decode_options

Options to use for decoding.

Type Definitions

size_t

size_type

Functions

bool

attach(std::basic_ios< charT, Traits > &ios)

Attaches a base64::streambuf to a stream.

ZORBA_DLL_PUBLIC size_type

decode(char const *from, size_type from_len, char *to, int options=dopt_none)

Decodes a Base64-encoded buffer.

ZORBA_DLL_PUBLIC size_type

decode(char const *from, size_type from_len, std::vector< char > *to, int options=dopt_none)

Decodes a Base64-encoded buffer and appends the decoded bytes onto a vector<char>.

ZORBA_DLL_PUBLIC size_type

decode(char const *from, size_type from_len, std::ostream &to, int options=dopt_none)

Base64-decodes a buffer and writes the decoded bytes to the given stream.

std::enable_if< ZORBA_IS_STRING(ToStringType), size_type >::type

decode(char const *from, size_type from_len, ToStringType *to, int options=dopt_none)

Decodes a Base64-encoded buffer and appends the decoded bytes onto a string.

std::enable_if< ZORBA_IS_STRING(FromStringType)&&ZORBA_IS_STRING(ToStringType), size_type >::type

decode(FromStringType const &from, ToStringType *to)

Decodes a Base64-encoded string and appends the decoded bytes onto another string.

ZORBA_DLL_PUBLIC size_type

decode(std::istream &from, std::ostream &to, int options=dopt_none)

Decodes a Base64-encoded istream.

std::enable_if< ZORBA_IS_STRING(FromStringType), size_type >::type

decode(FromStringType const &from, std::ostream &to)

Base64-decodes a string and writes the decoded bytes to a stream.

std::enable_if< ZORBA_IS_STRING(ToStringType), size_type >::type

decode(std::istream &from, ToStringType *to, int options=dopt_none)

Decodes a Base64-encoded istream and appends the decoded bytes to a string.

ZORBA_DLL_PUBLIC size_type

decode(std::istream &from, std::vector< char > *to, int options=dopt_none)

Decodes a Base64-encoded stream and appends the decoded bytes onto a vector<char;>.

size_type

decoded_size(size_type n)

Calculates the number of bytes required to decode n Base64-encoded bytes.

bool

detach(std::basic_ios< charT, Traits > &ios)

Detaches a previously attached base64::streambuf from a stream.

ZORBA_DLL_PUBLIC size_type

encode(char const *from, size_type from_len, char *to)

Base64-encodes a buffer.

ZORBA_DLL_PUBLIC size_type

encode(char const *from, size_type from_len, std::vector< char > *to)

Base64-encodes a buffer and appends the encoded bytes onto a vector<char>.

ZORBA_DLL_PUBLIC size_type

encode(char const *from, size_type from_len, std::ostream &to)

Base64-encodes a buffer and writes the encoded bytes to the given stream.

std::enable_if< ZORBA_IS_STRING(ToStringType), size_type >::type

encode(char const *from, size_type from_len, ToStringType *to)

Base64-encodes a buffer and appends the encoded bytes onto a string.

std::enable_if< ZORBA_IS_STRING(FromStringType)&&ZORBA_IS_STRING(ToStringType), size_type >::type

encode(FromStringType const &from, ToStringType *to)

Base64-encodes a string and appends the encoded bytes onto another string.

ZORBA_DLL_PUBLIC size_type

encode(std::istream &from, std::ostream &to)

Base64-encodes one stream and writes the encoded bytes to another.

std::enable_if< ZORBA_IS_STRING(FromStringType), size_type >::type

encode(FromStringType const &from, std::ostream &to)

Base64-encodes a string and writes the encoded bytes to a stream.

std::enable_if< ZORBA_IS_STRING(ToStringType), size_type >::type

encode(std::istream &from, ToStringType *to)

Encodes a stream to Base64 and appends the encoded bytes to a string.

ZORBA_DLL_PUBLIC size_type

encode(std::istream &from, std::vector< char > *to)

Base64-encodes a stream and appends the encoded bytes onto a vector<char;>.

size_type

encoded_size(size_type n)

Calculates the number of bytes required to Base64-encode n bytes.

bool

is_attached(std::basic_ios< charT, Traits > &ios)

Checks whether the given stream has a base64::streambuf attached.

void

validate(char const *buf, size_type buf_len, int options=dopt_none)

Validates a Base64-encoded buffer.

Enumerations

decode_options

 decode_options

Options to use for decoding.

Type Definitions

size_type

size_t size_type

Functions

attach

bool attach(std::basic_ios< charT, Traits > &ios)

Attaches a base64::streambuf to a stream.

Unlike using a base64::streambuf directly, this function will create the streambuf, attach it to the stream, and manage it for the lifetime of the stream automatically.

Parameters

ios The stream to attach the base64::streambuf to. If the stream already has a base64::streambuf attached to it, this function does nothing.

Returns

true only if a base64::streambuf was attached.

decode

ZORBA_DLL_PUBLIC size_type decode(char const *from, size_type from_len, char *to, int options=dopt_none)

Decodes a Base64-encoded buffer.

Embedded newlines and carriage-returns are skipped.

Parameters

from A pointer to the Base64 buffer to be decoded.
from_len The number of bytes to decode. to A pointer to the buffer to receive the decoded bytes. The buffer must be large enough to contain them. Note that the buffer is not null terminated.
options The decoding options to use.

Returns

Returns the number of decoded bytes.

Parameters

invalid_argument if options does not have the dtop_any_len bit set and from_len is not a multiple of 4.
if an = is encountered unexpectedly or an invalid byte is encountered.

decode

ZORBA_DLL_PUBLIC size_type decode(char const *from, size_type from_len, std::vector< char > *to, int options=dopt_none)

Decodes a Base64-encoded buffer and appends the decoded bytes onto a vector<char>.

Embedded newlines and carriage-returns are skipped.

Parameters

from A pointer to the buffer to be encoded.
from_len The number of bytes to encode.
to A pointer to the vector to append the encoded bytes appended onto. The vector is made large enough to contain the additional bytes.
options The decoding options to use.

Returns

Returns the number of decoded bytes.

Parameters

invalid_argument if options does not have the dopt_any_len bit set and the number of Base64 bytes decoded is not a multiple of 4.
if an = is encountered unexpectedly or an invalid byte is encountered.

decode

ZORBA_DLL_PUBLIC size_type decode(char const *from, size_type from_len, std::ostream &to, int options=dopt_none)

Base64-decodes a buffer and writes the decoded bytes to the given stream.

Parameters

from A pointer to the Base64 buffer to be decoded.
from_len The number of bytes to decode.
to The ostream to write the decoded bytes to.
options The options to use.

Returns

Returns the number of decoded bytes.

Parameters

invalid_argument if options does not have the dopt_any_len bit set and the number of Base64 bytes decoded is not a multiple of 4.
if an = is encountered unexpectedly or an invalid byte is encountered.

decode

std::enable_if< ZORBA_IS_STRING(ToStringType), size_type >::type decode(char const *from, size_type from_len, ToStringType *to, int options=dopt_none)

Decodes a Base64-encoded buffer and appends the decoded bytes onto a string.

Embedded newlines and carriage-returns are skipped.

Parameters

ToStringType The string type.

Parameters

from A pointer to the Base64 buffer to be decoded.
from_len The number of bytes to decode.
to The string to append the decoded bytes to.
options The options to use.

Returns

Returns the number of decoded bytes.

Parameters

invalid_argument if options does not have the dopt_any_len bit set and the number of Base64 bytes decoded is not a multiple of 4.
if an = is encountered unexpectedly or an invalid byte is encountered.

decode

std::enable_if< ZORBA_IS_STRING(FromStringType)&&ZORBA_IS_STRING(ToStringType), size_type >::type decode(FromStringType const &from, ToStringType *to)

Decodes a Base64-encoded string and appends the decoded bytes onto another string.

Embedded newlines and carriage-returns are skipped.

Parameters

FromStringType The from string type.
ToStringType The to string type.

Parameters

from The Base64-encoded string to be decoded.
to The string to append the decoded bytes to.
options The options to use.

Returns

Returns the number of decoded bytes.

Parameters

invalid_argument if options does not have the dopt_any_len bit set and the number of Base64 bytes decoded is not a multiple of 4.
if an = is encountered unexpectedly or an invalid byte is encountered.

decode

ZORBA_DLL_PUBLIC size_type decode(std::istream &from, std::ostream &to, int options=dopt_none)

Decodes a Base64-encoded istream.

Embedded newlines and carriage-returns are skipped.

Parameters

from The istream to read from until EOF is reached.
to The ostream to write the decoded bytes to.
options The options to use.

Returns

Returns the number of decoded bytes.

Parameters

invalid_argument if options does not have the dopt_any_len bit set and the number of Base64 bytes decoded is not a multiple of 4.
if an = is encountered unexpectedly or an invalid byte is encountered.

decode

std::enable_if< ZORBA_IS_STRING(FromStringType), size_type >::type decode(FromStringType const &from, std::ostream &to)

Base64-decodes a string and writes the decoded bytes to a stream.

Parameters

FromStringType The string type.

Parameters

from The string to be decoded.
to The ostream to write the decoded bytes to.

Returns

Returns the number of decoded bytes.

decode

std::enable_if< ZORBA_IS_STRING(ToStringType), size_type >::type decode(std::istream &from, ToStringType *to, int options=dopt_none)

Decodes a Base64-encoded istream and appends the decoded bytes to a string.

Embedded newlines and carriage-returns are skipped.

Parameters

ToStringType The string type.

Parameters

from The istream to read from until EOF is reached.
to The string to append the decoded bytes to.
options The options to use.

Returns

Returns the number of decoded bytes.

Parameters

invalid_argument if options does not have the dopt_any_len bit set and the number of Base64 bytes decoded is not a multiple of 4.
if an = is encountered unexpectedly or an invalid byte is encountered.

decode

ZORBA_DLL_PUBLIC size_type decode(std::istream &from, std::vector< char > *to, int options=dopt_none)

Decodes a Base64-encoded stream and appends the decoded bytes onto a vector<char;>.

Parameters

from The istream to read from until EOF is reached.
to The string to append the decoded bytes to.
options The options to use.
Returns the number of decoded bytes.

Parameters

invalid_argument if options does not have the dopt_any_len bit set and the number of Base64 bytes decoded is not a multiple of 4.
if an = is encountered unexpectedly or an invalid byte is encountered.

decoded_size

size_type decoded_size(size_type n)

Calculates the number of bytes required to decode n Base64-encoded bytes.

Parameters

n The number of bytes to decode.

Returns

Returns the number of bytes needed for Base64 decoding.

detach

bool detach(std::basic_ios< charT, Traits > &ios)

Detaches a previously attached base64::streambuf from a stream.

The streambuf is destroyed and the stream's original streambuf is restored.

Parameters

ios The stream to detach the base64::streambuf from. If the stream doesn't have a base64::streambuf attached to it, this function does nothing.

Returns

true only if a base64::streambuf was detached.

encode

ZORBA_DLL_PUBLIC size_type encode(char const *from, size_type from_len, char *to)

Base64-encodes a buffer.

Parameters

from A pointer to the buffer to be encoded.
from_len The number of bytes to encode.
to A pointer to the buffer to receive the encoded bytes. The buffer must be large enough to contain them. Note that the buffer is not null terminated.

Returns

Returns the number of encoded bytes.

encode

ZORBA_DLL_PUBLIC size_type encode(char const *from, size_type from_len, std::vector< char > *to)

Base64-encodes a buffer and appends the encoded bytes onto a vector<char>.

Parameters

from A pointer to the buffer to be encoded.
from_len The number of bytes to encode.
to A pointer to the vector to append the encoded bytes appended onto. The vector is made large enough to contain the additional bytes.

encode

ZORBA_DLL_PUBLIC size_type encode(char const *from, size_type from_len, std::ostream &to)

Base64-encodes a buffer and writes the encoded bytes to the given stream.

Parameters

from A pointer to the buffer to be encoded.
from_len The number of bytes to encode.
to The ostream to write the encoded bytes to.

Returns

Returns the number of encoded bytes.

encode

std::enable_if< ZORBA_IS_STRING(ToStringType), size_type >::type encode(char const *from, size_type from_len, ToStringType *to)

Base64-encodes a buffer and appends the encoded bytes onto a string.

Parameters

ToStringType The string type.

Parameters

from A pointer to the buffer to be encoded.
from_len The number of bytes to encode.
to A pointer to the string to append the encoded bytes onto.

Returns

Returns the number of encoded bytes.

encode

std::enable_if< ZORBA_IS_STRING(FromStringType)&&ZORBA_IS_STRING(ToStringType), size_type >::type encode(FromStringType const &from, ToStringType *to)

Base64-encodes a string and appends the encoded bytes onto another string.

Parameters

FromStringType The from string type.
ToStringType The to string type.

Parameters

from The string to be encoded.
to A pointer to the string to append the encoded bytes onto.

Returns

Returns the number of encoded bytes.

encode

ZORBA_DLL_PUBLIC size_type encode(std::istream &from, std::ostream &to)

Base64-encodes one stream and writes the encoded bytes to another.

Parameters

from The istream to read from until EOF is reached.
to The ostream to write the encoded bytes to.

Returns

Returns the number of encoded bytes.

encode

std::enable_if< ZORBA_IS_STRING(FromStringType), size_type >::type encode(FromStringType const &from, std::ostream &to)

Base64-encodes a string and writes the encoded bytes to a stream.

Parameters

FromStringType The string type.

Parameters

from The string to be encoded.
to The ostream to write the encoded bytes to.

Returns

Returns the number of encoded bytes.

encode

std::enable_if< ZORBA_IS_STRING(ToStringType), size_type >::type encode(std::istream &from, ToStringType *to)

Encodes a stream to Base64 and appends the encoded bytes to a string.

Parameters

ToStringType The string type.

Parameters

from The istream to read from until EOF is reached.
to The string to append the encoded bytes to.

Returns

Returns the number of encoded bytes.

encode

ZORBA_DLL_PUBLIC size_type encode(std::istream &from, std::vector< char > *to)

Base64-encodes a stream and appends the encoded bytes onto a vector<char;>.

Parameters

from The istream to read from until EOF is reached.
to The vector to append the encoded bytes to.
Returns the number of encoded bytes.

encoded_size

size_type encoded_size(size_type n)

Calculates the number of bytes required to Base64-encode n bytes.

Parameters

n The number of bytes to encode.

Returns

Returns the number of bytes needed for Base64 encoding.

is_attached

bool is_attached(std::basic_ios< charT, Traits > &ios)

Checks whether the given stream has a base64::streambuf attached.

Parameters

ios The stream to check.

Returns

true only if a base64::streambuf is attached.

validate

void validate(char const *buf, size_type buf_len, int options=dopt_none)

Validates a Base64-encoded buffer.

Embedded newlines and carriage-returns are skipped.

Parameters

buf A pointer to the Base64 buffer to be validated.
buf_len The number of bytes to validate.
options The options to use.

Parameters

invalid_argument if options does not have the dopt_any_len bit set and the number of Base64 bytes validated is not a multiple of 4.
if an = is encountered unexpectedly or an invalid byte is encountered.