diff options
Diffstat (limited to 'src/base64.h')
-rw-r--r-- | src/base64.h | 45 |
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 | |||
6 | namespace 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 | ||