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 
29*cdf0e10cSrcweir #ifndef ADC_CPP_PE_VAFU_HXX
30*cdf0e10cSrcweir #define ADC_CPP_PE_VAFU_HXX
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir // BASE CLASSES
33*cdf0e10cSrcweir #include "cpp_pe.hxx"
34*cdf0e10cSrcweir // USED SERVICES
35*cdf0e10cSrcweir #include <semantic/callf.hxx>
36*cdf0e10cSrcweir #include <semantic/sub_peu.hxx>
37*cdf0e10cSrcweir #include <ary/cpp/c_types4cpp.hxx>
38*cdf0e10cSrcweir #include <ary/cpp/c_vfflag.hxx>
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir namespace cpp
43*cdf0e10cSrcweir {
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir class PE_Type;
46*cdf0e10cSrcweir class PE_Variable;
47*cdf0e10cSrcweir class PE_Function;
48*cdf0e10cSrcweir class PE_Ignore;
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir class PE_VarFunc : public Cpp_PE
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir   public:
56*cdf0e10cSrcweir 	enum E_State
57*cdf0e10cSrcweir 	{
58*cdf0e10cSrcweir 		start,
59*cdf0e10cSrcweir 		expectCtor,
60*cdf0e10cSrcweir 		afterClassDecl,     // Also used for after enum declaration.
61*cdf0e10cSrcweir 		expectName,
62*cdf0e10cSrcweir 		afterName,
63*cdf0e10cSrcweir         afterName_inErraneousTemplate,
64*cdf0e10cSrcweir 		finished,
65*cdf0e10cSrcweir         finishedIncludingFunctionImplementation,
66*cdf0e10cSrcweir 		size_of_states
67*cdf0e10cSrcweir 	};
68*cdf0e10cSrcweir     enum E_ResultType
69*cdf0e10cSrcweir     {
70*cdf0e10cSrcweir         result_unknown = 0,
71*cdf0e10cSrcweir 		result_ignore,         	/// Used for class and enum declarations and predeclarations and for extern variables and functions.
72*cdf0e10cSrcweir 		result_variable,
73*cdf0e10cSrcweir 		result_function
74*cdf0e10cSrcweir     };
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir 	typedef ary::cpp::E_Protection 				E_Protection;
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir 						PE_VarFunc(
80*cdf0e10cSrcweir 							Cpp_PE *			i_pParent );
81*cdf0e10cSrcweir 						~PE_VarFunc();
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir 	virtual void		Call_Handler(
84*cdf0e10cSrcweir 							const cpp::Token &	i_rTok );
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir 	const std::vector<ary::cpp::Ce_id> &
87*cdf0e10cSrcweir             			Result_Ids() const;
88*cdf0e10cSrcweir 	ary::cpp::Type_id   Result_FrontType() const;
89*cdf0e10cSrcweir 	const StringVector &
90*cdf0e10cSrcweir             			Result_Names() const;
91*cdf0e10cSrcweir 	E_ResultType		Result_CeType() const;
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir   private:
94*cdf0e10cSrcweir 	typedef SubPe< PE_VarFunc, PE_Type >		SP_Type;
95*cdf0e10cSrcweir 	typedef SubPeUse< PE_VarFunc, PE_Type >		SPU_Type;
96*cdf0e10cSrcweir 	typedef SubPe< PE_VarFunc, PE_Variable >	SP_Variable;
97*cdf0e10cSrcweir 	typedef SubPeUse< PE_VarFunc, PE_Variable >	SPU_Variable;
98*cdf0e10cSrcweir 	typedef SubPe< PE_VarFunc, PE_Function >	SP_Function;
99*cdf0e10cSrcweir 	typedef SubPeUse< PE_VarFunc, PE_Function >	SPU_Function;
100*cdf0e10cSrcweir 	typedef SubPe< PE_VarFunc, PE_Ignore >		SP_Ignore;
101*cdf0e10cSrcweir 	typedef SubPeUse< PE_VarFunc, PE_Ignore >   SPU_Ignore;
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir 	void				Setup_StatusFunctions();
104*cdf0e10cSrcweir 	virtual void		InitData();
105*cdf0e10cSrcweir 	virtual void		TransferData();
106*cdf0e10cSrcweir 	void  				Hdl_UnknownToken( const char *);
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir 	void				SpInit_FunctionStd();
109*cdf0e10cSrcweir 	void				SpInit_FunctionCtor();
110*cdf0e10cSrcweir 	void				SpInit_FunctionDtor();
111*cdf0e10cSrcweir 	void				SpInit_FunctionCastOperator();
112*cdf0e10cSrcweir 	void				SpInit_FunctionNormalOperator();
113*cdf0e10cSrcweir 	void				SpReturn_Type();
114*cdf0e10cSrcweir 	void				SpReturn_Variable();
115*cdf0e10cSrcweir 	void				SpReturn_FunctionStd();
116*cdf0e10cSrcweir 	void				SpReturn_Ignore();
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir 	void				On_start_Identifier(const char * i_sText);
119*cdf0e10cSrcweir 	void				On_start_operator(const char * i_sText);
120*cdf0e10cSrcweir 	void				On_start_TypeKey(const char * i_sText);
121*cdf0e10cSrcweir 	void				On_start_virtual(const char * i_sText);
122*cdf0e10cSrcweir 	void				On_start_Tilde(const char * i_sText);
123*cdf0e10cSrcweir 	void				On_start_const(const char * i_sText);
124*cdf0e10cSrcweir 	void				On_start_volatile(const char * i_sText);
125*cdf0e10cSrcweir 	void				On_start_extern(const char * i_sText);
126*cdf0e10cSrcweir 	void				On_start_static(const char * i_sText);
127*cdf0e10cSrcweir 	void				On_start_mutable(const char * i_sText);
128*cdf0e10cSrcweir 	void				On_start_register(const char * i_sText);
129*cdf0e10cSrcweir 	void				On_start_inline(const char * i_sText);
130*cdf0e10cSrcweir 	void				On_start_explicit(const char * i_sText);
131*cdf0e10cSrcweir 	void				On_start_Bracket_Right(const char * i_sText);
132*cdf0e10cSrcweir 	void                On_start_typename(const char * i_sText);
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir 	void				On_expectCtor_Bracket_Left(const char * i_sText);
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir 	void				On_afterClassDecl_Semicolon(const char * i_sText);
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir 	void				On_expectName_Identifier(const char * i_sText);
139*cdf0e10cSrcweir 	void				On_expectName_operator(const char * i_sText);
140*cdf0e10cSrcweir 	void				On_expectName_Bracket_Left(const char * i_sText);
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir 	void				On_afterName_ArrayBracket_Left(const char * i_sText);
143*cdf0e10cSrcweir 	void				On_afterName_Bracket_Left(const char * i_sText);
144*cdf0e10cSrcweir     void                On_afterName_DoubleColon(const char * i_sText);
145*cdf0e10cSrcweir 	void				On_afterName_Semicolon(const char * i_sText);
146*cdf0e10cSrcweir 	void				On_afterName_Comma(const char * i_sText);
147*cdf0e10cSrcweir 	void				On_afterName_Assign(const char * i_sText);
148*cdf0e10cSrcweir 	void				On_afterName_Less(const char * i_sText);
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir     void                On_afterName_inErraneousTemplate_Less(const char * i_sText);
151*cdf0e10cSrcweir     void                On_afterName_inErraneousTemplate_Greater(const char * i_sText);
152*cdf0e10cSrcweir     void                On_afterName_inErraneousTemplate_Default(const char * i_sText);
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir 	void				On_finished_Semicolon(const char * i_sText);
155*cdf0e10cSrcweir 	void				On_finished_Comma(const char * i_sText);
156*cdf0e10cSrcweir 	void				On_finished_Default(const char * i_sText);
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir     void                On_finishedIncludingFunctionImplementation_Default(const char * i_sText);
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir     ary::cpp::FunctionFlags
161*cdf0e10cSrcweir                         CreateFunctionFlags();
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir     // DATA
164*cdf0e10cSrcweir 	Dyn< PeStatusArray<PE_VarFunc> >
165*cdf0e10cSrcweir 						pStati;
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir 	Dyn<SP_Type>	    pSpType;
168*cdf0e10cSrcweir 	Dyn<SPU_Type>	 	pSpuType;
169*cdf0e10cSrcweir 	Dyn<SP_Variable>	pSpVariable;
170*cdf0e10cSrcweir 	Dyn<SPU_Variable>	pSpuVariable;
171*cdf0e10cSrcweir 	Dyn<SP_Function>	pSpFunction;
172*cdf0e10cSrcweir 	Dyn<SPU_Function> 	pSpuFunctionStd;
173*cdf0e10cSrcweir 	Dyn<SPU_Function> 	pSpuFunctionCtor;
174*cdf0e10cSrcweir 	Dyn<SPU_Function> 	pSpuFunctionDtor;
175*cdf0e10cSrcweir 	Dyn<SPU_Function> 	pSpuFunctionCastOperator;
176*cdf0e10cSrcweir 	Dyn<SPU_Function> 	pSpuFunctionNormalOperator;
177*cdf0e10cSrcweir 	Dyn<SP_Ignore>	    pSpIgnore;
178*cdf0e10cSrcweir 	Dyn<SPU_Ignore>	 	pSpuIgnore;
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir     intt                nCounter_TemplateBrackets;
181*cdf0e10cSrcweir     bool                bInDestructor;
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir     std::vector<ary::cpp::Ce_id>
184*cdf0e10cSrcweir                         aResultIds;
185*cdf0e10cSrcweir 	ary::cpp::Type_id	nResultFrontType;
186*cdf0e10cSrcweir     E_ResultType        eResultType;
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir 	// Pre-Results
189*cdf0e10cSrcweir     String              sName;
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir     bool                bVirtual;
192*cdf0e10cSrcweir     bool                bStatic;
193*cdf0e10cSrcweir     bool                bExtern;
194*cdf0e10cSrcweir     bool                bExternC;
195*cdf0e10cSrcweir     bool                bMutable;
196*cdf0e10cSrcweir     bool                bInline;
197*cdf0e10cSrcweir     bool                bRegister;
198*cdf0e10cSrcweir     bool                bExplicit;
199*cdf0e10cSrcweir };
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir // IMPLEMENTATION
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir inline const std::vector<ary::cpp::Ce_id> &
206*cdf0e10cSrcweir PE_VarFunc::Result_Ids() const
207*cdf0e10cSrcweir     { return aResultIds; }
208*cdf0e10cSrcweir inline ary::cpp::Type_id
209*cdf0e10cSrcweir PE_VarFunc::Result_FrontType() const
210*cdf0e10cSrcweir     { return nResultFrontType; }
211*cdf0e10cSrcweir inline PE_VarFunc::E_ResultType
212*cdf0e10cSrcweir PE_VarFunc::Result_CeType() const
213*cdf0e10cSrcweir     { return eResultType; }
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir }   // namespace cpp
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir #endif
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir /*	// Overview of Stati
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir Undecided
228*cdf0e10cSrcweir ---------
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir start			// vor und w�hrend storage class specifiern
231*cdf0e10cSrcweir     any         ->stay
232*cdf0e10cSrcweir     operaator   ->goto Function
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir ->Typ
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir expectName
237*cdf0e10cSrcweir     Identifier  ->stay
238*cdf0e10cSrcweir     operator    ->goto Function
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir afterName       ->goto Variable or Function
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir Variable
246*cdf0e10cSrcweir --------
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir start			// vor und w�hrend storage class specifiern
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir ->Typ
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir expectName		// Typ ist da  -> im Falle von '(': notyetimplemented
253*cdf0e10cSrcweir afterName
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir expectSize  	// after [
256*cdf0e10cSrcweir expectFinish
257*cdf0e10cSrcweir 				// vor ; oder ,
258*cdf0e10cSrcweir expectNextVarName  // anders als bei expectName kann hier auch * oder & kommen
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir Function
265*cdf0e10cSrcweir --------
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir start				// vor und w�hrend storage class specifiern
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir ->Typ
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir expectName			// Typ ist da
272*cdf0e10cSrcweir expectBracket		// Nach Name
273*cdf0e10cSrcweir expectParameter		// nach ( oder ,
274*cdf0e10cSrcweir -> Parameter
275*cdf0e10cSrcweir after Parameters    // before const, volatile throw or = 0.
276*cdf0e10cSrcweir after throw			// expect (
277*cdf0e10cSrcweir expectException		// after (
278*cdf0e10cSrcweir after exceptions	// = 0 oder ; oder ,
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir expectNextVarName  // anders als bei expectName kann hier auch * oder & kommen
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir */
290