CppCommon  1.0.4.1
C++ Common Library
Public Member Functions | Static Public Member Functions | List of all members
CppCommon::Encoding Class Reference

Encoding utilities. More...

#include <encoding.h>

Public Member Functions

 Encoding ()=delete
 
 Encoding (const Encoding &)=delete
 
 Encoding (Encoding &&)=delete
 
 ~Encoding ()=delete
 
Encodingoperator= (const Encoding &)=delete
 
Encodingoperator= (Encoding &&)=delete
 

Static Public Member Functions

static std::string ToUTF8 (std::wstring_view wstr)
 Convert system wide-string to UTF-8 encoded string. More...
 
static std::wstring FromUTF8 (std::string_view str)
 Convert UTF-8 encoded string to system wide-string. More...
 
static std::u16string UTF8toUTF16 (std::string_view str)
 Convert UTF-8 encoded string to UTF-16 encoded string. More...
 
static std::u32string UTF8toUTF32 (std::string_view str)
 Convert UTF-8 encoded string to UTF-32 encoded string. More...
 
static std::string UTF16toUTF8 (std::u16string_view str)
 Convert UTF-16 encoded string to UTF-8 encoded string. More...
 
static std::u32string UTF16toUTF32 (std::u16string_view str)
 Convert UTF-16 encoded string to UTF-32 encoded string. More...
 
static std::string UTF32toUTF8 (std::u32string_view str)
 Convert UTF-32 encoded string to UTF-8 encoded string. More...
 
static std::u16string UTF32toUTF16 (std::u32string_view str)
 Convert UTF-32 encoded string to UTF-16 encoded string. More...
 
static std::string Base16Encode (std::string_view str)
 Base16 encode string. More...
 
static std::string Base16Decode (std::string_view str)
 Base16 decode string. More...
 
static std::string Base32Encode (std::string_view str)
 Base32 encode string. More...
 
static std::string Base32Decode (std::string_view str)
 Base32 decode string. More...
 
static std::string Base64Encode (std::string_view str)
 Base64 encode string. More...
 
static std::string Base64Decode (std::string_view str)
 Base64 decode string. More...
 
static std::string URLEncode (std::string_view str)
 URL encode string. More...
 
static std::string URLDecode (std::string_view str)
 URL decode string. More...
 

Detailed Description

Encoding utilities.

Encoding utilities contains methods for UTF-8, UTF-16, UTF-32 encoding conversions.

Thread-safe.

Definition at line 23 of file encoding.h.

Constructor & Destructor Documentation

◆ Encoding() [1/3]

CppCommon::Encoding::Encoding ( )
delete

◆ Encoding() [2/3]

CppCommon::Encoding::Encoding ( const Encoding )
delete

◆ Encoding() [3/3]

CppCommon::Encoding::Encoding ( Encoding &&  )
delete

◆ ~Encoding()

CppCommon::Encoding::~Encoding ( )
delete

Member Function Documentation

◆ Base16Decode()

std::string CppCommon::Encoding::Base16Decode ( std::string_view  str)
static

Base16 decode string.

Parameters
str- Base16 encoded string
Returns
Decoded string

Definition at line 155 of file encoding.cpp.

◆ Base16Encode()

std::string CppCommon::Encoding::Base16Encode ( std::string_view  str)
static

Base16 encode string.

Parameters
str- String to encode
Returns
Base16 encoded string

Definition at line 134 of file encoding.cpp.

◆ Base32Decode()

std::string CppCommon::Encoding::Base32Decode ( std::string_view  str)
static

Base32 decode string.

Parameters
str- Base32 encoded string
Returns
Decoded string

Definition at line 286 of file encoding.cpp.

◆ Base32Encode()

std::string CppCommon::Encoding::Base32Encode ( std::string_view  str)
static

Base32 encode string.

Parameters
str- String to encode
Returns
Base32 encoded string

Definition at line 208 of file encoding.cpp.

◆ Base64Decode()

std::string CppCommon::Encoding::Base64Decode ( std::string_view  str)
static

