diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-03-25 20:00:08 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-03-25 20:00:08 +0000 |
commit | 469bbcf0701e1eb8a6670c23145b0da87357e178 (patch) | |
tree | b5b062a16e46a6c5d3410b4e574cd0cc09057211 /src/stable/base64.h | |
parent | ee1b79396076edc4e30aefb285fada03bb45e80d (diff) | |
download | libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.gz libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.bz2 libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.xz libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.zip |
Code is all reorganized. We're about ready to release. I should write up a
little explenation of the arrangement.
Diffstat (limited to 'src/stable/base64.h')
-rw-r--r-- | src/stable/base64.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/stable/base64.h b/src/stable/base64.h new file mode 100644 index 0000000..c081ac1 --- /dev/null +++ b/src/stable/base64.h | |||
@@ -0,0 +1,59 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2011 Xagasoft, All rights reserved. | ||
3 | * | ||
4 | * This file is part of the libbu++ library and is released under the | ||
5 | * terms of the license contained in the file LICENSE. | ||
6 | */ | ||
7 | |||
8 | #ifndef BU_BASE64_H | ||
9 | #define BU_BASE64_H | ||
10 | |||
11 | #include "bu/filter.h" | ||
12 | #include "bu/exceptionbase.h" | ||
13 | |||
14 | namespace Bu | ||
15 | { | ||
16 | subExceptionDecl( Base64Exception ); | ||
17 | |||
18 | /** | ||
19 | * | ||
20 | *@ingroup Streams | ||
21 | */ | ||
22 | class Base64 : public Bu::Filter | ||
23 | { | ||
24 | public: | ||
25 | Base64( Bu::Stream &rNext, int iChunkSize=0 ); | ||
26 | virtual ~Base64(); | ||
27 | |||
28 | virtual void start(); | ||
29 | virtual Bu::size stop(); | ||
30 | virtual Bu::size read( void *pBuf, Bu::size nBytes ); | ||
31 | virtual Bu::size write( const void *pBuf, Bu::size nBytes ); | ||
32 | |||
33 | virtual bool isOpen(); | ||
34 | |||
35 | virtual bool isEos(); | ||
36 | |||
37 | private: | ||
38 | int iBPos; | ||
39 | int iBuf; | ||
40 | int iRPos; | ||
41 | int iChars; | ||
42 | bool bEosIn; | ||
43 | Bu::size iTotalIn; | ||
44 | Bu::size iTotalOut; | ||
45 | static const char tblEnc[65]; | ||
46 | char tblDec[80]; | ||
47 | enum Mode | ||
48 | { | ||
49 | Nothing = 0x00, | ||
50 | Encode = 0x01, | ||
51 | Decode = 0x02, | ||
52 | }; | ||
53 | Mode eMode; | ||
54 | int iChunkSize; | ||
55 | int iCurChunk; | ||
56 | }; | ||
57 | }; | ||
58 | |||
59 | #endif | ||