CppCommon  1.0.4.1
C++ Common Library
encoding.h
Go to the documentation of this file.
1 
9 #ifndef CPPCOMMON_STRING_ENCODING_H
10 #define CPPCOMMON_STRING_ENCODING_H
11 
12 #include <cstdint>
13 #include <string>
14 
15 namespace CppCommon {
16 
18 
23 class Encoding
24 {
25 public:
26  Encoding() = delete;
27  Encoding(const Encoding&) = delete;
28  Encoding(Encoding&&) = delete;
29  ~Encoding() = delete;
30 
31  Encoding& operator=(const Encoding&) = delete;
32  Encoding& operator=(Encoding&&) = delete;
33 
35 
41  static std::string ToUTF8(std::wstring_view wstr);
42 
44 
50  static std::wstring FromUTF8(std::string_view str);
51 
53 
57  static std::u16string UTF8toUTF16(std::string_view str);
59 
63  static std::u32string UTF8toUTF32(std::string_view str);
64 
66 
70  static std::string UTF16toUTF8(std::u16string_view str);
72 
76  static std::u32string UTF16toUTF32(std::u16string_view str);
77 
79 
83  static std::string UTF32toUTF8(std::u32string_view str);
85 
89  static std::u16string UTF32toUTF16(std::u32string_view str);
90 
92 
96  static std::string Base16Encode(std::string_view str);
98 
102  static std::string Base16Decode(std::string_view str);
103 
105 
109  static std::string Base32Encode(std::string_view str);
111 
115  static std::string Base32Decode(std::string_view str);
116 
118 
122  static std::string Base64Encode(std::string_view str);
124 
128  static std::string Base64Decode(std::string_view str);
129 
131 
135  static std::string URLEncode(std::string_view str);
137 
141  static std::string URLDecode(std::string_view str);
142 };
143 
146 } // namespace CppCommon
147 
148 #endif // CPPCOMMON_STRING_ENCODING_H
Encoding utilities.
Definition: encoding.h:24
static std::wstring FromUTF8(std::string_view str)
Convert UTF-8 encoded string to system wide-string.
Definition: encoding.cpp:33
static std::string ToUTF8(std::wstring_view wstr)
Convert system wide-string to UTF-8 encoded string.
Definition: encoding.cpp:19
static std::u32string UTF16toUTF32(std::u16string_view str)
Convert UTF-16 encoded string to UTF-32 encoded string.
Definition: encoding.cpp:83
Encoding & operator=(const Encoding &)=delete
static std::u32string UTF8toUTF32(std::string_view str)
Convert UTF-8 encoded string to UTF-32 encoded string.
Definition: encoding.cpp:60
static std::string Base16Decode(std::string_view str)
Base16 decode string.
Definition: encoding.cpp:155
static std::string Base16Encode(std::string_view str)
Base16 encode string.
Definition: encoding.cpp:134
static std::string Base64Decode(std::string_view str)
Base64 decode string.
Definition: encoding.cpp:418
static std::string Base64Encode(std::string_view str)
Base64 encode string.
Definition: encoding.cpp:387
static std::string URLDecode(std::string_view str)
URL decode string.
Definition: encoding.cpp:494
Encoding(Encoding &&)=delete
static std::u16string UTF32toUTF16(std::u32string_view str)
Convert UTF-32 encoded string to UTF-16 encoded string.
Definition: encoding.cpp:115
static std::string UTF16toUTF8(std::u16string_view str)
Convert UTF-16 encoded string to UTF-8 encoded string.
Definition: encoding.cpp:72
Encoding & operator=(Encoding &&)=delete
static std::u16string UTF8toUTF16(std::string_view str)
Convert UTF-8 encoded string to UTF-16 encoded string.
Definition: encoding.cpp:48
static std::string UTF32toUTF8(std::u32string_view str)
Convert UTF-32 encoded string to UTF-8 encoded string.
Definition: encoding.cpp:104
static std::string URLEncode(std::string_view str)
URL encode string.
Definition: encoding.cpp:471
static std::string Base32Decode(std::string_view str)
Base32 decode string.
Definition: encoding.cpp:286
static std::string Base32Encode(std::string_view str)
Base32 encode string.
Definition: encoding.cpp:208
Encoding(const Encoding &)=delete
C++ Common project definitions.
Definition: token_bucket.h:15