Yate: Base64 Class Reference

Yate

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
Base64 Class Reference

Base64 encoder/decoder class. More...

`#include <yateclass.h>`

Inheritance diagram for Base64:

## Public Member Functions
| Base64 ()
| Base64 (void *src, unsigned int len, bool copyData=true)
void | encode (String &dest, unsigned int lineLen=0, bool lineAtEnd=false)
bool | decode (DataBlock &dest, bool liberal=true)
Base64 & | operator<< (const String &value)
Base64 & | operator<< (const DataBlock &data)
Base64 & | operator<< (const char *value)
Public Member Functions inherited from DataBlock
| DataBlock (unsigned int overAlloc=0)
| DataBlock (const DataBlock &value)
| DataBlock (const DataBlock &value, unsigned int overAlloc)
| DataBlock (void *value, unsigned int len, bool copyData=true, unsigned int overAlloc=0)
virtual | ~DataBlock ()
virtual void * | getObject (const String &name) const
void * | data () const
unsigned char * | data (unsigned int offs, unsigned int len=1) const
int | at (unsigned int offs, int defvalue=-1) const
bool | null () const
unsigned int | length () const
unsigned int | overAlloc () const
void | overAlloc (unsigned int bytes)
void | clear (bool deleteData=true)
DataBlock & | assign (void *value, unsigned int len, bool copyData=true, unsigned int allocated=0)
void | append (void *value, unsigned int len)
void | append (const DataBlock &value)
void | append (const String &value)
void | insert (const DataBlock &value)
void | resize (unsigned int len)
void | truncate (unsigned int len)
void | cut (int len)
int | operator[] (signed int index) const
int | operator[] (unsigned int index) const
DataBlock & | operator= (const DataBlock &value)
DataBlock & | operator+= (const DataBlock &value)
DataBlock & | operator+= (const String &value)
bool | convert (const DataBlock &src, const String &sFormat, const String &dFormat, unsigned maxlen=0)
bool | unHexify (const char *data, unsigned int len, char sep)
bool | unHexify (const char *data, unsigned int len)
bool | unHexify (const String &data)
String | sqlEscape (char extraEsc) const
Public Member Functions inherited from GenObject
| GenObject ()
virtual | ~GenObject ()
virtual bool | alive () const
virtual void | destruct ()
virtual const String & | toString () const
virtual const String & | traceId () const
NamedCounter * | getObjCounter () const
NamedCounter * | setObjCounter (NamedCounter *counter)

## Additional Inherited Members
Static Public Member Functions inherited from DataBlock
static const DataBlock & | empty ()
Static Public Member Functions inherited from GenObject
static void * | getObject (const String &name, const GenObject *obj)
static bool | getObjCounting ()
static void | setObjCounting (bool enable)
static NamedCounter * | getObjCounter (const String &name, bool create=true)
static ObjList & | getObjCounters ()

## Detailed Description

Base64 encoder/decoder class.

Base64 encoder/decoder class

## Constructor & Destructor Documentation

Base64 | ( |  | ) |
| inline

Constructor

Base64 | ( | void * | src,
|  | unsigned int | len,
|  | bool | copyData = `true`
| ) |  |
| inline

Constructor. Set the buffer

Parameters

  src | Initial data buffer
  len | Initial data buffer length
  copyData | True to make a copy of the received data

## Member Function Documentation

bool decode | ( | DataBlock & | dest,
|  | bool | liberal = `true`
| ) |  |

Decode this buffer to a destination one

Parameters

  dest | Destination data buffer
  liberal | True to use 'liberal' rules when decoding. Some non alphabet characters (such as CR, LF, TAB, SPACE or the Base64 padding char '=') will be accepted and ignored. The resulting number of Base64 chars to decode must be a valid one

Returns
  True on succes, false if an invalid (non Base64) character was found or the number of Base64 characters is invalid (must be a multiple of 4 plus 0, 2 or 3 characters) or the padding is incorrect

void encode | ( | String & | dest,
|  | unsigned int | lineLen = `0`,
|  | bool | lineAtEnd = `false`
| ) |  |

Encode this buffer to a destination string

Parameters

  dest | Destination string
  lineLen | The length of a line. If non 0, a line break (CR/LF) will be inserted in the encoded data after each lineLine characters. No line break will be added after the last line. Use the lineAtEnd parameter to do that
  lineAtEnd | True to add a line break at the end of encoded data

Base64& operator<< | ( | const String & | value | ) |
| inline

Base64 append operator for Strings

References DataBlock::append().

Referenced by Base64::operator<<().

Base64& operator<< | ( | const DataBlock & | data | ) |
| inline

Base64 append operator for DataBlocks

References DataBlock::append().

Base64& operator<< | ( | const char * | value | ) |
| inline

Base64 append operator for C strings

References Base64::operator<<().

The documentation for this class was generated from the following file:

- yateclass.h