line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2003-2021 by [Mark Overmeer]. |
2
|
|
|
|
|
|
|
# For other contributors see ChangeLog. |
3
|
|
|
|
|
|
|
# See the manual pages for details on the licensing terms. |
4
|
|
|
|
|
|
|
# Pod stripped from pm file by OODoc 2.02. |
5
|
|
|
|
|
|
|
# This code is part of perl distribution OODoc. It is licensed under the |
6
|
|
|
|
|
|
|
# same terms as Perl itself: https://spdx.org/licenses/Artistic-2.0.html |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package OODoc::Text::Structure; |
9
|
1
|
|
|
1
|
|
8
|
use vars '$VERSION'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
50
|
|
10
|
|
|
|
|
|
|
$VERSION = '2.02'; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
5
|
use base 'OODoc::Text'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
425
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
15
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
4
|
use Log::Report 'oodoc'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
18
|
1
|
|
|
1
|
|
222
|
use List::Util 'first'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
798
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub init($) |
22
|
0
|
|
|
0
|
0
|
|
{ my ($self, $args) = @_; |
23
|
0
|
0
|
|
|
|
|
$self->SUPER::init($args) or return; |
24
|
0
|
|
|
|
|
|
$self->{OTS_subs} = []; |
25
|
|
|
|
|
|
|
$self->{OTS_level} = delete $args->{level} |
26
|
0
|
0
|
|
|
|
|
or panic "no level defined for structural component"; |
27
|
0
|
|
|
|
|
|
$self; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub emptyExtension($) |
32
|
0
|
|
|
0
|
1
|
|
{ my ($self, $container) = @_; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $new = ref($self)->new |
35
|
|
|
|
|
|
|
( name => $self->name |
36
|
|
|
|
|
|
|
, linenr => -1 |
37
|
|
|
|
|
|
|
, level => $self->level |
38
|
|
|
|
|
|
|
, container => $container |
39
|
|
|
|
|
|
|
); |
40
|
0
|
|
|
|
|
|
$new->extends($self); |
41
|
0
|
|
|
|
|
|
$new; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
#------------------------------------------- |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
0
|
1
|
|
sub level() {shift->{OTS_level}} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub niceName() |
51
|
0
|
|
|
0
|
1
|
|
{ my $name = shift->name; |
52
|
0
|
0
|
|
|
|
|
$name =~ m/[a-z]/ ? $name : ucfirst(lc $name); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
#------------------------------------------- |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
0
|
1
|
|
sub path() { panic "Not implemented" } |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
0
|
1
|
|
sub findEntry($) { panic "Not implemented" } |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
#------------------------------------------- |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub all($@) |
67
|
0
|
|
|
0
|
1
|
|
{ my ($self, $method) = (shift, shift); |
68
|
0
|
|
|
|
|
|
$self->$method(@_); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub isEmpty() |
73
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
my $manual = $self->manual; |
76
|
0
|
0
|
|
|
|
|
return 0 if $self->description !~ m/^\s*$/; |
77
|
0
|
|
|
0
|
|
|
return 0 if first {!$manual->inherited($_)} |
78
|
0
|
0
|
|
|
|
|
$self->examples, $self->subroutines; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
my @nested |
81
|
0
|
0
|
|
|
|
|
= $self->isa('OODoc::Text::Chapter') ? $self->sections |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
82
|
|
|
|
|
|
|
: $self->isa('OODoc::Text::Section') ? $self->subsections |
83
|
|
|
|
|
|
|
: $self->isa('OODoc::Text::SubSection') ? $self->subsubsections |
84
|
|
|
|
|
|
|
: return 1; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
0
|
|
|
not first {!$_->isEmpty} @nested; |
|
0
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
#------------------- |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub addSubroutine(@) |
92
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
93
|
0
|
|
|
|
|
|
push @{$self->{OTS_subs}}, @_; |
|
0
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
$_->container($self) for @_; |
95
|
0
|
|
|
|
|
|
$self; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
0
|
1
|
|
sub subroutines() { @{shift->{OTS_subs}} } |
|
0
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub subroutine($) |
103
|
0
|
|
|
0
|
1
|
|
{ my ($self, $name) = @_; |
104
|
0
|
|
|
0
|
|
|
first {$_->name eq $name} $self->subroutines; |
|
0
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub setSubroutines($) |
109
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
110
|
0
|
|
0
|
|
|
|
$self->{OTS_subs} = shift || []; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
#------------------------------------------- |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
1; |