Class to encode and decode Base64. More...
#include <OpenMS/FORMAT/Base64.h>
Classes | |
union | Reinterpreter32_ |
Internal class needed for type-punning. More... | |
union | Reinterpreter64_ |
Internal class needed for type-punning. More... | |
Public Types | |
enum | ByteOrder { BYTEORDER_BIGENDIAN, BYTEORDER_LITTLEENDIAN } |
Byte order type. More... | |
Public Member Functions | |
Base64 () | |
default constructor More... | |
virtual | ~Base64 () |
Destructor. More... | |
template<typename FromType > | |
void | encode (std::vector< FromType > &in, ByteOrder to_byte_order, String &out, bool zlib_compression=false) |
Encodes a vector of floating point numbers to a Base64 string. More... | |
template<typename ToType > | |
void | decode (const String &in, ByteOrder from_byte_order, std::vector< ToType > &out, bool zlib_compression=false) |
Decodes a Base64 string to a vector of floating point numbers. More... | |
template<typename FromType > | |
void | encodeIntegers (std::vector< FromType > &in, ByteOrder to_byte_order, String &out, bool zlib_compression=false) |
Encodes a vector of integer point numbers to a Base64 string. More... | |
template<typename ToType > | |
void | decodeIntegers (const String &in, ByteOrder from_byte_order, std::vector< ToType > &out, bool zlib_compression=false) |
Decodes a Base64 string to a vector of integer numbers. More... | |
void | encodeStrings (const std::vector< String > &in, String &out, bool zlib_compression=false, bool append_null_byte=true) |
Encodes a vector of strings to a Base64 string. More... | |
void | decodeStrings (const String &in, std::vector< String > &out, bool zlib_compression=false) |
Decodes a Base64 string to a vector of (null-terminated) strings. More... | |
void | decodeSingleString (const String &in, QByteArray &base64_uncompressed, bool zlib_compression) |
Decodes a Base64 string to a QByteArray. More... | |
Private Member Functions | |
template<typename ToType > | |
void | decodeUncompressed_ (const String &in, ByteOrder from_byte_order, std::vector< ToType > &out) |
Decodes a Base64 string to a vector of floating point numbers. More... | |
template<typename ToType > | |
void | decodeCompressed_ (const String &in, ByteOrder from_byte_order, std::vector< ToType > &out) |
Decodes a compressed Base64 string to a vector of floating point numbers. More... | |
template<typename ToType > | |
void | decodeIntegersUncompressed_ (const String &in, ByteOrder from_byte_order, std::vector< ToType > &out) |
Decodes a Base64 string to a vector of integer numbers. More... | |
template<typename ToType > | |
void | decodeIntegersCompressed_ (const String &in, ByteOrder from_byte_order, std::vector< ToType > &out) |
Decodes a compressed Base64 string to a vector of integer numbers. More... | |
Static Private Attributes | |
static const char | encoder_ [] |
static const char | decoder_ [] |
Class to encode and decode Base64.
Base64 supports two precisions: 32 bit (float) and 64 bit (double).
enum ByteOrder |
Base64 | ( | ) |
default constructor
|
virtual |
Destructor.
void decode | ( | const String & | in, |
ByteOrder | from_byte_order, | ||
std::vector< ToType > & | out, | ||
bool | zlib_compression = false |
||
) |
Decodes a Base64 string to a vector of floating point numbers.
You have to specify the byte order of the input and if it is zlib-compressed.
|
private |
Decodes a compressed Base64 string to a vector of floating point numbers.
References Base64::BYTEORDER_BIGENDIAN, Base64::BYTEORDER_LITTLEENDIAN, OpenMS::endianize32(), OpenMS::endianize64(), and OPENMS_IS_BIG_ENDIAN.
void decodeIntegers | ( | const String & | in, |
ByteOrder | from_byte_order, | ||
std::vector< ToType > & | out, | ||
bool | zlib_compression = false |
||
) |
Decodes a Base64 string to a vector of integer numbers.
You have to specify the byte order of the input and if it is zlib-compressed.
|
private |
Decodes a compressed Base64 string to a vector of integer numbers.
References Base64::BYTEORDER_BIGENDIAN, Base64::BYTEORDER_LITTLEENDIAN, OpenMS::endianize32(), OpenMS::endianize64(), and OPENMS_IS_BIG_ENDIAN.
|
private |
Decodes a Base64 string to a vector of integer numbers.
References Base64::BYTEORDER_BIGENDIAN, Base64::BYTEORDER_LITTLEENDIAN, and OPENMS_IS_BIG_ENDIAN.
void decodeSingleString | ( | const String & | in, |
QByteArray & | base64_uncompressed, | ||
bool | zlib_compression | ||
) |
void decodeStrings | ( | const String & | in, |
std::vector< String > & | out, | ||
bool | zlib_compression = false |
||
) |
|
private |
Decodes a Base64 string to a vector of floating point numbers.
References Base64::BYTEORDER_BIGENDIAN, Base64::BYTEORDER_LITTLEENDIAN, and OPENMS_IS_BIG_ENDIAN.
void encode | ( | std::vector< FromType > & | in, |
ByteOrder | to_byte_order, | ||
String & | out, | ||
bool | zlib_compression = false |
||
) |
Encodes a vector of floating point numbers to a Base64 string.
You can specify the byte order of the output and if it is zlib-compressed.
in
will be empty after this method References Base64::BYTEORDER_BIGENDIAN, Base64::BYTEORDER_LITTLEENDIAN, OpenMS::endianize32(), OpenMS::endianize64(), Base64::Reinterpreter64_::f, Base64::Reinterpreter32_::f, Base64::Reinterpreter64_::i, Base64::Reinterpreter32_::i, and OPENMS_IS_BIG_ENDIAN.
void encodeIntegers | ( | std::vector< FromType > & | in, |
ByteOrder | to_byte_order, | ||
String & | out, | ||
bool | zlib_compression = false |
||
) |
Encodes a vector of integer point numbers to a Base64 string.
You can specify the byte order of the output and if it is zlib-compressed.
in
will be empty after this method References Base64::BYTEORDER_BIGENDIAN, Base64::BYTEORDER_LITTLEENDIAN, OpenMS::endianize32(), OpenMS::endianize64(), and OPENMS_IS_BIG_ENDIAN.
void encodeStrings | ( | const std::vector< String > & | in, |
String & | out, | ||
bool | zlib_compression = false , |
||
bool | append_null_byte = true |
||
) |
Encodes a vector of strings to a Base64 string.
You can specify zlib-compression.
in | A vector of data to be encoded (String) |
out | A String containing the Base64 encoded data |
zlib_compression | Whether the data should be compressed with zlib before encoding in Base64 |
append_null_byte | Whether a null-byte should be appended after each of the Strings contained in the in vector |
|
staticprivate |
|
staticprivate |
OpenMS / TOPP release 2.3.0 | Documentation generated on Tue Jan 9 2018 18:22:07 using doxygen 1.8.13 |