mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Signed-off-by: Alexey Polyudov <apolyudov@google.com> Change-Id: I0023ac6e40456fc4a8169c3173bcbff3b5ccc476
33 lines
857 B
C++
33 lines
857 B
C++
#ifndef PLATFORM_BASE64_UTILS_H_
|
|
#define PLATFORM_BASE64_UTILS_H_
|
|
|
|
#include "platform/byte_array.h"
|
|
#include "platform/port/string.h"
|
|
#include "platform/ptr.h"
|
|
#include "absl/strings/string_view.h"
|
|
|
|
namespace location {
|
|
namespace nearby {
|
|
|
|
class Base64Utils {
|
|
public:
|
|
static std::string encode(absl::string_view input);
|
|
static std::string encode(const ByteArray& bytes);
|
|
static std::string encode(ConstPtr<ByteArray> bytes);
|
|
|
|
template <typename T>
|
|
static T decode(absl::string_view base64_string);
|
|
template <>
|
|
Ptr<ByteArray> decode(absl::string_view base64_string);
|
|
template <>
|
|
ByteArray decode(absl::string_view base64_string);
|
|
static Ptr<ByteArray> decode(absl::string_view base64_string) {
|
|
return decode<Ptr<ByteArray>>(base64_string);
|
|
}
|
|
};
|
|
|
|
} // namespace nearby
|
|
} // namespace location
|
|
|
|
#endif // PLATFORM_BASE64_UTILS_H_
|