IncredibleXMLParser  3.05
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | List of all members

Helper class to include binary data inside XML strings using "Base64 encoding". More...

#include <IXMLParser.h>

Public Member Functions

 IXMLParserBase64Tool ()
 
 ~IXMLParserBase64Tool ()
 
void clear ()
 Call this function when you have finished using this object to release memory used by the internal buffer. More...
 
IXMLStr encode (unsigned char *inByteBuf, unsigned int inByteLen, char formatted=0)
 returns a pointer to an internal buffer containing the base64 string containing the binary data encoded from "inByteBuf" More...
 
unsigned char * decode (IXMLCStr inString, int *outByteLen=NULL, IXMLError *xe=NULL)
 returns a pointer to an internal buffer containing the binary data decoded from "inString" More...
 

Static Public Member Functions

static int encodeLength (int inBufLen, char formatted=0)
 return the length of the base64 string that encodes a data buffer of size inBufLen bytes. More...
 
static unsigned int decodeSize (IXMLCStr inString, IXMLError *xe=NULL)
 returns the number of bytes which will be decoded from "inString". More...
 
static unsigned char decode (IXMLCStr inString, unsigned char *outByteBuf, int inMaxByteOutBuflen, IXMLError *xe=NULL)
 deprecated. More...
 

Detailed Description

Helper class to include binary data inside XML strings using "Base64 encoding".

The "IXMLParserBase64Tool" class allows you to include any binary data (images, sounds,...) into an XML document using "Base64 encoding". This class is completely separated from the rest of the IXMLParser library and can be removed without any problem. To include some binary data into an XML file, you must convert the binary data into standard text (using "encode"). To retrieve the original binary data from the b64-encoded text included inside the XML file, use "decode". Alternatively, these functions can also be used to "encrypt/decrypt" some critical data contained inside the XML (it's not a strong encryption at all, but sometimes it can be useful).

Definition at line 1436 of file IXMLParser.h.

Constructor & Destructor Documentation

IXMLParserBase64Tool::IXMLParserBase64Tool ( )
inline

Definition at line 1439 of file IXMLParser.h.

IXMLParserBase64Tool::~IXMLParserBase64Tool ( )

Member Function Documentation

void IXMLParserBase64Tool::clear ( )

Call this function when you have finished using this object to release memory used by the internal buffer.

unsigned char* IXMLParserBase64Tool::decode ( IXMLCStr  inString,
int *  outByteLen = NULL,
IXMLError xe = NULL 
)

returns a pointer to an internal buffer containing the binary data decoded from "inString"

The "decode" function returns a pointer to a buffer containing the binary data decoded from "inString" The output buffer will be free'd when the IXMLParserBase64Tool object is deleted. All output buffer are sharing the same memory space.

Parameters
inStringIf "instring" is malformed, NULL will be returned

Referenced by example8().

static unsigned char IXMLParserBase64Tool::decode ( IXMLCStr  inString,
unsigned char *  outByteBuf,
int  inMaxByteOutBuflen,
IXMLError xe = NULL 
)
static

deprecated.

decodes data from "inString" to "outByteBuf". You need to provide the size (in byte) of "outByteBuf" in "inMaxByteOutBuflen". If "outByteBuf" is not large enough or if data is malformed, then "FALSE" will be returned; otherwise "TRUE".

static unsigned int IXMLParserBase64Tool::decodeSize ( IXMLCStr  inString,
IXMLError xe = NULL 
)
static

returns the number of bytes which will be decoded from "inString".

IXMLStr IXMLParserBase64Tool::encode ( unsigned char *  inByteBuf,
unsigned int  inByteLen,
char  formatted = 0 
)

returns a pointer to an internal buffer containing the base64 string containing the binary data encoded from "inByteBuf"

The "base64Encode" function returns a string containing the base64 encoding of "inByteLen" bytes from "inByteBuf". If "formatted" parameter is true, then there will be a carriage-return every 72 chars. The string will be free'd when the IXMLParserBase64Tool object is deleted. All returned strings are sharing the same memory space.

Referenced by example8().

static int IXMLParserBase64Tool::encodeLength ( int  inBufLen,
char  formatted = 0 
)
static

return the length of the base64 string that encodes a data buffer of size inBufLen bytes.

Parameters
formattedIf "formatted"=true, some space will be reserved for a carriage-return every 72 chars.

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