TDME2 1.9.121
Base64.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
5
6#include <tdme/tdme.h>
8
9using std::string;
10using std::vector;
11
12/**
13 * Base64 encoding/decoding class
14 * @author Andreas Drewke
15 */
17public:
18 /**
19 * @brief Encodes an string to base 64 string
20 * @param decodedString string to encode
21 * @returns encodedString
22 */
23 inline static const string encode(const string& decodedString) {
24 string encodedString;
25 encode(decodedString, encodedString);
26 return encodedString;
27 }
28
29 /**
30 * @brief Decodes an base64 encoded string
31 * @param encodedString encoded string
32 * @returns decodedString
33 */
34 inline static const string decode(const string& encodedString) {
35 string decodedString;
36 decode(encodedString, decodedString);
37 return decodedString;
38 }
39
40 /**
41 * Encodes an string to base 64 string
42 * @param decodedString string to encode
43 * @param encodedString encoded string
44 */
45 static void encode(const string& decodedString, string& encodedString);
46
47 /**
48 * Encodes uint8_t vector to base 64 string
49 * @param decodedData data to encode
50 * @param encodedString encoded string
51 */
52 static void encode(const vector<uint8_t>& decodedData, string& encodedString);
53
54 /**
55 * Decodes an base64 encoded string
56 * @param encodedString encoded string
57 * @param decodedString decoded string
58 */
59 static void decode(const string& encodedString, string& decodedString);
60
61 /**
62 * Decodes an base64 encoded string into uint8_t vector
63 * @param encodedString encoded string
64 * @param decodedData decoded data
65 */
66 static void decode(const string& encodedString, vector<uint8_t>& decodedData);
67
68};
Base64 encoding/decoding class.
Definition: Base64.h:16
static const string decode(const string &encodedString)
Decodes an base64 encoded string.
Definition: Base64.h:34
static const string encode(const string &decodedString)
Encodes an string to base 64 string.
Definition: Base64.h:23