Deskflow
1.26.0.418
Keyboard and mouse sharing utility
Toggle main menu visibility
Loading...
Searching...
No Matches
Unicode.h
Go to the documentation of this file.
1
/*
2
* Deskflow -- mouse and keyboard sharing utility
3
* SPDX-FileCopyrightText: (C) 2012 - 2016 Synergy App Ltd
4
* SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman
5
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
6
*/
7
8
#pragma once
9
10
#include <cstdint>
11
#include <string>
12
14
18
class
Unicode
19
{
20
public
:
22
23
25
29
static
bool
isUTF8
(
const
std::string &);
30
32
37
static
std::string
UTF8ToUCS2
(
const
std::string &,
bool
*errors =
nullptr
);
38
40
45
static
std::string
UTF8ToUTF16
(
const
std::string &,
bool
*errors =
nullptr
);
46
48
52
static
std::string
UCS2ToUTF8
(
const
std::string_view &,
bool
*errors =
nullptr
);
53
55
59
static
std::string
UTF16ToUTF8
(
const
std::string_view &,
bool
*errors =
nullptr
);
60
62
63
private
:
64
// internal conversion to UTF8
65
static
std::string doUCS2ToUTF8(
const
uint8_t *src, uint32_t n,
bool
*errors);
66
static
std::string doUTF16ToUTF8(
const
uint8_t *src, uint32_t n,
bool
*errors);
67
68
// convert characters to/from UTF8
69
static
uint32_t fromUTF8(
const
uint8_t *&src, uint32_t &size);
70
static
void
toUTF8(std::string &dst, uint32_t c,
bool
*errors);
71
72
private
:
73
static
uint32_t s_invalid;
74
static
uint32_t s_replacement;
75
};
Unicode
Unicode utility functions.
Definition
Unicode.h:19
Unicode::UTF16ToUTF8
static std::string UTF16ToUTF8(const std::string_view &, bool *errors=nullptr)
Convert from UTF-16 to UTF-8.
Definition
Unicode.cpp:139
Unicode::isUTF8
static bool isUTF8(const std::string &)
Test UTF-8 string for validity.
Definition
Unicode.cpp:55
Unicode::UTF8ToUTF16
static std::string UTF8ToUTF16(const std::string &, bool *errors=nullptr)
Convert from UTF-8 to UTF-16 encoding.
Definition
Unicode.cpp:94
Unicode::UTF8ToUCS2
static std::string UTF8ToUCS2(const std::string &, bool *errors=nullptr)
Convert from UTF-8 to UCS-2 encoding.
Definition
Unicode.cpp:67
Unicode::UCS2ToUTF8
static std::string UCS2ToUTF8(const std::string_view &, bool *errors=nullptr)
Convert from UCS-2 to UTF-8.
Definition
Unicode.cpp:129
src
lib
base
Unicode.h
Generated by
1.18.0