Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
xstream::base64::istreambuf Class Reference

Base64 decode stream class. More...

#include <base64.h>

+ Inheritance diagram for xstream::base64::istreambuf:

Public Member Functions

 istreambuf (std::streambuf *sb, unsigned int width=76, char delimiter='\n')
 construct using a streambuf More...
 
 ~istreambuf ()
 closes the base64 stream More...
 

Private Member Functions

int underflow ()
 requests that input buffer be reloaded (overloaded from streambuf) More...
 

Private Attributes

std::streambuf * _sb
 
bool end
 
char delim
 
unsigned int delim_w
 
unsigned int col
 
char buf [3]
 

Detailed Description

Base64 decode stream class.

decodes data encoded in base64 and makes it available for reading. Only 4 bytes buffered at a time, and this is not configurable

Todo:
xsgetn support

Definition at line 106 of file base64.h.

Constructor & Destructor Documentation

xstream::base64::istreambuf::istreambuf ( std::streambuf *  sb,
unsigned int  width = 76,
char  delimiter = '\n' 
)

construct using a streambuf

Parameters
sbstreambuf where to read the encoded data from
widthwidth in bytes of lines (=0 for unlimited lines)
delimiterchar to delimit the lines

the parameters need to be the same specified at encoding or it will throw an exception indicating invalid data width=76 and delim=newline are default because they are the values in the RFC

if data is not delimited exactly at width characters with a newline, decoding will throw an exception. RFC specifies that whitespace should be ignored but this library is very strict when decoding, interpreting spurious whitespace as an error.

Definition at line 186 of file base64.cpp.

References buf, and LOG.

xstream::base64::istreambuf::~istreambuf ( )

closes the base64 stream

Definition at line 255 of file base64.cpp.

References LOG.

Member Function Documentation

int xstream::base64::istreambuf::underflow ( )
private

requests that input buffer be reloaded (overloaded from streambuf)

Definition at line 192 of file base64.cpp.

References _sb, buf, col, xstream::base64::decode(), delim, delim_w, end, xstream::base64::eof, and LOG.

Member Data Documentation

std::streambuf* xstream::base64::istreambuf::_sb
private

stream to read from

Definition at line 108 of file base64.h.

Referenced by underflow().

char xstream::base64::istreambuf::buf[3]
private

buffer to store decoded data

Definition at line 113 of file base64.h.

Referenced by istreambuf(), and underflow().

unsigned int xstream::base64::istreambuf::col
private

Definition at line 112 of file base64.h.

Referenced by underflow().

char xstream::base64::istreambuf::delim
private

Definition at line 110 of file base64.h.

Referenced by underflow().

unsigned int xstream::base64::istreambuf::delim_w
private

Definition at line 111 of file base64.h.

Referenced by underflow().

bool xstream::base64::istreambuf::end
private

signals if stream has reached the end

Definition at line 109 of file base64.h.

Referenced by underflow().


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