aboutsummaryrefslogtreecommitdiff
path: root/src/base64.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-06-18 19:57:12 +0000
committerMike Buland <eichlan@xagasoft.com>2009-06-18 19:57:12 +0000
commit158d215b33d5b5bf07f73bb7547aae1fb12593b3 (patch)
treee4a0204370bc295509d1299c603dff13efe00cc3 /src/base64.h
parentededeea60b8dca5320e741c7859b54f32ad75cf7 (diff)
downloadlibbu++-158d215b33d5b5bf07f73bb7547aae1fb12593b3.tar.gz
libbu++-158d215b33d5b5bf07f73bb7547aae1fb12593b3.tar.bz2
libbu++-158d215b33d5b5bf07f73bb7547aae1fb12593b3.tar.xz
libbu++-158d215b33d5b5bf07f73bb7547aae1fb12593b3.zip
Added a new enum value to Bu::File, Bu::File::WriteNew which combines Write,
Truncate, and Create, the flags used most commonly when writing a new file. Also added the Bu::Base64 filter class, it does base64 encoding and decoding, it may need a couple more interfaces added, but for the most part, it's solid.
Diffstat (limited to 'src/base64.h')
-rw-r--r--src/base64.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/base64.h b/src/base64.h
new file mode 100644
index 0000000..2c3b331
--- /dev/null
+++ b/src/base64.h
@@ -0,0 +1,45 @@
1#ifndef BU_BASE64_H
2#define BU_BASE64_H
3
4#include "bu/filter.h"
5
6namespace Bu
7{
8 /**
9 *
10 *@ingroup Streams
11 */
12 class Base64 : public Bu::Filter
13 {
14 public:
15 enum Mode
16 {
17 Encode = 0x01,
18 Read = 0x01,
19 Decode = 0x02,
20 Write = 0x02
21 };
22
23 public:
24 Base64( Bu::Stream &rNext, Mode eMode );
25 virtual ~Base64();
26
27 virtual void start();
28 virtual size_t stop();
29 virtual size_t read( void *pBuf, size_t nBytes );
30 virtual size_t write( const void *pBuf, size_t nBytes );
31
32 virtual bool isOpen();
33
34 private:
35 int iBPos;
36 int iBuf;
37 size_t iTotalIn;
38 size_t iTotalOut;
39 static const char tblEnc[65];
40 char tblDec[80];
41 Mode eMode;
42 };
43};
44
45#endif