Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Classes | Public Types | Public Member Functions | Private Member Functions | Static Private Attributes
Base64 Class Reference

Class to encode and decode Base64. More...

#include <OpenMS/FORMAT/Base64.h>

List of all members.

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
virtual ~Base64 ()
 Destructor.
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.
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.
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.
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.
void encodeStrings (std::vector< String > &in, String &out, bool zlib_compression=false)
 Encodes a vector of strings to a Base64 string.
void decodeStrings (const String &in, std::vector< String > &out, bool zlib_compression=false)
 Decodes a Base64 string to a vector of (null-terminated) strings.

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.
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.
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.
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.

Static Private Attributes

static const char encoder_ []
static const char decoder_ []

Detailed Description

Class to encode and decode Base64.

Base64 supports two precisions: 32 bit (float) and 64 bit (double).


Member Enumeration Documentation

enum ByteOrder

Byte order type.

Enumerator:
BYTEORDER_BIGENDIAN 

Big endian type.

BYTEORDER_LITTLEENDIAN 

Little endian type.


Constructor & Destructor Documentation

Base64 ( )

default constructor

virtual ~Base64 ( ) [virtual]

Destructor.


Member Function Documentation

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.

Note:
in will be emtpy after this method

References Base64::decodeCompressed_(), and Base64::decodeUncompressed_().

void decodeCompressed_ ( const String in,
ByteOrder  from_byte_order,
std::vector< ToType > &  out 
) [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.

Referenced by Base64::decode().

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.

Note:
in will be emtpy after this method

References Base64::decodeIntegersCompressed_(), and Base64::decodeIntegersUncompressed_().

void decodeIntegersCompressed_ ( const String in,
ByteOrder  from_byte_order,
std::vector< ToType > &  out 
) [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.

Referenced by Base64::decodeIntegers().

void decodeIntegersUncompressed_ ( const String in,
ByteOrder  from_byte_order,
std::vector< ToType > &  out 
) [private]

Decodes a Base64 string to a vector of integer numbers.

References Base64::BYTEORDER_BIGENDIAN, Base64::BYTEORDER_LITTLEENDIAN, Base64::decoder_, and OPENMS_IS_BIG_ENDIAN.

Referenced by Base64::decodeIntegers().

void decodeStrings ( const String in,
std::vector< String > &  out,
bool  zlib_compression = false 
)

Decodes a Base64 string to a vector of (null-terminated) strings.

You have to specify whether the Base64 string is zlib-compressed.

Note:
in will be emtpy after this method
void decodeUncompressed_ ( const String in,
ByteOrder  from_byte_order,
std::vector< ToType > &  out 
) [private]

Decodes a Base64 string to a vector of floating point numbers.

References Base64::BYTEORDER_BIGENDIAN, Base64::BYTEORDER_LITTLEENDIAN, Base64::decoder_, and OPENMS_IS_BIG_ENDIAN.

Referenced by Base64::decode().

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.

Note:
in will be emtpy after this method

References Base64::BYTEORDER_BIGENDIAN, Base64::BYTEORDER_LITTLEENDIAN, Base64::encoder_, OpenMS::endianize32(), OpenMS::endianize64(), Base64::Reinterpreter64_::f, Base64::Reinterpreter32_::f, Base64::Reinterpreter64_::i, Base64::Reinterpreter32_::i, and OPENMS_IS_BIG_ENDIAN.

Referenced by MzDataHandler< MapType >::writeBinary_().

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.

Note:
in will be emtpy after this method

References Base64::BYTEORDER_BIGENDIAN, Base64::BYTEORDER_LITTLEENDIAN, Base64::encoder_, OpenMS::endianize32(), OpenMS::endianize64(), and OPENMS_IS_BIG_ENDIAN.

void encodeStrings ( std::vector< String > &  in,
String out,
bool  zlib_compression = false 
)

Encodes a vector of strings to a Base64 string.

You can specify zlib-compression.

Note:
in will be emtpy after this method

Member Data Documentation

const char decoder_[] [static, private]
const char encoder_[] [static, private]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

OpenMS / TOPP release 1.9.0 Documentation generated on Sat Feb 11 2012 12:44:26 using doxygen 1.7.6.1