xref: /aoo41x/main/autodoc/inc/ary/cpp/inpcontx.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_INPCONTX_HXX
29*cdf0e10cSrcweir #define ARY_CPP_INPCONTX_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir // USED SERVICES
34*cdf0e10cSrcweir 	// BASE CLASSES
35*cdf0e10cSrcweir 	// OTHER
36*cdf0e10cSrcweir #include <ary/cpp/c_types4cpp.hxx>
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir namespace ary
41*cdf0e10cSrcweir {
42*cdf0e10cSrcweir namespace loc
43*cdf0e10cSrcweir {
44*cdf0e10cSrcweir     class File;
45*cdf0e10cSrcweir }
46*cdf0e10cSrcweir namespace cpp
47*cdf0e10cSrcweir {
48*cdf0e10cSrcweir     class Gate;
49*cdf0e10cSrcweir     class Namespace;
50*cdf0e10cSrcweir     class Class;
51*cdf0e10cSrcweir     class Enum;
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir     class OperationSignature;
54*cdf0e10cSrcweir }
55*cdf0e10cSrcweir }
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir namespace ary
60*cdf0e10cSrcweir {
61*cdf0e10cSrcweir namespace cpp
62*cdf0e10cSrcweir {
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir /** The context of a CodeEntity, which is going to be stored in the
66*cdf0e10cSrcweir     repository. The information is used mainly by ->ary::cpp::CeAdmin.
67*cdf0e10cSrcweir */
68*cdf0e10cSrcweir class InputContext
69*cdf0e10cSrcweir {
70*cdf0e10cSrcweir   public:
71*cdf0e10cSrcweir     class Owner
72*cdf0e10cSrcweir     {
73*cdf0e10cSrcweir       public:
74*cdf0e10cSrcweir         // LIFECYCLE
75*cdf0e10cSrcweir         virtual             ~Owner() {}
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir         // OPERATIONS
78*cdf0e10cSrcweir         /// Adds Class data to current inner scope (Namespace or Class).
79*cdf0e10cSrcweir         void                Add_Class(
80*cdf0e10cSrcweir                                 const String  &     i_sLocalName,
81*cdf0e10cSrcweir                                 Cid                 i_nId );
82*cdf0e10cSrcweir         /// Adds Enum data to current inner scope (Namespace or Class).
83*cdf0e10cSrcweir         void                Add_Enum(
84*cdf0e10cSrcweir                                 const String  &     i_sLocalName,
85*cdf0e10cSrcweir                                 Cid                 i_nId );
86*cdf0e10cSrcweir         /// Adds Typedef data to current inner scope (Namespace or Class).
87*cdf0e10cSrcweir         void                Add_Typedef(
88*cdf0e10cSrcweir                                 const String  &     i_sLocalName,
89*cdf0e10cSrcweir                                 Cid                 i_nId );
90*cdf0e10cSrcweir         /// Adds Operation data to current inner scope (Namespace or Class).
91*cdf0e10cSrcweir         void                Add_Operation(
92*cdf0e10cSrcweir                                 const String  &     i_sLocalName,
93*cdf0e10cSrcweir                                 Cid                 i_nId,
94*cdf0e10cSrcweir                                 bool                i_bIsStaticMember );    /// True only for static class members.
95*cdf0e10cSrcweir         /// Adds Variable data to current inner scope (Namespace or Class).
96*cdf0e10cSrcweir         void                Add_Variable(
97*cdf0e10cSrcweir                                 const String  &     i_sLocalName,
98*cdf0e10cSrcweir                                 Cid                 i_nId,
99*cdf0e10cSrcweir                                 bool                i_bIsConst,
100*cdf0e10cSrcweir                                 bool                i_bIsStaticMember );    /// True only for static class members.
101*cdf0e10cSrcweir         // INQUIRY
102*cdf0e10cSrcweir         Ce_id               CeId() const;
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir         /** @attention Must only be used by ary::cpp::GatePilot!
105*cdf0e10cSrcweir             Will work nowhere else!
106*cdf0e10cSrcweir         */
107*cdf0e10cSrcweir         virtual bool        HasClass(
108*cdf0e10cSrcweir                                 const String  &     i_sLocalName ) = 0;
109*cdf0e10cSrcweir       private:
110*cdf0e10cSrcweir         virtual void        do_Add_Class(
111*cdf0e10cSrcweir                                 const String  &     i_sLocalName,
112*cdf0e10cSrcweir                                 Cid                 i_nId ) = 0;
113*cdf0e10cSrcweir         virtual void        do_Add_Enum(
114*cdf0e10cSrcweir                                 const String  &     i_sLocalName,
115*cdf0e10cSrcweir                                 Cid                 i_nId ) = 0;
116*cdf0e10cSrcweir         virtual void        do_Add_Typedef(
117*cdf0e10cSrcweir                                 const String  &     i_sLocalName,
118*cdf0e10cSrcweir                                 Cid                 i_nId ) = 0;
119*cdf0e10cSrcweir         virtual void        do_Add_Operation(
120*cdf0e10cSrcweir                                 const String  &     i_sLocalName,
121*cdf0e10cSrcweir                                 Cid                 i_nId,
122*cdf0e10cSrcweir                                 bool                i_bIsStatic ) = 0;
123*cdf0e10cSrcweir         virtual void        do_Add_Variable(
124*cdf0e10cSrcweir                                 const String  &     i_sLocalName,
125*cdf0e10cSrcweir                                 Cid                 i_nId,
126*cdf0e10cSrcweir                                 bool                i_bIsConst,
127*cdf0e10cSrcweir                                 bool                i_bIsStatic ) = 0;
128*cdf0e10cSrcweir         virtual Ce_id       inq_CeId() const = 0;
129*cdf0e10cSrcweir     };
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir     // LIFECYCLE
132*cdf0e10cSrcweir 	virtual				~InputContext() {}
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir     // OPERATIONS
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir     // INQUIRY
137*cdf0e10cSrcweir     loc::File &         CurFile() const;
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir     Namespace &         CurNamespace() const;
140*cdf0e10cSrcweir     Class *             CurClass() const;
141*cdf0e10cSrcweir     Enum *              CurEnum() const;
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir     Owner &             CurOwner() const;
144*cdf0e10cSrcweir     E_Protection        CurProtection() const;
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir   private:
147*cdf0e10cSrcweir     virtual loc::File & inq_CurFile() const = 0;
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir     virtual Namespace & inq_CurNamespace() const = 0;
150*cdf0e10cSrcweir     virtual Class *     inq_CurClass() const = 0;
151*cdf0e10cSrcweir     virtual Enum *      inq_CurEnum() const = 0;
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir     virtual Owner &     inq_CurOwner() const = 0;
154*cdf0e10cSrcweir     virtual E_Protection
155*cdf0e10cSrcweir                         inq_CurProtection() const = 0;
156*cdf0e10cSrcweir };
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir // IMPLEMENTATION
162*cdf0e10cSrcweir inline loc::File &
163*cdf0e10cSrcweir InputContext::CurFile() const
164*cdf0e10cSrcweir     { return inq_CurFile(); }
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir inline Namespace &
167*cdf0e10cSrcweir InputContext::CurNamespace() const
168*cdf0e10cSrcweir     { return inq_CurNamespace(); }
169*cdf0e10cSrcweir inline Class *
170*cdf0e10cSrcweir InputContext::CurClass() const
171*cdf0e10cSrcweir     { return inq_CurClass(); }
172*cdf0e10cSrcweir inline Enum *
173*cdf0e10cSrcweir InputContext::CurEnum() const
174*cdf0e10cSrcweir     { return inq_CurEnum(); }
175*cdf0e10cSrcweir inline InputContext::Owner &
176*cdf0e10cSrcweir InputContext::CurOwner() const
177*cdf0e10cSrcweir     { return inq_CurOwner(); }
178*cdf0e10cSrcweir inline E_Protection
179*cdf0e10cSrcweir InputContext::CurProtection() const
180*cdf0e10cSrcweir     { return inq_CurProtection(); }
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir inline void
184*cdf0e10cSrcweir InputContext::Owner::Add_Class( const String  &     i_sLocalName,
185*cdf0e10cSrcweir                                 Cid                 i_nId )
186*cdf0e10cSrcweir     { do_Add_Class(i_sLocalName, i_nId); }
187*cdf0e10cSrcweir inline void
188*cdf0e10cSrcweir InputContext::Owner::Add_Enum( const String  &     i_sLocalName,
189*cdf0e10cSrcweir                                Cid                 i_nId )
190*cdf0e10cSrcweir     { do_Add_Enum(i_sLocalName, i_nId); }
191*cdf0e10cSrcweir inline void
192*cdf0e10cSrcweir InputContext::Owner::Add_Typedef( const String  &     i_sLocalName,
193*cdf0e10cSrcweir                                   Cid                 i_nId )
194*cdf0e10cSrcweir     { do_Add_Typedef(i_sLocalName, i_nId); }
195*cdf0e10cSrcweir inline void
196*cdf0e10cSrcweir InputContext::Owner::Add_Operation( const String  &             i_sLocalName,
197*cdf0e10cSrcweir                                     Cid                         i_nId,
198*cdf0e10cSrcweir                                     bool                        i_bIsStatic )
199*cdf0e10cSrcweir     { do_Add_Operation( i_sLocalName, i_nId, i_bIsStatic ); }
200*cdf0e10cSrcweir inline void
201*cdf0e10cSrcweir InputContext::Owner::Add_Variable( const String  &     i_sLocalName,
202*cdf0e10cSrcweir                                    Cid                 i_nId,
203*cdf0e10cSrcweir                                    bool                i_bIsConst,
204*cdf0e10cSrcweir                                    bool                i_bIsStatic )
205*cdf0e10cSrcweir     { do_Add_Variable( i_sLocalName, i_nId, i_bIsConst, i_bIsStatic ); }
206*cdf0e10cSrcweir inline Ce_id
207*cdf0e10cSrcweir InputContext::Owner::CeId() const
208*cdf0e10cSrcweir     { return inq_CeId(); }
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir }   // namespace cpp
215*cdf0e10cSrcweir }   // namespace ary
216*cdf0e10cSrcweir #endif
217