zorba::base64
Functionsbool | 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. |
Enumerationsdecode_options decode_options
Options to use for decoding.
Type Definitionssize_typesize_t size_type Functionsattachbool 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.
decodeZORBA_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. Parametersfrom |
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. |
ReturnsReturns the number of decoded bytes.
Parametersinvalid_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. |
decodeZORBA_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. Parametersfrom |
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. |
ReturnsReturns the number of decoded bytes.
Parametersinvalid_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. |
decodeZORBA_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.
Parametersfrom |
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. |
ReturnsReturns the number of decoded bytes.
Parametersinvalid_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
Decodes a Base64-encoded buffer and appends the decoded bytes onto a string.
Embedded newlines and carriage-returns are skipped. ParametersToStringType |
The string type. |
Parametersfrom |
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. |
ReturnsReturns the number of decoded bytes.
Parametersinvalid_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
Decodes a Base64-encoded string and appends the decoded bytes onto another string.
Embedded newlines and carriage-returns are skipped. ParametersFromStringType |
The from string type. | ToStringType |
The to string type. |
Parametersfrom |
The Base64-encoded string to be decoded. | to |
The string to append the decoded bytes to. | options |
The options to use. |
ReturnsReturns the number of decoded bytes.
Parametersinvalid_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. |
decodeZORBA_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. Parametersfrom |
The istream to read from until EOF is reached. | to |
The ostream to write the decoded bytes to. | options |
The options to use. |
ReturnsReturns the number of decoded bytes.
Parametersinvalid_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
Base64-decodes a string and writes the decoded bytes to a stream.
ParametersFromStringType |
The string type. |
Parametersfrom |
The string to be decoded. | to |
The ostream to write the decoded bytes to. |
ReturnsReturns the number of decoded bytes.
decode
Decodes a Base64-encoded istream and appends the decoded bytes to a string.
Embedded newlines and carriage-returns are skipped. ParametersToStringType |
The string type. |
Parametersfrom |
The istream to read from until EOF is reached. | to |
The string to append the decoded bytes to. | options |
The options to use. |
ReturnsReturns the number of decoded bytes.
Parametersinvalid_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. |
decodeZORBA_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;>.
Parametersfrom |
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. |
Parametersinvalid_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
Calculates the number of bytes required to decode n Base64-encoded bytes.
Parametersn |
The number of bytes to decode. |
ReturnsReturns the number of bytes needed for Base64 decoding.
detachbool 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.
encodeZORBA_DLL_PUBLIC size_type encode(char const *from, size_type from_len, char *to)
Base64-encodes a buffer.
Parametersfrom |
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. |
ReturnsReturns the number of encoded bytes.
encodeZORBA_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>.
Parametersfrom |
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. |
encodeZORBA_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.
Parametersfrom |
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. |
ReturnsReturns the number of encoded bytes.
encode
Base64-encodes a buffer and appends the encoded bytes onto a string.
ParametersToStringType |
The string type. |
Parametersfrom |
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. |
ReturnsReturns the number of encoded bytes.
encode
Base64-encodes a string and appends the encoded bytes onto another string.
ParametersFromStringType |
The from string type. | ToStringType |
The to string type. |
Parametersfrom |
The string to be encoded. | to |
A pointer to the string to append the encoded bytes onto. |
ReturnsReturns the number of encoded bytes.
encodeZORBA_DLL_PUBLIC size_type encode(std::istream &from, std::ostream &to)
Base64-encodes one stream and writes the encoded bytes to another.
Parametersfrom |
The istream to read from until EOF is reached. | to |
The ostream to write the encoded bytes to. |
ReturnsReturns the number of encoded bytes.
encode
Base64-encodes a string and writes the encoded bytes to a stream.
ParametersFromStringType |
The string type. |
Parametersfrom |
The string to be encoded. | to |
The ostream to write the encoded bytes to. |
ReturnsReturns the number of encoded bytes.
encode
Encodes a stream to Base64 and appends the encoded bytes to a string.
ParametersToStringType |
The string type. |
Parametersfrom |
The istream to read from until EOF is reached. | to |
The string to append the encoded bytes to. |
ReturnsReturns the number of encoded bytes.
encodeZORBA_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;>.
Parametersfrom |
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
Calculates the number of bytes required to Base64-encode n bytes.
Parametersn |
The number of bytes to encode. |
ReturnsReturns the number of bytes needed for Base64 encoding.
is_attachedbool is_attached(std::basic_ios< charT, Traits > &ios) validatevoid validate(char const *buf, size_type buf_len, int options=dopt_none)
Validates a Base64-encoded buffer.
Embedded newlines and carriage-returns are skipped. Parametersbuf |
A pointer to the Base64 buffer to be validated. | buf_len |
The number of bytes to validate. | options |
The options to use. |
Parametersinvalid_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. |
|