1 : //==============================================================================
2 : // File <$/src/cpp/dev/idlc/char_value.cpp>
3 : // This file is part of YaOrb : Yet Another Object Request Broker,
4 : // Copyright (c) 2000-2003, 2006, 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 :
27 : #include "src/cpp/dev/idlc/char_value.h"
28 : #include "src/cpp/dev/idlc/yyutils.h"
29 :
30 63 : static IDLCharType global_type ;
31 :
32 0 : IDLType *IDLCharValue::GetValueType(void) const
33 : {
34 : return & global_type ;
35 : }
36 :
37 67 : IDLCharValue::IDLCharValue(char c)
38 67 : : IDLValue(idl_charType), _value(c)
39 : {}
40 :
41 127 : IDLCharValue::IDLCharValue(const IDLCharValue& v)
42 127 : : IDLValue(v), _value(v._value)
43 : {}
44 :
45 70 : IDLCharValue::~IDLCharValue()
46 70 : {}
47 :
48 62 : unsigned char IDLCharValue::GetChar(void)
49 : {
50 : return _value ;
51 : }
52 :
53 127 : IDLValue* IDLCharValue::copy(void)
54 : {
55 127 : return new IDLCharValue(*this) ;
56 : }
57 :
58 44 : void IDLCharValue::print(std::ostream &str) const
59 : {
60 44 : if (IsError())
61 : {
62 15 : str << "char <error>" ;
63 : }
64 : else
65 : {
66 29 : str << "char '" << _value << "'" ;
67 : }
68 : }
69 :
70 91 : void IDLCharValue::convert(IDLType *type)
71 : {
72 : ASSERT(type != NULL) ;
73 :
74 91 : if (type->isA() != idl_charType)
75 : {
76 3 : typeConvertionError(type) ;
77 : }
78 :
79 : return ;
80 63 : }
81 63 :
|