CreOS SDK
The CreOS SDK allows you to interact with Avular robots
 
Loading...
Searching...
No Matches
base64.hpp
1// Copyright (C) 2024 Avular Holding B.V. - All Rights Reserved
2// You may use this code under the terms of the Avular
3// Software End-User License Agreement.
4//
5// You should have received a copy of the Avular
6// Software End-User License Agreement license with
7// this file, or download it from: avular.com/eula
8//
9/*****************************************************************************
10 * Created on: 2024 August 20
11 * Author: Robbert-Jan de Jager
12 *
13 * Implementation of the base64 encoding and decoding.
14 ****************************************************************************/
15#pragma once
16
17#include <creos/utils_global.hpp>
18#include <cstddef>
19#include <cstdint>
20#include <span>
21#include <string>
22#include <vector>
23
24namespace creos {
25
32std::string CREOS_UTILS_API base64_encode(const std::span<const std::byte>& data);
33
34inline std::string CREOS_UTILS_API base64_encode(const std::span<const uint8_t>& data) {
35 return base64_encode(std::span(reinterpret_cast<const std::byte*>(data.data()), data.size()));
36}
37
44std::vector<std::byte> CREOS_UTILS_API base64_decode(const std::string_view& data);
45
46} // namespace creos
The main namespace for the CreOS client library.
std::vector< std::byte > CREOS_UTILS_API base64_decode(const std::string_view &data)
Decodes base64 encoded data.
Definition base64.cpp:44
std::string CREOS_UTILS_API base64_encode(const std::span< const std::byte > &data)
Encodes data to base64.
Definition base64.cpp:21