xref: /aoo42x/main/autodoc/inc/ary/cpp/c_class.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef ARY_CPP_C_CLASS_HXX
29*cdf0e10cSrcweir #define ARY_CPP_C_CLASS_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir // USED SERVICES
34*cdf0e10cSrcweir 	// BASE CLASSES
35*cdf0e10cSrcweir #include <ary/cpp/c_ce.hxx>
36*cdf0e10cSrcweir #include <ary/arygroup.hxx>
37*cdf0e10cSrcweir 	// OTHER
38*cdf0e10cSrcweir #include <ary/symtreenode.hxx>
39*cdf0e10cSrcweir #include <ary/cessentl.hxx>
40*cdf0e10cSrcweir #include <ary/sequentialids.hxx>
41*cdf0e10cSrcweir #include <ary/cpp/c_types4cpp.hxx>
42*cdf0e10cSrcweir #include <ary/cpp/c_slntry.hxx>
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir namespace ary
45*cdf0e10cSrcweir {
46*cdf0e10cSrcweir namespace cpp
47*cdf0e10cSrcweir {
48*cdf0e10cSrcweir     class Enum;
49*cdf0e10cSrcweir     class Typedef;
50*cdf0e10cSrcweir     class Function;
51*cdf0e10cSrcweir     class Variable;
52*cdf0e10cSrcweir }
53*cdf0e10cSrcweir }
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir namespace ary
58*cdf0e10cSrcweir {
59*cdf0e10cSrcweir namespace cpp
60*cdf0e10cSrcweir {
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir /** A C++ class.
64*cdf0e10cSrcweir */
65*cdf0e10cSrcweir class Class : public CodeEntity,
66*cdf0e10cSrcweir               public AryGroup
67*cdf0e10cSrcweir {
68*cdf0e10cSrcweir   public:
69*cdf0e10cSrcweir     enum E_ClassId { class_id = 1001 };
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir     enum E_Slots
72*cdf0e10cSrcweir     {
73*cdf0e10cSrcweir         SLOT_Bases = 1,
74*cdf0e10cSrcweir         SLOT_NestedClasses,
75*cdf0e10cSrcweir         SLOT_Enums,
76*cdf0e10cSrcweir         SLOT_Typedefs,
77*cdf0e10cSrcweir         SLOT_Operations,
78*cdf0e10cSrcweir         SLOT_StaticOperations,
79*cdf0e10cSrcweir         SLOT_Data,
80*cdf0e10cSrcweir         SLOT_StaticData,
81*cdf0e10cSrcweir         SLOT_FriendClasses,
82*cdf0e10cSrcweir         SLOT_FriendOperations
83*cdf0e10cSrcweir     };
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir     typedef ::ary::symtree::Node<CeNode_Traits>    node_t;
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir 	// LIFECYCLE
89*cdf0e10cSrcweir 						Class(
90*cdf0e10cSrcweir                             const String  &     i_sLocalName,
91*cdf0e10cSrcweir                             Ce_id               i_nOwner,
92*cdf0e10cSrcweir                             E_Protection        i_eProtection,
93*cdf0e10cSrcweir                             loc::Le_id          i_nFile,
94*cdf0e10cSrcweir                             E_ClassKey          i_eClassKey );
95*cdf0e10cSrcweir 						~Class();
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir 	// OPERATIONS
98*cdf0e10cSrcweir 	void				Add_BaseClass(
99*cdf0e10cSrcweir 							const S_Classes_Base &
100*cdf0e10cSrcweir                                                 i_rBaseClass );
101*cdf0e10cSrcweir     void                Add_TemplateParameterType(
102*cdf0e10cSrcweir                             const String  &     i_sLocalName,
103*cdf0e10cSrcweir                             Type_id             i_nIdAsType );
104*cdf0e10cSrcweir 	void				Add_KnownDerivative(
105*cdf0e10cSrcweir 							Ce_id               i_nId )
106*cdf0e10cSrcweir                                                 { aKnownDerivatives.Add(i_nId); }
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir 	void                Add_LocalClass(
109*cdf0e10cSrcweir                             const String  &     i_sLocalName,
110*cdf0e10cSrcweir                             Cid                 i_nId );
111*cdf0e10cSrcweir 	void                Add_LocalEnum(
112*cdf0e10cSrcweir                             const String  &     i_sLocalName,
113*cdf0e10cSrcweir                             Cid                 i_nId );
114*cdf0e10cSrcweir 	void                Add_LocalTypedef(
115*cdf0e10cSrcweir                             const String  &     i_sLocalName,
116*cdf0e10cSrcweir                             Cid                 i_nId );
117*cdf0e10cSrcweir 	void                Add_LocalOperation(
118*cdf0e10cSrcweir                             const String  &     i_sLocalName,
119*cdf0e10cSrcweir                             Cid                 i_nId );
120*cdf0e10cSrcweir 	void                Add_LocalStaticOperation(
121*cdf0e10cSrcweir                             const String  &     i_sLocalName,
122*cdf0e10cSrcweir                             Cid                 i_nId );
123*cdf0e10cSrcweir 	void                Add_LocalData(
124*cdf0e10cSrcweir                             const String  &     i_sLocalName,
125*cdf0e10cSrcweir                             Cid                 i_nId );
126*cdf0e10cSrcweir 	void                Add_LocalStaticData(
127*cdf0e10cSrcweir                             const String  &     i_sLocalName,
128*cdf0e10cSrcweir                             Cid                 i_nId );
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir     void                UpdateVirtuality(
131*cdf0e10cSrcweir                             E_Virtuality        i_eVirtuality )
132*cdf0e10cSrcweir                                                 { if ( int(i_eVirtuality) > int(eVirtuality) )
133*cdf0e10cSrcweir                                                      eVirtuality = i_eVirtuality; }
134*cdf0e10cSrcweir     const List_TplParam &
135*cdf0e10cSrcweir                         TemplateParameters() const
136*cdf0e10cSrcweir                                                 { return aTemplateParameterTypes; }
137*cdf0e10cSrcweir     const List_Bases &  BaseClasses() const     { return aBaseClasses; }
138*cdf0e10cSrcweir     const SequentialIds<Ce_id> &
139*cdf0e10cSrcweir                         KnownDerivatives() const
140*cdf0e10cSrcweir                                                 { return aKnownDerivatives; }
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir 	// INQUIRY
143*cdf0e10cSrcweir     E_ClassKey			ClassKey() const;
144*cdf0e10cSrcweir     E_Protection        Protection() const;
145*cdf0e10cSrcweir     E_Virtuality        Virtuality() const      { return eVirtuality; }
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir     Ce_id               Search_Child(
148*cdf0e10cSrcweir                             const String &      i_key ) const;
149*cdf0e10cSrcweir     Rid                 Search_LocalClass(
150*cdf0e10cSrcweir                             const String  &     i_sName ) const;
151*cdf0e10cSrcweir     const node_t &      AsNode() const;
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir     // ACCESS
154*cdf0e10cSrcweir     node_t &            AsNode();
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir   private:
157*cdf0e10cSrcweir     NON_COPYABLE(Class);
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir     // Interface csv::ConstProcessorClient
160*cdf0e10cSrcweir     virtual void        do_Accept(
161*cdf0e10cSrcweir                             csv::ProcessorIfc & io_processor ) const;
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir     // Interface ary::cpp::CodeEntity
164*cdf0e10cSrcweir 	virtual const String  &
165*cdf0e10cSrcweir                         inq_LocalName() const;
166*cdf0e10cSrcweir 	virtual Cid         inq_Owner() const;
167*cdf0e10cSrcweir 	virtual loc::Le_id  inq_Location() const;
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir     // Interface ary::cpp::CppEntity
170*cdf0e10cSrcweir     virtual ClassId     get_AryClass() const;
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir     // Interface ary::AryGroup
173*cdf0e10cSrcweir 	virtual Gid 		inq_Id_Group() const;
174*cdf0e10cSrcweir     virtual const cpp::CppEntity &
175*cdf0e10cSrcweir                         inq_RE_Group() const;
176*cdf0e10cSrcweir 	virtual const group::SlotList &
177*cdf0e10cSrcweir                         inq_Slots() const;
178*cdf0e10cSrcweir     virtual DYN Slot *  inq_Create_Slot(
179*cdf0e10cSrcweir                             SlotAccessId        i_nSlot ) const;
180*cdf0e10cSrcweir     // Local
181*cdf0e10cSrcweir  	typedef List_LocalCe::const_iterator        CIterator_Locals;
182*cdf0e10cSrcweir  	typedef List_LocalCe::iterator              Iterator_Locals;
183*cdf0e10cSrcweir     typedef SequentialIds<Ce_id>                IdSequence;
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir     CIterator_Locals    PosOfName(
186*cdf0e10cSrcweir                             const List_LocalCe& i_rList,
187*cdf0e10cSrcweir                             const String  &     i_sName ) const;
188*cdf0e10cSrcweir 	// DATA
189*cdf0e10cSrcweir 	CeEssentials		aEssentials;
190*cdf0e10cSrcweir 	node_t              aAssignedNode;
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir 	List_Bases			aBaseClasses;
193*cdf0e10cSrcweir     List_TplParam       aTemplateParameterTypes;
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir     List_LocalCe        aClasses;
196*cdf0e10cSrcweir     List_LocalCe        aEnums;
197*cdf0e10cSrcweir     List_LocalCe        aTypedefs;
198*cdf0e10cSrcweir     List_LocalCe        aOperations;
199*cdf0e10cSrcweir     List_LocalCe        aStaticOperations;
200*cdf0e10cSrcweir     List_LocalCe        aData;
201*cdf0e10cSrcweir     List_LocalCe        aStaticData;
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir     IdSequence          aFriendClasses;
204*cdf0e10cSrcweir     IdSequence          aFriendOperations;
205*cdf0e10cSrcweir     IdSequence          aKnownDerivatives;
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir 	E_ClassKey			eClassKey;
208*cdf0e10cSrcweir 	E_Protection		eProtection;
209*cdf0e10cSrcweir     E_Virtuality        eVirtuality;
210*cdf0e10cSrcweir };
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir // IMPLEMENTATION
216*cdf0e10cSrcweir inline E_ClassKey
217*cdf0e10cSrcweir Class::ClassKey() const
218*cdf0e10cSrcweir {
219*cdf0e10cSrcweir     return eClassKey;
220*cdf0e10cSrcweir }
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir inline E_Protection
223*cdf0e10cSrcweir Class::Protection() const
224*cdf0e10cSrcweir {
225*cdf0e10cSrcweir     return eProtection;
226*cdf0e10cSrcweir }
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir inline const Class::node_t &
229*cdf0e10cSrcweir Class::AsNode() const
230*cdf0e10cSrcweir {
231*cdf0e10cSrcweir     return aAssignedNode;
232*cdf0e10cSrcweir }
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir inline Class::node_t &
235*cdf0e10cSrcweir Class::AsNode()
236*cdf0e10cSrcweir {
237*cdf0e10cSrcweir     return aAssignedNode;
238*cdf0e10cSrcweir }
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir }   //  namespace cpp
244*cdf0e10cSrcweir }   //  namespace ary
245*cdf0e10cSrcweir #endif
246