The base encoder class.
Encoders read data from an input buffer, transform it in some way, then write the results to an output buffer. The resulting data may be of a different size or data type, and may or may not depend on previous data.
Contains functions for encoding and decoding strings in MIME Base64 notation.
Converts a string to base64 encoding.
Converts a string from base64 format into a normal string format.
An example of WvBase64Encoder:
/* * A WvBase64 example. * */ #include "wvbase64.h" #include "wvstream.h" #include "wvistreamlist.h" #include "wvencoderstream.h" #include "wvbufbase.h" int main() { WvEncoder *enc; enc = new WvBase64Encoder(); WvInPlaceBuf to_encode(100); WvInPlaceBuf encoded(100); to_encode.put("123",3); // to_encode contains the string to be encoded in base64 if (enc->encode(to_encode, encoded, true,true)) printf ("This is the result: %s\n", (char *) encoded.get(1)); // Displayed on screen: // This is the result: MTIz WvEncoder *dec; dec = new WvBase64Decoder(); WvInPlaceBuf to_decode(100); WvInPlaceBuf decoded(100); to_decode.put("MTIz",4); // to_encode contains the string to be encoded in base64 if (dec->encode(to_decode, decoded, true)) printf ("This is the result: %s\n", (char *) decoded.get(1)); // Displayed on screen: // This is the result: 123 return 0; }