#include <base64.h>
Collaboration diagram for Base64Encoder:
Public Member Functions | |
Base64Encoder (int _lwidth=0) | |
Base64Encoder (const Base64Encoder &b) | |
Copy-constructor as usual. | |
~Base64Encoder () | |
Destructor; a no-op... | |
Base64Encoder & | operator= (const Base64Encoder &b) |
Standard assignment operator:. | |
void | SetLWidth (int _lwidth) |
Set the line width for output formatting. | |
void | reset () |
Reset the encoder. | |
size_t | EncodedSize (size_t inlen) |
Compute the required output buffer length. | |
ssize_t | encode (const char *in, size_t inlen, char *out, size_t outlen) |
Encode binary data as base-64 ASCII. | |
Static Public Member Functions | |
ssize_t | EncodeBuf (const char *in, size_t inlen, char *out, size_t outlen, int lwidth) |
Static version of encoding function. | |
Private Attributes | |
uint32 | state |
Current encode state (carry). | |
int | lwidth |
Line width to use in 4-tuples; 0 for unlimited. |
Definition at line 35 of file base64.h.
|
Construct a base-64 encoder; lwidth is the line width; see SetLWidth() |
|
Copy-constructor as usual.
|
|
Destructor; a no-op...
|
|
Encode binary data as base-64 ASCII. You can encode 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 the end-of-data indicator ('=') appended to the output, use inlen=0. You can use the static variant EncodeBuf if you can encode all data in a single call.
Definition at line 247 of file base64.cc. References lwidth, ssize_t, and state. Referenced by base64_ctest(). |
|
Static version of encoding function. See the member function encode() for details. Definition at line 253 of file base64.cc. References ssize_t. Referenced by do_test_base64(). |
|
Compute the required output buffer length. Computes the length of the output buffer when encoding input of size inlen. The returned value may be slightly too large but never too small. Definition at line 86 of file base64.h. References lwidth. |
|
Standard assignment operator:.
|
|
Reset the encoder. This will clear the internal state (carry) so that new independent data can be encoded.
Definition at line 75 of file base64.h. References state. |
|
Set the line width for output formatting. If set to 0, the output will not contain line breaks; if set to values >0, a newline will be inserted every lwidth*4 chars. Definition at line 61 of file base64.h. References lwidth. |
|
Line width to use in 4-tuples; 0 for unlimited.
Definition at line 39 of file base64.h. Referenced by Base64Encoder(), encode(), EncodedSize(), operator=(), and SetLWidth(). |
|
Current encode state (carry).
Definition at line 38 of file base64.h. Referenced by Base64Encoder(), encode(), operator=(), and reset(). |