5 #include "../forms_export.h"
33 emoticon(
const xtd::ustring& name, std::initializer_list<char32_t> codepoints) : name_(name), codepoints_(codepoints) {}
38 emoticon(
const xtd::ustring& name,
const std::vector<char32_t>& codepoints) : name_(name), codepoints_(codepoints) {}
47 emoticon(std::initializer_list<char32_t> codepoints) : codepoints_(codepoints) {}
51 emoticon(
const std::vector<char32_t>& codepoints) : codepoints_(codepoints) {}
55 emoticon(char32_t codepoint) : codepoints_({codepoint}) {}
58 template<
typename type_t>
59 emoticon(
const xtd::ustring& name, std::initializer_list<type_t> codepoints) : name_(name) {
60 for(
auto codepoint : codepoints)
61 codepoints_.push_back(
static_cast<char32_t
>(codepoint));
64 template<
typename type_t>
65 emoticon(
const xtd::ustring& name,
const std::vector<type_t>& codepoints) : name_(name) {
66 for(
auto codepoint : codepoints)
67 codepoints_.push_back(
static_cast<char32_t
>(codepoint));
70 template<
typename type_t>
71 emoticon(
const xtd::ustring& name, type_t codepoint) : name_(name), codepoints_({
static_cast<char32_t
>(codepoint)}) {}
73 template<
typename type_t>
74 emoticon(std::initializer_list<type_t> codepoints) {
75 for(
auto codepoint : codepoints)
76 codepoints_.push_back(
static_cast<char32_t
>(codepoint));
79 template<
typename type_t>
80 emoticon(
const std::vector<type_t>& codepoints) {
81 for(
auto codepoint : codepoints)
82 codepoints_.push_back(
static_cast<char32_t
>(codepoint));
85 template<
typename type_t>
86 emoticon(type_t codepoint) : codepoints_({
static_cast<char32_t
>(codepoint)}) {}
89 emoticon(
const emoticon&) =
default;
90 emoticon& operator=(
const emoticon&) =
default;
91 bool operator==(
const emoticon& value) {
return name_ == value.name_ && codepoints_ == value.codepoints_;}
92 bool operator!=(
const emoticon& value) {
return !operator==(value);}
93 friend std::ostream& operator<<(std::ostream& os,
const xtd::forms::emoticon& emoticon) noexcept {
94 return os << emoticon.to_string();
104 const std::vector<char32_t>&
codepoints()
const {
return codepoints_;}
110 for (
auto codepoint : codepoints_) {
111 if (codepoint < 0x80) {
112 result.push_back(
static_cast<char>(codepoint));
113 }
else if (codepoint < 0x800) {
114 result.push_back(
static_cast<char>((codepoint >> 6) | 0xc0));
115 result.push_back(
static_cast<char>((codepoint & 0x3f) | 0x80));
116 }
else if (codepoint < 0x10000) {
117 result.push_back(
static_cast<char>((codepoint >> 12) | 0xe0));
118 result.push_back(
static_cast<char>(((codepoint >> 6) & 0x3f) | 0x80));
119 result.push_back(
static_cast<char>((codepoint & 0x3f) | 0x80));
121 result.push_back(
static_cast<char>((codepoint >> 18) | 0xf0));
122 result.push_back(
static_cast<char>(((codepoint >> 12) & 0x3f) | 0x80));
123 result.push_back(
static_cast<char>(((codepoint >> 6) & 0x3f) | 0x80));
124 result.push_back(
static_cast<char>((codepoint & 0x3f) | 0x80));
132 std::vector<char32_t> codepoints_;
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition: object.h:26
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
#define forms_export_
Define shared library export.
Definition: forms_export.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::object class.
Contains xtd::static_object class.
Contains xtd::ustring class.