merge the formfield patch from ooo-build
[ooovba.git] / autodoc / source / parser / cpp / pe_funct.hxx
blob12f50004cc31ff47c1cb24566e7d7ddfd77b9f0c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pe_funct.hxx,v $
10 * $Revision: 1.4 $
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 ************************************************************************/
32 #ifndef ADC_CPP_PE_FUNCT_HXX
33 #define ADC_CPP_PE_FUNCT_HXX
37 // USED SERVICES
38 // BASE CLASSES
39 #include "cpp_pe.hxx"
40 // COMPONENTS
41 #include <semantic/callf.hxx>
42 #include <semantic/sub_peu.hxx>
43 #include <ary/cpp/c_types4cpp.hxx>
44 #include <ary/cpp/c_vfflag.hxx>
45 // PARAMETERS
48 namespace ary
50 namespace cpp
52 class Function;
53 struct S_VariableInfo;
57 namespace cpp
60 class PE_Type;
61 class PE_Parameter;
63 class PE_Function : public Cpp_PE
65 public:
66 enum E_State
68 afterStdOperator, // if initializes as operator
69 afterStdOperatorLeftBracket,
70 // if initializes as operator with ( or [
71 afterCastOperator, // if initializes as operator
72 afterName, // undecided
73 expectParameterSeparator, //
74 afterParameters, // before const, volatile throw or = 0.
75 afterThrow, // expect (
76 expectExceptionSeparator, //
77 afterExceptions, // = 0 oder ; oder ,
78 expectZero, // after '='
79 inImplementation, // after {
80 size_of_states
82 typedef ary::cpp::E_Protection E_Protection;
83 typedef ary::cpp::E_Virtuality E_Virtuality;
84 typedef ary::cpp::E_ConVol E_ConVol;
86 PE_Function(
87 Cpp_PE * i_pParent );
88 ~PE_Function();
90 void Init_Std(
91 const String & i_sName,
92 ary::cpp::Type_id i_nReturnType,
93 bool i_bVirtual,
94 ary::cpp::FunctionFlags
95 i_aFlags );
96 void Init_Ctor(
97 const String & i_sName,
98 ary::cpp::FunctionFlags
99 i_aFlags );
100 void Init_Dtor(
101 const String & i_sName,
102 bool i_bVirtual,
103 ary::cpp::FunctionFlags
104 i_aFlags );
105 void Init_CastOperator(
106 bool i_bVirtual,
107 ary::cpp::FunctionFlags
108 i_aFlags );
109 void Init_NormalOperator(
110 ary::cpp::Type_id i_nReturnType,
111 bool i_bVirtual,
112 ary::cpp::FunctionFlags
113 i_aFlags );
115 ary::cpp::Ce_id Result_Id() const;
116 bool Result_WithImplementation() const;
118 virtual void Call_Handler(
119 const cpp::Token & i_rTok );
120 private:
121 typedef SubPe< PE_Function, PE_Type > SP_Type;
122 typedef SubPeUse< PE_Function, PE_Type > SPU_Type;
123 typedef SubPe< PE_Function, PE_Parameter> SP_Parameter;
124 typedef SubPeUse<PE_Function, PE_Parameter> SPU_Parameter;
126 typedef std::vector<ary::cpp::S_Parameter> ParameterList;
127 typedef std::vector<ary::cpp::Type_id> ExceptionTypeList;
129 void Setup_StatusFunctions();
130 virtual void InitData();
131 virtual void TransferData();
132 void Hdl_SyntaxError(const char * i_sText);
134 void SpInit_CastOperatorType();
136 void SpReturn_Parameter();
137 void SpReturn_Exception();
138 void SpReturn_CastOperatorType();
140 void On_afterOperator_Std_Operator(const char * i_sText); // Operator+() etc.
141 void On_afterOperator_Std_LeftBracket(const char * i_sText); // operator [] or ()
142 void On_afterStdOperatorLeftBracket_RightBracket(const char * i_sText);
143 void On_afterOperator_Cast_Type(const char * i_sText); // Type
145 void On_afterName_Bracket_Left(const char * i_sText);
147 void On_expectParameterSeparator_BracketRight(const char * i_sText);
148 void On_expectParameterSeparator_Comma(const char * i_sText);
150 void On_afterParameters_const(const char * i_sText);
151 void On_afterParameters_volatile(const char * i_sText);
152 void On_afterParameters_throw(const char * i_sText);
153 void On_afterParameters_SwBracket_Left(const char * i_sText);
154 void On_afterParameters_Semicolon(const char * i_sText);
155 void On_afterParameters_Comma(const char * i_sText);
156 void On_afterParameters_Colon(const char * i_sText);
157 void On_afterParameters_Assign(const char * i_sText);
159 void On_afterThrow_Bracket_Left(const char * i_sText);
161 void On_expectExceptionSeparator_BracketRight(const char * i_sText);
162 void On_expectExceptionSeparator_Comma(const char * i_sText);
164 void On_afterExceptions_SwBracket_Left(const char * i_sText);
165 void On_afterExceptions_Semicolon(const char * i_sText);
166 void On_afterExceptions_Comma(const char * i_sText);
167 void On_afterExceptions_Colon(const char * i_sText);
168 void On_afterExceptions_Assign(const char * i_sText);
170 void On_expectZero_Constant(const char * i_sText);
172 void On_inImplementation_SwBracket_Left(const char * i_sText);
173 void On_inImplementation_SwBracket_Right(const char * i_sText);
174 void On_inImplementation_Default(const char * i_sText);
176 void PerformFinishingPunctuation();
177 void EnterImplementation(
178 intt i_nBracketCountStart ); /// 1 normally, 0 in initialisation section of c'tors.
180 // DATA
181 Dyn< PeStatusArray<PE_Function> >
182 pStati;
184 Dyn< SP_Parameter > pSpParameter;
185 Dyn< SPU_Parameter> pSpuParameter;
186 Dyn< SP_Type > pSpType;
187 Dyn< SPU_Type > pSpuException;
188 Dyn< SPU_Type > pSpuCastOperatorType; // in "operator int()" or "operator ThatClass *()"
190 ary::cpp::Ce_id nResult;
191 bool bResult_WithImplementation; // Necessary for the parent ParseEnvironment
192 // to know, there is no semicolon or comma following.
193 // Pre results
194 StreamStr aName;
195 E_Virtuality eVirtuality;
196 E_ConVol eConVol;
197 ary::cpp::FunctionFlags
198 aFlags;
199 ary::cpp::Type_id nReturnType;
200 ParameterList aParameters;
201 ExceptionTypeList aExceptions;
202 bool bThrow; // Indicates, if there is a throw - important, if there are 0 exceptions listed.
203 intt nBracketCounterInImplementation;
209 // IMPLEMENTATION
210 inline bool
211 PE_Function::Result_WithImplementation() const
212 { return bResult_WithImplementation; }
217 } // namespace cpp
218 #endif
224 /* // Overview of Stati
226 Undecided
227 ---------
229 start // vor und während storage class specifiern
231 ->Typ
233 expectName // Typ ist da
235 afterName
240 Variable
241 --------
243 start // vor und während storage class specifiern
245 ->Typ
247 expectName // Typ ist da -> im Falle von '(': notyetimplemented
248 afterName
250 expectSize // after [
251 expectFinish
252 // vor ; oder ,
253 expectNextVarName // anders als bei expectName kann hier auch * oder & kommen
259 Function
260 --------
262 start // vor und während storage class specifiern
264 ->Typ
266 expectName // Typ ist da
267 expectBracket // Nach Name
268 expectParameter // nach ( oder ,
269 -> Parameter
270 after Parameters // before const, volatile throw or = 0.
271 after throw // expect (
272 expectException // after (
273 after exceptions // = 0 oder ; oder ,
276 expectNextVarName // anders als bei expectName kann hier auch * oder & kommen