| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
418
|
|
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
push(@::bean_desc, { |
|
4
|
|
|
|
|
|
|
bean_opt => { |
|
5
|
|
|
|
|
|
|
abstract => 'Ordered MULTI bean attribute information', |
|
6
|
|
|
|
|
|
|
package => 'PerlBean::Attribute::Multi::Ordered', |
|
7
|
|
|
|
|
|
|
use_perl_version => 5.005, |
|
8
|
|
|
|
|
|
|
base => [ qw(PerlBean::Attribute::Multi)], |
|
9
|
|
|
|
|
|
|
description => <
|
|
10
|
|
|
|
|
|
|
C contains ordered MULTI bean attribute information. It is a subclass of C. The code generation and documentation methods from C are implemented. |
|
11
|
|
|
|
|
|
|
EOF |
|
12
|
|
|
|
|
|
|
short_description => 'contains ordered MULTI bean attribute information', |
|
13
|
|
|
|
|
|
|
synopsis => &get_syn(), |
|
14
|
|
|
|
|
|
|
}, |
|
15
|
|
|
|
|
|
|
attr_opt => [ |
|
16
|
|
|
|
|
|
|
], |
|
17
|
|
|
|
|
|
|
meth_opt => [ |
|
18
|
|
|
|
|
|
|
{ |
|
19
|
|
|
|
|
|
|
method_name => 'create_methods', |
|
20
|
|
|
|
|
|
|
description => <
|
|
21
|
|
|
|
|
|
|
__SUPER_POD__ Access methods are B, B, B, B, B, B, B, B and B. |
|
22
|
|
|
|
|
|
|
EOF |
|
23
|
|
|
|
|
|
|
body => <<'EOF', |
|
24
|
|
|
|
|
|
|
my $self = shift; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
return( |
|
27
|
|
|
|
|
|
|
$self->create_method_get(), |
|
28
|
|
|
|
|
|
|
$self->create_method_exists(), |
|
29
|
|
|
|
|
|
|
$self->create_method_pop(), |
|
30
|
|
|
|
|
|
|
$self->create_method_push(), |
|
31
|
|
|
|
|
|
|
$self->create_method_set(), |
|
32
|
|
|
|
|
|
|
$self->create_method_set_idx(), |
|
33
|
|
|
|
|
|
|
$self->create_method_set_num(), |
|
34
|
|
|
|
|
|
|
$self->create_method_shift(), |
|
35
|
|
|
|
|
|
|
$self->create_method_unshift(), |
|
36
|
|
|
|
|
|
|
); |
|
37
|
|
|
|
|
|
|
EOF |
|
38
|
|
|
|
|
|
|
}, |
|
39
|
|
|
|
|
|
|
{ |
|
40
|
|
|
|
|
|
|
method_name => 'create_method_get', |
|
41
|
|
|
|
|
|
|
documented => 0, |
|
42
|
|
|
|
|
|
|
body => <<'THE_EOF', |
|
43
|
|
|
|
|
|
|
my $self = shift; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $an = $self->get_method_factory_name(); |
|
46
|
|
|
|
|
|
|
my $op = &{$MOF}('get'); |
|
47
|
|
|
|
|
|
|
my $mb = $self->get_method_base(); |
|
48
|
|
|
|
|
|
|
my $pkg_us = $self->get_package_us(); |
|
49
|
|
|
|
|
|
|
my $desc = defined( $self->get_short_description() ) ? $self->get_short_description() : 'not described option'; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Make body |
|
52
|
|
|
|
|
|
|
my $body = <
|
|
53
|
|
|
|
|
|
|
${IND}my \$self${AO}=${AO}shift; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
${IND}if${BCP}(${ACS}scalar${BFP}(\@_)${ACS})${PBOC[1]}{ |
|
56
|
|
|
|
|
|
|
${IND}${IND}my \@ret${AO}=${AO}(); |
|
57
|
|
|
|
|
|
|
${IND}${IND}foreach my \$i (\@_)${PBOC[2]}{ |
|
58
|
|
|
|
|
|
|
${IND}${IND}${IND}push${BFP}(${ACS}\@ret,${AC}\$self->{$pkg_us}{$an}[${ACS}int${BFP}(\$i)${ACS}]${ACS}); |
|
59
|
|
|
|
|
|
|
${IND}${IND}} |
|
60
|
|
|
|
|
|
|
${IND}${IND}return${BFP}(\@ret); |
|
61
|
|
|
|
|
|
|
${IND}}${PBCC[1]}else${PBOC[1]}{ |
|
62
|
|
|
|
|
|
|
${IND}${IND}# Return the full list |
|
63
|
|
|
|
|
|
|
${IND}${IND}return${BFP}(${ACS}\@{${ACS}\$self->{$pkg_us}{$an}${ACS}}${ACS}); |
|
64
|
|
|
|
|
|
|
${IND}} |
|
65
|
|
|
|
|
|
|
EOF |
|
66
|
|
|
|
|
|
|
# Create and return the method |
|
67
|
|
|
|
|
|
|
return( PerlBean::Method->new( { |
|
68
|
|
|
|
|
|
|
method_name => "$op$mb", |
|
69
|
|
|
|
|
|
|
parameter_description => "${ACS}\[${ACS}INDEX_ARRAY${ACS}]${ACS}", |
|
70
|
|
|
|
|
|
|
documented => $self->is_documented(), |
|
71
|
|
|
|
|
|
|
volatile => 1, |
|
72
|
|
|
|
|
|
|
description => <
|
|
73
|
|
|
|
|
|
|
Returns an C containing ${desc}. C is an optional list of indexes which when specified causes only the indexed elements in the ordered list to be returned. If not specified, all elements are returned. |
|
74
|
|
|
|
|
|
|
EOF |
|
75
|
|
|
|
|
|
|
body => $body, |
|
76
|
|
|
|
|
|
|
} ) ); |
|
77
|
|
|
|
|
|
|
THE_EOF |
|
78
|
|
|
|
|
|
|
}, |
|
79
|
|
|
|
|
|
|
{ |
|
80
|
|
|
|
|
|
|
method_name => 'create_method_exists', |
|
81
|
|
|
|
|
|
|
documented => 0, |
|
82
|
|
|
|
|
|
|
body => <<'THE_EOF', |
|
83
|
|
|
|
|
|
|
my $self = shift; |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
my $an = $self->get_method_factory_name(); |
|
86
|
|
|
|
|
|
|
my $op = &{$MOF}('exists'); |
|
87
|
|
|
|
|
|
|
my $mb = $self->get_method_base(); |
|
88
|
|
|
|
|
|
|
my $pkg_us = $self->get_package_us(); |
|
89
|
|
|
|
|
|
|
my $desc = defined( $self->get_short_description() ) ? $self->get_short_description() : 'not described option'; |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# Make body |
|
92
|
|
|
|
|
|
|
my $body = <
|
|
93
|
|
|
|
|
|
|
${IND}my \$self${AO}=${AO}shift; |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
${IND}# Count occurrences |
|
96
|
|
|
|
|
|
|
${IND}my \$count${AO}=${AO}0; |
|
97
|
|
|
|
|
|
|
${IND}foreach my \$val1 (\@_)${PBOC[1]}{ |
|
98
|
|
|
|
|
|
|
${IND}${IND}foreach my \$val2 (${ACS}\@{${ACS}\$self->{$pkg_us}{$an}${ACS}}${ACS})${PBOC[2]}{ |
|
99
|
|
|
|
|
|
|
${IND}${IND}${IND}(${ACS}\$val1${AO}eq${AO}\$val2${ACS})${AO}&&${AO}\$count${AO}++; |
|
100
|
|
|
|
|
|
|
${IND}${IND}} |
|
101
|
|
|
|
|
|
|
${IND}} |
|
102
|
|
|
|
|
|
|
${IND}return${BFP}(\$count); |
|
103
|
|
|
|
|
|
|
EOF |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# Create and return the method |
|
106
|
|
|
|
|
|
|
return( PerlBean::Method->new( { |
|
107
|
|
|
|
|
|
|
method_name => "$op$mb", |
|
108
|
|
|
|
|
|
|
parameter_description => 'ARRAY', |
|
109
|
|
|
|
|
|
|
documented => $self->is_documented(), |
|
110
|
|
|
|
|
|
|
volatile => 1, |
|
111
|
|
|
|
|
|
|
description => <
|
|
112
|
|
|
|
|
|
|
Returns the count of items in C that are in ${desc}. |
|
113
|
|
|
|
|
|
|
EOF |
|
114
|
|
|
|
|
|
|
body => $body, |
|
115
|
|
|
|
|
|
|
} ) ); |
|
116
|
|
|
|
|
|
|
THE_EOF |
|
117
|
|
|
|
|
|
|
}, |
|
118
|
|
|
|
|
|
|
{ |
|
119
|
|
|
|
|
|
|
method_name => 'create_method_pop', |
|
120
|
|
|
|
|
|
|
documented => 0, |
|
121
|
|
|
|
|
|
|
body => <<'THE_EOF', |
|
122
|
|
|
|
|
|
|
my $self = shift; |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
my $an = $self->get_method_factory_name(); |
|
125
|
|
|
|
|
|
|
my $an_esc = $self->_esc_aq($an); |
|
126
|
|
|
|
|
|
|
my $op = &{$MOF}('pop'); |
|
127
|
|
|
|
|
|
|
my $mb = $self->get_method_base(); |
|
128
|
|
|
|
|
|
|
my $ec = $self->get_exception_class(); |
|
129
|
|
|
|
|
|
|
my $pkg = $self->get_package(); |
|
130
|
|
|
|
|
|
|
my $pkg_us = $self->get_package_us(); |
|
131
|
|
|
|
|
|
|
my $desc = defined( $self->get_short_description() ) ? $self->get_short_description() : 'not described option'; |
|
132
|
|
|
|
|
|
|
my $empt = $self->is_allow_empty() ? '' : ' After popping at least one element must remain.'; |
|
133
|
|
|
|
|
|
|
my $exc = ' On error an exception C<' . $self->get_exception_class() . '> is thrown.'; |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
# Make body |
|
136
|
|
|
|
|
|
|
my $body = <
|
|
137
|
|
|
|
|
|
|
${IND}my \$self${AO}=${AO}shift; |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
EOF |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
# Check if list value is allowed to be empty |
|
142
|
|
|
|
|
|
|
if (! $self->is_allow_empty()) { |
|
143
|
|
|
|
|
|
|
$body .= <
|
|
144
|
|
|
|
|
|
|
${IND}# List value for $an_esc is not allowed to be empty |
|
145
|
|
|
|
|
|
|
${IND}(scalar${BFP}(\@_)${AO}>${AO}1)${AO}||${AO}throw $ec${BFP}("ERROR: ${pkg}::$op$mb, list value may not be empty."); |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
EOF |
|
148
|
|
|
|
|
|
|
} |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
# Method tail |
|
151
|
|
|
|
|
|
|
$body .= <
|
|
152
|
|
|
|
|
|
|
${IND}# Pop an element from the list |
|
153
|
|
|
|
|
|
|
${IND}return${BFP}(${ACS}pop${BFP}(${ACS}\@{${ACS}\$self->{$pkg_us}{$an}${ACS}}${ACS})${ACS}); |
|
154
|
|
|
|
|
|
|
EOF |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
# Create and return the method |
|
157
|
|
|
|
|
|
|
return( PerlBean::Method->new( { |
|
158
|
|
|
|
|
|
|
method_name => "$op$mb", |
|
159
|
|
|
|
|
|
|
documented => $self->is_documented(), |
|
160
|
|
|
|
|
|
|
volatile => 1, |
|
161
|
|
|
|
|
|
|
description => <
|
|
162
|
|
|
|
|
|
|
Pop and return an element off ${desc}.${empt}${exc} |
|
163
|
|
|
|
|
|
|
EOF |
|
164
|
|
|
|
|
|
|
body => $body, |
|
165
|
|
|
|
|
|
|
} ) ); |
|
166
|
|
|
|
|
|
|
THE_EOF |
|
167
|
|
|
|
|
|
|
}, |
|
168
|
|
|
|
|
|
|
{ |
|
169
|
|
|
|
|
|
|
method_name => 'create_method_push', |
|
170
|
|
|
|
|
|
|
documented => 0, |
|
171
|
|
|
|
|
|
|
body => <<'THE_EOF', |
|
172
|
|
|
|
|
|
|
my $self = shift; |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
my $an = $self->get_method_factory_name(); |
|
175
|
|
|
|
|
|
|
my $an_esc = $self->_esc_aq($an); |
|
176
|
|
|
|
|
|
|
my $op = &{$MOF}('push'); |
|
177
|
|
|
|
|
|
|
my $mb = $self->get_method_base(); |
|
178
|
|
|
|
|
|
|
my $ec = $self->get_exception_class(); |
|
179
|
|
|
|
|
|
|
my $pkg = $self->get_package(); |
|
180
|
|
|
|
|
|
|
my $pkg_us = $self->get_package_us(); |
|
181
|
|
|
|
|
|
|
my $desc = defined( $self->get_short_description() ) ? $self->get_short_description() : 'not described option'; |
|
182
|
|
|
|
|
|
|
my $exc = ' On error an exception C<' . $self->get_exception_class() . '> is thrown.'; |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
# Make body |
|
185
|
|
|
|
|
|
|
my $body = <
|
|
186
|
|
|
|
|
|
|
${IND}my \$self${AO}=${AO}shift; |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
EOF |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
# Check if isas/refs/rxs/values are allowed |
|
191
|
|
|
|
|
|
|
$body .= <
|
|
192
|
|
|
|
|
|
|
${IND}# Check if isas/refs/rxs/values are allowed |
|
193
|
|
|
|
|
|
|
${IND}\&_value_is_allowed${BFP}(${ACS}$an_esc,${AC}\@_${ACS})${AO}||${AO}throw $ec${BFP}("ERROR: ${pkg}::$op$mb, one or more specified value(s) '\@_' is/are not allowed."); |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
EOF |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
# Method tail |
|
198
|
|
|
|
|
|
|
$body .= <
|
|
199
|
|
|
|
|
|
|
${IND}# Push the list |
|
200
|
|
|
|
|
|
|
${IND}push${BFP}(${ACS}\@{${ACS}\$self->{$pkg_us}{$an}${ACS}},${AC}\@_${ACS}); |
|
201
|
|
|
|
|
|
|
EOF |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
# Make description |
|
204
|
|
|
|
|
|
|
my $description = <
|
|
205
|
|
|
|
|
|
|
Push additional values on ${desc}. C is the list value.${exc} |
|
206
|
|
|
|
|
|
|
EOF |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
# Add clauses to the description |
|
209
|
|
|
|
|
|
|
my $clauses = $self->mk_doc_clauses(); |
|
210
|
|
|
|
|
|
|
if ($clauses) { |
|
211
|
|
|
|
|
|
|
$description .= "\n" . $clauses; |
|
212
|
|
|
|
|
|
|
} |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
# Create and return the method |
|
215
|
|
|
|
|
|
|
return( PerlBean::Method->new( { |
|
216
|
|
|
|
|
|
|
method_name => "$op$mb", |
|
217
|
|
|
|
|
|
|
parameter_description => 'ARRAY', |
|
218
|
|
|
|
|
|
|
documented => $self->is_documented(), |
|
219
|
|
|
|
|
|
|
volatile => 1, |
|
220
|
|
|
|
|
|
|
description => $description, |
|
221
|
|
|
|
|
|
|
body => $body, |
|
222
|
|
|
|
|
|
|
} ) ); |
|
223
|
|
|
|
|
|
|
THE_EOF |
|
224
|
|
|
|
|
|
|
}, |
|
225
|
|
|
|
|
|
|
{ |
|
226
|
|
|
|
|
|
|
method_name => 'create_method_set', |
|
227
|
|
|
|
|
|
|
documented => 0, |
|
228
|
|
|
|
|
|
|
body => <<'THE_EOF', |
|
229
|
|
|
|
|
|
|
my $self = shift; |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
my $an = $self->get_method_factory_name(); |
|
232
|
|
|
|
|
|
|
my $an_esc = $self->_esc_aq($an); |
|
233
|
|
|
|
|
|
|
my $op = &{$MOF}('set'); |
|
234
|
|
|
|
|
|
|
my $mb = $self->get_method_base(); |
|
235
|
|
|
|
|
|
|
my $ec = $self->get_exception_class(); |
|
236
|
|
|
|
|
|
|
my $pkg = $self->get_package(); |
|
237
|
|
|
|
|
|
|
my $pkg_us = $self->get_package_us(); |
|
238
|
|
|
|
|
|
|
my $desc = defined( $self->get_short_description() ) ? $self->get_short_description() : 'not described option'; |
|
239
|
|
|
|
|
|
|
my $def = defined( $self->get_default_value() ) ? ' Default value at initialization is C<' . join( ', ', $self->_esc_aq( @{ $self->get_default_value() } ) ) . '>.' : ''; |
|
240
|
|
|
|
|
|
|
my $empt = $self->is_allow_empty() ? '' : ' It must at least have one element.'; |
|
241
|
|
|
|
|
|
|
my $exc = ' On error an exception C<' . $self->get_exception_class() . '> is thrown.'; |
|
242
|
|
|
|
|
|
|
my $attr_overl = $self->_get_overloaded_attribute(); |
|
243
|
|
|
|
|
|
|
my $overl = defined($attr_overl) ? " B Methods B> are overloaded from package C<". $attr_overl->get_package() .'>.': ''; |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
# Make body |
|
246
|
|
|
|
|
|
|
my $body = <
|
|
247
|
|
|
|
|
|
|
${IND}my \$self${AO}=${AO}shift; |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
EOF |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
# Check if list value is allowed to be empty |
|
252
|
|
|
|
|
|
|
if ( ! $self->is_allow_empty() ) { |
|
253
|
|
|
|
|
|
|
$body .= <
|
|
254
|
|
|
|
|
|
|
${IND}# List value for $an_esc is not allowed to be empty |
|
255
|
|
|
|
|
|
|
${IND}scalar${BFP}(\@_)${AO}||${AO}throw $ec${BFP}("ERROR: ${pkg}::$op$mb, list value may not be empty."); |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
EOF |
|
258
|
|
|
|
|
|
|
} |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
# Check if isas/refs/rxs/values are allowed |
|
261
|
|
|
|
|
|
|
$body .= <
|
|
262
|
|
|
|
|
|
|
${IND}# Check if isas/refs/rxs/values are allowed |
|
263
|
|
|
|
|
|
|
${IND}\&_value_is_allowed${BFP}(${ACS}$an_esc,${AC}\@_${ACS})${AO}||${AO}throw $ec${BFP}("ERROR: ${pkg}::$op$mb, one or more specified value(s) '\@_' is/are not allowed."); |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
EOF |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
# Set the list |
|
268
|
|
|
|
|
|
|
$body .= <
|
|
269
|
|
|
|
|
|
|
${IND}# Set the list |
|
270
|
|
|
|
|
|
|
${IND}\@{${ACS}\$self->{$pkg_us}{$an}${ACS}}${AO}=${AO}\@_; |
|
271
|
|
|
|
|
|
|
EOF |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
# Make description |
|
274
|
|
|
|
|
|
|
my $description = <
|
|
275
|
|
|
|
|
|
|
Set ${desc} absolutely. C is the list value.${def}${empt}${exc}${overl} |
|
276
|
|
|
|
|
|
|
EOF |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
# Add clauses to the description |
|
279
|
|
|
|
|
|
|
my $clauses = $self->mk_doc_clauses(); |
|
280
|
|
|
|
|
|
|
if ($clauses) { |
|
281
|
|
|
|
|
|
|
$description .= "\n" . $clauses; |
|
282
|
|
|
|
|
|
|
} |
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
# Create and return the method |
|
285
|
|
|
|
|
|
|
return( PerlBean::Method->new( { |
|
286
|
|
|
|
|
|
|
method_name => "$op$mb", |
|
287
|
|
|
|
|
|
|
parameter_description => 'ARRAY', |
|
288
|
|
|
|
|
|
|
documented => $self->is_documented(), |
|
289
|
|
|
|
|
|
|
volatile => 1, |
|
290
|
|
|
|
|
|
|
description => $description, |
|
291
|
|
|
|
|
|
|
body => $body, |
|
292
|
|
|
|
|
|
|
} ) ); |
|
293
|
|
|
|
|
|
|
THE_EOF |
|
294
|
|
|
|
|
|
|
}, |
|
295
|
|
|
|
|
|
|
{ |
|
296
|
|
|
|
|
|
|
method_name => 'create_method_set_idx', |
|
297
|
|
|
|
|
|
|
documented => 0, |
|
298
|
|
|
|
|
|
|
body => <<'THE_EOF', |
|
299
|
|
|
|
|
|
|
my $self = shift; |
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
my $an = $self->get_method_factory_name(); |
|
302
|
|
|
|
|
|
|
my $an_esc = $self->_esc_aq($an); |
|
303
|
|
|
|
|
|
|
my $op = &{$MOF}('set_idx'); |
|
304
|
|
|
|
|
|
|
my $mb = $self->get_method_base(); |
|
305
|
|
|
|
|
|
|
my $ec = $self->get_exception_class(); |
|
306
|
|
|
|
|
|
|
my $pkg = $self->get_package(); |
|
307
|
|
|
|
|
|
|
my $pkg_us = $self->get_package_us(); |
|
308
|
|
|
|
|
|
|
my $desc = defined( $self->get_short_description() ) ? $self->get_short_description() : 'not described option'; |
|
309
|
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
# Make body |
|
311
|
|
|
|
|
|
|
my $body = <
|
|
312
|
|
|
|
|
|
|
${IND}my \$self${AO}=${AO}shift; |
|
313
|
|
|
|
|
|
|
${IND}my \$idx${AO}=${AO}shift; |
|
314
|
|
|
|
|
|
|
${IND}my \$val${AO}=${AO}shift; |
|
315
|
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
EOF |
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
# Check if index is a positive integer or zero |
|
319
|
|
|
|
|
|
|
$body .= <
|
|
320
|
|
|
|
|
|
|
${IND}# Check if index is a positive integer or zero |
|
321
|
|
|
|
|
|
|
${IND}(${ACS}\$idx${AO}==${AO}int${BFP}(\$idx)${ACS})${AO}||${AO}throw $ec${BFP}("ERROR: ${pkg}::$op$mb, the specified index '\$idx' is not an integer."); |
|
322
|
|
|
|
|
|
|
${IND}(${ACS}\$idx${AO}>=${AO}0${ACS})${AO}||${AO}throw $ec${BFP}("ERROR: ${pkg}::$op$mb, the specified index '\$idx' is not a positive integer or zero."); |
|
323
|
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
EOF |
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
# Check if isas/refs/rxs/values are allowed |
|
327
|
|
|
|
|
|
|
$body .= <
|
|
328
|
|
|
|
|
|
|
${IND}# Check if isas/refs/rxs/values are allowed |
|
329
|
|
|
|
|
|
|
${IND}\&_value_is_allowed${BFP}(${ACS}$an_esc,${AC}\$val${ACS})${AO}||${AO}throw $ec${BFP}("ERROR: ${pkg}::$op$mb, one or more specified value(s) '\@_' is/are not allowed."); |
|
330
|
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
EOF |
|
332
|
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
# Set the value in the list |
|
334
|
|
|
|
|
|
|
$body .= <
|
|
335
|
|
|
|
|
|
|
${IND}# Set the value in the list |
|
336
|
|
|
|
|
|
|
${IND}\$self->{$pkg_us}{$an}[\$idx]${AO}=${AO}\$val; |
|
337
|
|
|
|
|
|
|
EOF |
|
338
|
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
# Make description |
|
340
|
|
|
|
|
|
|
my $description = <
|
|
341
|
|
|
|
|
|
|
Set value in $desc. C is the integer index which is greater than or equal to C<0>. C is the value. |
|
342
|
|
|
|
|
|
|
EOF |
|
343
|
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
# Add clauses to the description |
|
345
|
|
|
|
|
|
|
my $clauses = $self->mk_doc_clauses(); |
|
346
|
|
|
|
|
|
|
if ($clauses) { |
|
347
|
|
|
|
|
|
|
$description .= "\n" . $clauses; |
|
348
|
|
|
|
|
|
|
} |
|
349
|
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
# Create and return the method |
|
351
|
|
|
|
|
|
|
return( PerlBean::Method->new( { |
|
352
|
|
|
|
|
|
|
method_name => "$op$mb", |
|
353
|
|
|
|
|
|
|
parameter_description => "${ACS}INDEX, VALUE${ACS}", |
|
354
|
|
|
|
|
|
|
documented => $self->is_documented(), |
|
355
|
|
|
|
|
|
|
volatile => 1, |
|
356
|
|
|
|
|
|
|
description => $description, |
|
357
|
|
|
|
|
|
|
body => $body, |
|
358
|
|
|
|
|
|
|
} ) ); |
|
359
|
|
|
|
|
|
|
THE_EOF |
|
360
|
|
|
|
|
|
|
}, |
|
361
|
|
|
|
|
|
|
{ |
|
362
|
|
|
|
|
|
|
method_name => 'create_method_set_num', |
|
363
|
|
|
|
|
|
|
documented => 0, |
|
364
|
|
|
|
|
|
|
body => <<'THE_EOF', |
|
365
|
|
|
|
|
|
|
my $self = shift; |
|
366
|
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
my $an = $self->get_method_factory_name(); |
|
368
|
|
|
|
|
|
|
my $an_esc = $self->_esc_aq($an); |
|
369
|
|
|
|
|
|
|
my $op = &{$MOF}('set_num'); |
|
370
|
|
|
|
|
|
|
my $op_set_idx = &{$MOF}('set_idx'); |
|
371
|
|
|
|
|
|
|
my $mb = $self->get_method_base(); |
|
372
|
|
|
|
|
|
|
my $ec = $self->get_exception_class(); |
|
373
|
|
|
|
|
|
|
my $pkg = $self->get_package(); |
|
374
|
|
|
|
|
|
|
my $pkg_us = $self->get_package_us(); |
|
375
|
|
|
|
|
|
|
my $desc = defined( $self->get_short_description() ) ? $self->get_short_description() : 'not described option'; |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
# Make body |
|
378
|
|
|
|
|
|
|
my $body = <
|
|
379
|
|
|
|
|
|
|
${IND}my \$self${AO}=${AO}shift; |
|
380
|
|
|
|
|
|
|
${IND}my \$num${AO}=${AO}shift; |
|
381
|
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
EOF |
|
383
|
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
# Check if index is an integer |
|
385
|
|
|
|
|
|
|
$body .= <
|
|
386
|
|
|
|
|
|
|
${IND}# Check if index is an integer |
|
387
|
|
|
|
|
|
|
${IND}(${ACS}\$num${AO}==${AO}int${BFP}(\$num)${ACS})${AO}||${AO}throw $ec${BFP}("ERROR: ${pkg}::$op$mb, the specified number '\$num' is not an integer."); |
|
388
|
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
EOF |
|
390
|
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
# Call $op_set_idx$mb |
|
392
|
|
|
|
|
|
|
$body .= <
|
|
393
|
|
|
|
|
|
|
${IND}# Call $op_set_idx$mb |
|
394
|
|
|
|
|
|
|
${IND}\$self->$op_set_idx$mb${BFP}(${ACS}\$num${AO}-${AO}1,${AC}\@_${ACS}); |
|
395
|
|
|
|
|
|
|
EOF |
|
396
|
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
# Make description |
|
398
|
|
|
|
|
|
|
my $description = <
|
|
399
|
|
|
|
|
|
|
Set value in $desc. C is the integer index which is greater than C<0>. C is the value. |
|
400
|
|
|
|
|
|
|
EOF |
|
401
|
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
# Add clauses to the description |
|
403
|
|
|
|
|
|
|
my $clauses = $self->mk_doc_clauses(); |
|
404
|
|
|
|
|
|
|
if ($clauses) { |
|
405
|
|
|
|
|
|
|
$description .= "\n" . $clauses; |
|
406
|
|
|
|
|
|
|
} |
|
407
|
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
# Create and return the method |
|
409
|
|
|
|
|
|
|
return( PerlBean::Method->new( { |
|
410
|
|
|
|
|
|
|
method_name => "$op$mb", |
|
411
|
|
|
|
|
|
|
parameter_description => "${ACS}NUMBER, VALUE${ACS}", |
|
412
|
|
|
|
|
|
|
documented => $self->is_documented(), |
|
413
|
|
|
|
|
|
|
volatile => 1, |
|
414
|
|
|
|
|
|
|
description => $description, |
|
415
|
|
|
|
|
|
|
body => $body, |
|
416
|
|
|
|
|
|
|
} ) ); |
|
417
|
|
|
|
|
|
|
THE_EOF |
|
418
|
|
|
|
|
|
|
}, |
|
419
|
|
|
|
|
|
|
{ |
|
420
|
|
|
|
|
|
|
method_name => 'create_method_shift', |
|
421
|
|
|
|
|
|
|
documented => 0, |
|
422
|
|
|
|
|
|
|
body => <<'THE_EOF', |
|
423
|
|
|
|
|
|
|
my $self = shift; |
|
424
|
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
my $an = $self->get_method_factory_name(); |
|
426
|
|
|
|
|
|
|
my $an_esc = $self->_esc_aq($an); |
|
427
|
|
|
|
|
|
|
my $op = &{$MOF}('shift'); |
|
428
|
|
|
|
|
|
|
my $mb = $self->get_method_base(); |
|
429
|
|
|
|
|
|
|
my $ec = $self->get_exception_class(); |
|
430
|
|
|
|
|
|
|
my $pkg = $self->get_package(); |
|
431
|
|
|
|
|
|
|
my $pkg_us = $self->get_package_us(); |
|
432
|
|
|
|
|
|
|
my $desc = defined( $self->get_short_description() ) ? $self->get_short_description() : 'not described option'; |
|
433
|
|
|
|
|
|
|
my $empt = $self->is_allow_empty() ? '' : ' After shifting at least one element must remain.'; |
|
434
|
|
|
|
|
|
|
my $exc = ' On error an exception C<' . $self->get_exception_class() . '> is thrown.'; |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
# Make body |
|
437
|
|
|
|
|
|
|
my $body = <
|
|
438
|
|
|
|
|
|
|
${IND}my \$self${AO}=${AO}shift; |
|
439
|
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
EOF |
|
441
|
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
# Check if list value is allowed to be empty |
|
443
|
|
|
|
|
|
|
if ( ! $self->is_allow_empty() ) { |
|
444
|
|
|
|
|
|
|
$body .= <
|
|
445
|
|
|
|
|
|
|
${IND}# List value for $an_esc is not allowed to be empty |
|
446
|
|
|
|
|
|
|
${IND}(${ACS}scalar${BFP}(\@_)${AO}>${AO}1${ACS})${AO}||${AO}throw $ec${BFP}("ERROR: ${pkg}::$op$mb, list value may not be empty."); |
|
447
|
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
EOF |
|
449
|
|
|
|
|
|
|
} |
|
450
|
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
# Method tail |
|
452
|
|
|
|
|
|
|
$body .= <
|
|
453
|
|
|
|
|
|
|
${IND}# Shift an element from the list |
|
454
|
|
|
|
|
|
|
${IND}return${BFP}(${ACS}shift${BFP}(${ACS}\@{${ACS}\$self->{$pkg_us}{$an}${ACS}}${ACS})${ACS}); |
|
455
|
|
|
|
|
|
|
EOF |
|
456
|
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
# Create and return the method |
|
458
|
|
|
|
|
|
|
return( PerlBean::Method->new( { |
|
459
|
|
|
|
|
|
|
method_name => "$op$mb", |
|
460
|
|
|
|
|
|
|
documented => $self->is_documented(), |
|
461
|
|
|
|
|
|
|
volatile => 1, |
|
462
|
|
|
|
|
|
|
description => <
|
|
463
|
|
|
|
|
|
|
Shift and return an element off ${desc}.${empt}${exc} |
|
464
|
|
|
|
|
|
|
EOF |
|
465
|
|
|
|
|
|
|
body => $body, |
|
466
|
|
|
|
|
|
|
} ) ); |
|
467
|
|
|
|
|
|
|
THE_EOF |
|
468
|
|
|
|
|
|
|
}, |
|
469
|
|
|
|
|
|
|
{ |
|
470
|
|
|
|
|
|
|
method_name => 'create_method_unshift', |
|
471
|
|
|
|
|
|
|
documented => 0, |
|
472
|
|
|
|
|
|
|
body => <<'THE_EOF', |
|
473
|
|
|
|
|
|
|
my $self = shift; |
|
474
|
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
my $an = $self->get_method_factory_name(); |
|
476
|
|
|
|
|
|
|
my $an_esc = $self->_esc_aq($an); |
|
477
|
|
|
|
|
|
|
my $op = &{$MOF}('unshift'); |
|
478
|
|
|
|
|
|
|
my $mb = $self->get_method_base(); |
|
479
|
|
|
|
|
|
|
my $ec = $self->get_exception_class(); |
|
480
|
|
|
|
|
|
|
my $pkg = $self->get_package(); |
|
481
|
|
|
|
|
|
|
my $pkg_us = $self->get_package_us(); |
|
482
|
|
|
|
|
|
|
my $desc = defined( $self->get_short_description() ) ? $self->get_short_description() : 'not described option'; |
|
483
|
|
|
|
|
|
|
my $exc = ' On error an exception C<' . $self->get_exception_class() . '> is thrown.'; |
|
484
|
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
# Make body |
|
486
|
|
|
|
|
|
|
my $body = <
|
|
487
|
|
|
|
|
|
|
${IND}my \$self${AO}=${AO}shift; |
|
488
|
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
${IND}# Check if isas/refs/rxs/values are allowed |
|
490
|
|
|
|
|
|
|
${IND}\&_value_is_allowed${BFP}(${ACS}$an_esc,${AC}\@_${ACS})${AO}||${AO}throw $ec${BFP}("ERROR: ${pkg}::$op$mb, one or more specified value(s) '\@_' is/are not allowed."); |
|
491
|
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
${IND}# Unshift the list |
|
493
|
|
|
|
|
|
|
${IND}unshift${BFP}(${ACS}\@{${ACS}\$self->{$pkg_us}{$an}${ACS}},${AC}\@_${ACS}); |
|
494
|
|
|
|
|
|
|
EOF |
|
495
|
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
# Make description |
|
497
|
|
|
|
|
|
|
my $description = <
|
|
498
|
|
|
|
|
|
|
Unshift additional values on ${desc}. C is the list value.${exc} |
|
499
|
|
|
|
|
|
|
EOF |
|
500
|
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
# Add clauses to the description |
|
502
|
|
|
|
|
|
|
my $clauses = $self->mk_doc_clauses(); |
|
503
|
|
|
|
|
|
|
if ($clauses) { |
|
504
|
|
|
|
|
|
|
$description .= "\n" . $clauses; |
|
505
|
|
|
|
|
|
|
} |
|
506
|
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
# Create and return the method |
|
508
|
|
|
|
|
|
|
return( PerlBean::Method->new( { |
|
509
|
|
|
|
|
|
|
method_name => "$op$mb", |
|
510
|
|
|
|
|
|
|
parameter_description => 'ARRAY', |
|
511
|
|
|
|
|
|
|
documented => $self->is_documented(), |
|
512
|
|
|
|
|
|
|
volatile => 1, |
|
513
|
|
|
|
|
|
|
description => $description, |
|
514
|
|
|
|
|
|
|
body => $body, |
|
515
|
|
|
|
|
|
|
} ) ); |
|
516
|
|
|
|
|
|
|
THE_EOF |
|
517
|
|
|
|
|
|
|
}, |
|
518
|
|
|
|
|
|
|
], |
|
519
|
|
|
|
|
|
|
sym_opt => [ |
|
520
|
|
|
|
|
|
|
], |
|
521
|
|
|
|
|
|
|
use_opt => [ |
|
522
|
|
|
|
|
|
|
{ |
|
523
|
|
|
|
|
|
|
dependency_name => 'PerlBean::Style', |
|
524
|
|
|
|
|
|
|
import_list => [ 'qw(:codegen)' ], |
|
525
|
|
|
|
|
|
|
}, |
|
526
|
|
|
|
|
|
|
], |
|
527
|
|
|
|
|
|
|
} ); |
|
528
|
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
sub get_syn { |
|
530
|
1
|
|
|
1
|
|
5
|
use IO::File; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
180
|
|
|
531
|
|
|
|
|
|
|
my $fh = IO::File->new('< syn-PerlBean_Attribute_Multi_Ordered.pl'); |
|
532
|
|
|
|
|
|
|
$fh = IO::File->new('< gen/syn-PerlBean_Attribute_Multi_Ordered.pl') if (! defined($fh)); |
|
533
|
|
|
|
|
|
|
my $syn = ''; |
|
534
|
|
|
|
|
|
|
my $prev_line = $fh->getline (); |
|
535
|
|
|
|
|
|
|
while (my $line = $fh->getline ()) { |
|
536
|
|
|
|
|
|
|
$syn .= ' ' . $prev_line; |
|
537
|
|
|
|
|
|
|
$prev_line = $line; |
|
538
|
|
|
|
|
|
|
} |
|
539
|
|
|
|
|
|
|
return($syn); |
|
540
|
|
|
|
|
|
|
} |
|
541
|
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
1; |