The Battle for Wesnoth  1.17.0-dev
base64.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2021
3  by David White <dave@whitevine.net>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
18 #include <string_view>
19 #include <vector>
20 
21 namespace utils
22 {
23 using byte_string_view = std::basic_string_view<uint8_t>;
24 }
25 
26 // Official Base64 encoding (RFC4648)
27 namespace base64 {
28  std::vector<uint8_t> decode(std::string_view encoded);
29  std::string encode(utils::byte_string_view bytes);
30 }
31 // crypt()-compatible radix-64 encoding
32 namespace crypt64 {
33  std::vector<uint8_t> decode(std::string_view encoded);
34  std::string encode(utils::byte_string_view bytes);
35  // Single character functions. For special use only
36  int decode(char encoded_char);
37  char encode(int value);
38 }
static void decode(const std::string &input_file, const std::string &output_file)
Definition: wesnoth.cpp:182
std::basic_string_view< uint8_t > byte_string_view
Definition: base64.hpp:23
static void encode(const std::string &input_file, const std::string &output_file)
Definition: wesnoth.cpp:154