Update suitable examples and tests to use blank mode
[shapes.git] / source / shapesvalue.cc
blobe9c8ba59141a5098eda248f490796221fcb9a2d3
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
6 * any later version.
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, 2013 Henrik Tidefelt
19 #include "shapesvalue.h"
20 #include "shapesexceptions.h"
21 #include "consts.h"
22 #include "classtreemacros.h"
24 #if DISPATCHSTYLE == DISPATCHSTYLE_VOID
25 #include "globals.h"
26 #elif DISPATCHSTYLE == DISPATCHSTYLE_CASE
27 #include "astexpr.h"
28 #endif
30 using namespace Shapes;
33 Lang::Value::Value( )
34 : node_( 0 )
35 { }
37 Lang::Value::~Value( )
38 { }
40 DISPATCHBASEIMPL
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( ) );
48 void
49 Lang::Value::show( std::ostream & os ) const
51 os << "(unable to display)" ;
54 RefCountPtr< const char >
55 Lang::Value::getTypeName( ) const
57 return this->getClass( )->getPrettyName( );
61 Lang::Void::Void( )
62 { }
64 RefCountPtr< const Lang::Class > Lang::Void::TypeID( new Lang::SystemFinalClass( strrefdup( "Void" ) ) );
65 TYPEINFOIMPL( Void );
67 void
68 Lang::Void::show( std::ostream & os ) const
69 { }
72 DISPATCHIMPL( NoOperatorOverloadValue );
74 DISPATCHIMPL( NoOperatorOverloadGeometric2D );
77 //RefCountPtr< const Lang::Class > Lang::NoOperatorOverloadValue::TypeID( new Lang::SystemFinalClass( strrefdup( "NonDispatching" ) ) );
78 //TYPEINFOIMPL( NoOperatorOverloadValue );
80 RefCountPtr< const Lang::Class > Lang::Geometric2D::TypeID = NullPtr< const Lang::Class >( ); /* The value is set in main */
81 TYPEINFOIMPL( Geometric2D );
83 RefCountPtr< const Lang::Class > Lang::Geometric3D::TypeID = NullPtr< const Lang::Class >( ); /* The value is set in main */
84 TYPEINFOIMPL( Geometric3D );
87 Lang::Hot::Hot::Hot( )
88 { }
90 Lang::Hot::~Hot( )
91 { }
93 RefCountPtr< const Lang::Class > Lang::Hot::TypeID( new Lang::SystemFinalClass( strrefdup( "Hot" ) ) );
94 TYPEINFOIMPL( Hot );
97 Kernel::VariableHandle
98 Helpers::newValHandle( const Lang::Value * val )
100 return Kernel::VariableHandle( new Kernel::Variable( RefCountPtr< const Lang::Value >( val ) ) );