Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Base64Decoder Class Reference

Base-64 decoding class. More...

#include <base64.h>

Collaboration diagram for Base64Decoder:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Base64Decoder ()
 Construct a base-64 decoder.

 Base64Decoder (const Base64Decoder &b)
 Copy-constructor as usual.

 ~Base64Decoder ()
 Destructor; a no-op...

Base64Decoderoperator= (const Base64Decoder &b)
 Standard assignment operator:.

void reset ()
 Reset the decoder.

size_t DecodedSize (size_t inlen)
 Compute the required output buffer length.

ssize_t decode (const char *in, size_t inlen, char *out, size_t outlen)
 Decode base-64 ASCII as binary data.


Static Public Member Functions

ssize_t DecodeBuf (const char *in, size_t inlen, char *out, size_t outlen)
 Static version of decoding function.


Private Attributes

uint32 state
 Current decode state (carry).


Detailed Description

Base-64 decoding class.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
This class only stores the internal carry of the base-64 decoding and is "C++-safe".

Definition at line 134 of file base64.h.


Constructor & Destructor Documentation

Base64Decoder::Base64Decoder  )  [inline]
 

Construct a base-64 decoder.

Definition at line 141 of file base64.h.

References state.

Base64Decoder::Base64Decoder const Base64Decoder b  )  [inline]
 

Copy-constructor as usual.

Definition at line 143 of file base64.h.

References state.

Base64Decoder::~Base64Decoder  )  [inline]
 

Destructor; a no-op...

Definition at line 145 of file base64.h.


Member Function Documentation

ssize_t Base64Decoder::decode const char *  in,
size_t  inlen,
char *  out,
size_t  outlen
 

Decode base-64 ASCII as binary data.

You can decode very large data by calling this function repeatedly since this class has an internal state which saves the carry bytes from previous calls.

In order to have the carry flushed and all data appended to the output buffer, either call the function with inlen=0 or make sure that the end-of-input indicator ('=') is at the end of the base64 encoded input.

You can use the static variant DecodeBuf() if you can decode all data in a single call.

Parameters:
in: input data to be decoded
inlen: length of input data in bytes
out: buffer to store output data
outlen: length of output buffer
Returns:
>=0 -> number of bytes in output;
-2 -> illegal char in input
-3 -> premature end (if base64 termination char `=' is encountered too early)
-4 -> output buffer too small.
Note:
You can estimate the required output buffer size by calling the DecodedSize() function.

Definition at line 260 of file base64.cc.

References ssize_t, and state.

Referenced by base64_ctest().

ssize_t Base64Decoder::DecodeBuf const char *  in,
size_t  inlen,
char *  out,
size_t  outlen
[static]
 

Static version of decoding function.

See the member function decode() for details.

Definition at line 266 of file base64.cc.

References ssize_t.

size_t Base64Decoder::DecodedSize size_t  inlen  )  [inline]
 

Compute the required output buffer length.

Computes the length of the output buffer when decoding input of size inlen.

The returned value may be slightly too large but never too small.

Definition at line 168 of file base64.h.

Base64Decoder& Base64Decoder::operator= const Base64Decoder b  )  [inline]
 

Standard assignment operator:.

Definition at line 148 of file base64.h.

References state.

void Base64Decoder::reset  )  [inline]
 

Reset the decoder.

This will clear the internal state (carry) so that new independent data can be decoded.

Definition at line 157 of file base64.h.

References state.


Member Data Documentation

uint32 Base64Decoder::state [private]
 

Current decode state (carry).

Definition at line 137 of file base64.h.

Referenced by Base64Decoder(), decode(), operator=(), and reset().


The documentation for this class was generated from the following files:
Generated on Sat Feb 19 22:35:21 2005 for Ray by doxygen 1.3.5