NAWA 0.9
Web Application Framework for C++
encoding.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2019-2022 Tobias Flaig.
3 *
4 * This file is part of nawa.
5 *
6 * nawa is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License,
8 * version 3, as published by the Free Software Foundation.
9 *
10 * nawa is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with nawa. If not, see <https://www.gnu.org/licenses/>.
17 */
18
24#ifndef NAWA_ENCODING_H
25#define NAWA_ENCODING_H
26
27#include <string>
28
32namespace nawa::encoding {
41 std::string htmlEncode(std::string input, bool encodeAll = false);
42
51 std::string htmlDecode(std::string input);
52
59 std::string urlEncode(std::string const& input);
60
66 std::string urlDecode(std::string input);
67
74 bool isBase64(std::string const& input, bool allowWhitespaces = true);
75
84 std::string base64Encode(std::string const& input, size_t breakAfter = 0, std::string const& breakSequence = "");
85
93 std::string base64Decode(std::string const& input);
94
104 std::string quotedPrintableEncode(std::string const& input, std::string const& lineEnding = "\r\n",
105 bool replaceCrlf = false, bool qEncoding = false);
106
114 std::string quotedPrintableDecode(std::string input, bool qEncoding = false);
115
124 std::string makeEncodedWord(std::string const& input, bool base64 = false, bool onlyIfNecessary = true);
125
132 std::string punycodeEncode(std::string const& input);
133
140 std::string punycodeDecode(std::string const& input);
141}// namespace nawa::encoding
142
143#endif//NAWA_ENCODING_H
std::string makeEncodedWord(std::string const &input, bool base64=false, bool onlyIfNecessary=true)
Definition: encoding.cpp:339
std::string base64Decode(std::string const &input)
Definition: encoding.cpp:286
std::string quotedPrintableDecode(std::string input, bool qEncoding=false)
Definition: encoding.cpp:320
std::string base64Encode(std::string const &input, size_t breakAfter=0, std::string const &breakSequence="")
Definition: encoding.cpp:281
std::string quotedPrintableEncode(std::string const &input, std::string const &lineEnding="\r\n", bool replaceCrlf=false, bool qEncoding=false)
Definition: encoding.cpp:290
std::string punycodeEncode(std::string const &input)
Definition: encoding.cpp:355
std::string punycodeDecode(std::string const &input)
Definition: encoding.cpp:380
std::string urlEncode(std::string const &input)
Definition: encoding.cpp:238
bool isBase64(std::string const &input, bool allowWhitespaces=true)
Definition: encoding.cpp:270
std::string urlDecode(std::string input)
Definition: encoding.cpp:256
std::string htmlEncode(std::string input, bool encodeAll=false)
Definition: encoding.cpp:133
std::string htmlDecode(std::string input)
Definition: encoding.cpp:185