Base64 decode string.

Parameters
str- Base64 encoded string
Returns
Decoded string

Definition at line 418 of file encoding.cpp.

◆ Base64Encode()

std::string CppCommon::Encoding::Base64Encode ( std::string_view  str)
static

Base64 encode string.

Parameters
str- String to encode
Returns
Base64 encoded string

Definition at line 387 of file encoding.cpp.

◆ FromUTF8()

std::wstring CppCommon::Encoding::FromUTF8 ( std::string_view  str)
static

Convert UTF-8 encoded string to system wide-string.

System wide-string could be UTF-16 (Windows) or UTF-32 (Unix).

Parameters
str- UTF-8 encoded string to convert
Returns
System wide-string
Examples
string_encoding.cpp.

Definition at line 33 of file encoding.cpp.

◆ operator=() [1/2]

Encoding& CppCommon::Encoding::operator= ( const Encoding )
delete

◆ operator=() [2/2]

Encoding& CppCommon::Encoding::operator= ( Encoding &&  )
delete

◆ ToUTF8()

std::string CppCommon::Encoding::ToUTF8 ( std::wstring_view  wstr)
static

Convert system wide-string to UTF-8 encoded string.

System wide-string could be UTF-16 (Windows) or UTF-32 (Unix).

Parameters
wstr- System wide-string to convert
Returns
UTF-8 encoded string

Definition at line 19 of file encoding.cpp.

◆ URLDecode()

std::string CppCommon::Encoding::URLDecode ( std::string_view  str)
static

URL decode string.

Parameters
str- URL encoded string
Returns
Decoded string

Definition at line 494 of file encoding.cpp.

◆ URLEncode()

std::string CppCommon::Encoding::URLEncode ( std::string_view  str)
static

URL encode string.

Parameters
str- String to encode
Returns
URL encoded string

Definition at line 471 of file encoding.cpp.

◆ UTF16toUTF32()

std::u32string CppCommon::Encoding::UTF16toUTF32 ( std::u16string_view  str)
static

Convert UTF-16 encoded string to UTF-32 encoded string.

Parameters
str- UTF-16 encoded string to convert
Returns
UTF-32 encoded string

Definition at line 83 of file encoding.cpp.

◆ UTF16toUTF8()

std::string CppCommon::Encoding::UTF16toUTF8 ( std::u16string_view  str)
static

Convert UTF-16 encoded string to UTF-8 encoded string.

Parameters
str- UTF-16 encoded string to convert
Returns
UTF-8 encoded string

Definition at line 72 of file encoding.cpp.

◆ UTF32toUTF16()

std::u16string CppCommon::Encoding::UTF32toUTF16 ( std::u32string_view  str)
static

Convert UTF-32 encoded string to UTF-16 encoded string.

Parameters
str- UTF-32 encoded string to convert
Returns
UTF-16 encoded string

Definition at line 115 of file encoding.cpp.

◆ UTF32toUTF8()

std::string CppCommon::Encoding::UTF32toUTF8 ( std::u32string_view  str)
static

Convert UTF-32 encoded string to UTF-8 encoded string.

Parameters
str- UTF-32 encoded string to convert
Returns
UTF-8 encoded string

Definition at line 104 of file encoding.cpp.

◆ UTF8toUTF16()

std::u16string CppCommon::Encoding::UTF8toUTF16 ( std::string_view  str)
static

Convert UTF-8 encoded string to UTF-16 encoded string.

Parameters
str- UTF-8 encoded string to convert
Returns
UTF-16 encoded string

Definition at line 48 of file encoding.cpp.

◆ UTF8toUTF32()

std::u32string CppCommon::Encoding::UTF8toUTF32 ( std::string_view  str)
static

Convert UTF-8 encoded string to UTF-32 encoded string.

Parameters
str- UTF-8 encoded string to convert
Returns
UTF-32 encoded string

Definition at line 60 of file encoding.cpp.


The documentation for this class was generated from the following files: