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_struc.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 LUIDL_PE_STRUC_HXX
32 #define LUIDL_PE_STRUC_HXX
38 #include <s2_luidl/parsenv2.hxx>
39 #include <s2_luidl/pestate.hxx>
41 #include <s2_luidl/semnode.hxx>
42 #include <ary/qualiname.hxx>
65 class PE_StructElement
;
69 class PE_Struct
: public UnoIDL_PE
73 virtual void EstablishContacts(
74 UnoIDL_PE
* io_pParentPE
,
75 ary::Repository
& io_rRepository
,
76 TokenProcessing_Result
&
79 virtual void ProcessToken(
80 const Token
& i_rToken
);
88 void Prepare_PE_QualifiedName();
89 void Prepare_PE_Element();
91 const char * i_sName
);
92 void Data_Set_TemplateParam(
93 const char * i_sTemplateParam
);
96 String sData_TemplateParam
;
97 bool bIsPreDeclaration
;
98 ary::idl::Ce_id nCurStruct
;
100 Dyn
<PE_StructElement
>
102 ary::idl::Ce_id nCurParsed_ElementRef
;
103 Dyn
<PE_Type
> pPE_Type
;
104 ary::idl::Type_id nCurParsed_Base
;
108 class PE_StructState
;
109 friend struct S_Stati
;
110 friend class PE_StructState
;
113 class PE_StructState
: public ParseEnvState
119 PE_Struct
& i_rStruct
)
120 : rStruct(i_rStruct
) {}
122 ParseEnvState
& i_rState
) const;
125 E_EnvStackAction i_eWhat2DoWithEnvStack
,
126 UnoIDL_PE
* i_pParseEnv2Push
= 0 ) const
127 { rStruct
.SetResult(i_eDone
, i_eWhat2DoWithEnvStack
, i_pParseEnv2Push
); }
129 S_Stati
& Stati() const { return *rStruct
.pStati
; }
130 S_Work
& Work() const { return rStruct
.aWork
; }
131 PE_Struct
& PE() const { return rStruct
; }
134 virtual UnoIDL_PE
& MyPE();
139 class State_None
: public PE_StructState
143 PE_Struct
& i_rStruct
)
144 : PE_StructState(i_rStruct
) {}
146 class State_WaitForName
: public PE_StructState
150 PE_Struct
& i_rStruct
)
151 : PE_StructState(i_rStruct
) {}
152 virtual void Process_Identifier(
153 const TokIdentifier
&
156 class State_GotName
: public PE_StructState
160 PE_Struct
& i_rStruct
)
161 : PE_StructState(i_rStruct
) {}
162 virtual void Process_Punctuation(
163 const TokPunctuation
&
166 class State_WaitForTemplateParam
: public PE_StructState
167 { // -> Template parameter identifier
169 State_WaitForTemplateParam(
170 PE_Struct
& i_rStruct
)
171 : PE_StructState(i_rStruct
) {}
172 virtual void Process_Identifier(
173 const TokIdentifier
&
176 class State_WaitForTemplateEnd
: public PE_StructState
179 State_WaitForTemplateEnd(
180 PE_Struct
& i_rStruct
)
181 : PE_StructState(i_rStruct
) {}
182 virtual void Process_Punctuation(
183 const TokPunctuation
&
186 class State_WaitForBase
: public PE_StructState
190 PE_Struct
& i_rStruct
)
191 : PE_StructState(i_rStruct
) {}
192 virtual void On_SubPE_Left();
194 class State_GotBase
: public PE_StructState
198 PE_Struct
& i_rStruct
)
199 : PE_StructState(i_rStruct
) {}
200 virtual void Process_Punctuation(
201 const TokPunctuation
&
204 class State_WaitForElement
: public PE_StructState
207 State_WaitForElement(
208 PE_Struct
& i_rStruct
)
209 : PE_StructState(i_rStruct
) {}
210 virtual void Process_Identifier(
211 const TokIdentifier
&
213 virtual void Process_NameSeparator();
214 virtual void Process_BuiltInType(
215 const TokBuiltInType
&
217 virtual void Process_TypeModifier(
218 const TokTypeModifier
&
220 virtual void Process_Punctuation(
221 const TokPunctuation
&
224 class State_WaitForFinish
: public PE_StructState
228 PE_Struct
& i_rStruct
)
229 : PE_StructState(i_rStruct
) {}
230 virtual void Process_Punctuation(
231 const TokPunctuation
&
238 PE_Struct
& io_rStruct
);
240 ParseEnvState
& i_rNextState
)
241 { pCurStatus
= &i_rNextState
; }
244 State_WaitForName aWaitForName
;
245 State_GotName aGotName
;
246 State_WaitForTemplateParam
247 aWaitForTemplateParam
;
248 State_WaitForTemplateEnd
250 State_WaitForBase aWaitForBase
;
251 State_GotBase aGotBase
;
254 State_WaitForFinish aWaitForFinish
;
256 ParseEnvState
* pCurStatus
;
259 virtual void InitData();
260 virtual void TransferData();
261 virtual void ReceiveData();
269 S_Stati
& Stati() { return *pStati
; }
270 S_Work
& Work() { return aWork
; }
279 PE_Struct::PE_StructState::MoveState(
280 ParseEnvState
& i_rState
) const
281 { rStruct
.Stati().SetState(i_rState
); }