1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #include <precomp.h>
29 #include <ary/cpp/c_builtintype.hxx>
30 
31 
32 // NOT FULLY DEFINED SERVICES
33 #include <ary/cpp/c_type.hxx>
34 
35 
36 namespace ary
37 {
38 namespace cpp
39 {
40 
41 
42 
43 
44 //**********************        Type        **************************//
45 Rid
46 Type::inq_RelatedCe() const
47 {
48  	return 0;
49 }
50 
51 
52 //**********************        BuiltInType        **************************//
53 
54 BuiltInType::BuiltInType( const String  &		i_sName,
55 						  E_TypeSpecialisation	i_eSpecialisation )
56 	:	sName( i_sName ),
57 		eSpecialisation( i_eSpecialisation )
58 {
59 }
60 
61 String
62 BuiltInType::SpecializedName_( const char *		    i_sName,
63 							   E_TypeSpecialisation i_eTypeSpecialisation )
64 {
65     StreamLock
66         aStrLock(60);
67     StreamStr &
68         ret = aStrLock();
69 
70 	switch ( i_eTypeSpecialisation )
71 	{
72 		case TYSP_unsigned:
73                     ret << "u_";
74                     break;
75 		case TYSP_signed:
76 		            if (strcmp(i_sName,"char") == 0)
77 		                ret << "s_";
78                     break;
79         default:
80                     ;
81 
82 	}	// end switch
83 
84 	ret << i_sName;
85     return String(ret.c_str());
86 }
87 
88 void
89 BuiltInType::do_Accept(csv::ProcessorIfc & io_processor) const
90 {
91     csv::CheckedCall(io_processor,*this);
92 }
93 
94 ary::ClassId
95 BuiltInType::get_AryClass() const
96 {
97     return class_id;
98 }
99 
100 bool
101 BuiltInType::inq_IsConst() const
102 {
103 	return false;
104 }
105 
106 void
107 BuiltInType::inq_Get_Text( StreamStr &      ,               // o_rPreName
108 						   StreamStr &      o_rName,
109 						   StreamStr &      ,               // o_rPostName
110 						   const Gate &     ) const         // i_rGate
111 {
112 	switch (eSpecialisation)
113 	{
114 		case TYSP_unsigned:	o_rName << "unsigned "; break;
115 		case TYSP_signed:   o_rName << "signed ";   break;
116 
117 		default:            // Does nothing.
118 		                    ;
119 	}
120 	o_rName << sName;
121 }
122 
123 
124 
125 
126 }   // namespace cpp
127 }   // namespace ary
128