Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

base64 Namespace Reference


Detailed Description

holds some functions for encoding and decoding base64 data


Functions

const string Base64Table ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
 this lookup table defines the base64 encoding
string encode (char buf[], unsigned int len)
 returns a string containing the base64 encoding of len bytes from buf
unsigned int decodeSize (const std::string &data)
 returns the number of bytes which will be decoded from data
char * decode (const std::string &data)
 returns a pointer to a newly allocated region contained the binary data decoded from data
bool decode (const std::string &data, char buf[], unsigned int len)
 decodes data into buf, which you need to provide the size of in len

Variables

static const char fillchar = '='
 used to mark partial words at the end
static const string::size_type np = string::npos
 shorthand for the "no position" return code from string
const string::size_type DecodeTable []
 Decode Table gives the index of any valid base64 character in the Base64 table].


Function Documentation

const string base64::Base64Table ( "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"   ) 

this lookup table defines the base64 encoding

Referenced by encode().

bool base64::decode ( const std::string &  data,
char  buf[],
unsigned int  len 
)

decodes data into buf, which you need to provide the size of in len

If buf is not large enough or data is malformed, false will be returned; otherwise true

Definition at line 147 of file Base64.cc.

char * base64::decode ( const std::string &  data  ) 

returns a pointer to a newly allocated region contained the binary data decoded from data

If data is malformed NULL will be returned

Definition at line 138 of file Base64.cc.

unsigned int base64::decodeSize ( const std::string &  data  ) 

returns the number of bytes which will be decoded from data

Does not check data for correctness, just counts the fill characters at the end of the string

Definition at line 117 of file Base64.cc.

Referenced by decode().

std::string base64::encode ( char  buf[],
unsigned int  len 
)

returns a string containing the base64 encoding of len bytes from buf

Definition at line 73 of file Base64.cc.

Referenced by EventLogger::logImage().


Variable Documentation

const string::size_type base64::DecodeTable[]

Initial value:

 {
    np,np,np,np,np,np,np,np,np,np,  
    np,np,np,np,np,np,np,np,np,np,  
    np,np,np,np,np,np,np,np,np,np,  
    np,np,np,np,np,np,np,np,np,np,  
    np,np,np,62,np,np,np,63,52,53,  
    54,55,56,57,58,59,60,61,np,np,  
    np,np,np,np,np, 0, 1, 2, 3, 4,  
    5, 6, 7, 8, 9,10,11,12,13,14,  
    15,16,17,18,19,20,21,22,23,24,  
    25,np,np,np,np,np,np,26,27,28,  
    29,30,31,32,33,34,35,36,37,38,  
    39,40,41,42,43,44,45,46,47,48,  
    49,50,51,np,np,np,np,np,np,np,  
    np,np,np,np,np,np,np,np,np,np,  
    np,np,np,np,np,np,np,np,np,np,  
    np,np,np,np,np,np,np,np,np,np,  
    np,np,np,np,np,np,np,np,np,np,  
    np,np,np,np,np,np,np,np,np,np,  
    np,np,np,np,np,np,np,np,np,np,  
    np,np,np,np,np,np,np,np,np,np,  
    np,np,np,np,np,np,np,np,np,np,  
    np,np,np,np,np,np,np,np,np,np,  
    np,np,np,np,np,np,np,np,np,np,  
    np,np,np,np,np,np,np,np,np,np,  
    np,np,np,np,np,np,np,np,np,np,  
    np,np,np,np,np,np               
  }
Decode Table gives the index of any valid base64 character in the Base64 table].

65 == A, 97 == a, 48 == 0, 43 == +, 47 == /

Definition at line 43 of file Base64.cc.

Referenced by decode(), and decodeSize().

const char base64::fillchar = '=' [static]

used to mark partial words at the end

Definition at line 35 of file Base64.cc.

Referenced by decode(), decodeSize(), and encode().

const string::size_type base64::np = string::npos [static]

shorthand for the "no position" return code from string

Definition at line 36 of file Base64.cc.

Referenced by decode(), decodeSize(), and WalkEngineNode< W, mcName, mcDesc >::setVelocity().


Tekkotsu v4.0
Generated Thu Nov 22 00:58:50 2007 by Doxygen 1.5.4