xref: /aoo41x/main/autodoc/source/parser/cpp/pev.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 ADC_CPP_PEV_HXX
29*cdf0e10cSrcweir #define ADC_CPP_PEV_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir // USED SERVICES
34*cdf0e10cSrcweir 	// BASE CLASSES
35*cdf0e10cSrcweir #include <tokens/tokproct.hxx>
36*cdf0e10cSrcweir 	// COMPONENTS
37*cdf0e10cSrcweir 	// PARAMETERS
38*cdf0e10cSrcweir #include <ary/cpp/c_types4cpp.hxx>
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir namespace ary
41*cdf0e10cSrcweir {
42*cdf0e10cSrcweir     namespace cpp
43*cdf0e10cSrcweir     {
44*cdf0e10cSrcweir         class Gate;
45*cdf0e10cSrcweir         class InputContext;
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir         class Namespace;
48*cdf0e10cSrcweir         class Class;
49*cdf0e10cSrcweir         class Enum;
50*cdf0e10cSrcweir         class Typedef;
51*cdf0e10cSrcweir         class Function;
52*cdf0e10cSrcweir         class Variable;
53*cdf0e10cSrcweir         class EnumValue;
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir         class DefineEntity;
56*cdf0e10cSrcweir     }
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir     class Documentation;
59*cdf0e10cSrcweir }
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir namespace cpp
63*cdf0e10cSrcweir {
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir class PeEnvironment : protected TokenProcessing_Types
67*cdf0e10cSrcweir {
68*cdf0e10cSrcweir   public:
69*cdf0e10cSrcweir     // INQUIRY
70*cdf0e10cSrcweir 	virtual				~PeEnvironment() {}
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir     // OPERATIONS
73*cdf0e10cSrcweir         // Token results
74*cdf0e10cSrcweir 	void				SetTokenResult(
75*cdf0e10cSrcweir 							E_TokenDone			i_eDone,
76*cdf0e10cSrcweir 							E_EnvStackAction	i_eWhat2DoWithEnvStack,
77*cdf0e10cSrcweir 							ParseEnvironment *	i_pParseEnv2Push = 0 );
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir         // Owner stack
80*cdf0e10cSrcweir 	void                OpenNamespace(
81*cdf0e10cSrcweir 							ary::cpp::Namespace &
82*cdf0e10cSrcweir                                                 io_rOpenedNamespace );
83*cdf0e10cSrcweir 	void                OpenExternC(
84*cdf0e10cSrcweir 	                    	bool				i_bOnlyForOneDeclaration = false );
85*cdf0e10cSrcweir 	void                OpenClass(
86*cdf0e10cSrcweir 							ary::cpp::Class &	io_rOpenedClass );
87*cdf0e10cSrcweir 	void                OpenEnum(
88*cdf0e10cSrcweir 							ary::cpp::Enum &	io_rOpenedEnum );
89*cdf0e10cSrcweir 	void                CloseBlock();           /// Handles a '}' on file scope.
90*cdf0e10cSrcweir 	void                CloseClass();
91*cdf0e10cSrcweir 	void                CloseEnum();
92*cdf0e10cSrcweir     void                SetCurProtection(       /// Handles 'public:', 'protected:' and 'private:' on class scope.
93*cdf0e10cSrcweir                             ary::cpp::E_Protection
94*cdf0e10cSrcweir                                                 i_eProtection );
95*cdf0e10cSrcweir     void                OpenTemplate(
96*cdf0e10cSrcweir                             const StringVector &
97*cdf0e10cSrcweir                                                 i_rParameters );
98*cdf0e10cSrcweir     /// Removes parameters from this object.
99*cdf0e10cSrcweir     DYN StringVector *  Get_CurTemplateParameters();
100*cdf0e10cSrcweir     /// Checks, if a template is still open, and if yes, closes it.
101*cdf0e10cSrcweir     void                Close_OpenTemplate();
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir         // Special events
104*cdf0e10cSrcweir     void                Event_Class_FinishedBase(
105*cdf0e10cSrcweir                             const String  &     i_sParameterName );
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir     void                Event_Store_Typedef(
108*cdf0e10cSrcweir                             ary::cpp::Typedef & io_rTypedef );
109*cdf0e10cSrcweir     void                Event_Store_EnumValue(
110*cdf0e10cSrcweir                             ary::cpp::EnumValue &
111*cdf0e10cSrcweir                                                 io_rEnumValue );
112*cdf0e10cSrcweir     void                Event_Store_CppDefinition(
113*cdf0e10cSrcweir                             ary::cpp::DefineEntity  &
114*cdf0e10cSrcweir                                                 io_rDefinition );
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir     void                Event_EnterFunction_ParameterList();
117*cdf0e10cSrcweir     void                Event_Function_FinishedParameter(
118*cdf0e10cSrcweir                             const String  &     i_sParameterName );
119*cdf0e10cSrcweir     void                Event_LeaveFunction_ParameterList();
120*cdf0e10cSrcweir     void                Event_EnterFunction_Implementation();
121*cdf0e10cSrcweir     void                Event_LeaveFunction_Implementation();
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir     void                Event_Store_Function(
124*cdf0e10cSrcweir                             ary::cpp::Function &
125*cdf0e10cSrcweir                                                 io_rFunction );
126*cdf0e10cSrcweir     void                Event_Store_Variable(
127*cdf0e10cSrcweir                             ary::cpp::Variable &
128*cdf0e10cSrcweir                                                 io_rVariable );
129*cdf0e10cSrcweir         // Error recovery
130*cdf0e10cSrcweir     void                StartWaitingFor_Recovery();
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir     // INQUIRY
133*cdf0e10cSrcweir     ary::cpp::Gate &  AryGate() const;
134*cdf0e10cSrcweir 	const ary::cpp::InputContext &
135*cdf0e10cSrcweir 						Context() const;
136*cdf0e10cSrcweir 	String              CurFileName() const;
137*cdf0e10cSrcweir 	uintt               LineCount() const;
138*cdf0e10cSrcweir 	bool                IsWaitingFor_Recovery() const;
139*cdf0e10cSrcweir 	bool                IsExternC() const;
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir   private:
142*cdf0e10cSrcweir 	virtual void        do_SetTokenResult(
143*cdf0e10cSrcweir 							E_TokenDone			i_eDone,
144*cdf0e10cSrcweir 							E_EnvStackAction	i_eWhat2DoWithEnvStack,
145*cdf0e10cSrcweir 							ParseEnvironment *	i_pParseEnv2Push ) = 0;
146*cdf0e10cSrcweir 	virtual void        do_OpenNamespace(
147*cdf0e10cSrcweir 							ary::cpp::Namespace &
148*cdf0e10cSrcweir 												io_rOpenedNamespace ) = 0;
149*cdf0e10cSrcweir 	virtual void        do_OpenExternC(
150*cdf0e10cSrcweir 							bool				i_bOnlyForOneDeclaration ) = 0;
151*cdf0e10cSrcweir 	virtual void        do_OpenClass(
152*cdf0e10cSrcweir 							ary::cpp::Class &	io_rOpenedClass ) = 0;
153*cdf0e10cSrcweir 	virtual void        do_OpenEnum(
154*cdf0e10cSrcweir 							ary::cpp::Enum &	io_rOpenedEnum ) = 0;
155*cdf0e10cSrcweir 	virtual void        do_CloseBlock() = 0;
156*cdf0e10cSrcweir 	virtual void        do_CloseClass() = 0;
157*cdf0e10cSrcweir 	virtual void        do_CloseEnum() = 0;
158*cdf0e10cSrcweir     virtual void        do_SetCurProtection(
159*cdf0e10cSrcweir                             ary::cpp::E_Protection
160*cdf0e10cSrcweir 												i_eProtection ) = 0;
161*cdf0e10cSrcweir     virtual void        do_OpenTemplate(
162*cdf0e10cSrcweir                             const StringVector &
163*cdf0e10cSrcweir                                                 i_rParameters ) = 0;
164*cdf0e10cSrcweir     virtual DYN StringVector *
165*cdf0e10cSrcweir                         do_Get_CurTemplateParameters() = 0;
166*cdf0e10cSrcweir     virtual void        do_Close_OpenTemplate() = 0;
167*cdf0e10cSrcweir 	virtual void        do_Event_Class_FinishedBase(
168*cdf0e10cSrcweir                             const String  &     i_sBaseName ) = 0;
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir     virtual void        do_Event_Store_Typedef(
171*cdf0e10cSrcweir 							ary::cpp::Typedef & io_rTypedef ) = 0;
172*cdf0e10cSrcweir     virtual void        do_Event_Store_EnumValue(
173*cdf0e10cSrcweir                             ary::cpp::EnumValue &
174*cdf0e10cSrcweir                                                 io_rEnumValue ) = 0;
175*cdf0e10cSrcweir     virtual void        do_Event_Store_CppDefinition(
176*cdf0e10cSrcweir                             ary::cpp::DefineEntity &
177*cdf0e10cSrcweir                                                 io_rDefinition ) = 0;
178*cdf0e10cSrcweir     virtual void        do_Event_EnterFunction_ParameterList() = 0;
179*cdf0e10cSrcweir     virtual void        do_Event_Function_FinishedParameter(
180*cdf0e10cSrcweir                             const String  &     i_sParameterName ) = 0;
181*cdf0e10cSrcweir 	virtual void        do_Event_LeaveFunction_ParameterList() = 0;
182*cdf0e10cSrcweir     virtual void        do_Event_EnterFunction_Implementation() = 0;
183*cdf0e10cSrcweir     virtual void        do_Event_LeaveFunction_Implementation() = 0;
184*cdf0e10cSrcweir     virtual void        do_Event_Store_Function(
185*cdf0e10cSrcweir 							ary::cpp::Function &
186*cdf0e10cSrcweir                                                 io_rFunction ) = 0;
187*cdf0e10cSrcweir 	virtual void        do_Event_Store_Variable(
188*cdf0e10cSrcweir                             ary::cpp::Variable &
189*cdf0e10cSrcweir                                                 io_rVariable ) = 0;
190*cdf0e10cSrcweir     virtual void        do_StartWaitingFor_Recovery() = 0;
191*cdf0e10cSrcweir     virtual ary::cpp::Gate &
192*cdf0e10cSrcweir 						inq_AryGate() const = 0;
193*cdf0e10cSrcweir 	virtual const ary::cpp::InputContext &
194*cdf0e10cSrcweir 						inq_Context() const = 0;
195*cdf0e10cSrcweir 	virtual String 		inq_CurFileName() const = 0;
196*cdf0e10cSrcweir 	virtual uintt       inq_LineCount() const = 0;
197*cdf0e10cSrcweir     virtual bool        inq_IsWaitingFor_Recovery() const = 0;
198*cdf0e10cSrcweir 	virtual bool        inq_IsExternC() const = 0;
199*cdf0e10cSrcweir };
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir // IMPLEMENTATION
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir inline void
206*cdf0e10cSrcweir PeEnvironment::SetTokenResult( E_TokenDone			i_eDone,
207*cdf0e10cSrcweir 							   E_EnvStackAction	    i_eWhat2DoWithEnvStack,
208*cdf0e10cSrcweir 							   ParseEnvironment *	i_pParseEnv2Push )
209*cdf0e10cSrcweir     { do_SetTokenResult(i_eDone, i_eWhat2DoWithEnvStack,  i_pParseEnv2Push); }
210*cdf0e10cSrcweir inline void
211*cdf0e10cSrcweir PeEnvironment::OpenNamespace( ary::cpp::Namespace & io_rOpenedNamespace )
212*cdf0e10cSrcweir 	{ do_OpenNamespace(io_rOpenedNamespace); }
213*cdf0e10cSrcweir inline void
214*cdf0e10cSrcweir PeEnvironment::OpenExternC( bool i_bOnlyForOneDeclaration )
215*cdf0e10cSrcweir     { do_OpenExternC(i_bOnlyForOneDeclaration); }
216*cdf0e10cSrcweir inline void
217*cdf0e10cSrcweir PeEnvironment::OpenClass( ary::cpp::Class &	io_rOpenedClass )
218*cdf0e10cSrcweir     { do_OpenClass(io_rOpenedClass); }
219*cdf0e10cSrcweir inline void
220*cdf0e10cSrcweir PeEnvironment::OpenEnum( ary::cpp::Enum & io_rOpenedEnum )
221*cdf0e10cSrcweir     { do_OpenEnum(io_rOpenedEnum); }
222*cdf0e10cSrcweir inline void
223*cdf0e10cSrcweir PeEnvironment::CloseBlock()
224*cdf0e10cSrcweir     { do_CloseBlock(); }
225*cdf0e10cSrcweir inline void
226*cdf0e10cSrcweir PeEnvironment::CloseClass()
227*cdf0e10cSrcweir     { do_CloseClass(); }
228*cdf0e10cSrcweir inline void
229*cdf0e10cSrcweir PeEnvironment::CloseEnum()
230*cdf0e10cSrcweir     { do_CloseEnum(); }
231*cdf0e10cSrcweir inline void
232*cdf0e10cSrcweir PeEnvironment::SetCurProtection( ary::cpp::E_Protection i_eProtection )
233*cdf0e10cSrcweir     { do_SetCurProtection(i_eProtection); }
234*cdf0e10cSrcweir inline void
235*cdf0e10cSrcweir PeEnvironment::OpenTemplate( const StringVector & i_rParameters )
236*cdf0e10cSrcweir     { do_OpenTemplate(i_rParameters); }
237*cdf0e10cSrcweir inline DYN StringVector *
238*cdf0e10cSrcweir PeEnvironment::Get_CurTemplateParameters()
239*cdf0e10cSrcweir     { return do_Get_CurTemplateParameters(); }
240*cdf0e10cSrcweir inline void
241*cdf0e10cSrcweir PeEnvironment::Close_OpenTemplate()
242*cdf0e10cSrcweir     { do_Close_OpenTemplate(); }
243*cdf0e10cSrcweir inline void
244*cdf0e10cSrcweir PeEnvironment::Event_Class_FinishedBase( const String  &  i_sBaseName )
245*cdf0e10cSrcweir     { do_Event_Class_FinishedBase(i_sBaseName); }
246*cdf0e10cSrcweir inline void
247*cdf0e10cSrcweir PeEnvironment::Event_Store_Typedef( ary::cpp::Typedef & io_rTypedef )
248*cdf0e10cSrcweir     { do_Event_Store_Typedef(io_rTypedef); }
249*cdf0e10cSrcweir inline void
250*cdf0e10cSrcweir PeEnvironment::Event_Store_EnumValue( ary::cpp::EnumValue & io_rEnumValue )
251*cdf0e10cSrcweir     { do_Event_Store_EnumValue(io_rEnumValue); }
252*cdf0e10cSrcweir inline void
253*cdf0e10cSrcweir PeEnvironment::Event_Store_CppDefinition( ary::cpp::DefineEntity & io_rDefinition )
254*cdf0e10cSrcweir     { do_Event_Store_CppDefinition(io_rDefinition); }
255*cdf0e10cSrcweir inline void
256*cdf0e10cSrcweir PeEnvironment::Event_EnterFunction_ParameterList()
257*cdf0e10cSrcweir     { do_Event_EnterFunction_ParameterList(); }
258*cdf0e10cSrcweir inline void
259*cdf0e10cSrcweir PeEnvironment::Event_Function_FinishedParameter( const String  & i_sParameterName )
260*cdf0e10cSrcweir     { do_Event_Function_FinishedParameter(i_sParameterName); }
261*cdf0e10cSrcweir inline void
262*cdf0e10cSrcweir PeEnvironment::Event_LeaveFunction_ParameterList()
263*cdf0e10cSrcweir     { do_Event_LeaveFunction_ParameterList(); }
264*cdf0e10cSrcweir inline void
265*cdf0e10cSrcweir PeEnvironment::Event_EnterFunction_Implementation()
266*cdf0e10cSrcweir     { do_Event_EnterFunction_Implementation(); }
267*cdf0e10cSrcweir inline void
268*cdf0e10cSrcweir PeEnvironment::Event_LeaveFunction_Implementation()
269*cdf0e10cSrcweir 	{ do_Event_LeaveFunction_Implementation(); }
270*cdf0e10cSrcweir inline void
271*cdf0e10cSrcweir PeEnvironment::Event_Store_Function( ary::cpp::Function & io_rFunction )
272*cdf0e10cSrcweir 	{ do_Event_Store_Function(io_rFunction); }
273*cdf0e10cSrcweir inline void
274*cdf0e10cSrcweir PeEnvironment::Event_Store_Variable( ary::cpp::Variable & io_rVariable )
275*cdf0e10cSrcweir 	{ do_Event_Store_Variable(io_rVariable); }
276*cdf0e10cSrcweir inline void
277*cdf0e10cSrcweir PeEnvironment::StartWaitingFor_Recovery()
278*cdf0e10cSrcweir 	{ do_StartWaitingFor_Recovery(); }
279*cdf0e10cSrcweir inline ary::cpp::Gate &
280*cdf0e10cSrcweir PeEnvironment::AryGate() const
281*cdf0e10cSrcweir 	{ return inq_AryGate(); }
282*cdf0e10cSrcweir inline const ary::cpp::InputContext &
283*cdf0e10cSrcweir PeEnvironment::Context() const
284*cdf0e10cSrcweir 	{ return inq_Context(); }
285*cdf0e10cSrcweir inline String
286*cdf0e10cSrcweir PeEnvironment::CurFileName() const
287*cdf0e10cSrcweir 	{ return inq_CurFileName(); }
288*cdf0e10cSrcweir inline uintt
289*cdf0e10cSrcweir PeEnvironment::LineCount() const
290*cdf0e10cSrcweir 	{ return inq_LineCount(); }
291*cdf0e10cSrcweir inline bool
292*cdf0e10cSrcweir PeEnvironment::IsWaitingFor_Recovery() const
293*cdf0e10cSrcweir     { return inq_IsWaitingFor_Recovery(); }
294*cdf0e10cSrcweir inline bool
295*cdf0e10cSrcweir PeEnvironment::IsExternC() const
296*cdf0e10cSrcweir     { return inq_IsExternC(); }
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir }   // namespace cpp
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir #endif
304*cdf0e10cSrcweir 
305