9 #if !defined(__BASE64_H_INCLUDED__) 10 #define __BASE64_H_INCLUDED__ 1 19 int _base64Chars[]= {
'A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
'I',
'J',
'K',
'L',
'M',
'N',
'O',
'P',
'Q',
'R',
'S',
'T',
'U',
'V',
'W',
'X',
'Y',
'Z',
20 'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',
'i',
'j',
'k',
'l',
'm',
'n',
'o',
'p',
'q',
'r',
's',
't',
'u',
'v',
'w',
'x',
'y',
'z',
21 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
25 #define _0000_0011 0x03 26 #define _1111_1100 0xFC 27 #define _1111_0000 0xF0 28 #define _0011_0000 0x30 29 #define _0011_1100 0x3C 30 #define _0000_1111 0x0F 31 #define _1100_0000 0xC0 32 #define _0011_1111 0x3F 34 #define _EQUAL_CHAR (-1) 35 #define _UNKNOWN_CHAR (-2) 37 #define _IOS_FAILBIT std::ios_base::failbit 38 #define _IOS_EOFBIT std::ios_base::eofbit 39 #define _IOS_BADBIT std::ios_base::badbit 40 #define _IOS_GOODBIT std::ios_base::goodbit 43 template<
class _E =
char,
class _Tr = std::
char_traits<_E> >
61 *_To = _Tr::to_char_type(
'\r'); ++_To;
62 *_To = _Tr::to_char_type(
'\n'); ++_To;
73 *_To = _Tr::to_char_type(
'\r'); ++_To;
74 *_To = _Tr::to_char_type(
'\n'); ++_To;
75 *_To = _Tr::to_char_type(
' '); ++_To;
156 template<
class _II,
class _OI,
class _State,
class _Endline>
157 _II
put(_II _First, _II _Last, _OI _To, _State&, _Endline)
const 162 while(_First != _Last)
166 _3to4.
set_0(*_First);
173 *_To = _Tr::to_char_type(
'='); ++_To;
174 *_To = _Tr::to_char_type(
'='); ++_To;
178 _3to4.
set_1(*_First);
186 *_To = _Tr::to_char_type(
'='); ++_To;
190 _3to4.
set_2(*_First);
198 if(line_octets == 17)
215 template<
class _II,
class _OI,
class _State>
216 _II
get(_II _First, _II _Last, _OI _To, _State& _St)
const 221 while(_First != _Last)
231 if(++_First == _Last)
248 while(++_First != _Last)
252 if(_First == _Last) {
268 while(++_First != _Last)
272 if(_First == _Last) {
284 if(++_First == _Last)
309 while(++_First != _Last)
313 if(_First == _Last) {
364 if((_base64Chars[26] <= _Ch) && (_base64Chars[51] >= _Ch))
365 return _Ch - _base64Chars[26] + 26;
367 if((_base64Chars[52] <= _Ch) && (_base64Chars[61] >= _Ch))
368 return _Ch - _base64Chars[52] + 52;
370 if(_Ch == _Tr::to_int_type(
'='))
_OI operator()(_OI _To) const
static int _base64Chars[]
_OI operator()(_OI _To) const
int _getCharType(int _Ch) const
_OI operator()(_OI _To) const
_II put(_II _First, _II _Last, _OI _To, _State &, _Endline) const