SAC/Selector/Descendant.pm

filter: Statementstmt 100% 26 / 26 Branchbran 50.0% 3 / 6 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 7 / 7 Podpod 100% 3 / 3 totaltotal 88.8% 40 / 45 CC 4 SCAR 5.1
CC
4
Cov
88%
AncestorSelector
2.1
SimpleSelector
2.1
new
2.0
CRAP 1.7
« SAC/Selector/Conditional.pm ↑ Summary SAC/Condition/Negative.pm »
1
2 ###
3 # CSS::SAC::Selector::Descendant - SAC DescendantSelector
4 # Robin Berjon <robin@knowscape.com>
5 # 24/02/2001
6 ###
7
8 package CSS::SAC::Selector::Descendant;
9 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶$VERSION = $CSS::SAC::VERSION || '0.03';
Condition50%1/2
$CSS::SAC::VERSION || '0.03'
l!l
02
MC/DC0%0/1
$CSS::SAC::VERSION || '0.03'
$CSS::SAC::VERSION
Truth table50%1/2
A
A= $CSS::SAC::VERSION
Aresult
11
00
12
13 2 ▶use base qw(CSS::SAC::Selector);
Subroutine BEGIN: called CC=1 SCAR=0.0
14
15
16 #---------------------------------------------------------------------#
17 # build the fields for an array based object
18 #---------------------------------------------------------------------#
19 2 ▶use Class::ArrayObjects extend => {
Subroutine BEGIN: called CC=1 SCAR=0.0
20 class => 'CSS::SAC::Selector',
21 with => [qw(
22 _ancestor_
23 _simple_
24 )],
25 2 };
26 #---------------------------------------------------------------------#
27
28
29
30
31 ### Constructor #######################################################
32 # #
33 # #
34
35
36 #---------------------------------------------------------------------#
37 # CSS::SAC::Selector::Descendant->new($type,$ancestor_sel,$simple_sel)
38 # creates a new sac DescendantSelector object
39 #---------------------------------------------------------------------#
40 2 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
Pod documented
41 2 ▶ my $class = ref($_[0])?ref(shift):shift;
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 2 2
42 2 my $type = shift;
43 2 my $ancestor_sel = shift;
44 2 my $simple_sel = shift;
45
46 # create a selector
47 2 my $dsel = $class->SUPER::new($type);
48
49 # add our fields
50 2 $dsel->[_ancestor_] = $ancestor_sel;
51 2 $dsel->[_simple_] = $simple_sel;
52
53 2 return $dsel;
54 }
55 #---------------------------------------------------------------------#
56
57
58 # #
59 # #
60 ### Constructor #######################################################
61
62
63
64 ### Accessors #########################################################
65 # #
66 # #
67
68 2 *CSS::SAC::Selector::Descendant::getAncestorSelector = \&AncestorSelector;
69 2 *CSS::SAC::Selector::Descendant::getSimpleSelector = \&SimpleSelector;
70
71 #---------------------------------------------------------------------#
72 # my $ancestor_sel = $dsel->AncestorSelector()
73 # $dsel->AncestorSelector($ancestor_sel)
74 # get/set the selector's ancestor selector
75 #---------------------------------------------------------------------#
76 2 ▶sub AncestorSelector {
Subroutine AncestorSelector: called CC=2 SCAR=7.6
Pod documented
77 2 ▶ (@_==2) ? $_[0]->[_ancestor_] = $_[1] :
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 0 2 2
78 $_[0]->[_ancestor_];
79 }
80 #---------------------------------------------------------------------#
81
82
83 #---------------------------------------------------------------------#
84 # my $simple_sel = $dsel->SimpleSelector()
85 # $dsel->SimpleSelector($simple_sel)
86 # get/set the selector's simple selector
87 #---------------------------------------------------------------------#
88 2 ▶sub SimpleSelector {
Subroutine SimpleSelector: called CC=2 SCAR=7.6
Pod documented
89 2 ▶ (@_==2) ? $_[0]->[_simple_] = $_[1] :
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 0 2 2
90 $_[0]->[_simple_];
91 }
92 #---------------------------------------------------------------------#
93
94
95 # #
96 # #
97 ### Accessors #########################################################
98
99
100
101 2 1;
102
103 =pod
104
105 =head1 NAME
106
107 CSS::SAC::Selector::Descendant - SAC DescendantSelector
108
109 =head1 SYNOPSIS
110
111 see CSS::SAC::Selector
112
113 =head1 DESCRIPTION
114
115 This is a subclass of CSS::SAC::Selector, look there for more
116 documentation. This class adds the following methods (which also exist
117 in spec style, simply prepend them with 'get'):
118
119 =head1 METHODS
120
121 =over
122
123 =item * CSS::SAC::Selector::Descendant->new($type,$ancestor_sel,$simple_sel)
124 =item * $dsel->new($type,$ancestor_sel,$simple_sel)
125
126 Creates a new descendant selector.
127
128 =item * $dsel->AncestorSelector([$ancestor_sel])
129
130 get/set the selector's ancestor selector
131
132 =item * $dsel->SimpleSelector([$simple_sel])
133
134 get/set the selector's simple selector
135
136 =back
137
138 =head1 AUTHOR
139
140 Robin Berjon <robin@knowscape.com>
141
142 This module is licensed under the same terms as Perl itself.
143
144 =cut
145
146
« SAC/Selector/Conditional.pm ↑ Summary SAC/Condition/Negative.pm »