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: pe_funct.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 ************************************************************************/
32 #ifndef ADC_CPP_PE_FUNCT_HXX
33 #define ADC_CPP_PE_FUNCT_HXX
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>
53 struct S_VariableInfo
;
63 class PE_Function
: public Cpp_PE
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 {
82 typedef ary::cpp::E_Protection E_Protection
;
83 typedef ary::cpp::E_Virtuality E_Virtuality
;
84 typedef ary::cpp::E_ConVol E_ConVol
;
91 const String
& i_sName
,
92 ary::cpp::Type_id i_nReturnType
,
94 ary::cpp::FunctionFlags
97 const String
& i_sName
,
98 ary::cpp::FunctionFlags
101 const String
& i_sName
,
103 ary::cpp::FunctionFlags
105 void Init_CastOperator(
107 ary::cpp::FunctionFlags
109 void Init_NormalOperator(
110 ary::cpp::Type_id i_nReturnType
,
112 ary::cpp::FunctionFlags
115 ary::cpp::Ce_id
Result_Id() const;
116 bool Result_WithImplementation() const;
118 virtual void Call_Handler(
119 const cpp::Token
& i_rTok
);
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.
181 Dyn
< PeStatusArray
<PE_Function
> >
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.
195 E_Virtuality eVirtuality
;
197 ary::cpp::FunctionFlags
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
;
211 PE_Function::Result_WithImplementation() const
212 { return bResult_WithImplementation
; }
224 /* // Overview of Stati
229 start // vor und während storage class specifiern
233 expectName // Typ ist da
243 start // vor und während storage class specifiern
247 expectName // Typ ist da -> im Falle von '(': notyetimplemented
250 expectSize // after [
253 expectNextVarName // anders als bei expectName kann hier auch * oder & kommen
262 start // vor und während storage class specifiern
266 expectName // Typ ist da
267 expectBracket // Nach Name
268 expectParameter // nach ( oder ,
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