base64_encode
Base64 encode and decode. Simple implementation, to be used with BLOB fields. If performance is important, look for an optimized implementation.
-
namespace lgraph_api
-
namespace base64
Functions
-
inline std::string Encode(const char *p, size_t s)
Encodes a string to Base64.
- 参数
p – The string to encode.
s – Size of the string.
- 返回
The encoded string.
-
inline std::string Encode(const std::string &str)
Encodes a string to Base64.
- 参数
str – The string to decode.
- 返回
The decoded string.
-
inline bool TryDecode(const char *p, size_t s, std::string &ret)
Tries to decode a Base64 string.
- 参数
p – The string to decode.
s – Size of the string.
ret – [out] The decoded string.
- 返回
True if the string was decoded successfully, false otherwise.
-
inline bool TryDecode(const std::string &str, std::string &out)
Tries to decode a Base64 string.
- 参数
str – The string to decode.
out – [out] The decoded string.
- 返回
True if the string was decoded successfully, false otherwise.
-
inline std::string Decode(const char *p, size_t s)
Decode a Base64 string and throw exception if fails.
- 抛出
InputError – Thrown if the string is not a valid Base64 string.
- 参数
p – The string to decode.
s – Size of the string.
- 返回
The decoded string.
-
inline std::string Decode(const std::string &str)
Decode a Base64 string and throw exception if fails.
- 抛出
InputError – Thrown if the string is not a valid Base64 string.
- 参数
str – The string to decode.
- 返回
The decoded string.
-
inline std::string Encode(const char *p, size_t s)
-
namespace base64