Hall-D Software
alpha
|
Base64 encode stream class. More...
#include <base64.h>
Public Member Functions | |
ostreambuf (std::streambuf *sb, unsigned int width=76, char delimiter='\n') | |
construct using a streambuf More... | |
~ostreambuf () | |
closes the base64 stream More... | |
Protected Member Functions | |
std::streamsize | available () const |
remaining characters in the buffer More... | |
std::streamsize | taken () const |
number of characters in the buffer More... | |
Private Member Functions | |
int | sync () |
flush as much data as possible (overloaded from streambuf) More... | |
int | overflow (int c) |
write a character that surpasses buffer end (overloaded from streambuf) More... | |
void | reset () |
reset input buffer More... | |
int | write (const char *buf, size_t len) |
Takes care of inserting delimiters every delim_w characters. More... | |
Private Attributes | |
std::streambuf * | _sb |
char | delim |
unsigned int | delim_w |
unsigned int | col |
char | buf [3] |
Base64 encode stream class.
encodes data to base64 and writes it to another streambuf
xsputn
support yet and flush
doesn't flush partial data, for example suppose you wrote 2 bytes of a 3 byte chunk, it's possible to know the first 2 characters of the encoded data, but these are not flushedxstream::base64::ostreambuf::ostreambuf | ( | std::streambuf * | sb, |
unsigned int | width = 76 , |
||
char | delimiter = '\n' |
||
) |
construct using a streambuf
sb | streambuf where to write the encoded data |
width | width in bytes of lines (=0 for unlimited lines) |
delimiter | char to delimit the lines |
the same parameters need to be used when decoding or it will throw an exception indicating invalid data width=76
and delim=newline
are default because they are the values in the RFC
Definition at line 16 of file base64.cpp.
xstream::base64::ostreambuf::~ostreambuf | ( | ) |
closes the base64 stream
Definition at line 85 of file base64.cpp.
References _sb, xstream::ostreambuf::available(), buf, xstream::base64::encode(), LOG, and write().
|
inlineprotectedinherited |
remaining characters in the buffer
Definition at line 28 of file common.h.
Referenced by ~ostreambuf().
|
private |
write a character that surpasses buffer end (overloaded from streambuf)
Definition at line 71 of file base64.cpp.
References buf, c, xstream::base64::encode(), LOG, and write().
|
private |
reset input buffer
Definition at line 22 of file base64.cpp.
Referenced by ostreambuf(), and write().
|
private |
flush as much data as possible (overloaded from streambuf)
Definition at line 28 of file base64.cpp.
|
inlineprotectedinherited |
number of characters in the buffer
Definition at line 36 of file common.h.
Referenced by xstream::digest::stream::xsputn().
|
private |
Takes care of inserting delimiters every delim_w
characters.
Definition at line 48 of file base64.cpp.
References _sb, col, delim, delim_w, LOG, and reset().
Referenced by overflow(), and ~ostreambuf().
|
private |
Definition at line 35 of file base64.h.
Referenced by sync(), write(), and ~ostreambuf().
|
private |
buffer to store non encoded data
Definition at line 40 of file base64.h.
Referenced by overflow(), reset(), and ~ostreambuf().
|
private |
|
private |
|
private |