line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Unicode::Emoji::KDDI - Emoji for au by KDDI |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Unicode::Emoji::E4U; |
8
|
|
|
|
|
|
|
my $e4u = Unicode::Emoji::E4U->new; |
9
|
|
|
|
|
|
|
my $kddi = $e4u->kddi; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $e; |
12
|
|
|
|
|
|
|
$e = $kddi->list->[0]; |
13
|
|
|
|
|
|
|
$e = $kddi->find(unicode => 'E488'); |
14
|
|
|
|
|
|
|
print "name_ja: ", $e->name_ja, "\n"; |
15
|
|
|
|
|
|
|
print "number: ", $e->number, "\n"; |
16
|
|
|
|
|
|
|
print "unicode: ", $e->unicode, "\n"; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $ke = $e->kddi_emoji; |
19
|
|
|
|
|
|
|
print "is_alt: ", $ke->is_alt, "\n"; |
20
|
|
|
|
|
|
|
print "unicode_string: ", $ke->unicode_string, "\n"; |
21
|
|
|
|
|
|
|
print "unicode_octets: ", $ke->unicode_octets, "\n"; |
22
|
|
|
|
|
|
|
print "cp932_string: ", $ke->cp932_string, "\n"; |
23
|
|
|
|
|
|
|
print "cp932_octets: ", $ke->cp932_octets, "\n"; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $kwe = $e->kddiweb_emoji; |
26
|
|
|
|
|
|
|
print "is_alt: ", $kwe->is_alt, "\n"; |
27
|
|
|
|
|
|
|
print "unicode_string: ", $kwe->unicode_string, "\n"; |
28
|
|
|
|
|
|
|
print "unicode_octets: ", $kwe->unicode_octets, "\n"; |
29
|
|
|
|
|
|
|
print "cp932_string: ", $kwe->cp932_string, "\n"; |
30
|
|
|
|
|
|
|
print "cp932_octets: ", $kwe->cp932_octets, "\n"; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 DEFINITION |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
L |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 AUTHOR |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Yusuke Kawasaki, L |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 SEE ALSO |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
L |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 COPYRIGHT |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Copyright 2009 Yusuke Kawasaki, all rights reserved. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
package Unicode::Emoji::KDDI; |
51
|
7
|
|
|
7
|
|
39
|
use Unicode::Emoji::Base; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
186
|
|
52
|
7
|
|
|
7
|
|
42
|
use Any::Moose; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
49
|
|
53
|
|
|
|
|
|
|
extends 'Unicode::Emoji::Base::File::Carrier'; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
56
|
|
|
|
|
|
|
|
57
|
1
|
|
|
1
|
|
7
|
sub _dataxml { 'kddi/carrier_data.xml'; } |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
package Unicode::Emoji::KDDI::XML::carrier_data; |
60
|
7
|
|
|
7
|
|
4237
|
use Any::Moose; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
40
|
|
61
|
|
|
|
|
|
|
has e => (is => 'ro', isa => 'Unicode::Emoji::KDDI::XML::e'); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
package Unicode::Emoji::KDDI::XML::e; |
64
|
7
|
|
|
7
|
|
3785
|
use Any::Moose; |
|
7
|
|
|
|
|
25
|
|
|
7
|
|
|
|
|
49
|
|
65
|
|
|
|
|
|
|
has name_ja => (is => 'ro', isa => 'Str'); |
66
|
|
|
|
|
|
|
has number => (is => 'ro', isa => 'Str'); |
67
|
|
|
|
|
|
|
has unicode => (is => 'ro', isa => 'Str'); |
68
|
|
|
|
|
|
|
has kddi_emoji => (is => 'ro', isa => 'Unicode::Emoji::KDDI::Emoji', lazy_build => 1); |
69
|
|
|
|
|
|
|
has kddiweb_emoji => (is => 'ro', isa => 'Unicode::Emoji::KDDIweb::Emoji', lazy_build => 1); |
70
|
|
|
|
|
|
|
|
71
|
1
|
|
|
1
|
|
53
|
sub _build_kddi_emoji { Unicode::Emoji::KDDI::Emoji->new(unicode_hex => $_[0]->unicode) }; |
72
|
1
|
|
|
1
|
|
155
|
sub _build_kddiweb_emoji { Unicode::Emoji::KDDIweb::Emoji->fromKDDI($_[0]->kddi_emoji) }; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
package Unicode::Emoji::KDDI::Emoji; |
75
|
7
|
|
|
7
|
|
4448
|
use Any::Moose; |
|
7
|
|
|
|
|
183
|
|
|
7
|
|
|
|
|
36
|
|
76
|
|
|
|
|
|
|
extends 'Unicode::Emoji::Base::Emoji::CP932'; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub _unicode_to_cp932 { |
79
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
80
|
1
|
|
|
|
|
3
|
my $code = shift; |
81
|
1
|
|
|
|
|
1
|
my $sjis; |
82
|
1
|
50
|
33
|
|
|
10
|
if ( $code >= 0xE468 && $code <= 0xE5DF ) { # 1-420 |
|
|
0
|
0
|
|
|
|
|
83
|
1
|
50
|
|
|
|
4
|
if ( $code <= 0xE4A6 ) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
84
|
1
|
|
|
|
|
3
|
$sjis = $code+4568; |
85
|
|
|
|
|
|
|
} elsif ( $code <= 0xE523 ) { |
86
|
0
|
|
|
|
|
0
|
$sjis = $code+4569; |
87
|
|
|
|
|
|
|
} elsif ( $code <= 0xE562 ) { |
88
|
0
|
|
|
|
|
0
|
$sjis = $code+4636; |
89
|
|
|
|
|
|
|
} elsif ( $code <= 0xE5B4 ) { |
90
|
0
|
|
|
|
|
0
|
$sjis = $code+4637; |
91
|
|
|
|
|
|
|
} elsif ( $code <= 0xE5CC ) { |
92
|
0
|
|
|
|
|
0
|
$sjis = $code+4656; |
93
|
|
|
|
|
|
|
} else { |
94
|
0
|
|
|
|
|
0
|
$sjis = $code+3443; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} elsif ( $code >= 0xEA80 && $code <= 0xEB8E ) { # 421- |
97
|
0
|
0
|
|
|
|
0
|
if ( $code <= 0xEAAB ) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
98
|
0
|
|
|
|
|
0
|
$sjis = $code+2259; |
99
|
|
|
|
|
|
|
} elsif ( $code <= 0xEAFA ) { |
100
|
0
|
|
|
|
|
0
|
$sjis = $code+2260; |
101
|
|
|
|
|
|
|
} elsif ( $code <= 0xEB0D ) { |
102
|
0
|
|
|
|
|
0
|
$sjis = $code+3287; |
103
|
|
|
|
|
|
|
} elsif ( $code <= 0xEB3B ) { |
104
|
0
|
|
|
|
|
0
|
$sjis = $code+2241; |
105
|
|
|
|
|
|
|
} elsif ( $code <= 0xEB7A ) { |
106
|
0
|
|
|
|
|
0
|
$sjis = $code+2308; |
107
|
|
|
|
|
|
|
} else { |
108
|
0
|
|
|
|
|
0
|
$sjis = $code+2309; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
} else { |
111
|
0
|
|
|
|
|
0
|
return; |
112
|
|
|
|
|
|
|
} |
113
|
1
|
|
|
|
|
18
|
$sjis |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
package Unicode::Emoji::KDDIweb::Emoji; |
117
|
7
|
|
|
7
|
|
5950
|
use Carp; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
752
|
|
118
|
7
|
|
|
7
|
|
41
|
use Any::Moose; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
31
|
|
119
|
|
|
|
|
|
|
extends 'Unicode::Emoji::Base::Emoji::CP932'; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub fromKDDI { |
122
|
1
|
|
|
1
|
|
3
|
my $class = shift; |
123
|
1
|
|
|
|
|
3
|
my $kddi = shift; |
124
|
|
|
|
|
|
|
# my $hex = sprintf('%04X' => unpack(n => $kddi->cp932_octets) - 1792); |
125
|
1
|
|
|
|
|
16
|
my $hex = join '+' => map {sprintf '%04X' => $_-1792} unpack 'n*' => $kddi->cp932_octets; |
|
1
|
|
|
|
|
10
|
|
126
|
1
|
50
|
|
|
|
16
|
$hex = '>'.$hex if $kddi->is_alt; |
127
|
1
|
|
|
|
|
9
|
$class->new(unicode_hex => $hex); |
128
|
|
|
|
|
|
|
}; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub _unicode_to_cp932 { |
131
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
132
|
1
|
|
|
|
|
4
|
my $code = shift; |
133
|
1
|
|
|
|
|
3
|
my $sjis = $code + 1792; |
134
|
1
|
|
|
|
|
15
|
$sjis; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |