comparison Lib/IMPL/DOM/Node.pm @ 11:75980091813b

DOM и навигация
author Sergey
date Wed, 02 Sep 2009 17:47:44 +0400
parents 94d47b388442
children 65a7bb156fb7
comparison
equal deleted inserted replaced
10:63f6653b094e 11:75980091813b
1 package IMPL::DOM::Node; 1 package IMPL::DOM::Node;
2 use strict; 2 use strict;
3 use warnings; 3 use warnings;
4 4
5 use base qw(IMPL::Object IMPL::Object::Serializable IMPL::Object::Autofill); 5 use base qw(IMPL::Object);
6 6
7 use IMPL::Object::List; 7 use IMPL::Object::List;
8 use IMPL::Class::Property; 8 use IMPL::Class::Property;
9 use IMPL::Class::Property::Direct; 9 use IMPL::Class::Property::Direct;
10 use Scalar::Util qw(weaken); 10 use Scalar::Util qw(weaken);
11 11
12 use IMPL::Exception; 12 use IMPL::Exception;
13
14 __PACKAGE__->PassThroughArgs;
15 13
16 BEGIN { 14 BEGIN {
17 public _direct property nodeName => prop_get | owner_set; 15 public _direct property nodeName => prop_get | owner_set;
18 public _direct property isComplex => { get => \&_getIsComplex } ; 16 public _direct property isComplex => { get => \&_getIsComplex } ;
19 public _direct property nodeValue => prop_all; 17 public _direct property nodeValue => prop_all;
21 public _direct property parentNode => prop_get ; 19 public _direct property parentNode => prop_get ;
22 private _direct property _propertyMap => prop_get ; 20 private _direct property _propertyMap => prop_get ;
23 } 21 }
24 22
25 sub CTOR { 23 sub CTOR {
26 my ($this,$name) = @_; 24 my ($this,%args) = @_;
27 25
28 $this->nodeName($name) or die new IMPL::InvalidArgumentException("A name is required"); 26 $this->nodeName($args{nodeName}) or die new IMPL::InvalidArgumentException("A name is required");
29 } 27 }
30 28
31 sub insertNode { 29 sub insertNode {
32 my ($this,$node,$pos) = @_; 30 my ($this,$node,$pos) = @_;
33 31
110 sub _getIsComplex { 108 sub _getIsComplex {
111 $_[0]->childNodes->Count ? 1 : 0; 109 $_[0]->childNodes->Count ? 1 : 0;
112 } 110 }
113 111
114 sub _setParent { 112 sub _setParent {
115 my ($this,$parentNode) = @_; 113 my ($this,$node) = @_;
116 114
117 $this->{$parentNode} = $parentNode; 115 $this->{$parentNode} = $node;
118 weaken($this->{$parentNode}); 116 weaken($this->{$parentNode});
119 } 117 }
120 118
121 sub text { 119 sub text {
122 my ($this) = @_; 120 my ($this) = @_;