1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #include <precomp.h>
23 #include <ary/cpp/c_builtintype.hxx>
24 
25 
26 // NOT FULLY DEFINED SERVICES
27 #include <ary/cpp/c_type.hxx>
28 
29 
30 namespace ary
31 {
32 namespace cpp
33 {
34 
35 
36 
37 
38 //**********************        Type        **************************//
39 Rid
inq_RelatedCe() const40 Type::inq_RelatedCe() const
41 {
42  	return 0;
43 }
44 
45 
46 //**********************        BuiltInType        **************************//
47 
BuiltInType(const String & i_sName,E_TypeSpecialisation i_eSpecialisation)48 BuiltInType::BuiltInType( const String  &		i_sName,
49 						  E_TypeSpecialisation	i_eSpecialisation )
50 	:	sName( i_sName ),
51 		eSpecialisation( i_eSpecialisation )
52 {
53 }
54 
55 String
SpecializedName_(const char * i_sName,E_TypeSpecialisation i_eTypeSpecialisation)56 BuiltInType::SpecializedName_( const char *		    i_sName,
57 							   E_TypeSpecialisation i_eTypeSpecialisation )
58 {
59     StreamLock
60         aStrLock(60);
61     StreamStr &
62         ret = aStrLock();
63 
64 	switch ( i_eTypeSpecialisation )
65 	{
66 		case TYSP_unsigned:
67                     ret << "u_";
68                     break;
69 		case TYSP_signed:
70 		            if (strcmp(i_sName,"char") == 0)
71 		                ret << "s_";
72                     break;
73         default:
74                     ;
75 
76 	}	// end switch
77 
78 	ret << i_sName;
79     return String(ret.c_str());
80 }
81 
82 void
do_Accept(csv::ProcessorIfc & io_processor) const83 BuiltInType::do_Accept(csv::ProcessorIfc & io_processor) const
84 {
85     csv::CheckedCall(io_processor,*this);
86 }
87 
88 ary::ClassId
get_AryClass() const89 BuiltInType::get_AryClass() const
90 {
91     return class_id;
92 }
93 
94 bool
inq_IsConst() const95 BuiltInType::inq_IsConst() const
96 {
97 	return false;
98 }
99 
100 void
inq_Get_Text(StreamStr &,StreamStr & o_rName,StreamStr &,const Gate &) const101 BuiltInType::inq_Get_Text( StreamStr &      ,               // o_rPreName
102 						   StreamStr &      o_rName,
103 						   StreamStr &      ,               // o_rPostName
104 						   const Gate &     ) const         // i_rGate
105 {
106 	switch (eSpecialisation)
107 	{
108 		case TYSP_unsigned:	o_rName << "unsigned "; break;
109 		case TYSP_signed:   o_rName << "signed ";   break;
110 
111 		default:            // Does nothing.
112 		                    ;
113 	}
114 	o_rName << sName;
115 }
116 
117 
118 
119 
120 }   // namespace cpp
121 }   // namespace ary
122