Yate
Public Member Functions | List of all members
Base64 Class Reference

Base64 encoder/decoder class. More...

#include <yateclass.h>

Inheritance diagram for Base64:
DataBlock GenObject

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)
 
Base64operator<< (const String &value)
 
Base64operator<< (const DataBlock &data)
 
Base64operator<< (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)
 
DataBlockassign (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
 
DataBlockoperator= (const DataBlock &value)
 
DataBlockoperator+= (const DataBlock &value)
 
DataBlockoperator+= (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 StringtoString () const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 

Additional Inherited Members

- Static Public Member Functions inherited from DataBlock
static const DataBlockempty ()
 
- 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 NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 

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
srcInitial data buffer
lenInitial data buffer length
copyDataTrue 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
destDestination data buffer
liberalTrue 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
destDestination string
lineLenThe 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
lineAtEndTrue 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: