line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
###
|
3
|
|
|
|
|
|
|
# CSS::SAC::Condition::Combinator - SAC CombinatorConditions
|
4
|
|
|
|
|
|
|
# Robin Berjon
|
5
|
|
|
|
|
|
|
# 24/02/2001
|
6
|
|
|
|
|
|
|
###
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package CSS::SAC::Condition::Combinator;
|
9
|
2
|
|
|
2
|
|
10
|
use strict;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
73
|
|
10
|
2
|
|
|
2
|
|
11
|
use vars qw($VERSION);
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
108
|
|
11
|
|
|
|
|
|
|
$VERSION = $CSS::SAC::VERSION || '0.03';
|
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
12
|
use base qw(CSS::SAC::Condition);
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
203
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
17
|
|
|
|
|
|
|
# build the fields for an array based object
|
18
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
19
|
2
|
|
|
|
|
16
|
use Class::ArrayObjects extend => {
|
20
|
|
|
|
|
|
|
class => 'CSS::SAC::Condition',
|
21
|
|
|
|
|
|
|
with => [qw(
|
22
|
|
|
|
|
|
|
_condition_1_
|
23
|
|
|
|
|
|
|
_condition_2_
|
24
|
|
|
|
|
|
|
)],
|
25
|
2
|
|
|
2
|
|
12
|
};
|
|
2
|
|
|
|
|
4
|
|
26
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
### Constructor #######################################################
|
32
|
|
|
|
|
|
|
# #
|
33
|
|
|
|
|
|
|
# #
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
37
|
|
|
|
|
|
|
# CSS::SAC::Condition::Combinator->new($type,$first_cond,$second_cond)
|
38
|
|
|
|
|
|
|
# creates a new sac CombinatorCondition object
|
39
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
40
|
|
|
|
|
|
|
sub new {
|
41
|
2
|
50
|
|
2
|
1
|
6
|
my $class = ref($_[0])?ref(shift):shift;
|
42
|
2
|
|
|
|
|
3
|
my $type = shift; # should be one of the combinator conditions
|
43
|
2
|
|
|
|
|
3
|
my $condition_1 = shift; # any default ?
|
44
|
2
|
|
|
|
|
2
|
my $condition_2 = shift;
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# create a condition
|
47
|
2
|
|
|
|
|
12
|
my $ccond = $class->SUPER::new($type);
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# add our fields
|
50
|
2
|
50
|
|
|
|
28
|
$ccond->[_condition_1_] = $condition_1 if $condition_1;
|
51
|
2
|
50
|
|
|
|
8
|
$ccond->[_condition_2_] = $condition_2 if $condition_2;
|
52
|
|
|
|
|
|
|
|
53
|
2
|
|
|
|
|
7
|
return $ccond;
|
54
|
|
|
|
|
|
|
}
|
55
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# #
|
59
|
|
|
|
|
|
|
# #
|
60
|
|
|
|
|
|
|
### Constructor #######################################################
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
### Accessors #########################################################
|
65
|
|
|
|
|
|
|
# #
|
66
|
|
|
|
|
|
|
# #
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# aliases
|
69
|
|
|
|
|
|
|
*CSS::SAC::Condition::Combinator::getFirstCondition = \&FirstCondition;
|
70
|
|
|
|
|
|
|
*CSS::SAC::Condition::Combinator::getSecondCondition = \&SecondCondition;
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
74
|
|
|
|
|
|
|
# my $cond1 = $ccond->FirstCondition()
|
75
|
|
|
|
|
|
|
# $ccond->FirstCondition($cond1)
|
76
|
|
|
|
|
|
|
# get/set the first condition
|
77
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
78
|
|
|
|
|
|
|
sub FirstCondition {
|
79
|
6
|
50
|
|
6
|
1
|
53
|
(@_==2) ? $_[0]->[_condition_1_] = $_[1] :
|
80
|
|
|
|
|
|
|
$_[0]->[_condition_1_];
|
81
|
|
|
|
|
|
|
}
|
82
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
86
|
|
|
|
|
|
|
# my $cond2 = $ccond->SecondCondition()
|
87
|
|
|
|
|
|
|
# $ccond->SecondCondition($cond2)
|
88
|
|
|
|
|
|
|
# get/set the second condition
|
89
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
90
|
|
|
|
|
|
|
sub SecondCondition {
|
91
|
6
|
50
|
|
6
|
1
|
45
|
(@_==2) ? $_[0]->[_condition_2_] = $_[1] :
|
92
|
|
|
|
|
|
|
$_[0]->[_condition_2_];
|
93
|
|
|
|
|
|
|
}
|
94
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
# #
|
99
|
|
|
|
|
|
|
# #
|
100
|
|
|
|
|
|
|
### Accessors #########################################################
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1;
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=pod
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 NAME
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
CSS::SAC::Condition::Combinator - SAC CombinatorConditions
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
see CSS::SAC::Condition
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
This is a subclass of CSS::SAC::Condition, look there for more
|
119
|
|
|
|
|
|
|
documentation. This class adds the following methods (the spec
|
120
|
|
|
|
|
|
|
equivalents are available as well, just prepend 'get'):
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 METHODS
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=over 4
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item * CSS::SAC::Condition::Combinator->new($type,$cond1,$cond2)
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=item * $cond->new($type,$cond1,$cond2)
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Creates a new combinator condition.
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item * $ccond->FirstCondition([$cond])
|
133
|
|
|
|
|
|
|
=item * $ccond->SecondCondition([$cond])
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
get/set the conditions that compose the combinator
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=back
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 AUTHOR
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Robin Berjon
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
This module is licensed under the same terms as Perl itself.
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=cut
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|