1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pev.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef ADC_CPP_PEV_HXX
32 #define ADC_CPP_PEV_HXX
38 #include <tokens/tokproct.hxx>
41 #include <ary/cpp/c_types4cpp.hxx>
69 class PeEnvironment
: protected TokenProcessing_Types
73 virtual ~PeEnvironment() {}
79 E_EnvStackAction i_eWhat2DoWithEnvStack
,
80 ParseEnvironment
* i_pParseEnv2Push
= 0 );
85 io_rOpenedNamespace
);
87 bool i_bOnlyForOneDeclaration
= false );
89 ary::cpp::Class
& io_rOpenedClass
);
91 ary::cpp::Enum
& io_rOpenedEnum
);
92 void CloseBlock(); /// Handles a '}' on file scope.
95 void SetCurProtection( /// Handles 'public:', 'protected:' and 'private:' on class scope.
96 ary::cpp::E_Protection
101 /// Removes parameters from this object.
102 DYN StringVector
* Get_CurTemplateParameters();
103 /// Checks, if a template is still open, and if yes, closes it.
104 void Close_OpenTemplate();
107 void Event_Class_FinishedBase(
108 const String
& i_sParameterName
);
110 void Event_Store_Typedef(
111 ary::cpp::Typedef
& io_rTypedef
);
112 void Event_Store_EnumValue(
113 ary::cpp::EnumValue
&
115 void Event_Store_CppDefinition(
116 ary::cpp::DefineEntity
&
119 void Event_EnterFunction_ParameterList();
120 void Event_Function_FinishedParameter(
121 const String
& i_sParameterName
);
122 void Event_LeaveFunction_ParameterList();
123 void Event_EnterFunction_Implementation();
124 void Event_LeaveFunction_Implementation();
126 void Event_Store_Function(
129 void Event_Store_Variable(
133 void StartWaitingFor_Recovery();
136 ary::cpp::Gate
& AryGate() const;
137 const ary::cpp::InputContext
&
139 String
CurFileName() const;
140 uintt
LineCount() const;
141 bool IsWaitingFor_Recovery() const;
142 bool IsExternC() const;
145 virtual void do_SetTokenResult(
147 E_EnvStackAction i_eWhat2DoWithEnvStack
,
148 ParseEnvironment
* i_pParseEnv2Push
) = 0;
149 virtual void do_OpenNamespace(
150 ary::cpp::Namespace
&
151 io_rOpenedNamespace
) = 0;
152 virtual void do_OpenExternC(
153 bool i_bOnlyForOneDeclaration
) = 0;
154 virtual void do_OpenClass(
155 ary::cpp::Class
& io_rOpenedClass
) = 0;
156 virtual void do_OpenEnum(
157 ary::cpp::Enum
& io_rOpenedEnum
) = 0;
158 virtual void do_CloseBlock() = 0;
159 virtual void do_CloseClass() = 0;
160 virtual void do_CloseEnum() = 0;
161 virtual void do_SetCurProtection(
162 ary::cpp::E_Protection
164 virtual void do_OpenTemplate(
167 virtual DYN StringVector
*
168 do_Get_CurTemplateParameters() = 0;
169 virtual void do_Close_OpenTemplate() = 0;
170 virtual void do_Event_Class_FinishedBase(
171 const String
& i_sBaseName
) = 0;
173 virtual void do_Event_Store_Typedef(
174 ary::cpp::Typedef
& io_rTypedef
) = 0;
175 virtual void do_Event_Store_EnumValue(
176 ary::cpp::EnumValue
&
178 virtual void do_Event_Store_CppDefinition(
179 ary::cpp::DefineEntity
&
180 io_rDefinition
) = 0;
181 virtual void do_Event_EnterFunction_ParameterList() = 0;
182 virtual void do_Event_Function_FinishedParameter(
183 const String
& i_sParameterName
) = 0;
184 virtual void do_Event_LeaveFunction_ParameterList() = 0;
185 virtual void do_Event_EnterFunction_Implementation() = 0;
186 virtual void do_Event_LeaveFunction_Implementation() = 0;
187 virtual void do_Event_Store_Function(
190 virtual void do_Event_Store_Variable(
193 virtual void do_StartWaitingFor_Recovery() = 0;
194 virtual ary::cpp::Gate
&
195 inq_AryGate() const = 0;
196 virtual const ary::cpp::InputContext
&
197 inq_Context() const = 0;
198 virtual String
inq_CurFileName() const = 0;
199 virtual uintt
inq_LineCount() const = 0;
200 virtual bool inq_IsWaitingFor_Recovery() const = 0;
201 virtual bool inq_IsExternC() const = 0;
209 PeEnvironment::SetTokenResult( E_TokenDone i_eDone
,
210 E_EnvStackAction i_eWhat2DoWithEnvStack
,
211 ParseEnvironment
* i_pParseEnv2Push
)
212 { do_SetTokenResult(i_eDone
, i_eWhat2DoWithEnvStack
, i_pParseEnv2Push
); }
214 PeEnvironment::OpenNamespace( ary::cpp::Namespace
& io_rOpenedNamespace
)
215 { do_OpenNamespace(io_rOpenedNamespace
); }
217 PeEnvironment::OpenExternC( bool i_bOnlyForOneDeclaration
)
218 { do_OpenExternC(i_bOnlyForOneDeclaration
); }
220 PeEnvironment::OpenClass( ary::cpp::Class
& io_rOpenedClass
)
221 { do_OpenClass(io_rOpenedClass
); }
223 PeEnvironment::OpenEnum( ary::cpp::Enum
& io_rOpenedEnum
)
224 { do_OpenEnum(io_rOpenedEnum
); }
226 PeEnvironment::CloseBlock()
229 PeEnvironment::CloseClass()
232 PeEnvironment::CloseEnum()
235 PeEnvironment::SetCurProtection( ary::cpp::E_Protection i_eProtection
)
236 { do_SetCurProtection(i_eProtection
); }
238 PeEnvironment::OpenTemplate( const StringVector
& i_rParameters
)
239 { do_OpenTemplate(i_rParameters
); }
240 inline DYN StringVector
*
241 PeEnvironment::Get_CurTemplateParameters()
242 { return do_Get_CurTemplateParameters(); }
244 PeEnvironment::Close_OpenTemplate()
245 { do_Close_OpenTemplate(); }
247 PeEnvironment::Event_Class_FinishedBase( const String
& i_sBaseName
)
248 { do_Event_Class_FinishedBase(i_sBaseName
); }
250 PeEnvironment::Event_Store_Typedef( ary::cpp::Typedef
& io_rTypedef
)
251 { do_Event_Store_Typedef(io_rTypedef
); }
253 PeEnvironment::Event_Store_EnumValue( ary::cpp::EnumValue
& io_rEnumValue
)
254 { do_Event_Store_EnumValue(io_rEnumValue
); }
256 PeEnvironment::Event_Store_CppDefinition( ary::cpp::DefineEntity
& io_rDefinition
)
257 { do_Event_Store_CppDefinition(io_rDefinition
); }
259 PeEnvironment::Event_EnterFunction_ParameterList()
260 { do_Event_EnterFunction_ParameterList(); }
262 PeEnvironment::Event_Function_FinishedParameter( const String
& i_sParameterName
)
263 { do_Event_Function_FinishedParameter(i_sParameterName
); }
265 PeEnvironment::Event_LeaveFunction_ParameterList()
266 { do_Event_LeaveFunction_ParameterList(); }
268 PeEnvironment::Event_EnterFunction_Implementation()
269 { do_Event_EnterFunction_Implementation(); }
271 PeEnvironment::Event_LeaveFunction_Implementation()
272 { do_Event_LeaveFunction_Implementation(); }
274 PeEnvironment::Event_Store_Function( ary::cpp::Function
& io_rFunction
)
275 { do_Event_Store_Function(io_rFunction
); }
277 PeEnvironment::Event_Store_Variable( ary::cpp::Variable
& io_rVariable
)
278 { do_Event_Store_Variable(io_rVariable
); }
280 PeEnvironment::StartWaitingFor_Recovery()
281 { do_StartWaitingFor_Recovery(); }
282 inline ary::cpp::Gate
&
283 PeEnvironment::AryGate() const
284 { return inq_AryGate(); }
285 inline const ary::cpp::InputContext
&
286 PeEnvironment::Context() const
287 { return inq_Context(); }
289 PeEnvironment::CurFileName() const
290 { return inq_CurFileName(); }
292 PeEnvironment::LineCount() const
293 { return inq_LineCount(); }
295 PeEnvironment::IsWaitingFor_Recovery() const
296 { return inq_IsWaitingFor_Recovery(); }
298 PeEnvironment::IsExternC() const
299 { return inq_IsExternC(); }