HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_Base64.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_Base64.h ( UT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __UT_Base64__
12 #define __UT_Base64__
13 
14 #include "UT_API.h"
15 
16 #include <SYS/SYS_Types.h>
17 
18 class UT_WorkBuffer;
19 class UT_IStream;
20 class UT_StringView;
21 
23 {
24 public:
25  /// @{
26  /// Encode a stream of binary into base64 encoding. If the input is not
27  /// a multiple of three, padding is added to indicate proper size.
28  static void encode(const UT_WorkBuffer &src, UT_WorkBuffer &dst);
29  static void encode(const uint8 *src, exint src_len, UT_WorkBuffer &dst);
30  static void encode(const UT_StringView &src, UT_WorkBuffer &dst);
31  /// @}
32 
33  /// @{
34  /// Decode a base64 encoded string into binary. Returns @c false if
35  /// decoding failed (bad input character, or wrong padding). Whitespace
36  /// is ignored on parsing.
37  static bool decode(const UT_WorkBuffer &src, UT_WorkBuffer &dst);
38  static bool decode(const UT_StringView& view, UT_WorkBuffer& dst);
39  static bool decode(UT_IStream &is, UT_WorkBuffer &dst);
40  /// @}
41 
42 private:
43  static bool decode_(const char* src, exint len, UT_WorkBuffer& dst);
44 };
45 
46 #endif // __UT_Base64__
int64 exint
Definition: SYS_Types.h:125
#define UT_API
Definition: UT_API.h:14
unsigned char uint8
Definition: SYS_Types.h:36
A utility class to do read-only operations on a subset of an existing string.
Definition: UT_StringView.h:39
GLenum GLenum dst
Definition: glcorearb.h:1793
Definition: core.h:982
GLenum src
Definition: glcorearb.h:1793