line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
###
|
3
|
|
|
|
|
|
|
# CSS::SAC::Condition::Attribute - SAC AttributeConditions
|
4
|
|
|
|
|
|
|
# Robin Berjon
|
5
|
|
|
|
|
|
|
# 24/02/2001
|
6
|
|
|
|
|
|
|
###
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package CSS::SAC::Condition::Attribute;
|
9
|
2
|
|
|
2
|
|
11
|
use strict;
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
77
|
|
10
|
2
|
|
|
2
|
|
10
|
use vars qw($VERSION);
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
110
|
|
11
|
|
|
|
|
|
|
$VERSION = $CSS::SAC::VERSION || '0.03';
|
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
11
|
use base qw(CSS::SAC::Condition);
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
339
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
16
|
|
|
|
|
|
|
# build the fields for an array based object
|
17
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
18
|
2
|
|
|
|
|
16
|
use Class::ArrayObjects extend => {
|
19
|
|
|
|
|
|
|
class => 'CSS::SAC::Condition',
|
20
|
|
|
|
|
|
|
with => [qw(
|
21
|
|
|
|
|
|
|
_local_name_
|
22
|
|
|
|
|
|
|
_value_
|
23
|
|
|
|
|
|
|
_ns_uri_
|
24
|
|
|
|
|
|
|
_specified_
|
25
|
|
|
|
|
|
|
)],
|
26
|
2
|
|
|
2
|
|
12
|
};
|
|
2
|
|
|
|
|
4
|
|
27
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
### Constructor #######################################################
|
33
|
|
|
|
|
|
|
# #
|
34
|
|
|
|
|
|
|
# #
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
38
|
|
|
|
|
|
|
# CSS::SAC::Condition::Attribute->new($type,$lname,$ns,$specified,$value)
|
39
|
|
|
|
|
|
|
# creates a new sac AttributeCondition object
|
40
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
41
|
|
|
|
|
|
|
sub new {
|
42
|
15
|
50
|
|
15
|
1
|
34
|
my $class = ref($_[0])?ref(shift):shift;
|
43
|
15
|
|
|
|
|
18
|
my $type = shift; # should be one of the attribute conditions
|
44
|
15
|
|
|
|
|
17
|
my $local_name = shift;
|
45
|
15
|
|
|
|
|
17
|
my $ns_uri = shift;
|
46
|
15
|
|
|
|
|
15
|
my $specified = shift;
|
47
|
15
|
|
|
|
|
20
|
my $value = shift;
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# create a condition
|
50
|
15
|
|
|
|
|
59
|
my $acond = $class->SUPER::new($type);
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# add our fields
|
53
|
15
|
100
|
|
|
|
58
|
$acond->[_local_name_] = $local_name if $local_name;
|
54
|
15
|
100
|
|
|
|
54
|
$acond->[_value_] = $value if defined $value;
|
55
|
15
|
100
|
|
|
|
43
|
$acond->[_ns_uri_] = $ns_uri if defined $ns_uri;
|
56
|
15
|
100
|
|
|
|
30
|
$acond->[_specified_] = $specified if $specified;
|
57
|
|
|
|
|
|
|
|
58
|
15
|
|
|
|
|
59
|
return $acond;
|
59
|
|
|
|
|
|
|
}
|
60
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# #
|
64
|
|
|
|
|
|
|
# #
|
65
|
|
|
|
|
|
|
### Constructor #######################################################
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
### Accessors #########################################################
|
70
|
|
|
|
|
|
|
# #
|
71
|
|
|
|
|
|
|
# #
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# aliases
|
74
|
|
|
|
|
|
|
*CSS::SAC::Condition::Attribute::getLocalName = \&LocalName;
|
75
|
|
|
|
|
|
|
*CSS::SAC::Condition::Attribute::getNamespaceURI = \&NamespaceURI;
|
76
|
|
|
|
|
|
|
*CSS::SAC::Condition::Attribute::getValue = \&Value;
|
77
|
|
|
|
|
|
|
*CSS::SAC::Condition::Attribute::getSpecified = \&Specified;
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
81
|
|
|
|
|
|
|
# my $lname = $cond->LocalName()
|
82
|
|
|
|
|
|
|
# $cond->LocalName($lname)
|
83
|
|
|
|
|
|
|
# get/set the local name
|
84
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
85
|
|
|
|
|
|
|
sub LocalName {
|
86
|
9
|
50
|
|
9
|
1
|
106
|
(@_==2) ? $_[0]->[_local_name_] = $_[1] :
|
87
|
|
|
|
|
|
|
$_[0]->[_local_name_];
|
88
|
|
|
|
|
|
|
}
|
89
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
93
|
|
|
|
|
|
|
# my $ns = $cond->NamespaceURI()
|
94
|
|
|
|
|
|
|
# $cond->NamespaceURI($ns)
|
95
|
|
|
|
|
|
|
# get/set the ns uri
|
96
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
97
|
|
|
|
|
|
|
sub NamespaceURI {
|
98
|
9
|
50
|
|
9
|
1
|
103
|
(@_==2) ? $_[0]->[_ns_uri_] = $_[1] :
|
99
|
|
|
|
|
|
|
$_[0]->[_ns_uri_];
|
100
|
|
|
|
|
|
|
}
|
101
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
105
|
|
|
|
|
|
|
# my $value = $cond->Value()
|
106
|
|
|
|
|
|
|
# $cond->Value($value)
|
107
|
|
|
|
|
|
|
# get/set the value
|
108
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
109
|
|
|
|
|
|
|
sub Value {
|
110
|
12
|
50
|
|
12
|
1
|
128
|
(@_==2) ? $_[0]->[_value_] = $_[1] :
|
111
|
|
|
|
|
|
|
$_[0]->[_value_];
|
112
|
|
|
|
|
|
|
}
|
113
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
117
|
|
|
|
|
|
|
# my $spec = $cond->Specified()
|
118
|
|
|
|
|
|
|
# $cond->Specified($spec)
|
119
|
|
|
|
|
|
|
# get/set the 'specified' state, ie whether a specific value was
|
120
|
|
|
|
|
|
|
# requested for this attr
|
121
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
122
|
|
|
|
|
|
|
sub Specified {
|
123
|
9
|
50
|
|
9
|
1
|
89
|
(@_==2) ? $_[0]->[_specified_] = $_[1] :
|
124
|
|
|
|
|
|
|
$_[0]->[_specified_];
|
125
|
|
|
|
|
|
|
}
|
126
|
|
|
|
|
|
|
#---------------------------------------------------------------------#
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
# #
|
131
|
|
|
|
|
|
|
# #
|
132
|
|
|
|
|
|
|
### Accessors #########################################################
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
1;
|
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=pod
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 NAME
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
CSS::SAC::Condition::Attribute - SAC AttributeConditions
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
see CSS::SAC::Condition
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
This is a subclass of CSS::SAC::Condition, look there for more
|
151
|
|
|
|
|
|
|
documentation. This class adds the following methods (the spec
|
152
|
|
|
|
|
|
|
equivalents are available as well, just prepend 'get'):
|
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 METHODS
|
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=over 4
|
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=item * CSS::SAC::Condition::Attribute->new($type,$lname,$ns,$specified,$value)
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item * $cond->new($type,$lname,$ns,$specified,$value)
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Creates a new attribute condition.
|
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item * $acond->LocalName([$lname])
|
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
get/set the local name
|
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item * $acond->NamespaceURI([$ns])
|
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
get/set the ns uri
|
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item * $acond->Value([$value])
|
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
get/set the value
|
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item * $acond->Specified([$spec])
|
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
get/set the 'specified' state, ie whether a specific value was
|
179
|
|
|
|
|
|
|
requested for this attr
|
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=back
|
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 AUTHOR
|
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Robin Berjon
|
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
This module is licensed under the same terms as Perl itself.
|
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=cut
|
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
|