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
23
24 #ifndef ARY_CPP_C_TYPE_HXX
25 #define ARY_CPP_C_TYPE_HXX
26
27
28
29 // USED SERVICES
30 // BASE CLASSES
31 #include <ary/entity.hxx>
32 // OTHER
33 #include <ary/cpp/c_types4cpp.hxx>
34 #include <ary/cpp/c_traits.hxx>
35
36
37 namespace ary
38 {
39 namespace cpp
40 {
41 class Gate;
42 }
43 }
44
45
46
47
48
49 namespace ary
50 {
51 namespace cpp
52 {
53
54
55
56 /** Base of all C++ types
57 */
58 class Type : public ::ary::Entity
59 {
60 public:
61 typedef Type_Traits traits_t;
62
~Type()63 virtual ~Type() {}
64
TypeId() const65 Type_id TypeId() const { return Type_id(Id()); }
66 Ce_id RelatedCe() const;
67 bool IsConst() const;
68 void Get_Text(
69 StreamStr & o_rOut,
70 const Gate & i_rGate ) const;
71
72 /** It is guaranteed, that the output is correct, also,
73 if all three output-streams are the same instance.
74 */
75 void Get_Text(
76 StreamStr & o_rPreName,
77 StreamStr & o_rName,
78 StreamStr & o_rPostName,
79 const Gate & i_rGate ) const;
80
81 private:
82 virtual Rid inq_RelatedCe() const; // Defaulted to 0. Implemented in c_builtintype.cxx.
83 virtual bool inq_IsConst() const = 0;
84 virtual void inq_Get_Text(
85 StreamStr & o_rPreName,
86 StreamStr & o_rName,
87 StreamStr & o_rPostName,
88 const Gate & i_rGate ) const = 0;
89 };
90
91
92
93
94 // IMPLEMENTATION
95 inline Ce_id
RelatedCe() const96 Type::RelatedCe() const
97 {
98 return Ce_id(inq_RelatedCe());
99 }
100
101 inline bool
IsConst() const102 Type::IsConst() const
103 {
104 return inq_IsConst();
105 }
106
107 inline void
Get_Text(StreamStr & o_rOut,const Gate & i_rGate) const108 Type::Get_Text( StreamStr & o_rOut,
109 const Gate & i_rGate ) const
110 {
111 inq_Get_Text( o_rOut, o_rOut, o_rOut, i_rGate );
112 }
113
114 inline void
Get_Text(StreamStr & o_rPreName,StreamStr & o_rName,StreamStr & o_rPostName,const Gate & i_rGate) const115 Type::Get_Text( StreamStr & o_rPreName,
116 StreamStr & o_rName,
117 StreamStr & o_rPostName,
118 const Gate & i_rGate ) const
119 {
120 inq_Get_Text( o_rPreName,o_rName,o_rPostName, i_rGate );
121 }
122
123
124
125
126
127 } // namespace cpp
128 } // namespace ary
129 #endif
130