| 1 | package TUI::Objects::StringCollection; | ||
| 2 | # ABSTRACT: Implement a string collection for the framework. | ||
| 3 | |||
| 4 | 21 | ▶ | use 5.010; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 21 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 21 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 21 | our $VERSION = '2.000002'; | |
| 9 | 21 | $VERSION =~ tr/_//d; | |
| 10 | 21 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |
| 11 | |||
| 12 | 21 | ▶ | use Exporter 'import'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 21 | our @EXPORT = qw( | |
| 14 | TStringCollection | ||
| 15 | new_TStringCollection | ||
| 16 | ); | ||
| 17 | |||
| 18 | 21 | ▶ | use TUI::toolkit; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 19 | 21 | ▶ | use TUI::toolkit::Types qw( :types ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 20 | |||
| 21 | 21 | ▶ | use TUI::Objects::Const qw( ccNotFound ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | 21 | ▶ | use TUI::Objects::SortedCollection; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 23 | |||
| 24 | sub TStringCollection() { __PACKAGE__ } | ||
| 25 | sub name() { 'TStringCollection' }; | ||
| 26 | 2 | ▶ | sub new_TStringCollection { __PACKAGE__->from(@_) } |
|
Subroutine
new_TStringCollection: called CC=1 SCAR=0.0
Pod
documented
| |||
| 27 | |||
| 28 | 21 | extends TSortedCollection; | |
| 29 | |||
| 30 | 4 | ▶ | sub BUILDARGS { # \%args (%args) |
|
Subroutine
BUILDARGS: called CC=1 SCAR=0.0
Pod
documented
| |||
| 31 | 4 | state $sig = signature( | |
| 32 | method => 1, | ||
| 33 | named => [ | ||
| 34 | limit => Int, { alias => 'aLimit' }, | ||
| 35 | delta => Int, { alias => 'aDelta' }, | ||
| 36 | ], | ||
| 37 | caller_level => +1, | ||
| 38 | ); | ||
| 39 | 4 | my ( $class, $args ) = $sig->( @_ ); | |
| 40 | 4 | return { %$args }; | |
| 41 | } | ||
| 42 | |||
| 43 | 2 | ▶ | sub from { # $obj ($aLimit, $aDelta) |
|
Subroutine
from: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 44 | 2 | state $sig = signature( | |
| 45 | method => 1, | ||
| 46 | pos => [Int, Int], | ||
| 47 | ); | ||
| 48 | 2 | my ( $class, @args ) = $sig->( @_ ); | |
| 49 | 2 | return $class->new( limit => $args[0], delta => $args[1] ); | |
| 50 | } | ||
| 51 | |||
| 52 | 3 | ▶ | sub compare { # $cmp ($key1, $key2) |
|
Subroutine
compare: called CC=1 SCAR=0.0
Pod
documented
| |||
| 53 | 3 | state $sig = signature( | |
| 54 | method => Object, | ||
| 55 | pos => [Str, Str], | ||
| 56 | ); | ||
| 57 | 3 | my ( $self, $key1, $key2 ) = $sig->( @_ ); | |
| 58 | 3 | return $key1 cmp $key2; | |
| 59 | } | ||
| 60 | |||
| 61 | 21 | 1 | |
| 62 | |||
| 63 | __END__ | ||