-
Notifications
You must be signed in to change notification settings - Fork 5
/
LBPBase64.h
28 lines (22 loc) · 1.16 KB
/
LBPBase64.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once
class CLBPString;
class CLBPBase64
{
public:
CLBPBase64();
virtual ~CLBPBase64();
// Decode a base64 string.
// pBufferOut must be large enough to accomodate the decoded data. It is safe to use the
// length of sBase64in because this Base64 string will always be about 33% bigger than the
// data it was created from. Returns the number of bytes written to pBufferOut.
// If pBufferOut is NULL, the function simply calculates the exact required buffer size.
size_t Decode(BYTE* pBufferOut, const CLBPString& sBase64in) const;
// The same as Decode() above, but stops when uMaxLength bytes have been decoded.
// Added 13.04.2010 to allow reading of data that was saved with garbage at the end
// due to a bug in the base 64 cache.
size_t Decode(BYTE* pBufferOut, const CLBPString& sBase64in, size_t maxLength) const;
// Encode data to a base64 string. If bAppend is true, the encoded string is appended to sBase64out.
// Otherwise sBase64out is replaced with the encoded string.
// Returns true if ok, false if unable to allocate the output buffer.
bool Encode(const BYTE* pBufferIn, size_t dwBufNumBytes, CLBPString& sBase64out, bool bAppend) const;
};