1*1c78a5d6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*1c78a5d6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*1c78a5d6SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*1c78a5d6SAndrew Rist * distributed with this work for additional information
6*1c78a5d6SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*1c78a5d6SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*1c78a5d6SAndrew Rist * "License"); you may not use this file except in compliance
9*1c78a5d6SAndrew Rist * with the License. You may obtain a copy of the License at
10*1c78a5d6SAndrew Rist *
11*1c78a5d6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*1c78a5d6SAndrew Rist *
13*1c78a5d6SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*1c78a5d6SAndrew Rist * software distributed under the License is distributed on an
15*1c78a5d6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1c78a5d6SAndrew Rist * KIND, either express or implied. See the License for the
17*1c78a5d6SAndrew Rist * specific language governing permissions and limitations
18*1c78a5d6SAndrew Rist * under the License.
19*1c78a5d6SAndrew Rist *
20*1c78a5d6SAndrew Rist *************************************************************/
21*1c78a5d6SAndrew Rist
22*1c78a5d6SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #ifndef ARY_CPP_C_CLASS_HXX
25cdf0e10cSrcweir #define ARY_CPP_C_CLASS_HXX
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir
29cdf0e10cSrcweir // USED SERVICES
30cdf0e10cSrcweir // BASE CLASSES
31cdf0e10cSrcweir #include <ary/cpp/c_ce.hxx>
32cdf0e10cSrcweir #include <ary/arygroup.hxx>
33cdf0e10cSrcweir // OTHER
34cdf0e10cSrcweir #include <ary/symtreenode.hxx>
35cdf0e10cSrcweir #include <ary/cessentl.hxx>
36cdf0e10cSrcweir #include <ary/sequentialids.hxx>
37cdf0e10cSrcweir #include <ary/cpp/c_types4cpp.hxx>
38cdf0e10cSrcweir #include <ary/cpp/c_slntry.hxx>
39cdf0e10cSrcweir
40cdf0e10cSrcweir namespace ary
41cdf0e10cSrcweir {
42cdf0e10cSrcweir namespace cpp
43cdf0e10cSrcweir {
44cdf0e10cSrcweir class Enum;
45cdf0e10cSrcweir class Typedef;
46cdf0e10cSrcweir class Function;
47cdf0e10cSrcweir class Variable;
48cdf0e10cSrcweir }
49cdf0e10cSrcweir }
50cdf0e10cSrcweir
51cdf0e10cSrcweir
52cdf0e10cSrcweir
53cdf0e10cSrcweir namespace ary
54cdf0e10cSrcweir {
55cdf0e10cSrcweir namespace cpp
56cdf0e10cSrcweir {
57cdf0e10cSrcweir
58cdf0e10cSrcweir
59cdf0e10cSrcweir /** A C++ class.
60cdf0e10cSrcweir */
61cdf0e10cSrcweir class Class : public CodeEntity,
62cdf0e10cSrcweir public AryGroup
63cdf0e10cSrcweir {
64cdf0e10cSrcweir public:
65cdf0e10cSrcweir enum E_ClassId { class_id = 1001 };
66cdf0e10cSrcweir
67cdf0e10cSrcweir enum E_Slots
68cdf0e10cSrcweir {
69cdf0e10cSrcweir SLOT_Bases = 1,
70cdf0e10cSrcweir SLOT_NestedClasses,
71cdf0e10cSrcweir SLOT_Enums,
72cdf0e10cSrcweir SLOT_Typedefs,
73cdf0e10cSrcweir SLOT_Operations,
74cdf0e10cSrcweir SLOT_StaticOperations,
75cdf0e10cSrcweir SLOT_Data,
76cdf0e10cSrcweir SLOT_StaticData,
77cdf0e10cSrcweir SLOT_FriendClasses,
78cdf0e10cSrcweir SLOT_FriendOperations
79cdf0e10cSrcweir };
80cdf0e10cSrcweir
81cdf0e10cSrcweir typedef ::ary::symtree::Node<CeNode_Traits> node_t;
82cdf0e10cSrcweir
83cdf0e10cSrcweir
84cdf0e10cSrcweir // LIFECYCLE
85cdf0e10cSrcweir Class(
86cdf0e10cSrcweir const String & i_sLocalName,
87cdf0e10cSrcweir Ce_id i_nOwner,
88cdf0e10cSrcweir E_Protection i_eProtection,
89cdf0e10cSrcweir loc::Le_id i_nFile,
90cdf0e10cSrcweir E_ClassKey i_eClassKey );
91cdf0e10cSrcweir ~Class();
92cdf0e10cSrcweir
93cdf0e10cSrcweir // OPERATIONS
94cdf0e10cSrcweir void Add_BaseClass(
95cdf0e10cSrcweir const S_Classes_Base &
96cdf0e10cSrcweir i_rBaseClass );
97cdf0e10cSrcweir void Add_TemplateParameterType(
98cdf0e10cSrcweir const String & i_sLocalName,
99cdf0e10cSrcweir Type_id i_nIdAsType );
Add_KnownDerivative(Ce_id i_nId)100cdf0e10cSrcweir void Add_KnownDerivative(
101cdf0e10cSrcweir Ce_id i_nId )
102cdf0e10cSrcweir { aKnownDerivatives.Add(i_nId); }
103cdf0e10cSrcweir
104cdf0e10cSrcweir void Add_LocalClass(
105cdf0e10cSrcweir const String & i_sLocalName,
106cdf0e10cSrcweir Cid i_nId );
107cdf0e10cSrcweir void Add_LocalEnum(
108cdf0e10cSrcweir const String & i_sLocalName,
109cdf0e10cSrcweir Cid i_nId );
110cdf0e10cSrcweir void Add_LocalTypedef(
111cdf0e10cSrcweir const String & i_sLocalName,
112cdf0e10cSrcweir Cid i_nId );
113cdf0e10cSrcweir void Add_LocalOperation(
114cdf0e10cSrcweir const String & i_sLocalName,
115cdf0e10cSrcweir Cid i_nId );
116cdf0e10cSrcweir void Add_LocalStaticOperation(
117cdf0e10cSrcweir const String & i_sLocalName,
118cdf0e10cSrcweir Cid i_nId );
119cdf0e10cSrcweir void Add_LocalData(
120cdf0e10cSrcweir const String & i_sLocalName,
121cdf0e10cSrcweir Cid i_nId );
122cdf0e10cSrcweir void Add_LocalStaticData(
123cdf0e10cSrcweir const String & i_sLocalName,
124cdf0e10cSrcweir Cid i_nId );
125cdf0e10cSrcweir
UpdateVirtuality(E_Virtuality i_eVirtuality)126cdf0e10cSrcweir void UpdateVirtuality(
127cdf0e10cSrcweir E_Virtuality i_eVirtuality )
128cdf0e10cSrcweir { if ( int(i_eVirtuality) > int(eVirtuality) )
129cdf0e10cSrcweir eVirtuality = i_eVirtuality; }
130cdf0e10cSrcweir const List_TplParam &
TemplateParameters() const131cdf0e10cSrcweir TemplateParameters() const
132cdf0e10cSrcweir { return aTemplateParameterTypes; }
BaseClasses() const133cdf0e10cSrcweir const List_Bases & BaseClasses() const { return aBaseClasses; }
134cdf0e10cSrcweir const SequentialIds<Ce_id> &
KnownDerivatives() const135cdf0e10cSrcweir KnownDerivatives() const
136cdf0e10cSrcweir { return aKnownDerivatives; }
137cdf0e10cSrcweir
138cdf0e10cSrcweir // INQUIRY
139cdf0e10cSrcweir E_ClassKey ClassKey() const;
140cdf0e10cSrcweir E_Protection Protection() const;
Virtuality() const141cdf0e10cSrcweir E_Virtuality Virtuality() const { return eVirtuality; }
142cdf0e10cSrcweir
143cdf0e10cSrcweir Ce_id Search_Child(
144cdf0e10cSrcweir const String & i_key ) const;
145cdf0e10cSrcweir Rid Search_LocalClass(
146cdf0e10cSrcweir const String & i_sName ) const;
147cdf0e10cSrcweir const node_t & AsNode() const;
148cdf0e10cSrcweir
149cdf0e10cSrcweir // ACCESS
150cdf0e10cSrcweir node_t & AsNode();
151cdf0e10cSrcweir
152cdf0e10cSrcweir private:
153cdf0e10cSrcweir NON_COPYABLE(Class);
154cdf0e10cSrcweir
155cdf0e10cSrcweir // Interface csv::ConstProcessorClient
156cdf0e10cSrcweir virtual void do_Accept(
157cdf0e10cSrcweir csv::ProcessorIfc & io_processor ) const;
158cdf0e10cSrcweir
159cdf0e10cSrcweir // Interface ary::cpp::CodeEntity
160cdf0e10cSrcweir virtual const String &
161cdf0e10cSrcweir inq_LocalName() const;
162cdf0e10cSrcweir virtual Cid inq_Owner() const;
163cdf0e10cSrcweir virtual loc::Le_id inq_Location() const;
164cdf0e10cSrcweir
165cdf0e10cSrcweir // Interface ary::cpp::CppEntity
166cdf0e10cSrcweir virtual ClassId get_AryClass() const;
167cdf0e10cSrcweir
168cdf0e10cSrcweir // Interface ary::AryGroup
169cdf0e10cSrcweir virtual Gid inq_Id_Group() const;
170cdf0e10cSrcweir virtual const cpp::CppEntity &
171cdf0e10cSrcweir inq_RE_Group() const;
172cdf0e10cSrcweir virtual const group::SlotList &
173cdf0e10cSrcweir inq_Slots() const;
174cdf0e10cSrcweir virtual DYN Slot * inq_Create_Slot(
175cdf0e10cSrcweir SlotAccessId i_nSlot ) const;
176cdf0e10cSrcweir // Local
177cdf0e10cSrcweir typedef List_LocalCe::const_iterator CIterator_Locals;
178cdf0e10cSrcweir typedef List_LocalCe::iterator Iterator_Locals;
179cdf0e10cSrcweir typedef SequentialIds<Ce_id> IdSequence;
180cdf0e10cSrcweir
181cdf0e10cSrcweir CIterator_Locals PosOfName(
182cdf0e10cSrcweir const List_LocalCe& i_rList,
183cdf0e10cSrcweir const String & i_sName ) const;
184cdf0e10cSrcweir // DATA
185cdf0e10cSrcweir CeEssentials aEssentials;
186cdf0e10cSrcweir node_t aAssignedNode;
187cdf0e10cSrcweir
188cdf0e10cSrcweir List_Bases aBaseClasses;
189cdf0e10cSrcweir List_TplParam aTemplateParameterTypes;
190cdf0e10cSrcweir
191cdf0e10cSrcweir List_LocalCe aClasses;
192cdf0e10cSrcweir List_LocalCe aEnums;
193cdf0e10cSrcweir List_LocalCe aTypedefs;
194cdf0e10cSrcweir List_LocalCe aOperations;
195cdf0e10cSrcweir List_LocalCe aStaticOperations;
196cdf0e10cSrcweir List_LocalCe aData;
197cdf0e10cSrcweir List_LocalCe aStaticData;
198cdf0e10cSrcweir
199cdf0e10cSrcweir IdSequence aFriendClasses;
200cdf0e10cSrcweir IdSequence aFriendOperations;
201cdf0e10cSrcweir IdSequence aKnownDerivatives;
202cdf0e10cSrcweir
203cdf0e10cSrcweir E_ClassKey eClassKey;
204cdf0e10cSrcweir E_Protection eProtection;
205cdf0e10cSrcweir E_Virtuality eVirtuality;
206cdf0e10cSrcweir };
207cdf0e10cSrcweir
208cdf0e10cSrcweir
209cdf0e10cSrcweir
210cdf0e10cSrcweir
211cdf0e10cSrcweir // IMPLEMENTATION
212cdf0e10cSrcweir inline E_ClassKey
ClassKey() const213cdf0e10cSrcweir Class::ClassKey() const
214cdf0e10cSrcweir {
215cdf0e10cSrcweir return eClassKey;
216cdf0e10cSrcweir }
217cdf0e10cSrcweir
218cdf0e10cSrcweir inline E_Protection
Protection() const219cdf0e10cSrcweir Class::Protection() const
220cdf0e10cSrcweir {
221cdf0e10cSrcweir return eProtection;
222cdf0e10cSrcweir }
223cdf0e10cSrcweir
224cdf0e10cSrcweir inline const Class::node_t &
AsNode() const225cdf0e10cSrcweir Class::AsNode() const
226cdf0e10cSrcweir {
227cdf0e10cSrcweir return aAssignedNode;
228cdf0e10cSrcweir }
229cdf0e10cSrcweir
230cdf0e10cSrcweir inline Class::node_t &
AsNode()231cdf0e10cSrcweir Class::AsNode()
232cdf0e10cSrcweir {
233cdf0e10cSrcweir return aAssignedNode;
234cdf0e10cSrcweir }
235cdf0e10cSrcweir
236cdf0e10cSrcweir
237cdf0e10cSrcweir
238cdf0e10cSrcweir
239cdf0e10cSrcweir } // namespace cpp
240cdf0e10cSrcweir } // namespace ary
241cdf0e10cSrcweir #endif
242