1 : //==============================================================================
2 : // File <$/src/cpp/dev/idlc/wchar_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 :
27 : #include "src/cpp/dev/idlc/wchar_value.h"
28 : #include "src/cpp/dev/idlc/yyutils.h"
29 :
30 63 : static IDLWCharType global_type ;
31 :
32 0 : IDLType* IDLWCharValue::GetValueType(void) const
33 : {
34 : return & global_type ;
35 : }
36 :
37 55 : IDLWCharValue::IDLWCharValue(wchar_t wc)
38 55 : : IDLValue(idl_wcharType), _value(wc)
39 : {}
40 :
41 115 : IDLWCharValue::IDLWCharValue(const IDLWCharValue& v)
42 115 : : IDLValue(v), _value(v._value)
43 : {}
44 :
45 66 : IDLWCharValue::~IDLWCharValue()
46 66 : {}
47 :
48 52 : wchar_t IDLWCharValue::GetWChar(void)
49 : {
50 : return _value ;
51 : }
52 :
53 115 : IDLValue* IDLWCharValue::copy(void)
54 : {
55 115 : return new IDLWCharValue(*this) ;
56 : }
57 :
58 42 : void IDLWCharValue::print(std::ostream &str) const
59 : {
60 42 : if (IsError())
61 : {
62 15 : str << "wchar <error>" ;
63 : }
64 : else
65 : {
66 : char buf[10] ;
67 27 : sprintf(buf, "%04x", _value) ;
68 27 : str << "wchar '0x" << buf << "'" ;
69 : }
70 : }
71 :
72 79 : void IDLWCharValue::convert(IDLType *type)
73 : {
74 : ASSERT(type != NULL) ;
75 :
76 79 : if (type->isA() != idl_wcharType)
77 : {
78 3 : typeConvertionError(type) ;
79 : }
80 :
81 : return ;
82 63 : }
83 63 :
|