xtd 0.2.0
emoticon.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "../forms_export.hpp"
6#include <xtd/collections/generic/list>
7#include <xtd/icomparable>
8#include <xtd/iequatable>
9#include <xtd/object>
10#include <xtd/static>
11#include <xtd/string>
12#include <ostream>
13#include <vector>
14
16namespace xtd {
18 namespace forms {
32 class forms_export_ emoticon : public object, public xtd::iequatable<emoticon>, public icomparable<emoticon> {
33 struct data;
34 public:
36
39 static const emoticon empty();
41
43
48 emoticon(const xtd::string& name, std::initializer_list<char32> codepoints);
49
53 emoticon(const xtd::string& name, const xtd::array<char32>& codepoints);
54
58 emoticon(const xtd::string& name, char32 codepoint);
59
62 explicit emoticon(std::initializer_list<char32> codepoints);
63
66 explicit emoticon(const xtd::array<char32>& codepoints);
67
70 explicit emoticon(char32 codepoint);
72
74 template<class type_t>
75 emoticon(const xtd::string& name, std::initializer_list<type_t> codepoints) {
76 create_data();
77 name_(name);
78 for (auto codepoint : codepoints)
79 codepoints_().push_back(static_cast<char32>(codepoint));
80 }
81
82 template<class type_t>
83 emoticon(const xtd::string& name, const xtd::array<type_t>& codepoints) {
84 create_data();
85 name_(name);
86 for (auto codepoint : codepoints)
87 codepoints_().push_back(static_cast<char32>(codepoint));
88 }
89
90 template<class type_t>
91 emoticon(const xtd::string& name, type_t codepoint) {
92 create_data();
93 name_(name);
94 codepoints_({static_cast<char32>(codepoint)});
95 }
96
97 template<class type_t>
98 explicit emoticon(std::initializer_list<type_t> codepoints) {
99 create_data();
100 for (auto codepoint : codepoints)
101 codepoints_().push_back(static_cast<char32>(codepoint));
102 }
103
104 template<class type_t>
105 explicit emoticon(const xtd::array<type_t>& codepoints) {
106 create_data();
107 for (auto codepoint : codepoints)
108 codepoints_().push_back(static_cast<char32>(codepoint));
109 }
110
111 template<class type_t>
112 explicit emoticon(type_t codepoint) {
113 create_data();
114 codepoints_({static_cast<char32>(codepoint)});
115 }
116
117 emoticon();
118 emoticon(const emoticon& other);
119 emoticon& operator =(const emoticon& other);
121
123
127 const xtd::string& name() const noexcept;
128
131 xtd::array<char32> codepoints() const noexcept;
133
135
147 int32 compare_to(const emoticon &obj) const noexcept override;
148
152 bool equals(const xtd::object& obj) const noexcept override;
156 bool equals(const emoticon& other) const noexcept override;
157
160 xtd::size get_hash_code() const noexcept override;
161
164 xtd::string to_string() const noexcept override;
166
167 private:
168 void create_data();
169 void name_(const string& name);
170 xtd::collections::generic::list<char32>& codepoints_();
171 void codepoints_(xtd::array<char32>&& codepoints);
172
173 xtd::sptr<data> data_;
174 };
175 }
176}
177
179inline xtd::string operator +(const xtd::forms::emoticon& value_a, const xtd::forms::emoticon& value_b) {
180 return value_a.to_string() + value_b.to_string();
181}
182
183inline xtd::string operator +(const xtd::forms::emoticon& value_a, const char* value_b) {
184 return value_a.to_string() + value_b;
185}
186
187inline xtd::string operator +(const xtd::forms::emoticon& value_a, const xtd::string& value_b) {
188 return value_a.to_string() + value_b;
189}
190
191inline xtd::string operator +(const xtd::string& value_a, const xtd::forms::emoticon& value_b) {
192 return value_a + value_b.to_string();
193}
194
195inline xtd::string operator +(const char* value_a, const xtd::forms::emoticon& value_b) {
196 return xtd::string(value_a) + value_b.to_string();
197}
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:61
Represents text as a sequence of character units.
Definition basic_string.hpp:71
Represent a emoticon with name and codepoints.
Definition emoticon.hpp:32
emoticon(std::initializer_list< char32 > codepoints)
Initialize a new instance of emoticon class with specified codepoints.
emoticon(const xtd::array< char32 > &codepoints)
Initialize a new instance of emoticon class with specified codepoints.
const xtd::string & name() const noexcept
Gets name of emoticon.
static const emoticon empty()
Represents an empty emoticon.
xtd::string to_string() const noexcept override
Returns a string containing the codepoints of the emoticons.
emoticon(const xtd::string &name, char32 codepoint)
Initialize a new instance of emoticon class with specified name and codepoint.
emoticon(const xtd::string &name, const xtd::array< char32 > &codepoints)
Initialize a new instance of emoticon class with specified name and codepoints.
emoticon(const xtd::string &name, std::initializer_list< char32 > codepoints)
Initialize a new instance of emoticon class with specified name and codepoints.
emoticon(char32 codepoint)
Initialize a new instance of emoticon class with specified codepoint.
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.hpp:21
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:43
The xtd::shared_ptr_object is a shared pointer as std::shared_ptr.
Definition shared_ptr_object.hpp:30
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
char32_t char32
Represents a 32-bit unicode character.
Definition char32.hpp:26
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.hpp:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10