#include <base64_stream_decoder.h>
◆ Base64StreamDecoder()
Base64StreamDecoder::Base64StreamDecoder |
( |
| ) |
|
19 :
state(States::AwaitingFirst) {
◆ find64()
23 return base64_inverse[base64c];
◆ Reset()
void Base64StreamDecoder::Reset |
( |
| ) |
|
27 state = States::AwaitingFirst;
◆ ConsumeChar()
int Base64StreamDecoder::ConsumeChar |
( |
char |
c, |
|
|
uint8_t * |
out |
|
) |
| |
30 uint8_t ic = (c !=
'=') ?
find64(static_cast<uint8_t>(c)) : 0;
35 case States::AwaitingFirst:
37 state = States::FirstByteOut;
39 case States::FirstByteOut: {
40 *out = (lastbits << 2) | (ic >> 4);
42 state = States::SecondByteOut;
45 case States::SecondByteOut: {
46 *out = (lastbits << 4) | (ic >> 2);
48 state = States::ThirdByteOut;
51 case States::ThirdByteOut: {
52 *out = (lastbits << 6) | ic;
54 state = States::AwaitingFirst;