line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ExtUtils::XSpp::Node::Method; |
2
|
21
|
|
|
21
|
|
9667
|
use strict; |
|
21
|
|
|
|
|
45
|
|
|
21
|
|
|
|
|
759
|
|
3
|
21
|
|
|
21
|
|
113
|
use warnings; |
|
21
|
|
|
|
|
41
|
|
|
21
|
|
|
|
|
694
|
|
4
|
21
|
|
|
21
|
|
116
|
use base 'ExtUtils::XSpp::Node::Function'; |
|
21
|
|
|
|
|
53
|
|
|
21
|
|
|
|
|
1947
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
ExtUtils::XSpp::Node::Method - Node representing a method |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 DESCRIPTION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
An L sub-class representing a single method |
13
|
|
|
|
|
|
|
declaration in a class such as |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
class FooBar { |
16
|
|
|
|
|
|
|
int foo(double someArgument); // <-- this one |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 METHODS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head2 new |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Creates a new C. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Most of the functionality of this class is inherited. This |
27
|
|
|
|
|
|
|
means that all named parameters of L |
28
|
|
|
|
|
|
|
are also valid for this class. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Additional named parameters accepted by the constructor: |
31
|
|
|
|
|
|
|
C, which can be an L |
32
|
|
|
|
|
|
|
object, C and C that are true if the method has |
33
|
|
|
|
|
|
|
been declared C or C. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub init { |
38
|
69
|
|
|
69
|
1
|
135
|
my $this = shift; |
39
|
69
|
|
|
|
|
666
|
my %args = @_; |
40
|
|
|
|
|
|
|
|
41
|
69
|
|
|
|
|
569
|
$this->SUPER::init( %args ); |
42
|
69
|
|
|
|
|
218
|
$this->{CLASS} = $args{class}; |
43
|
69
|
|
|
|
|
163
|
$this->{CONST} = $args{const}; |
44
|
69
|
|
|
|
|
433
|
$this->{VIRTUAL} = $args{virtual}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 perl_function_name |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Returns the name of the Perl function (method) that this |
50
|
|
|
|
|
|
|
method represents. It is constructed from the method's |
51
|
|
|
|
|
|
|
class's name and the C attribute. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub perl_function_name { |
56
|
60
|
|
|
60
|
1
|
108
|
my( $self ) = @_; |
57
|
|
|
|
|
|
|
|
58
|
60
|
100
|
|
|
|
269
|
if( $self->package_static ) { |
59
|
1
|
|
|
|
|
8
|
return $self->perl_name; |
60
|
|
|
|
|
|
|
} else { |
61
|
59
|
|
|
|
|
376
|
return $self->class->cpp_name . '::' . $self->perl_name; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub _call_code { |
66
|
64
|
|
|
64
|
|
129
|
my( $self, $arg_string ) = @_; |
67
|
|
|
|
|
|
|
|
68
|
64
|
|
|
|
|
251
|
return $self->_call_code_aliased($self->cpp_name, $arg_string); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub _call_code_aliased { |
72
|
65
|
|
|
65
|
|
133
|
my( $self, $alias_name, $arg_string ) = @_; |
73
|
|
|
|
|
|
|
|
74
|
65
|
100
|
|
|
|
207
|
if( $self->package_static ) { |
75
|
1
|
|
|
|
|
4
|
return $self->class->cpp_name . '::' . |
76
|
|
|
|
|
|
|
$alias_name . '(' . $arg_string . ')'; |
77
|
|
|
|
|
|
|
} else { |
78
|
64
|
|
|
|
|
312
|
return "THIS->" . |
79
|
|
|
|
|
|
|
$alias_name . '(' . $arg_string . ')'; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 is_method |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Returns true, since all objects of this class are methods. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|
89
|
111
|
|
|
111
|
1
|
411
|
sub is_method { 1 } |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 ACCESSORS |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 class |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Returns the class (L) that the |
96
|
|
|
|
|
|
|
method belongs to. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 virtual |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Returns whether the method was declared virtual. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 set_virtual |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Set whether the method is to be considered virtual. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 const |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Returns whether the method was declared const. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 access |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Returns C<'public'>, C<'protected'> or C<'private'> depending on |
113
|
|
|
|
|
|
|
method access declaration. By default, only public methods are |
114
|
|
|
|
|
|
|
generated. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |
117
|
|
|
|
|
|
|
|
118
|
89
|
|
|
89
|
1
|
452
|
sub class { $_[0]->{CLASS} } |
119
|
0
|
|
|
0
|
1
|
0
|
sub virtual { $_[0]->{VIRTUAL} } |
120
|
5
|
|
|
5
|
1
|
15
|
sub set_virtual { $_[0]->{VIRTUAL} = $_[1] } |
121
|
0
|
|
|
0
|
1
|
0
|
sub const { $_[0]->{CONST} } |
122
|
49
|
|
|
49
|
1
|
311
|
sub access { $_[0]->{ACCESS} } |
123
|
0
|
|
|
0
|
0
|
|
sub set_access { $_[0]->{ACCESS} = $_[1] } |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
1; |