xtd 0.2.0
Loading...
Searching...
No Matches
emoticon.h
Go to the documentation of this file.
1
4#pragma once
5#include "../forms_export.h"
6#include <xtd/iequatable>
7#include <xtd/object>
8#include <xtd/static>
9#include <xtd/string>
10#include <ostream>
11#include <vector>
12
14namespace xtd {
16 namespace forms {
30 class forms_export_ emoticon : public object, public xtd::iequatable<emoticon> {
31 struct data;
32 public:
34
37 static const emoticon empty();
39
41
46 emoticon(const xtd::string& name, std::initializer_list<char32> codepoints);
47
51 emoticon(const xtd::string& name, const std::vector<char32>& codepoints);
52
56 emoticon(const xtd::string& name, char32 codepoint);
57
60 explicit emoticon(std::initializer_list<char32> codepoints);
61
64 explicit emoticon(const std::vector<char32>& codepoints);
65
68 explicit emoticon(char32 codepoint);
70
72 template<typename type_t>
73 emoticon(const xtd::string& name, std::initializer_list<type_t> codepoints) {
74 create_data();
75 name_(name);
76 for (auto codepoint : codepoints)
77 codepoints_().push_back(static_cast<char32>(codepoint));
78 }
79
80 template<typename type_t>
81 emoticon(const xtd::string& name, const std::vector<type_t>& codepoints) {
82 create_data();
83 name_(name);
84 for (auto codepoint : codepoints)
85 codepoints_().push_back(static_cast<char32>(codepoint));
86 }
87
88 template<typename type_t>
89 emoticon(const xtd::string& name, type_t codepoint) {
90 create_data();
91 name_(name);
92 codepoints_({static_cast<char32>(codepoint)});
93 }
94
95 template<typename type_t>
96 explicit emoticon(std::initializer_list<type_t> codepoints) {
97 create_data();
98 for (auto codepoint : codepoints)
99 codepoints_().push_back(static_cast<char32>(codepoint));
100 }
101
102 template<typename type_t>
103 explicit emoticon(const std::vector<type_t>& codepoints) {
104 create_data();
105 for (auto codepoint : codepoints)
106 codepoints_().push_back(static_cast<char32>(codepoint));
107 }
108
109 template<typename type_t>
110 explicit emoticon(type_t codepoint) {
111 create_data();
112 codepoints_({static_cast<char32>(codepoint)});
113 }
114
115 emoticon();
116 emoticon(const emoticon& other);
117 emoticon& operator =(const emoticon& other);
119
121
125 const xtd::string& name() const noexcept;
126
129 const std::vector<char32>& codepoints() const noexcept;
131
133
135 using object::equals;
136 bool equals(const emoticon& value) const noexcept override;
137
140 xtd::string to_string() const noexcept override;
142
143 private:
144 void create_data();
145 void name_(const string& name);
146 std::vector<char32>& codepoints_();
147 void codepoints_(std::vector<char32>&& codepoints);
148
149 xtd::sptr<data> data_;
150 };
151 }
152}
153
155inline xtd::string operator +(const xtd::forms::emoticon& value_a, const xtd::forms::emoticon& value_b) {
156 return value_a.to_string() + value_b.to_string();
157}
158
159inline xtd::string operator +(const xtd::forms::emoticon& value_a, const char* value_b) {
160 return value_a.to_string() + value_b;
161}
162
163inline xtd::string operator +(const xtd::forms::emoticon& value_a, const xtd::string& value_b) {
164 return value_a.to_string() + value_b;
165}
166
167inline xtd::string operator +(const xtd::string& value_a, const xtd::forms::emoticon& value_b) {
168 return value_a + value_b.to_string();
169}
170
171inline xtd::string operator +(const char* value_a, const xtd::forms::emoticon& value_b) {
172 return xtd::string(value_a) + value_b.to_string();
173}
Represents text as a sequence of character units.
Definition basic_string.h:79
Represent a emoticon with name and codepoints.
Definition emoticon.h:30
emoticon(std::initializer_list< 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, const std::vector< char32 > &codepoints)
Initialize a new instance of emoticon class with specified name and codepoints.
emoticon(const std::vector< char32 > &codepoints)
Initialize a new instance of emoticon class with specified codepoints.
emoticon(const xtd::string &name, char32 codepoint)
Initialize a new instance of emoticon class with specified name and codepoint.
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 method that a value type or class implements to create a type-specific method f...
Definition iequatable.h:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:42
#define forms_export_
Define shared library export.
Definition forms_export.h:13
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.h:43
char32_t char32
Represents a 32-bit unicode character.
Definition char32.h:26
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.h:25
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10