2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2016-09-25 17:23:39 -07:00
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
#ifndef WPIUTIL_WPI_BASE64_H_
|
|
|
|
|
#define WPIUTIL_WPI_BASE64_H_
|
2016-09-25 17:23:39 -07:00
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
|
#include <string>
|
2021-06-06 16:13:58 -07:00
|
|
|
#include <string_view>
|
2021-11-01 07:48:26 -07:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
#include "wpi/span.h"
|
2016-09-25 17:23:39 -07:00
|
|
|
|
2018-04-29 23:33:19 -07:00
|
|
|
namespace wpi {
|
2017-08-13 00:55:56 -07:00
|
|
|
template <typename T>
|
|
|
|
|
class SmallVectorImpl;
|
|
|
|
|
class raw_ostream;
|
2016-09-25 17:23:39 -07:00
|
|
|
|
2021-06-06 16:13:58 -07:00
|
|
|
size_t Base64Decode(raw_ostream& os, std::string_view encoded);
|
2017-08-13 00:55:56 -07:00
|
|
|
|
2021-06-06 16:13:58 -07:00
|
|
|
size_t Base64Decode(std::string_view encoded, std::string* plain);
|
2017-08-13 00:55:56 -07:00
|
|
|
|
2021-06-06 16:13:58 -07:00
|
|
|
std::string_view Base64Decode(std::string_view encoded, size_t* num_read,
|
|
|
|
|
SmallVectorImpl<char>& buf);
|
2017-08-13 00:55:56 -07:00
|
|
|
|
2021-11-01 07:48:26 -07:00
|
|
|
size_t Base64Decode(std::string_view encoded, std::vector<uint8_t>* plain);
|
|
|
|
|
|
|
|
|
|
span<uint8_t> Base64Decode(std::string_view encoded, size_t* num_read,
|
|
|
|
|
SmallVectorImpl<uint8_t>& buf);
|
|
|
|
|
|
2021-06-06 16:13:58 -07:00
|
|
|
void Base64Encode(raw_ostream& os, std::string_view plain);
|
2017-08-13 00:55:56 -07:00
|
|
|
|
2021-06-06 16:13:58 -07:00
|
|
|
void Base64Encode(std::string_view plain, std::string* encoded);
|
2016-09-25 17:23:39 -07:00
|
|
|
|
2021-06-06 16:13:58 -07:00
|
|
|
std::string_view Base64Encode(std::string_view plain,
|
|
|
|
|
SmallVectorImpl<char>& buf);
|
2017-08-13 00:55:56 -07:00
|
|
|
|
2021-11-01 07:48:26 -07:00
|
|
|
void Base64Encode(raw_ostream& os, span<const uint8_t> plain);
|
|
|
|
|
|
|
|
|
|
void Base64Encode(span<const uint8_t> plain, std::string* encoded);
|
|
|
|
|
|
|
|
|
|
std::string_view Base64Encode(span<const uint8_t> plain,
|
|
|
|
|
SmallVectorImpl<char>& buf);
|
|
|
|
|
|
2016-09-25 17:23:39 -07:00
|
|
|
} // namespace wpi
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
#endif // WPIUTIL_WPI_BASE64_H_
|