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