YPC  0.2.0
base64.h
1 //
2 // base64 encoding and decoding with C++.
3 // Version: 2.rc.08 (release candidate)
4 //
5 
6 #ifndef BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A
7 #define BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A
8 
9 #include <string>
10 
11 #if __cplusplus >= 201703L
12 #include <string_view>
13 #endif // __cplusplus >= 201703L
14 
15 std::string base64_encode(std::string const &s, bool url = false);
16 std::string base64_encode_pem(std::string const &s);
17 std::string base64_encode_mime(std::string const &s);
18 
19 std::string base64_decode(std::string const &s, bool remove_linebreaks = false);
20 std::string base64_encode(unsigned char const *, size_t len, bool url = false);
21 
22 #if __cplusplus >= 201703L
23 //
24 // Interface with std::string_view rather than const std::string&
25 // Requires C++17
26 // Provided by Yannic Bonenberger (https://github.com/Yannic)
27 //
28 std::string base64_encode(std::string_view s, bool url = false);
29 std::string base64_encode_pem(std::string_view s);
30 std::string base64_encode_mime(std::string_view s);
31 
32 std::string base64_decode(std::string_view s, bool remove_linebreaks = false);
33 #endif // __cplusplus >= 201703L
34 
35 #endif /* BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A */