Mercurial > pub > Impl
comparison Lib/IMPL/Class/Property/Direct.pm @ 194:4d0e1962161c
Replaced tabs with spaces
IMPL::Web::View - fixed document model, new features (control classes, document constructor parameters)
author | cin |
---|---|
date | Tue, 10 Apr 2012 20:08:29 +0400 |
parents | d1676be8afcc |
children | 6253872024a4 |
comparison
equal
deleted
inserted
replaced
193:8e8401c0aea4 | 194:4d0e1962161c |
---|---|
9 require IMPL::Exception; | 9 require IMPL::Exception; |
10 | 10 |
11 __PACKAGE__->mk_accessors( qw(ExportField) ); | 11 __PACKAGE__->mk_accessors( qw(ExportField) ); |
12 | 12 |
13 sub factoryParams { | 13 sub factoryParams { |
14 $_[0]->SUPER::factoryParams, qw($field); | 14 $_[0]->SUPER::factoryParams, qw($field); |
15 } | 15 } |
16 | 16 |
17 my $default = __PACKAGE__->new({ExportField => 1}); | 17 my $default = __PACKAGE__->new({ExportField => 1}); |
18 | 18 |
19 sub _direct($) { | 19 sub _direct($) { |
22 return $prop_info; | 22 return $prop_info; |
23 } | 23 } |
24 | 24 |
25 | 25 |
26 sub GenerateGet { | 26 sub GenerateGet { |
27 'return ($this->{$field});'; | 27 'return ($this->{$field});'; |
28 } | 28 } |
29 | 29 |
30 sub GenerateSet { | 30 sub GenerateSet { |
31 'return ($this->{$field} = $_[0])'; | 31 'return ($this->{$field} = $_[0])'; |
32 } | 32 } |
33 | 33 |
34 sub GenerateSetList { | 34 sub GenerateSetList { |
35 'return( | 35 'return( |
36 wantarray ? | 36 wantarray ? |
37 @{ $this->{$field} = IMPL::Object::List->new( | 37 @{ $this->{$field} = IMPL::Object::List->new( |
38 (@_ == 1 and UNIVERSAL::isa($_[0], \'ARRAY\') ) ? $_[0] : [@_] | 38 (@_ == 1 and UNIVERSAL::isa($_[0], \'ARRAY\') ) ? $_[0] : [@_] |
39 )} : | 39 )} : |
40 ($this->{$field} = IMPL::Object::List->new( | 40 ($this->{$field} = IMPL::Object::List->new( |
41 (@_ == 1 and UNIVERSAL::isa($_[0], \'ARRAY\') ) ? $_[0] : [@_] | 41 (@_ == 1 and UNIVERSAL::isa($_[0], \'ARRAY\') ) ? $_[0] : [@_] |
42 )) | 42 )) |
43 );'; | 43 );'; |
44 } | 44 } |
45 | 45 |
46 sub GenerateGetList { | 46 sub GenerateGetList { |
47 'return( | 47 'return( |
48 wantarray ? | 48 wantarray ? |
49 @{ $this->{$field} ? | 49 @{ $this->{$field} ? |
50 $this->{$field} : | 50 $this->{$field} : |
51 ( $this->{$field} = IMPL::Object::List->new() ) | 51 ( $this->{$field} = IMPL::Object::List->new() ) |
52 } : | 52 } : |
53 ( $this->{$field} ? | 53 ( $this->{$field} ? |
54 $this->{$field} : | 54 $this->{$field} : |
55 ( $this->{$field} = IMPL::Object::List->new() ) | 55 ( $this->{$field} = IMPL::Object::List->new() ) |
56 ) | 56 ) |
57 );'; | 57 );'; |
58 } | 58 } |
59 | 59 |
60 sub RemapFactoryParams { | 60 sub RemapFactoryParams { |
61 my ($self,$propInfo) = @_; | 61 my ($self,$propInfo) = @_; |
62 | 62 |
63 return $self->SUPER::RemapFactoryParams($propInfo),$self->FieldName($propInfo); | 63 return $self->SUPER::RemapFactoryParams($propInfo),$self->FieldName($propInfo); |
64 } | 64 } |
65 | 65 |
66 sub Make { | 66 sub Make { |
67 my ($self,$propInfo) = @_; | 67 my ($self,$propInfo) = @_; |
68 | 68 |
69 $self->SUPER::Make($propInfo); | 69 $self->SUPER::Make($propInfo); |
70 | 70 |
71 { | 71 { |
72 no strict 'refs'; | 72 no strict 'refs'; |
73 if (ref $self and $self->ExportField) { | 73 if (ref $self and $self->ExportField) { |
74 my $field = $self->FieldName($propInfo); | 74 my $field = $self->FieldName($propInfo); |
75 *{$propInfo->Class.'::'.$propInfo->Name} = \$field; | 75 *{$propInfo->Class.'::'.$propInfo->Name} = \$field; |
76 } | 76 } |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 sub FieldName { | 80 sub FieldName { |
81 my ($self,$propInfo) = @_; | 81 my ($self,$propInfo) = @_; |
82 | 82 |