| 1 | package TUI::ColorSel::ColorGroupList; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: A list viewer for color groups | ||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | 6 | ▶ | use 5.010; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 6 | our $VERSION = '2.000003'; | |||||||||||||||||||||||||||
| 9 | 6 | $VERSION =~ tr/_//d; | |||||||||||||||||||||||||||
| 10 | 6 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 6 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 6 | our @EXPORT = qw( | |||||||||||||||||||||||||||
| 14 | TColorGroupList | ||||||||||||||||||||||||||||
| 15 | new_TColorGroupList | ||||||||||||||||||||||||||||
| 16 | ); | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 6 | ▶ | use Storable; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 6 | ▶ | use Carp (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 6 | ▶ | use TUI::toolkit; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 6 | ▶ | use TUI::toolkit::Types qw( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | Maybe | ||||||||||||||||||||||||||||
| 23 | is_Object | ||||||||||||||||||||||||||||
| 24 | :types | ||||||||||||||||||||||||||||
| 25 | 6 | ); | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 6 | ▶ | use TUI::Drivers::Const qw( evBroadcast ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 28 | 6 | ▶ | use TUI::ColorSel::Const qw( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 29 | cmNewColorItem | ||||||||||||||||||||||||||||
| 30 | cmSaveColorIndex | ||||||||||||||||||||||||||||
| 31 | 6 | ); | |||||||||||||||||||||||||||
| 32 | 6 | ▶ | use TUI::ColorSel::ColorGroup; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 33 | 6 | ▶ | use TUI::ColorSel::ColorItem; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 34 | 6 | ▶ | use TUI::Objects::Rect; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 35 | 6 | ▶ | use TUI::Views::ListViewer; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 36 | 6 | ▶ | use TUI::Views::Util qw( message ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | sub TColorGroupList() { __PACKAGE__ } | ||||||||||||||||||||||||||||
| 39 | sub name() { 'TColorGroupList' } | ||||||||||||||||||||||||||||
| 40 | 0 | ▶ | sub new_TColorGroupList { __PACKAGE__->from( @_ ) } | ||||||||||||||||||||||||||
|
Subroutine
new_TColorGroupList: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 6 | extends TListViewer; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | # protected attributes | ||||||||||||||||||||||||||||
| 45 | 0 | ▶ | has groups => ( is => 'ro', default => sub { die 'required' } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | # predeclare private methods | ||||||||||||||||||||||||||||
| 48 | my ( | ||||||||||||||||||||||||||||
| 49 | 6 | $writeItems, | |||||||||||||||||||||||||||
| 50 | $writeGroups, | ||||||||||||||||||||||||||||
| 51 | $readItems, | ||||||||||||||||||||||||||||
| 52 | $readGroups, | ||||||||||||||||||||||||||||
| 53 | ); | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | ▶ | sub BUILDARGS { # \%args (%args) | ||||||||||||||||||||||||||
|
Subroutine
BUILDARGS: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 56 | 0 | state $sig = signature( | |||||||||||||||||||||||||||
| 57 | method => 1, | ||||||||||||||||||||||||||||
| 58 | named => [ | ||||||||||||||||||||||||||||
| 59 | bounds => Object, | ||||||||||||||||||||||||||||
| 60 | scrollBar => Maybe[Object], { alias => 'aScrollBar' }, | ||||||||||||||||||||||||||||
| 61 | groups => Maybe[Object], { alias => 'aGroups' }, | ||||||||||||||||||||||||||||
| 62 | ], | ||||||||||||||||||||||||||||
| 63 | caller_level => +1, | ||||||||||||||||||||||||||||
| 64 | ); | ||||||||||||||||||||||||||||
| 65 | 0 | my ( $class, $args1 ) = $sig->( @_ ); | |||||||||||||||||||||||||||
| 66 | 0 | local $Carp::CarpLevel = $Carp::CarpLevel + 1; | |||||||||||||||||||||||||||
| 67 | my $args2 = $class->SUPER::BUILDARGS( | ||||||||||||||||||||||||||||
| 68 | bounds => $args1->{bounds}, | ||||||||||||||||||||||||||||
| 69 | numCols => 1, | ||||||||||||||||||||||||||||
| 70 | hScrollBar => undef, | ||||||||||||||||||||||||||||
| 71 | vScrollBar => delete $args1->{scrollBar}, | ||||||||||||||||||||||||||||
| 72 | 0 | ); | |||||||||||||||||||||||||||
| 73 | 0 | return { %$args1, %$args2 }; | |||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 0 | ▶ | sub BUILD { # void (\%args) | ||||||||||||||||||||||||||
|
Subroutine
BUILD: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 77 | 0 | my ( $self, $args ) = @_; | |||||||||||||||||||||||||||
| 78 | 0 | ▶ | assert ( @_ == 2 ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 79 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | 0 | my $i = 0; | |||||||||||||||||||||||||||
| 81 | 0 | my $aGroups = $self->{groups}; | |||||||||||||||||||||||||||
| 82 | 0 | ▶ | while ( $aGroups ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | 0 | $aGroups = $aGroups->{next}; | |||||||||||||||||||||||||||
| 84 | 0 | $i++; | |||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | 0 | $self->setRange( $i ); | |||||||||||||||||||||||||||
| 87 | 0 | return; | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | 0 | ▶ | sub from { # $obj ($bounds, $aScrollBar|undef, $aGroups|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], Maybe[Object]], | ||||||||||||||||||||||||||||
| 94 | ); | ||||||||||||||||||||||||||||
| 95 | 0 | my ( $class, @args ) = $sig->( @_ ); | |||||||||||||||||||||||||||
| 96 | 0 | return $class->new( bounds => $args[0], scrollBar => $args[1], | |||||||||||||||||||||||||||
| 97 | groups => $args[2] ); | ||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 0 | ▶ | my $freeItems = sub { # void ($curItem|undef) | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 101 | 0 | my ( $curItem ) = @_; | |||||||||||||||||||||||||||
| 102 | 0 | ▶ | assert ( !defined $curItem or is_Object $curItem ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $curItem or &is_Object($curItem)
MC/DC0%0/2
not defined $curItem or &is_Object($curItem)
not defined $curItem
&is_Object($curItem)
Truth table0%0/3
not(A) or B
A= not defined $curItemB= &is_Object($curItem)
| |||||||||||||||||||||||||||||
| 103 | 0 | ▶ | while ( $curItem ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 104 | 0 | my $p = $curItem; | |||||||||||||||||||||||||||
| 105 | 0 | $curItem = $curItem->{next}; | |||||||||||||||||||||||||||
| 106 | 0 | undef $p; | |||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | 0 | return; | |||||||||||||||||||||||||||
| 109 | 6 | }; | |||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 0 | ▶ | my $freeGroups = sub { # void ($curGroup|undef) | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 112 | 0 | my ( $curGroup ) = @_; | |||||||||||||||||||||||||||
| 113 | 0 | ▶ | assert ( !defined $curGroup or is_Object $curGroup ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $curGroup or &is_Object($curGroup)
MC/DC0%0/2
not defined $curGroup or &is_Object($curGroup)
not defined $curGroup
&is_Object($curGroup)
Truth table0%0/3
not(A) or B
A= not defined $curGroupB= &is_Object($curGroup)
| |||||||||||||||||||||||||||||
| 114 | 0 | ▶ | while ( $curGroup ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 115 | 0 | my $p = $curGroup; | |||||||||||||||||||||||||||
| 116 | 0 | $freeItems->( $curGroup->{items} ); | |||||||||||||||||||||||||||
| 117 | 0 | $curGroup = $curGroup->{next}; | |||||||||||||||||||||||||||
| 118 | 0 | undef $p; | |||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | 0 | return; | |||||||||||||||||||||||||||
| 121 | 6 | }; | |||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 0 | ▶ | sub DEMOLISH { # void ($in_global_destruction) | ||||||||||||||||||||||||||
|
Subroutine
DEMOLISH: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 124 | 0 | my ( $self, $in_global_destruction ) = @_; | |||||||||||||||||||||||||||
| 125 | 0 | ▶ | assert ( @_ == 2 ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 126 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | 0 | $freeGroups->( $self->{groups} ); | |||||||||||||||||||||||||||
| 128 | 0 | return; | |||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 0 | ▶ | sub focusItem { # void ($item) | ||||||||||||||||||||||||||
|
Subroutine
focusItem: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 132 | 0 | state $sig = signature( | |||||||||||||||||||||||||||
| 133 | method => Object, | ||||||||||||||||||||||||||||
| 134 | pos => [Int], | ||||||||||||||||||||||||||||
| 135 | ); | ||||||||||||||||||||||||||||
| 136 | 0 | my ( $self, $item ) = $sig->( @_ ); | |||||||||||||||||||||||||||
| 137 | 0 | $self->SUPER::focusItem( $item ); | |||||||||||||||||||||||||||
| 138 | 0 | my $curGroup = $self->{groups}; | |||||||||||||||||||||||||||
| 139 | $curGroup = $curGroup->{next} | ||||||||||||||||||||||||||||
| 140 | 0 | ▶ | while $curGroup && $item-- > 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$curGroup and $item-- > 0
MC/DC0%0/2
$curGroup and $item-- > 0
$curGroup
$item-- > 0
Truth table0%0/3
A and B
A= $curGroupB= $item-- > 0
| |||||||||||||||||||||||||||||
| 141 | 0 | ▶ | message( $self->{owner}, evBroadcast, cmNewColorItem, $curGroup ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 142 | if $curGroup; | ||||||||||||||||||||||||||||
| 143 | 0 | return; | |||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | 0 | ▶ | sub getText { # void (\$dest, $item, $maxChars) | ||||||||||||||||||||||||||
|
Subroutine
getText: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 147 | 0 | state $sig = signature( | |||||||||||||||||||||||||||
| 148 | method => Object, | ||||||||||||||||||||||||||||
| 149 | pos => [ScalarRef, Int, Int], | ||||||||||||||||||||||||||||
| 150 | ); | ||||||||||||||||||||||||||||
| 151 | 0 | my ( $self, $dest, $item, $maxChars ) = $sig->( @_ ); | |||||||||||||||||||||||||||
| 152 | 0 | my $curGroup = $self->{groups}; | |||||||||||||||||||||||||||
| 153 | $curGroup = $curGroup->{next} | ||||||||||||||||||||||||||||
| 154 | 0 | ▶ | while $curGroup && $item-- > 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$curGroup and $item-- > 0
MC/DC0%0/2
$curGroup and $item-- > 0
$curGroup
$item-- > 0
Truth table0%0/3
A and B
A= $curGroupB= $item-- > 0
| |||||||||||||||||||||||||||||
| 155 | 0 | ▶ | $$dest = substr( $curGroup->{name}, 0, $maxChars ) if $curGroup; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 156 | 0 | return; | |||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | 0 | ▶ | sub handleEvent { # void ($event) | ||||||||||||||||||||||||||
|
Subroutine
handleEvent: not called CC=3 SCAR=20.0
Pod
documented
| |||||||||||||||||||||||||||||
| 160 | 6 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 161 | 0 | state $sig = signature( | |||||||||||||||||||||||||||
| 162 | method => Object, | ||||||||||||||||||||||||||||
| 163 | pos => [Object], | ||||||||||||||||||||||||||||
| 164 | ); | ||||||||||||||||||||||||||||
| 165 | 0 | my ( $self, $event ) = $sig->( @_ ); | |||||||||||||||||||||||||||
| 166 | 0 | $self->SUPER::handleEvent( $event ); | |||||||||||||||||||||||||||
| 167 | 0 | ▶ | if ( $event->{what} == evBroadcast | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$event->{"what"} == 512 and $event->{"message"}{"command"} == 76
MC/DC0%0/2
$event->{"what"} == 512 and $event->{"message"}{"command"} == 76
$event->{"what"} == 512
$event->{"message"}{"command"} == 76
Truth table0%0/3
A and B
A= $event->{"what"} == 512B= $event->{"message"}{"command"} == 76
| |||||||||||||||||||||||||||||
| 168 | && $event->{message}{command} == cmSaveColorIndex | ||||||||||||||||||||||||||||
| 169 | ) { | ||||||||||||||||||||||||||||
| 170 | 0 | $self->setGroupIndex( $self->{focused}, $event->{message}{infoByte} ); | |||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | 0 | return; | |||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 0 | ▶ | sub setGroupIndex { # void ($groupNum, $itemNum) | ||||||||||||||||||||||||||
|
Subroutine
setGroupIndex: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 176 | 0 | state $sig = signature( | |||||||||||||||||||||||||||
| 177 | method => Object, | ||||||||||||||||||||||||||||
| 178 | pos => [PositiveOrZeroInt, PositiveOrZeroInt], | ||||||||||||||||||||||||||||
| 179 | ); | ||||||||||||||||||||||||||||
| 180 | 0 | my ( $self, $groupNum, $itemNum ) = $sig->( @_ ); | |||||||||||||||||||||||||||
| 181 | 0 | my $g = $self->getGroup( $groupNum ); | |||||||||||||||||||||||||||
| 182 | 0 | ▶ | $g->{index} = $itemNum | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 183 | if $g; | ||||||||||||||||||||||||||||
| 184 | 0 | return; | |||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 0 | ▶ | sub getGroupIndex { # $index ($groupNum) | ||||||||||||||||||||||||||
|
Subroutine
getGroupIndex: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 188 | 0 | state $sig = signature( | |||||||||||||||||||||||||||
| 189 | method => Object, | ||||||||||||||||||||||||||||
| 190 | pos => [PositiveOrZeroInt], | ||||||||||||||||||||||||||||
| 191 | ); | ||||||||||||||||||||||||||||
| 192 | 0 | my ( $self, $groupNum ) = $sig->( @_ ); | |||||||||||||||||||||||||||
| 193 | 0 | my $g = $self->getGroup( $groupNum ); | |||||||||||||||||||||||||||
| 194 | 0 | ▶ | return $g ? $g->{index} : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | 0 | ▶ | sub getGroup { # $colorGroup ($groupNum) | ||||||||||||||||||||||||||
|
Subroutine
getGroup: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 198 | 0 | state $sig = signature( | |||||||||||||||||||||||||||
| 199 | method => Object, | ||||||||||||||||||||||||||||
| 200 | pos => [PositiveOrZeroInt], | ||||||||||||||||||||||||||||
| 201 | ); | ||||||||||||||||||||||||||||
| 202 | 0 | my ( $self, $groupNum ) = $sig->( @_ ); | |||||||||||||||||||||||||||
| 203 | 0 | my $g = $self->{groups}; | |||||||||||||||||||||||||||
| 204 | $g = $g->{next} | ||||||||||||||||||||||||||||
| 205 | 0 | ▶ | while $g && $groupNum--; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$g and $groupNum--
MC/DC0%0/2
$g and $groupNum--
$g
$groupNum--
Truth table0%0/3
A and B
A= $gB= $groupNum--
| |||||||||||||||||||||||||||||
| 206 | 0 | return $g; | |||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | 0 | ▶ | sub getNumGroups { # $num () | ||||||||||||||||||||||||||
|
Subroutine
getNumGroups: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 210 | 0 | state $sig = signature( | |||||||||||||||||||||||||||
| 211 | method => Object, | ||||||||||||||||||||||||||||
| 212 | pos => [], | ||||||||||||||||||||||||||||
| 213 | ); | ||||||||||||||||||||||||||||
| 214 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||||||||||||||||||||
| 215 | 0 | my $n; | |||||||||||||||||||||||||||
| 216 | 0 | my $g = $self->{groups}; | |||||||||||||||||||||||||||
| 217 | 0 | ▶ | for ( $n = 0 ; $g ; $n++ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 218 | 0 | $g = $g->{next}; | |||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||
| 220 | 0 | return $n; | |||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | 0 | ▶ | $writeItems = sub { # void ($os, $items|undef) | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||
| 224 | 0 | my ( $self, $os, $items ) = @_; | |||||||||||||||||||||||||||
| 225 | 0 | ▶ | assert ( @_ == 3 ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 226 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 227 | 0 | ▶ | assert ( is_Object $os ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 228 | 0 | ▶ | assert ( !defined $items or is_Object $items ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $items or &is_Object($items)
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)
| |||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | 0 | my $count = 0; | |||||||||||||||||||||||||||
| 231 | 0 | ▶ | for ( my $item = $items ; $item ; $item = $item->{next} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 232 | 0 | $count++; | |||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||
| 234 | 0 | $os->put( $count ); | |||||||||||||||||||||||||||
| 235 | 0 | ▶ | for ( my $item = $items ; $item ; $item = $item->{next} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 236 | 0 | $os->put( $item->{name}, $item->{index} ); | |||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||
| 238 | 0 | return; | |||||||||||||||||||||||||||
| 239 | 6 | }; | |||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | 0 | ▶ | $writeGroups = sub { # void ($os, $groups|undef) | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||
| 242 | 0 | my ( $self, $os, $groups ) = @_; | |||||||||||||||||||||||||||
| 243 | 0 | ▶ | assert ( @_ == 3 ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 244 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 245 | 0 | ▶ | assert ( is_Object $os ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 246 | 0 | ▶ | assert ( !defined $groups or is_Object $groups ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $groups or &is_Object($groups)
MC/DC0%0/2
not defined $groups or &is_Object($groups)
not defined $groups
&is_Object($groups)
Truth table0%0/3
not(A) or B
A= not defined $groupsB= &is_Object($groups)
| |||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | 0 | my $count = 0; | |||||||||||||||||||||||||||
| 249 | 0 | ▶ | for ( my $group = $groups ; $group ; $group = $group->{next} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 250 | 0 | $count++; | |||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||
| 252 | 0 | $os->put( $count ); | |||||||||||||||||||||||||||
| 253 | 0 | ▶ | for ( my $group = $groups ; $group ; $group = $group->{next} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 254 | 0 | $os->put( $group->{name} ); | |||||||||||||||||||||||||||
| 255 | 0 | $self->$writeItems( $os, $group->{items} ); | |||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||
| 257 | 0 | return; | |||||||||||||||||||||||||||
| 258 | 6 | }; | |||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | 0 | ▶ | $readItems = sub { # $items|undef ($is) | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 261 | 0 | my ( $self, $is ) = @_; | |||||||||||||||||||||||||||
| 262 | 0 | ▶ | assert ( @_ == 2 ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 263 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 264 | 0 | ▶ | assert ( is_Object $is ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | 0 | my $count = $is->get(); | |||||||||||||||||||||||||||
| 267 | 0 | my ( $first, $last ); | |||||||||||||||||||||||||||
| 268 | 0 | ▶ | while ( $count-- > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 269 | 0 | ▶ | my $item = TColorItem->new( | ||||||||||||||||||||||||||
|
Condition0%0/2
$is->get // ""
MC/DC0%0/1
$is->get // ""
$is->get
Truth table0%0/2
A
A= $is->get
| |||||||||||||||||||||||||||||
| 270 | name => $is->get() // '', | ||||||||||||||||||||||||||||
| 271 | index => $is->get(), | ||||||||||||||||||||||||||||
| 272 | ); | ||||||||||||||||||||||||||||
| 273 | 0 | ▶ | if ( $last ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 274 | 0 | $last->{next} = $item; | |||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||
| 276 | else { | ||||||||||||||||||||||||||||
| 277 | 0 | $first = $item; | |||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||
| 279 | 0 | $last = $item; | |||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||
| 281 | 0 | return $first; | |||||||||||||||||||||||||||
| 282 | 6 | }; | |||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | 0 | ▶ | $readGroups = sub { # $groups|undef ($is) | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 285 | 0 | my ( $self, $is ) = @_; | |||||||||||||||||||||||||||
| 286 | 0 | ▶ | assert ( @_ == 2 ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 287 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 288 | 0 | ▶ | assert ( is_Object $is ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | 0 | my $count = $is->get(); | |||||||||||||||||||||||||||
| 291 | 0 | my ( $first, $last ); | |||||||||||||||||||||||||||
| 292 | 0 | ▶ | while ( $count-- > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 293 | 0 | ▶ | my $group = TColorGroup->new( | ||||||||||||||||||||||||||
|
Condition0%0/2
$is->get // ""
MC/DC0%0/1
$is->get // ""
$is->get
Truth table0%0/2
A
A= $is->get
| |||||||||||||||||||||||||||||
| 294 | name => $is->get() // '', | ||||||||||||||||||||||||||||
| 295 | items => $self->$readItems( $is ), | ||||||||||||||||||||||||||||
| 296 | ); | ||||||||||||||||||||||||||||
| 297 | 0 | ▶ | if ( $last ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 298 | 0 | $last->{next} = $group; | |||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||
| 300 | else { | ||||||||||||||||||||||||||||
| 301 | 0 | $first = $group; | |||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||
| 303 | 0 | $last = $group; | |||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||
| 305 | 0 | return $first; | |||||||||||||||||||||||||||
| 306 | 6 | }; | |||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | 0 | ▶ | sub write :method { # void ($os) | ||||||||||||||||||||||||||
|
Subroutine
write: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 309 | 0 | state $sig = signature( | |||||||||||||||||||||||||||
| 310 | method => Object, | ||||||||||||||||||||||||||||
| 311 | pos => [Object], | ||||||||||||||||||||||||||||
| 312 | ); | ||||||||||||||||||||||||||||
| 313 | 0 | my ( $self, $os ) = $sig->( @_ ); | |||||||||||||||||||||||||||
| 314 | 0 | $self->SUPER::write( $os ); | |||||||||||||||||||||||||||
| 315 | 0 | $self->$writeGroups( $os, $self->{groups} ); | |||||||||||||||||||||||||||
| 316 | 0 | return; | |||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | 0 | ▶ | sub read :method { # $self ($is) | ||||||||||||||||||||||||||
|
Subroutine
read: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 320 | 0 | state $sig = signature( | |||||||||||||||||||||||||||
| 321 | method => Object, | ||||||||||||||||||||||||||||
| 322 | pos => [Object], | ||||||||||||||||||||||||||||
| 323 | ); | ||||||||||||||||||||||||||||
| 324 | 0 | my ( $self, $is ) = $sig->( @_ ); | |||||||||||||||||||||||||||
| 325 | 0 | $self->SUPER::read( $is ); | |||||||||||||||||||||||||||
| 326 | 0 | $self->{groups} = $self->$readGroups( $is ); | |||||||||||||||||||||||||||
| 327 | 0 | return $self; | |||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | 0 | ▶ | sub build { # $obj () | ||||||||||||||||||||||||||
|
Subroutine
build: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 331 | 0 | my ( $class ) = @_; | |||||||||||||||||||||||||||
| 332 | 0 | ▶ | assert ( @_ == 1 ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 333 | 0 | ▶ | assert ( is_Str $class ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 334 | 0 | ▶ | assert ( Storable::is_retrieving ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 335 | 0 | return $class->new( | |||||||||||||||||||||||||||
| 336 | bounds => TRect->new(), | ||||||||||||||||||||||||||||
| 337 | scrollBar => undef, | ||||||||||||||||||||||||||||
| 338 | groups => undef, | ||||||||||||||||||||||||||||
| 339 | ); | ||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||
| 342 | 6 | 1 | |||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | __END__ | ||||||||||||||||||||||||||||