| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SPVM::ExchangeAPI::Class; |
|
2
|
278
|
|
|
278
|
|
1975
|
use strict; |
|
|
278
|
|
|
|
|
590
|
|
|
|
278
|
|
|
|
|
8241
|
|
|
3
|
278
|
|
|
278
|
|
1469
|
use warnings; |
|
|
278
|
|
|
|
|
623
|
|
|
|
278
|
|
|
|
|
95998
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# Fields |
|
6
|
|
|
|
|
|
|
sub __name { |
|
7
|
12450
|
|
|
12450
|
|
18656
|
my $self = shift; |
|
8
|
12450
|
50
|
|
|
|
24790
|
if (@_) { |
|
9
|
0
|
|
|
|
|
0
|
$self->{__name} = $_[0]; |
|
10
|
0
|
|
|
|
|
0
|
return $self; |
|
11
|
|
|
|
|
|
|
} |
|
12
|
|
|
|
|
|
|
else { |
|
13
|
12450
|
|
|
|
|
28069
|
return $self->{__name}; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub __api { |
|
18
|
12450
|
|
|
12450
|
|
18415
|
my $self = shift; |
|
19
|
12450
|
50
|
|
|
|
23864
|
if (@_) { |
|
20
|
0
|
|
|
|
|
0
|
$self->{__api} = $_[0]; |
|
21
|
0
|
|
|
|
|
0
|
return $self; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
else { |
|
24
|
12450
|
|
|
|
|
35411
|
return $self->{__api}; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Class Methods |
|
29
|
|
|
|
|
|
|
sub __new { |
|
30
|
12450
|
|
|
12450
|
|
20845
|
my $class = shift; |
|
31
|
|
|
|
|
|
|
|
|
32
|
12450
|
|
|
|
|
35784
|
my $self = {@_}; |
|
33
|
|
|
|
|
|
|
|
|
34
|
12450
|
|
33
|
|
|
53410
|
bless $self, ref $class || $class; |
|
35
|
|
|
|
|
|
|
|
|
36
|
12450
|
|
|
|
|
28179
|
return $self; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
our $AUTOLOAD; |
|
40
|
|
|
|
|
|
|
sub AUTOLOAD { |
|
41
|
12450
|
|
|
12450
|
|
21365
|
my $self = shift; |
|
42
|
|
|
|
|
|
|
|
|
43
|
12450
|
|
|
|
|
25914
|
my $basic_type_name = $self->__name; |
|
44
|
|
|
|
|
|
|
|
|
45
|
12450
|
|
|
|
|
23387
|
my $method_name = $AUTOLOAD; |
|
46
|
12450
|
|
|
|
|
50858
|
$method_name =~ s/^SPVM::ExchangeAPI::Class:://; |
|
47
|
|
|
|
|
|
|
|
|
48
|
12450
|
|
|
|
|
29721
|
my $ret = $self->__api->call_method($basic_type_name, $method_name, @_); |
|
49
|
|
|
|
|
|
|
|
|
50
|
12450
|
|
|
|
|
50364
|
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 |