1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008 Henrik Tidefelt
19 #include "shapesvalue.h"
20 #include "shapesexceptions.h"
22 #include "classtreemacros.h"
24 #if DISPATCHSTYLE == DISPATCHSTYLE_VOID
26 #elif DISPATCHSTYLE == DISPATCHSTYLE_CASE
30 using namespace Shapes
;
37 Lang::Value::~Value( )
42 Kernel::VariableHandle
43 Lang::Value::getField( const char * fieldID
, const RefCountPtr
< const Lang::Value
> & selfRef
) const
45 throw Exceptions::ElementaryWithout( Exceptions::ElementaryWithout::VALUE
, Exceptions::ElementaryWithout::FIELD
, getTypeName( ) );
49 Lang::Value::show( std::ostream
& os
) const
51 os
<< "(unable to display)" ;
55 RefCountPtr< const Lang::Value >
56 Lang::Value::transformed( const Shapes::Transform & transform, Kernel::ValueRef self ) const
58 throw Exceptions::CoreTypeMismatch( strrefdup( "<transform>" ), 1, this->getTypeName( ), Shapes::SEVERAL_TYPES );
61 RefCountPtr< const Lang::Value >
62 Lang::Value::transformed( const Lang::Transform3D & transform, Kernel::ValueRef self ) const
64 throw Exceptions::CoreTypeMismatch( strrefdup( "<transform3D>" ), 1, this->getTypeName( ), Shapes::SEVERAL_TYPES );
68 RefCountPtr
< const char >
69 Lang::Value::getTypeName( ) const
71 return this->getClass( )->getPrettyName( );
75 DISPATCHIMPL( NoOperatorOverloadValue
);
77 DISPATCHIMPL( NoOperatorOverloadGeometric2D
);
80 //RefCountPtr< const Lang::Class > Lang::NoOperatorOverloadValue::TypeID( new Lang::SystemFinalClass( strrefdup( "NonDispatching" ) ) );
81 //TYPEINFOIMPL( NoOperatorOverloadValue );
83 RefCountPtr
< const Lang::Class
> Lang::Geometric2D::TypeID
= NullPtr
< const Lang::Class
>( ); /* The value is set in main */
84 TYPEINFOIMPL( Geometric2D
);
86 RefCountPtr
< const Lang::Class
> Lang::Geometric3D::TypeID
= NullPtr
< const Lang::Class
>( ); /* The value is set in main */
87 TYPEINFOIMPL( Geometric3D
);
90 Kernel::VariableHandle
91 Helpers::newValHandle( const Lang::Value
* val
)
93 return Kernel::VariableHandle( new Kernel::Variable( RefCountPtr
< const Lang::Value
>( val
) ) );