our
$VERSION
=
'0.012'
;
sub
SET_DESCRIPTION {
my
(
$this
,
$description
) =
@_
;
$this
->X3DField::SET_DESCRIPTION(
$description
);
$_
[0]->X3DPackage::Scalar(
"FieldType"
) =
'S'
.
substr
$description
->{typeName}, 1;
}
use
Weed
'X3DArrayField : X3DField { [] }'
;
use
overload
'@{}'
=>
sub
{
$_
[0]->{array} };
*new
= \
&X3DField::new
;
sub
create {
my
(
$this
) =
@_
;
die
$this
->getDefinition
unless
defined
$this
->getInitialValue;
$this
->{value} =
$this
->getInitialValue->getClone;
$this
->{array} = new Weed::Tie::Value::Array
$this
;
tie
$this
->{
length
},
'Weed::Tie::ArrayLength'
,
$this
->{array};
return
;
}
sub
getFieldType {
$_
[0]->X3DPackage::Scalar(
"FieldType"
) }
sub
setValue {
my
$this
=
shift
;
my
$array
=
$this
->{array};
if
( 0 ==
@_
) {
@$array
= ();
}
elsif
( 1 ==
@_
)
{
my
$value
=
shift
;
if
( X3DArray::isArray(
$value
) ) {
@$array
=
@$value
;
}
else
{
@$array
= (
$value
);
}
}
else
{
@$array
=
@_
;
}
$this
->X3DField::setValue(
$this
->getValue );
}
sub
length
: lvalue {
$_
[0]->{
length
} }
1;