1 : //==============================================================================
2 : // File <$/src/cpp/dev/idlc/boolean_value.cpp>
3 : // This file is part of YaOrb : Yet Another Object Request Broker,
4 : // Copyright (c) 2000-2003, Marc Alff.
5 : //
6 : // This program is free software; you can redistribute it and/or
7 : // modify it under the terms of the GNU General Public License
8 : // as published by the Free Software Foundation; either version 2
9 : // of the License, or (at your option) any later version.
10 : //
11 : // This program is distributed in the hope that it will be useful,
12 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : // GNU General Public License for more details.
15 : //
16 : // You should have received a copy of the GNU General Public License
17 : // along with this program; if not, write to the Free Software
18 : // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 : //
20 : //==============================================================================
21 :
22 : #include <stdio.h>
23 :
24 : #include "src/cpp/prod/tool/DEVELOPMENT.h"
25 : #include "src/cpp/prod/tool/Assert.h"
26 : #include "src/cpp/prod/tool/String.h"
27 :
28 : #include "src/cpp/dev/idlc/boolean_value.h"
29 : #include "src/cpp/dev/idlc/yyutils.h"
30 :
31 48 : static IDLBoolType global_type ;
32 :
33 0 : IDLType* IDLBooleanValue::GetValueType(void) const
34 : {
35 : return & global_type ;
36 : }
37 :
38 0 : IDLBooleanValue::IDLBooleanValue(bool b)
39 0 : : IDLValue(idl_boolType), _value(b)
40 : {}
41 :
42 0 : IDLBooleanValue::IDLBooleanValue(const IDLBooleanValue& v)
43 0 : : IDLValue(v), _value(v._value)
44 : {}
45 :
46 0 : IDLBooleanValue::~IDLBooleanValue()
47 0 : {}
48 :
49 0 : bool IDLBooleanValue::GetBoolean(void) const
50 : {
51 : return _value ;
52 : }
53 :
54 0 : IDLValue* IDLBooleanValue::copy(void)
55 : {
56 0 : return new IDLBooleanValue(*this) ;
57 : }
58 :
59 0 : void IDLBooleanValue::print(std::ostream &str) const
60 : {
61 0 : if (IsError())
62 : {
63 0 : str << "boolean <error>" ;
64 : }
65 : else
66 : {
67 0 : str << "boolean " << (_value ? "TRUE" : "FALSE") ;
68 : }
69 : }
70 :
71 0 : void IDLBooleanValue::convert(IDLType *type)
72 : {
73 0 : if (type->isA() != idl_boolType)
74 : {
75 0 : typeConvertionError(type) ;
76 : }
77 48 : }
78 48 :
|