blob: b93a1915e4bb2f1508737f27d6ea6d56d05a2c4c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/*
* Copyright (c) 2016-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <SwifTools/EmojiMapper.h>
#include <string>
#include <unordered_map>
namespace Swift {
//AUTO-GENERATED CONTENT
<%= mapping %>
std::vector<std::string> EmojiMapper::getCategories() {
std::vector<std::string> categories;
for (const auto& keyValuePair : emojisInCategory) {
categories.push_back(keyValuePair.first);
}
return categories;
}
std::string EmojiMapper::shortnameToUnicode(const std::string& shortname) {
auto unicodeSequenceIterator = shortnameUnicode.find(shortname);
if (unicodeSequenceIterator != shortnameUnicode.end()) {
return unicodeSequenceIterator->second;
}
else {
return std::string();
}
}
std::string EmojiMapper::unicodeToShortname(const std::string& unicode) {
auto shortnameIterator = unicodeShortname.find(unicode);
if (shortnameIterator != unicodeShortname.end()) {
return shortnameIterator->second;
}
else {
return std::string();
}
}
std::vector<std::string> EmojiMapper::categoryNameToEmojis(const std::string& categoryName) {
auto emojiIterator = emojisInCategory.find(categoryName);
if (emojiIterator != emojisInCategory.end()) {
return emojiIterator->second;
}
else {
return std::vector<std::string>();
}
}
std::string EmojiMapper::categoryToFlagshipUnicodeEmoji(const std::string& category) {
if (category == "recent") {
return shortnameToUnicode(":clock3:");
} else if (category == "people") {
return shortnameToUnicode(":smiley:");
} else if (category == "nature" ) {
return shortnameToUnicode(":dog:");
} else if (category == "food") {
return shortnameToUnicode(":apple:");
} else if (category == "activity") {
return shortnameToUnicode(":soccer:");
} else if (category == "travel") {
return shortnameToUnicode(":red_car:");
} else if (category == "objects") {
return shortnameToUnicode(":bulb:");
} else if (category == "symbols") {
return shortnameToUnicode(":heavy_division_sign:");
} else if (category == "flags") {
return shortnameToUnicode(":flag_white:");
}
return std::string();
}
}
|