ARC SDK
Base64.h
1 // -*- indent-tabs-mode: nil -*-
2 
3 // Base64 encoding and decoding
4 
5 #ifndef ARCLIB_BASE64
6 #define ARCLIB_BASE64
7 
8 #include <string>
9 
10 namespace Arc {
11 
13 
15  class Base64 {
16  public:
18  Base64();
19  ~Base64();
20 
22 
25  static std::string encode(const std::string& bufplain);
26 
28  static std::string encode(const char* bufplain);
29 
31  static std::string encode(const char* bufplain, int size);
32 
34  static std::string encodeURLSafe(const std::string& bufplain);
35 
37  static std::string encodeURLSafe(const char* bufplain);
38 
40  static std::string encodeURLSafe(const char* bufplain, int size);
41 
43 
46  static std::string decode(const std::string& bufcoded);
47 
49  static std::string decode(const char* bufcoded);
50 
52  static std::string decode(const char* bufcoded, int size);
53 
55  static std::string decodeURLSafe(const std::string& bufcoded);
56 
58  static std::string decodeURLSafe(const char* bufcoded);
59 
61  static std::string decodeURLSafe(const char* bufcoded, int size);
62 
63  // The next 4 methods are legacy API kept for backwards compatibility. They
64  // can be removed in the next major version.
65  static int encode_len(int len);
67 
68  static int encode(char *encoded, const char *string, int len);
69  static int decode_len(const char *bufcoded);
71 
72  static int decode(char *bufplain, const char *bufcoded);
73  };
74 } // namespace Arc
75 
76 #endif // ARCLIB_BASE64
Arc namespace contains all core ARC classes.
Definition: ArcConfig.h:11
Base64()
Constructor is not implemented. Use static methods instead.
static std::string decode(const std::string &bufcoded)
Decode a string from base 64.
Base64 encoding and decoding.
Definition: Base64.h:15
static std::string decodeURLSafe(const std::string &bufcoded)
Decode a string from base 64 with URL-safe character set.
static std::string encode(const std::string &bufplain)
Encode a string to base 64.
static std::string encodeURLSafe(const std::string &bufplain)
Encode a string to base 64 using URL-safe character set.