lib/TUI/Menus/StatusLine.pm

filter: Statementstmt 23.4% 73 / 312 Branchbran 0.0% 0 / 130 Conditioncond 0.0% 0 / 26 MC/DCmcdc 0.0% 0 / 16 Subroutinesub 46.3% 19 / 41 Podpod 71.4% 10 / 14 totaltotal 18.9% 102 / 539 CC 77 SCAR 42.2
CC
77
Cov
16%
__ANON__
185.5
handleEvent
157.9
__ANON__
90.0
CRAP 68.0
« lib/TUI/StdDlg/DirListBox.pm ↑ Summary lib/TUI/Views/View.pm »
1 package TUI::Menus::StatusLine;
2 # ABSTRACT: Message line for the bottom of the application screen
3
4 62 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 62 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 62 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 62 our $VERSION = '2.000003';
9 62 $VERSION =~ tr/_//d;
10 62 our $AUTHORITY = 'cpan:BRICKPOOL';
11
12 62 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 62 our @EXPORT = qw(
14 TStatusLine
15 new_TStatusLine
16 );
17
18 62 ▶use Storable;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 62 ▶use TUI::toolkit;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 62 ▶use TUI::toolkit::Types qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
21 Maybe
22 is_Object
23 :types
24 62 );
25
26 62 ▶use TUI::Menus::Const qw( cpStatusLine );
Subroutine BEGIN: called CC=1 SCAR=0.0
27 62 ▶use TUI::Drivers::Const qw( :evXXXX );
Subroutine BEGIN: called CC=1 SCAR=0.0
28 62 ▶use TUI::Drivers::Util qw( cstrlen );
Subroutine BEGIN: called CC=1 SCAR=0.0
29 62 ▶use TUI::Objects::Rect;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 62 ▶use TUI::Views::DrawBuffer;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 62 ▶use TUI::Views::Const qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
32 cmCommandSetChanged
33 :gfXXXX
34 hcNoContext
35 ofPreProcess
36 62 );
37 62 ▶use TUI::Views::Palette;
Subroutine BEGIN: called CC=1 SCAR=0.0
38 62 ▶use TUI::Views::View;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 62 ▶use TUI::Menus::StatusDef;
Subroutine BEGIN: called CC=1 SCAR=0.0
40 62 ▶use TUI::Menus::StatusItem;
Subroutine BEGIN: called CC=1 SCAR=0.0
41
42 sub TStatusLine() { __PACKAGE__ }
43 sub name() { 'TStatusLine' }
44 0 ▶sub new_TStatusLine { __PACKAGE__->from(@_) }
Subroutine new_TStatusLine: not called CC=1 SCAR=6.9
Pod documented
45
46 62 extends TView;
47
48 # declare global variables
49 62 our $hintSeparator = "\xB3 ";
50
51 # protected attributes
52 62 has items => ( is => 'ro' );
53 0 ▶has defs => ( is => 'ro', default => sub { die 'required' } );
Subroutine __ANON__: not called CC=1 SCAR=1.2
54
55 # predeclare private methods
56 my (
57 62 $drawSelect,
58 $findItems,
59 $itemMouseIsIn,
60 $writeItems,
61 $writeDefs,
62 $readItems,
63 $readDefs,
64 );
65
66 0 ▶sub BUILDARGS { # \%args (%args)
Subroutine BUILDARGS: not called CC=1 SCAR=6.9
Pod documented
67 0 state $sig = signature(
68 method => 1,
69 named => [
70 bounds => Object,
71 defs => Maybe[Object], { alias => 'aDefs' },
72 ],
73 caller_level => +1,
74 );
75 0 my ( $class, $args ) = $sig->( @_ );
76 0 return { %$args };
77 }
78
79 0 ▶sub BUILD { # void (\%args)
Subroutine BUILD: not called CC=3 SCAR=24.8
Pod documented
80 0 my ( $self, $args ) = @_;
81 0 ▶ assert ( @_ == 2 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
82 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
83 0 $self->{options} |= ofPreProcess;
84 0 $self->{eventMask} |= evBroadcast;
85 0 $self->{growMode} = gfGrowLoY | gfGrowHiX | gfGrowHiY;
86 0 $self->$findItems();
87 0 return;
88 } #/ sub new
89
90 0 ▶sub from { # $obj ($bounds, $aDefs|undef)
Subroutine from: not called CC=1 SCAR=6.9
Pod undocumented
91 0 state $sig = signature(
92 method => 1,
93 pos => [ Object, Maybe[Object] ],
94 );
95 0 my ( $class, @args ) = $sig->( @_ );
96 0 return $class->new( bounds => $args[0], defs => $args[1] );
97 }
98
99 0 ▶sub DEMOLISH { # void ($in_global_destruction)
Subroutine DEMOLISH: not called CC=4 SCAR=30.0
Pod documented
100 0 my ( $self, $in_global_destruction ) = @_;
101 0 ▶ assert ( @_ == 2 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
102 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
103 0 ▶ while ( $self->{defs} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"defs"}) 0 0 0
104 0 my $T = $self->{defs};
105 0 $self->{defs} = $self->{defs}{next};
106 0 $self->disposeItems( $T->{items} );
107 0 undef $T;
108 }
109 0 return;
110 }
111
112 0 ▶sub disposeItems { # void ($item|undef)
Subroutine disposeItems: not called CC=3 SCAR=24.8
Pod documented
113 0 state $sig = signature(
114 method => Object,
115 pos => [Maybe[Object]],
116 );
117 0 my ( $self, $item ) = $sig->( @_ );
118 0 ▶ while ( $item ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($item) 0 0 0
119 0 alias: for my $T ( $item ) {
120 0 $item = $item->next;
121 0 undef $T;
122 } #/ alias
123 }
124 0 return;
125 }
126
127 0 ▶sub draw { # void ()
Subroutine draw: not called CC=1 SCAR=6.9
Pod documented
128 0 state $sig = signature(
129 method => Object,
130 pos => [],
131 );
132 0 my ( $self ) = $sig->( @_ );
133 0 $self->$drawSelect( undef );
134 0 return;
135 }
136
137 0 ▶sub getPalette { # $palette ()
Subroutine getPalette: not called CC=1 SCAR=6.9
Pod documented
138 0 state $sig = signature(
139 method => Object,
140 pos => [],
141 );
142 0 my ( $self ) = $sig->( @_ );
143 0 state $palette = TPalette->new(
144 data => cpStatusLine,
145 size => length( cpStatusLine ),
146 );
147 0 return $palette->clone();
148 }
149
150 0 ▶sub handleEvent { # void ($event)
Subroutine handleEvent: not called CC=13 SCAR=50.6
Pod documented
151 62 ▶ no warnings 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
152 0 state $sig = signature(
153 method => Object,
154 pos => [Object],
155 );
156 0 my ( $self, $event ) = $sig->( @_ );
157 0 $self->SUPER::handleEvent( $event );
158
159 0 SWITCH: for ( $event->{what} ) {
160 0 ▶ $_ == evMouseDown and do {
Branch: 1 branch
BranchTrueFalseTotal
$_ == 1 and do { my $T; do { my $mouse = $self->makeLocal($event->{"mouse"}{"where"}); if ($T != $self->$itemMouseIsIn($mouse)) { $self->$drawSelect($T = $self->$itemMouseIsIn($mouse)); } } while $self->mouseEvent($event, 4); if ($T and "TUI::Views::View"->commandEnabled($T->{"command"})) { $event->{"what"} = 256; $event->{"message"}{"command"} = $T->{"command"}; $event->{"message"}{"infoPtr"} = undef; $self->putEvent($event); } ; $self->clearEvent($event); $self->drawView; last } 0 0 0
161 0 my $T;
162 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$self->mouseEvent($event, 4) and do { do { my $mouse = $self->makeLocal($event->{"mouse"}{"where"}); if ($T != $self->$itemMouseIsIn($mouse)) { $self->$drawSelect($T = $self->$itemMouseIsIn($mouse)); } } } 0 0 0
163 0 my $mouse = $self->makeLocal( $event->{mouse}{where} );
164 0 ▶ if ( $T != $self->$itemMouseIsIn( $mouse ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($T != $self->$itemMouseIsIn($mouse)) 0 0 0
165 0 $self->$drawSelect( $T = $self->$itemMouseIsIn( $mouse ) );
166 }
167 } while ( $self->mouseEvent( $event, evMouseMove ) );
168
169 0 ▶ if ( $T && TView->commandEnabled( $T->{command} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($T and "TUI::Views::View"->commandEnabled($T->{"command"})) 0 0 0
Condition0%0/3
$T and "TUI::Views::View"->commandEnabled($T->{"command"})
!ll&&!rl&&r
000
MC/DC0%0/2
$T and "TUI::Views::View"->commandEnabled($T->{"command"})
$T "TUI::Views::View"->commandEnabled($T->{"command"})
Truth table0%0/3
A and B
A= $TB= "TUI::Views::View"->commandEnabled($T->{"command"})
ABresult
0X0
100
111
170 0 $event->{what} = evCommand;
171 0 $event->{message}{command} = $T->{command};
172 0 $event->{message}{infoPtr} = undef;
173 0 $self->putEvent( $event );
174 }
175 0 $self->clearEvent( $event );
176 0 $self->drawView();
177 0 last;
178 };
179 0 ▶ $_ == evKeyDown and do {
Branch: 1 branch
BranchTrueFalseTotal
$_ == 16 and do { my $T = $self->{"items"}; while ($T) { if ($event->{"keyDown"}{"keyCode"} == $T->{"keyCode"} and "TUI::Views::View"->commandEnabled($T->{"command"})) { $event->{"what"} = 256; $event->{"message"}{"command"} = $T->{"command"}; $event->{"message"}{"infoPtr"} = undef; return; } ; $T = $T->{"next"}; } ; last } 0 0 0
180 0 my $T = $self->{items};
181 0 ▶ while ( $T ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($T) 0 0 0
182 0 ▶ if ( $event->{keyDown}{keyCode} == $T->{keyCode}
Branch: 1 branch
BranchTrueFalseTotal
if ($event->{"keyDown"}{"keyCode"} == $T->{"keyCode"} and "TUI::Views::View"->commandEnabled($T->{"command"})) 0 0 0
Condition0%0/3
$event->{"keyDown"}{"keyCode"} == $T->{"keyCode"} and "TUI::Views::View"->commandEnabled($T->{"command"})
!ll&&!rl&&r
000
MC/DC0%0/2
$event->{"keyDown"}{"keyCode"} == $T->{"keyCode"} and "TUI::Views::View"->commandEnabled($T->{"command"})
$event->{"keyDown"}{"keyCode"} == $T->{"keyCode"} "TUI::Views::View"->commandEnabled($T->{"command"})
Truth table0%0/3
A and B
A= $event->{"keyDown"}{"keyCode"} == $T->{"keyCode"}B= "TUI::Views::View"->commandEnabled($T->{"command"})
ABresult
0X0
100
111
183 && TView->commandEnabled( $T->{command} ) )
184 {
185 0 $event->{what} = evCommand;
186 0 $event->{message}{command} = $T->{command};
187 0 $event->{message}{infoPtr} = undef;
188 0 return;
189 }
190 0 $T = $T->{next};
191 } #/ while ( $T )
192 0 last;
193 };
194 0 ▶ $_ == evBroadcast and do {
Branch: 1 branch
BranchTrueFalseTotal
$_ == 512 and do { if ($event->{"message"}{"command"} == 52) { $self->drawView; } ; last } 0 0 0
195 0 ▶ if ( $event->{message}{command} == cmCommandSetChanged
Branch: 1 branch
BranchTrueFalseTotal
if ($event->{"message"}{"command"} == 52) 0 0 0
196 ) {
197 0 $self->drawView();
198 }
199 0 last;
200 };
201 }
202 0 return;
203 } #/ sub handleEvent
204
205 0 ▶sub hint { # $str ($aHelpCtx)
Subroutine hint: not called CC=1 SCAR=6.9
Pod documented
206 0 state $sig = signature(
207 method => Object,
208 pos => [PositiveOrZeroInt],
209 );
210 0 my ( $self, $aHelpCtx ) = $sig->( @_ );
211 0 return '';
212 }
213
214 0 ▶sub update { # void ()
Subroutine update: not called CC=3 SCAR=24.8
Pod documented
215 0 state $sig = signature(
216 method => Object,
217 pos => [],
218 );
219 0 my ( $self ) = $sig->( @_ );
220 0 my $p = $self->TopView();
221 0 ▶ my $h = $p ? $p->getHelpCtx() : hcNoContext;
Branch: 1 branch
BranchTrueFalseTotal
$p ? : 0 0 0
222 0 ▶ if ( $self->{helpCtx} != $h ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"helpCtx"} != $h) 0 0 0
223 0 $self->{helpCtx} = $h;
224 0 $self->$findItems();
225 0 $self->drawView();
226 }
227 0 return;
228 } #/ sub update
229
230 0 ▶$drawSelect = sub { # void ($selected|undef)
Subroutine __ANON__: not called CC=14 SCAR=52.2
231 0 my ( $self, $selected ) = @_;
232 0 ▶ assert ( @_ == 2 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
233 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
234 0 ▶ assert ( !defined $selected or is_Object $selected );
Branch: 1 branch
BranchTrueFalseTotal
unless not defined $selected or &is_Object($selected) 0 0 0
Condition0%0/3
not defined $selected or &is_Object($selected)
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $selected or &is_Object($selected)
not defined $selected &is_Object($selected)
Truth table0%0/3
not(A) or B
A= not defined $selectedB= &is_Object($selected)
ABresult
1X1
011
000
235 0 my $b = TDrawBuffer->new();
236
237 0 my $cNormal = $self->getColor( 0x0301 );
238 0 my $cSelect = $self->getColor( 0x0604 );
239 0 my $cNormDisabled = $self->getColor( 0x0202 );
240 0 my $cSelDisabled = $self->getColor( 0x0505 );
241 0 $b->moveChar( 0, ' ', $cNormal, $self->{size}{x} );
242 0 my $T = $self->{items};
243 0 my $i = 0;
244
245 0 ▶ while ( $T ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($T) 0 0 0
246 0 ▶ if ( $T->{text} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($T->{"text"}) 0 0 0
247 0 my $l = cstrlen( $T->{text} );
248 0 ▶ if ( $i + $l < $self->{size}{x} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i + $l < $self->{"size"}{"x"}) 0 0 0
249 62 ▶ no warnings 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
250 0 my $color;
251 0 ▶ if ( TView->commandEnabled( $T->{command} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ('TUI::Views::View'->commandEnabled($T->{'command'})) { } 0 0 0
252 0 ▶ $color = ( $T == $selected )
Branch: 1 branch
BranchTrueFalseTotal
$T == $selected ? : 0 0 0
253 ? $cSelect
254 : $cNormal;
255 }
256 else {
257 0 ▶ $color = ( $T == $selected )
Branch: 1 branch
BranchTrueFalseTotal
$T == $selected ? : 0 0 0
258 ? $cSelDisabled
259 : $cNormDisabled;
260 }
261 0 $b->moveChar( $i, ' ', $color, 1 );
262 0 $b->moveCStr( $i + 1, $T->{text}, $color );
263 0 $b->moveChar( $i + $l + 1, ' ', $color, 1 );
264 } #/ if ( $i + $l < $self->...)
265 0 $i += $l + 2;
266 } #/ if ( $T->{text} )
267 0 $T = $T->{next};
268 } #/ while ( $T )
269 0 ▶ if ( $i < $self->{size}{x} - 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $self->{"size"}{"x"} - 2) 0 0 0
270 0 my $hintBuf = $self->hint( $self->{helpCtx} );
271 0 ▶ if ( $hintBuf ne '' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hintBuf ne "") 0 0 0
272 0 $b->moveStr( $i, $hintSeparator, $cNormal );
273 0 $i += 2;
274 0 ▶ if ( length( $hintBuf ) + $i > $self->{size}{x} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length($hintBuf) + $i > $self->{"size"}{"x"}) 0 0 0
275 0 $hintBuf = substr( $hintBuf, 0, $self->{size}{x} - $i );
276 }
277 0 $b->moveStr( $i, $hintBuf, $cNormal );
278 0 $i += length( $hintBuf );
279 }
280 } #/ if ( $i < $self->{size...})
281 0 $self->writeLine( 0, 0, $self->{size}{x}, 1, $b );
282 0 return;
283 62 }; #/ sub drawSelect
284
285 0 ▶$findItems = sub { # void ()
Subroutine __ANON__: not called CC=7 SCAR=40.3
286 0 my ( $self ) = @_;
287 0 ▶ assert ( @_ == 1 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 1 0 0 0
288 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
289 0 my $p = $self->{defs};
290 0 ▶ while ( $p
Branch: 1 branch
BranchTrueFalseTotal
if ($p and $self->{"helpCtx"} < $p->{"min"} || $self->{"helpCtx"} > $p->{"max"}) 0 0 0
Condition0%0/6
$p and $self->{"helpCtx"} < $p->{"min"} || $self->{"helpCtx"} > $p->{"max"}
!ll&&!rl&&r
000
$self->{"helpCtx"} < $p->{"min"} or $self->{"helpCtx"} > $p->{"max"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$p and $self->{"helpCtx"} < $p->{"min"} || $self->{"helpCtx"} > $p->{"max"}
$p $self->{"helpCtx"} < $p->{"min"} $self->{"helpCtx"} > $p->{"max"}
Truth table0%0/4
A and B or C
A= $pB= $self->{"helpCtx"} < $p->{"min"}C= $self->{"helpCtx"} > $p->{"max"}
ABCresult
0XX0
1000
11X1
1011
291 && ( $self->{helpCtx} < $p->{min} || $self->{helpCtx} > $p->{max} )
292 ) {
293 0 $p = $p->{next};
294 }
295 0 ▶ $self->{items} = $p ? $p->{items} : undef;
Branch: 1 branch
BranchTrueFalseTotal
$p ? : 0 0 0
296 0 return;
297 62 };
298
299 0 ▶$itemMouseIsIn = sub { # $statusItem|undef ($mouse)
Subroutine __ANON__: not called CC=9 SCAR=45.0
300 0 my ( $self, $mouse ) = @_;
301 0 ▶ assert ( @_ == 2 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
302 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
303 0 ▶ assert ( is_HashLike $mouse );
Branch: 1 branch
BranchTrueFalseTotal
unless $mouse->is_HashLike 0 0 0
304 return undef
305 0 ▶ if $mouse->{y} != 0;
Branch: 1 branch
BranchTrueFalseTotal
if $mouse->{"y"} != 0 0 0 0
306
307 0 my $i = 0;
308 0 my $T = $self->{items};
309
310 0 ▶ while ( $T ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($T) 0 0 0
311 0 ▶ if ( $T->{text} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($T->{"text"}) 0 0 0
312 0 my $k = $i + cstrlen( $T->{text} ) + 2;
313 return $T
314 0 ▶ if $mouse->{x} >= $i && $mouse->{x} < $k;
Branch: 1 branch
BranchTrueFalseTotal
if $mouse->{"x"} >= $i and $mouse->{"x"} < $k 0 0 0
Condition0%0/3
$mouse->{"x"} >= $i and $mouse->{"x"} < $k
!ll&&!rl&&r
000
MC/DC0%0/2
$mouse->{"x"} >= $i and $mouse->{"x"} < $k
$mouse->{"x"} >= $i $mouse->{"x"} < $k
Truth table0%0/3
A and B
A= $mouse->{"x"} >= $iB= $mouse->{"x"} < $k
ABresult
0X0
100
111
315 0 $i = $k;
316 }
317 0 $T = $T->{next};
318 }
319 0 return undef;
320 62 }; #/ sub itemMouseIsIn
321
322 0 ▶$writeItems = sub { # void ($os, $items|undef)
Subroutine __ANON__: not called CC=8 SCAR=42.8
323 0 my ( $self, $os, $items ) = @_;
324 0 ▶ assert ( @_ == 3 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 3 0 0 0
325 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
326 0 ▶ assert ( is_Object $os );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($os) 0 0 0
327 0 ▶ assert ( !defined $items or is_Object $items );
Branch: 1 branch
BranchTrueFalseTotal
unless not defined $items or &is_Object($items) 0 0 0
Condition0%0/3
not defined $items or &is_Object($items)
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $items or &is_Object($items)
not defined $items &is_Object($items)
Truth table0%0/3
not(A) or B
A= not defined $itemsB= &is_Object($items)
ABresult
1X1
011
000
328
329 0 my $count = 0;
330 0 ▶ for ( my $item = $items ; $item ; $item = $item->{next} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($item) 0 0 0
331 0 $count++;
332 }
333 0 $os->put( $count );
334 0 ▶ for ( my $item = $items ; $item ; $item = $item->{next} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($item) 0 0 0
335 0 $os->put( $item->{text}, $item->{keyCode}, $item->{command} );
336 }
337 0 return;
338 62 };
339
340 0 ▶$writeDefs = sub { # void ($os, $defs|undef)
Subroutine __ANON__: not called CC=8 SCAR=42.8
341 0 my ( $self, $os, $defs ) = @_;
342 0 ▶ assert ( @_ == 3 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 3 0 0 0
343 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
344 0 ▶ assert ( is_Object $os );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($os) 0 0 0
345 0 ▶ assert ( !defined $defs or is_Object $defs );
Branch: 1 branch
BranchTrueFalseTotal
unless not defined $defs or &is_Object($defs) 0 0 0
Condition0%0/3
not defined $defs or &is_Object($defs)
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $defs or &is_Object($defs)
not defined $defs &is_Object($defs)
Truth table0%0/3
not(A) or B
A= not defined $defsB= &is_Object($defs)
ABresult
1X1
011
000
346
347 0 my $count = 0;
348 0 ▶ for ( my $def = $defs ; $def ; $def = $def->{next} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($def) 0 0 0
349 0 $count++;
350 }
351 0 $os->put( $count );
352 0 ▶ for ( my $def = $defs ; $def ; $def = $def->{next} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($def) 0 0 0
353 0 $os->put( $def->{min}, $def->{max} );
354 0 $self->$writeItems( $os, $def->{items} );
355 }
356 0 return;
357 62 };
358
359 0 ▶$readItems = sub { # $items|undef ($is)
Subroutine __ANON__: not called CC=7 SCAR=40.3
360 0 my ( $self, $is ) = @_;
361 0 ▶ assert ( @_ == 2 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
362 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
363 0 ▶ assert ( is_Object $is );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($is) 0 0 0
364
365 0 my $count = $is->get();
366 0 my ( $first, $last );
367 0 ▶ while ( $count-- > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($count-- > 0) 0 0 0
368 0 ▶ my $item = TStatusItem->new(
Condition0%0/2
$is->get // ""
l!l
00
MC/DC0%0/1
$is->get // ""
$is->get
Truth table0%0/2
A
A= $is->get
Aresult
11
00
369 text => $is->get() // '',
370 keyCode => $is->get(),
371 command => $is->get(),
372 );
373 0 ▶ if ( $last ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($last) { } 0 0 0
374 0 $last->{next} = $item;
375 }
376 else {
377 0 $first = $item;
378 }
379 0 $last = $item;
380 }
381 0 return $first;
382 62 };
383
384 0 ▶$readDefs = sub { # $defs|undef ($is)
Subroutine __ANON__: not called CC=6 SCAR=37.4
385 0 my ( $self, $is ) = @_;
386 0 ▶ assert ( @_ == 2 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
387 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
388 0 ▶ assert ( is_Object $is );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($is) 0 0 0
389
390 0 my $count = $is->get();
391 0 my ( $first, $last );
392 0 ▶ while ( $count-- > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($count-- > 0) 0 0 0
393 0 my $def = TStatusDef->new(
394 min => $is->get(),
395 max => $is->get(),
396 items => $self->$readItems( $is ),
397 );
398 0 ▶ if ( $last ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($last) { } 0 0 0
399 0 $last->{next} = $def;
400 }
401 else {
402 0 $first = $def;
403 }
404 0 $last = $def;
405 }
406 0 return $first;
407 62 };
408
409 0 ▶sub write :method { # void ($os)
Subroutine write: not called CC=1 SCAR=6.9
Pod undocumented
410 0 state $sig = signature(
411 method => Object,
412 pos => [Object],
413 );
414 0 my ( $self, $os ) = $sig->( @_ );
415 0 $self->SUPER::write( $os );
416 0 $self->$writeDefs( $os, $self->{defs} );
417 0 return;
418 }
419
420 0 ▶sub read :method { # $self ($is)
Subroutine read: not called CC=1 SCAR=6.9
Pod undocumented
421 0 state $sig = signature(
422 method => Object,
423 pos => [Object],
424 );
425 0 my ( $self, $is ) = $sig->( @_ );
426 0 $self->SUPER::read( $is );
427 0 $self->{defs} = $self->$readDefs( $is );
428 0 $self->$findItems();
429 0 return $self;
430 }
431
432 0 ▶sub build { # $obj ()
Subroutine build: not called CC=4 SCAR=30.0
Pod undocumented
433 0 my ( $class ) = @_;
434 0 ▶ assert ( @_ == 1 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 1 0 0 0
435 0 ▶ assert ( is_Str $class );
Branch: 1 branch
BranchTrueFalseTotal
unless $class->is_Str 0 0 0
436 0 ▶ assert ( Storable::is_retrieving );
Branch: 1 branch
BranchTrueFalseTotal
unless &Storable::is_retrieving() 0 0 0
437 0 return $class->new(
438 bounds => TRect->new(),
439 defs => TStatusDef->new( min => 0, max => 0 ),
440 );
441 }
442
443 62 1
444
445 __END__
« lib/TUI/StdDlg/DirListBox.pm ↑ Summary lib/TUI/Views/View.pm »