MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Functions
Mezzanine::BinaryTools Namespace Reference

A grouping of utilities for working with binary data more easily. More...

Classes

class  BinaryBuffer
 A way to store and pass binary buffers, for example compiled bytecode. More...
 

Functions

BinaryBuffer Base64Decode (String const &EncodedString)
 Convert Base64 stuff back to binary. More...
 
String Base64Encode (String const &Unencoded)
 Converts the contents of a String into a String containing a base64 encoded String. More...
 
String Base64Encode (BinaryBuffer const &Buffer)
 Convert a binary buffer to a base64 String. More...
 
String Base64Encode (UInt8 const *BytesToEncode, unsigned int Length)
 Convert a binary buffer to a Base64 string. More...
 
bool IsBase64 (unsigned char Char8)
 Is a character a valid Base64 character. More...
 
Whole PredictBase64StringSizeFromBinarySize (Whole Length)
 From the size of a binary get the exact size in 8bit bytes. More...
 
Whole PredictBinarySizeFromBase64String (String const &EncodedString)
 From an encoded string get the exact size of the decode binary in 8bit bytes. More...
 

Detailed Description

A grouping of utilities for working with binary data more easily.

Function Documentation

BinaryBuffer Mezzanine::BinaryTools::Base64Decode ( String const &  EncodedString)

Convert Base64 stuff back to binary.

Parameters
EncodedStringThe results of a previous function like Base64Encode to be converted back to binary
Returns
A String with the raw bianry

Definition at line 338 of file binarybuffer.cpp.

String Mezzanine::BinaryTools::Base64Encode ( String const &  Unencoded)

Converts the contents of a String into a String containing a base64 encoded String.

Parameters
UnencodedA String/binary to be encoded
Returns
A string containing base64.

Definition at line 283 of file binarybuffer.cpp.

String Mezzanine::BinaryTools::Base64Encode ( BinaryBuffer const &  Buffer)

Convert a binary buffer to a base64 String.

Parameters
BufferA BinaryBuffer to base64 encode.
Returns
A string containing base64.

Definition at line 286 of file binarybuffer.cpp.

String Mezzanine::BinaryTools::Base64Encode ( UInt8 const *  BytesToEncode,
unsigned int  Length 
)

Convert a binary buffer to a Base64 string.

Parameters
BytesToEncodeA pointer to the beginning of the buffer.
LengthThe length of the bufferin bytes.
Returns
A String containing the base64 encoded binary

Definition at line 290 of file binarybuffer.cpp.

bool Mezzanine::BinaryTools::IsBase64 ( unsigned char  Char8)

Is a character a valid Base64 character.

Parameters
Char8a single char to check if it could possibly be valid base64
Returns
True if the character could be part of a valid block of Base64 text, false otherwise

Definition at line 280 of file binarybuffer.cpp.

Whole Mezzanine::BinaryTools::PredictBase64StringSizeFromBinarySize ( Whole  Length)

From the size of a binary get the exact size in 8bit bytes.

Parameters
LengthThe bytelength of the item before Base64 encoding.
Returns
This returns the exact length of the result once it is encoded. The Base64 is about 133% of the binary size, but that can be off by just enough to make memory allocation an issue if not calcualated carefully.

Definition at line 355 of file binarybuffer.cpp.

Whole Mezzanine::BinaryTools::PredictBinarySizeFromBase64String ( String const &  EncodedString)

From an encoded string get the exact size of the decode binary in 8bit bytes.

Parameters
EncodedStringThe base64 encoded string
Returns
This returns the exact length of the result once it is decoded. The binary is about 3/4 of the base64 size, but that can be off by just enough to make memory allocation an issue if not calcualated carefully.

Definition at line 347 of file binarybuffer.cpp.