libfilezilla
Namespaces | Enumerations | Functions
encode.hpp File Reference

Functions to encode/decode strings. More...

#include "libfilezilla.hpp"
#include <string>
#include <vector>
Include dependency graph for encode.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 fz
 The namespace used by libfilezilla.
 

Enumerations

enum  base64_type { standard, url }
 Alphabet variations for base64. More...
 

Functions

template<typename Char >
int hex_char_to_int (Char c)
 Converts a hex digit to decimal int. More...
 
template<typename String >
std::vector< uint8_t > hex_decode (String const &in)
 
template<typename Char = char, bool Lowercase = true>
Char int_to_hex_char (int d)
 Converts an integer to the corresponding lowercase hex digit. More...
 
template<typename String , typename InString , bool Lowercase = true>
String hex_encode (InString const &data)
 
std::string base64_encode (std::string const &in, base64_type type=base64_type::standard, bool pad=true)
 Encodes raw input string to base64.
 
std::string base64_decode (std::string const &in)
 Decodes base64, ignores whitespace. Returns empty string on invalid input. More...
 
std::string percent_encode (std::string const &s, bool keep_slashes=false)
 Percent-enodes string. More...
 
std::string percent_encode (std::wstring const &s, bool keep_slashes=false)
 
std::wstring percent_encode_w (std::wstring const &s, bool keep_slashes=false)
 Percent-enodes wide-character. Non-ASCII characters are converted to UTF-8 befor they are encoded. More...
 
std::string percent_decode (std::string const &s)
 Percent-decodes string. More...
 

Detailed Description

Functions to encode/decode strings.

Defines functions to deal with hex, base64 and percent encoding.