-
Notifications
You must be signed in to change notification settings - Fork 0
/
EmojiFactory.h
104 lines (86 loc) · 4.22 KB
/
EmojiFactory.h
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_EMOJI_FACTORY_H
#define ANDROID_EMOJI_FACTORY_H
namespace android {
// Abstract class for EmojiFactory.
//
// Here, PUA (or Android PUA) means Unicode PUA defined for various emoji. The
// PUA supports emoji of DoCoMo, KDDI, Softbank and Goomoji. Each PUA defined
// by the other vendors (careers) are called Vendor Specific PUA (vsp).
// For more information, go
// http://unicode.org/~mdavis/08080r-emoji-proposal/ (tentative)
class EmojiFactory {
public:
virtual ~EmojiFactory() {}
// Returns binary image data corresponding to "pua". The size of binary is
// stored to "size". Returns NULL if there's no mapping from the "pua" to a
// specific image. Currently, image format is all (animated) gif.
//
// TODO(dmiyakawa): there should be a way to tell users the format of the
// binary.
virtual const char *GetImageBinaryFromAndroidPua(int pua, int *size) = 0;
// Returns binary image data corresponding to "sjis", which is defined by
// each career. Returns NULL when there's no mapping for "sjis".
virtual const char *GetImageBinaryFromVendorSpecificSjis(unsigned short sjis,
int *size) {
return GetImageBinaryFromAndroidPua(
GetAndroidPuaFromVendorSpecificSjis(sjis), size);
}
// Returns binary image data corresponding to Vendor-specific PUA "vsp".
// Returns NULL when there's no mapping for "vsp".
virtual const char *GetImageBinaryFromVendorSpecificPua(int vsp,
int *size) {
return GetImageBinaryFromAndroidPua(
GetAndroidPuaFromVendorSpecificPua(vsp), size);
}
// Returns Android PUA corresponding to "sjis". Returns -1 when there's no
// mapping from "sjis" to a Android PUA.
virtual int GetAndroidPuaFromVendorSpecificSjis(unsigned short sjis) = 0;
// Returns Vendor-specific Shift jis code corresponding to "pua". Returns -1
// when ther's no mapping from "pua" to a specific sjis.
virtual int GetVendorSpecificSjisFromAndroidPua(int pua) = 0;
// Returns maximum Vendor-Specific PUA. This is the last valid value.
virtual int GetMaximumVendorSpecificPua() = 0;
// Returns minimum Vendor-Specific PUA.
virtual int GetMinimumVendorSpecificPua() = 0;
// Returns maximum Android PUA. This the last valid value.
virtual int GetMaximumAndroidPua() = 0;
// Returns minimum Android PUA.
virtual int GetMinimumAndroidPua() = 0;
// Returns Android PUA corresponding to Vendor-Specific Unicode "vsp". Returns
// -1 when there's no mapping from "vsp" to a Android PUA.
virtual int GetAndroidPuaFromVendorSpecificPua(int vsp) = 0;
// Returns Vendor-specific PUA corresponding to "pua". Returns -1 when
// there's no mapping from "pua" to a specific unicode.
virtual int GetVendorSpecificPuaFromAndroidPua(int pua) = 0;
// Returns non NULL string which defines the name of this factory.
// e.g. "docomo", "goomoji"
virtual const char *Name() const = 0;
// Get a specific implementation of EmojiFactory. If there's no implementation
// for "name", returns NULL.
// The ownership of the instance remains to this class, so users must not
// release it.
static EmojiFactory *GetImplementation(const char *name);
// Get an implementation of EmojiFactory. This assumes that, usually, there
// should be only one possible EmojiFactory implementation. If there are more
// than one implementations, most prefered one is returned.
// The ownership of the instance remains to this class, so users must not
// release it.
static EmojiFactory *GetAvailableImplementation();
};
} // namespace android
#endif // ANDROID_EMOJI_FACTORY_H