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_IDL_I_TYPE_HXX
25 #define ARY_IDL_I_TYPE_HXX
26
27 // USED SERVICES
28 #include <ary/entity.hxx>
29 #include <ary/idl/i_types4idl.hxx>
30
31
32
33
34 namespace ary
35 {
36 namespace idl
37 {
38 class Gate;
39
40
41 /** Abstract base for all secondary productions of types
42 */
43 class Type_2s
44 {
45 public:
~Type_2s()46 virtual ~Type_2s() {}
47
48 static DYN Type_2s *
49 Create_(
50 ClassId i_nCeId );
51 };
52
53
54 /** Base of all IDL types.
55
56 Type represents the occurrence of a type as base,
57 parameter, return type or element type in UNO IDL code.
58 Some of them relate to a ->CodeEntity, but
59 the ->Type "MyInterface" is something different than
60 the ->CodeEntity "MyInterface".
61
62 This is a storage base class, where more special
63 classes are derived from.
64 */
65 class Type : public ary::Entity
66 {
67 public:
68 typedef Type_2s secondary_productions;
69
70 // LIFECYCLE
~Type()71 virtual ~Type() {}
72
73 // INQUIRY
TypeId() const74 Type_id TypeId() const { return Type_id(Id()); }
75
76 /** Does NOT clear the output-parameters.
77
78 @attention
79 If this is a sequence, the text of the first non-sequence, enclosed type
80 is returned.
81 */
82 void Get_Text(
83 StringVector & o_module,
84 String & o_name,
85 Ce_id & o_nRelatedCe,
86 int & o_nSequenceCount,
87 const Gate & i_rGate ) const;
88 const std::vector<Type_id> *
89 TemplateParameters() const;
90 const Type & FirstEnclosedNonSequenceType( /// @return *this, if this is not a ->Sequence.
91 const Gate & i_rGate ) const;
92
93 private:
94 virtual void inq_Get_Text(
95 StringVector & o_module,
96 String & o_name,
97 Ce_id & o_nRelatedCe,
98 int & o_nSequemceCount,
99 const Gate & i_rGate ) const = 0;
100 virtual const std::vector<Type_id> *
101 inq_TemplateParameters() const;
102 virtual const Type &
103 inq_FirstEnclosedNonSequenceType(
104 const Gate & i_rGate ) const;
105 };
106
107
108
109
110 // IMPLEMENTATION
111 inline void
Get_Text(StringVector & o_module,String & o_name,Ce_id & o_nRelatedCe,int & o_nSequenceCount,const Gate & i_rGate) const112 Type::Get_Text( StringVector & o_module,
113 String & o_name,
114 Ce_id & o_nRelatedCe,
115 int & o_nSequenceCount,
116 const Gate & i_rGate ) const
117 {
118 inq_Get_Text(o_module,o_name,o_nRelatedCe,o_nSequenceCount,i_rGate);
119 }
120
121 inline const std::vector<Type_id> *
TemplateParameters() const122 Type::TemplateParameters() const
123 {
124 return inq_TemplateParameters();
125 }
126
127 inline const Type &
FirstEnclosedNonSequenceType(const Gate & i_rGate) const128 Type::FirstEnclosedNonSequenceType(const Gate & i_rGate) const
129 {
130 return inq_FirstEnclosedNonSequenceType(i_rGate);
131 }
132
133
134
135
136 } // namespace idl
137 } // namespace ary
138 #endif
139