line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SPVM::ExchangeAPI::Class; |
2
|
278
|
|
|
278
|
|
1915
|
use strict; |
|
278
|
|
|
|
|
546
|
|
|
278
|
|
|
|
|
7893
|
|
3
|
278
|
|
|
278
|
|
1364
|
use warnings; |
|
278
|
|
|
|
|
627
|
|
|
278
|
|
|
|
|
91443
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# Fields |
6
|
|
|
|
|
|
|
sub __name { |
7
|
12650
|
|
|
12650
|
|
18316
|
my $self = shift; |
8
|
12650
|
50
|
|
|
|
24358
|
if (@_) { |
9
|
0
|
|
|
|
|
0
|
$self->{__name} = $_[0]; |
10
|
0
|
|
|
|
|
0
|
return $self; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
else { |
13
|
12650
|
|
|
|
|
27064
|
return $self->{__name}; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub __api { |
18
|
12650
|
|
|
12650
|
|
18409
|
my $self = shift; |
19
|
12650
|
50
|
|
|
|
23020
|
if (@_) { |
20
|
0
|
|
|
|
|
0
|
$self->{__api} = $_[0]; |
21
|
0
|
|
|
|
|
0
|
return $self; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
else { |
24
|
12650
|
|
|
|
|
35346
|
return $self->{__api}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Class Methods |
29
|
|
|
|
|
|
|
sub __new { |
30
|
12650
|
|
|
12650
|
|
19951
|
my $class = shift; |
31
|
|
|
|
|
|
|
|
32
|
12650
|
|
|
|
|
34506
|
my $self = {@_}; |
33
|
|
|
|
|
|
|
|
34
|
12650
|
|
33
|
|
|
51990
|
bless $self, ref $class || $class; |
35
|
|
|
|
|
|
|
|
36
|
12650
|
|
|
|
|
27766
|
return $self; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
our $AUTOLOAD; |
40
|
|
|
|
|
|
|
sub AUTOLOAD { |
41
|
12650
|
|
|
12650
|
|
21394
|
my $self = shift; |
42
|
|
|
|
|
|
|
|
43
|
12650
|
|
|
|
|
24657
|
my $basic_type_name = $self->__name; |
44
|
|
|
|
|
|
|
|
45
|
12650
|
|
|
|
|
24105
|
my $method_name = $AUTOLOAD; |
46
|
12650
|
|
|
|
|
48807
|
$method_name =~ s/^SPVM::ExchangeAPI::Class:://; |
47
|
|
|
|
|
|
|
|
48
|
12650
|
|
|
|
|
28548
|
my $ret = $self->__api->call_method($basic_type_name, $method_name, @_); |
49
|
|
|
|
|
|
|
|
50
|
12650
|
|
|
|
|
48130
|
return $ret; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
0
|
|
|
sub DESTROY {} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 Name |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
SPVM::ExchangeAPI::Class - Class Object |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 Description |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
C is a class object to call class methods. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 Usage |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# The same as the Int->__new(1) in SPVM language |
68
|
|
|
|
|
|
|
my $class = SPVM::ExchangeAPI::Class->__new(__name => 'Int', __api => $api); |
69
|
|
|
|
|
|
|
my $value = $class->new(1); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Create a class object using the L method in the L class: |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
my $class = $api->class('Int'); |
74
|
|
|
|
|
|
|
$class->new(1); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 Fields |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 __name |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
my $name = $self->__name; |
81
|
|
|
|
|
|
|
$self->__name($name); |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Gets and sets a class name. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 __api |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
my $api = $self->__api; |
88
|
|
|
|
|
|
|
$self->__api($api); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Gets and sets a L object. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 Class Methods |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 __new |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
my $class = SPVM::ExchangeAPI::Class->__new(%options); |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Creates a new C object. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Options: |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=over 2 |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * C<__name> : string |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
A class name |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item * C<__api> : SPVM::ExchangeAPI |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
A L object |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=back |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 Instance Methods |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 AUTOLOAD |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
$class->foo(@args); |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Calls L method in the L class using the L"__name"> field and the method name given in the C method. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 Copyright & License |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Copyright (c) 2023 Yuki Kimoto |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
MIT License |