xref: /AOO41X/main/autodoc/source/parser_i/inc/s2_luidl/pe_struc.hxx (revision 1c78a5d6c0093dece4c096ba53051800fbad6e33)
1*1c78a5d6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1c78a5d6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1c78a5d6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1c78a5d6SAndrew Rist  * distributed with this work for additional information
6*1c78a5d6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1c78a5d6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1c78a5d6SAndrew Rist  * "License"); you may not use this file except in compliance
9*1c78a5d6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*1c78a5d6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*1c78a5d6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1c78a5d6SAndrew Rist  * software distributed under the License is distributed on an
15*1c78a5d6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1c78a5d6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1c78a5d6SAndrew Rist  * specific language governing permissions and limitations
18*1c78a5d6SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*1c78a5d6SAndrew Rist  *************************************************************/
21*1c78a5d6SAndrew Rist 
22*1c78a5d6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef LUIDL_PE_STRUC_HXX
25cdf0e10cSrcweir #define LUIDL_PE_STRUC_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir 
29cdf0e10cSrcweir // USED SERVICES
30cdf0e10cSrcweir 	// BASE CLASSES
31cdf0e10cSrcweir #include <s2_luidl/parsenv2.hxx>
32cdf0e10cSrcweir #include <s2_luidl/pestate.hxx>
33cdf0e10cSrcweir 	// COMPONENTS
34cdf0e10cSrcweir #include <s2_luidl/semnode.hxx>
35cdf0e10cSrcweir #include <ary/qualiname.hxx>
36cdf0e10cSrcweir 	// PARAMETERS
37cdf0e10cSrcweir 
38cdf0e10cSrcweir 
39cdf0e10cSrcweir 
40cdf0e10cSrcweir namespace csi
41cdf0e10cSrcweir {
42cdf0e10cSrcweir namespace prl
43cdf0e10cSrcweir {
44cdf0e10cSrcweir     class TNamespace;
45cdf0e10cSrcweir }
46cdf0e10cSrcweir }
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 
49cdf0e10cSrcweir 
50cdf0e10cSrcweir namespace csi
51cdf0e10cSrcweir {
52cdf0e10cSrcweir namespace uidl
53cdf0e10cSrcweir {
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 
56cdf0e10cSrcweir class Struct;
57cdf0e10cSrcweir class StructElement;
58cdf0e10cSrcweir class PE_StructElement;
59cdf0e10cSrcweir class PE_Type;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 
62cdf0e10cSrcweir class PE_Struct : public UnoIDL_PE
63cdf0e10cSrcweir {
64cdf0e10cSrcweir   public:
65cdf0e10cSrcweir 						PE_Struct();
66cdf0e10cSrcweir 	virtual void	 	EstablishContacts(
67cdf0e10cSrcweir 							UnoIDL_PE *			io_pParentPE,
68cdf0e10cSrcweir 							ary::Repository &	io_rRepository,
69cdf0e10cSrcweir 							TokenProcessing_Result &
70cdf0e10cSrcweir 												o_rResult );
71cdf0e10cSrcweir 						~PE_Struct();
72cdf0e10cSrcweir 	virtual void	  	ProcessToken(
73cdf0e10cSrcweir 							const Token &		i_rToken );
74cdf0e10cSrcweir 
75cdf0e10cSrcweir   private:
76cdf0e10cSrcweir 	struct S_Work
77cdf0e10cSrcweir 	{
78cdf0e10cSrcweir 							S_Work();
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 		void				InitData();
81cdf0e10cSrcweir 		void				Prepare_PE_QualifiedName();
82cdf0e10cSrcweir 		void				Prepare_PE_Element();
83cdf0e10cSrcweir 		void				Data_Set_Name(
84cdf0e10cSrcweir 								const char *		i_sName );
85cdf0e10cSrcweir 		void				Data_Set_TemplateParam(
86cdf0e10cSrcweir 								const char *		i_sTemplateParam );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 		String              sData_Name;
89cdf0e10cSrcweir 		String              sData_TemplateParam;
90cdf0e10cSrcweir 		bool				bIsPreDeclaration;
91cdf0e10cSrcweir         ary::idl::Ce_id	    nCurStruct;
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 		Dyn<PE_StructElement>
94cdf0e10cSrcweir 							pPE_Element;
95cdf0e10cSrcweir 		ary::idl::Ce_id	    nCurParsed_ElementRef;
96cdf0e10cSrcweir 		Dyn<PE_Type>		pPE_Type;
97cdf0e10cSrcweir 		ary::idl::Type_id	nCurParsed_Base;
98cdf0e10cSrcweir 	};
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 	struct S_Stati;
101cdf0e10cSrcweir     class PE_StructState;
102cdf0e10cSrcweir     friend struct S_Stati;
103cdf0e10cSrcweir     friend class PE_StructState;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	class PE_StructState : public ParseEnvState
107cdf0e10cSrcweir 	{
108cdf0e10cSrcweir 	  public:
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 	  protected:
PE_StructState(PE_Struct & i_rStruct)111cdf0e10cSrcweir 							PE_StructState(
112cdf0e10cSrcweir 								PE_Struct &			i_rStruct )
113cdf0e10cSrcweir 													: 	rStruct(i_rStruct) {}
114cdf0e10cSrcweir 		void				MoveState(
115cdf0e10cSrcweir 								ParseEnvState &	    i_rState ) const;
SetResult(E_TokenDone i_eDone,E_EnvStackAction i_eWhat2DoWithEnvStack,UnoIDL_PE * i_pParseEnv2Push=0) const116cdf0e10cSrcweir 		void				SetResult(
117cdf0e10cSrcweir 								E_TokenDone			i_eDone,
118cdf0e10cSrcweir 								E_EnvStackAction	i_eWhat2DoWithEnvStack,
119cdf0e10cSrcweir 								UnoIDL_PE *			i_pParseEnv2Push = 0 ) const
120cdf0e10cSrcweir 													{ rStruct.SetResult(i_eDone, i_eWhat2DoWithEnvStack, i_pParseEnv2Push); }
121cdf0e10cSrcweir 
Stati() const122cdf0e10cSrcweir 		S_Stati &          	Stati() const           { return *rStruct.pStati; }
Work() const123cdf0e10cSrcweir 		S_Work &			Work() const			{ return rStruct.aWork; }
PE() const124cdf0e10cSrcweir 		PE_Struct &			PE() const				{ return rStruct; }
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 	  private:
127cdf0e10cSrcweir 		virtual UnoIDL_PE &	MyPE();
128cdf0e10cSrcweir 		// DATA
129cdf0e10cSrcweir 		PE_Struct &			rStruct;
130cdf0e10cSrcweir 	};
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	class State_None : public PE_StructState
133cdf0e10cSrcweir 	{
134cdf0e10cSrcweir 		public:
State_None(PE_Struct & i_rStruct)135cdf0e10cSrcweir 							State_None(
136cdf0e10cSrcweir 								PE_Struct &			i_rStruct )
137cdf0e10cSrcweir 													: 	PE_StructState(i_rStruct) {}
138cdf0e10cSrcweir 	};
139cdf0e10cSrcweir 	class State_WaitForName : public PE_StructState
140cdf0e10cSrcweir 	{  	// -> Name
141cdf0e10cSrcweir 	  public:
State_WaitForName(PE_Struct & i_rStruct)142cdf0e10cSrcweir 							State_WaitForName(
143cdf0e10cSrcweir 								PE_Struct &			i_rStruct )
144cdf0e10cSrcweir 													: 	PE_StructState(i_rStruct) {}
145cdf0e10cSrcweir 		virtual void		Process_Identifier(
146cdf0e10cSrcweir 								const TokIdentifier &
147cdf0e10cSrcweir 													i_rToken );
148cdf0e10cSrcweir 	};
149cdf0e10cSrcweir 	class State_GotName : public PE_StructState
150cdf0e10cSrcweir 	{  	// -> : { ; <
151cdf0e10cSrcweir 	  public:
State_GotName(PE_Struct & i_rStruct)152cdf0e10cSrcweir 							State_GotName(
153cdf0e10cSrcweir 								PE_Struct &			i_rStruct )
154cdf0e10cSrcweir 													: 	PE_StructState(i_rStruct) {}
155cdf0e10cSrcweir 		virtual void		Process_Punctuation(
156cdf0e10cSrcweir 								const TokPunctuation &
157cdf0e10cSrcweir 													i_rToken );
158cdf0e10cSrcweir 	};
159cdf0e10cSrcweir 	class State_WaitForTemplateParam : public PE_StructState
160cdf0e10cSrcweir 	{  	// -> Template parameter identifier
161cdf0e10cSrcweir 	  public:
State_WaitForTemplateParam(PE_Struct & i_rStruct)162cdf0e10cSrcweir 							State_WaitForTemplateParam(
163cdf0e10cSrcweir 								PE_Struct &			i_rStruct )
164cdf0e10cSrcweir 													: 	PE_StructState(i_rStruct) {}
165cdf0e10cSrcweir 		virtual void		Process_Identifier(
166cdf0e10cSrcweir 								const TokIdentifier &
167cdf0e10cSrcweir 													i_rToken );
168cdf0e10cSrcweir 	};
169cdf0e10cSrcweir 	class State_WaitForTemplateEnd : public PE_StructState
170cdf0e10cSrcweir 	{  	// -> >
171cdf0e10cSrcweir 	  public:
State_WaitForTemplateEnd(PE_Struct & i_rStruct)172cdf0e10cSrcweir 							State_WaitForTemplateEnd(
173cdf0e10cSrcweir 								PE_Struct &			i_rStruct )
174cdf0e10cSrcweir 													: 	PE_StructState(i_rStruct) {}
175cdf0e10cSrcweir 		virtual void		Process_Punctuation(
176cdf0e10cSrcweir 								const TokPunctuation &
177cdf0e10cSrcweir 													i_rToken );
178cdf0e10cSrcweir 	};
179cdf0e10cSrcweir 	class State_WaitForBase : public PE_StructState
180cdf0e10cSrcweir 	{   // -> Base
181cdf0e10cSrcweir 	  public:
State_WaitForBase(PE_Struct & i_rStruct)182cdf0e10cSrcweir 							State_WaitForBase(
183cdf0e10cSrcweir 								PE_Struct &			i_rStruct )
184cdf0e10cSrcweir 													: 	PE_StructState(i_rStruct) {}
185cdf0e10cSrcweir 		virtual void		On_SubPE_Left();
186cdf0e10cSrcweir 	};
187cdf0e10cSrcweir 	class State_GotBase : public PE_StructState
188cdf0e10cSrcweir 	{   // -> {
189cdf0e10cSrcweir 	  public:
State_GotBase(PE_Struct & i_rStruct)190cdf0e10cSrcweir 							State_GotBase(
191cdf0e10cSrcweir 								PE_Struct &			i_rStruct )
192cdf0e10cSrcweir 													: 	PE_StructState(i_rStruct) {}
193cdf0e10cSrcweir 		virtual void		Process_Punctuation(
194cdf0e10cSrcweir 								const TokPunctuation &
195cdf0e10cSrcweir 													i_rToken );
196cdf0e10cSrcweir 	};
197cdf0e10cSrcweir 	class State_WaitForElement : public PE_StructState
198cdf0e10cSrcweir 	{   // -> Typ }
199cdf0e10cSrcweir 	  public:
State_WaitForElement(PE_Struct & i_rStruct)200cdf0e10cSrcweir 							State_WaitForElement(
201cdf0e10cSrcweir 								PE_Struct &			i_rStruct )
202cdf0e10cSrcweir 													: 	PE_StructState(i_rStruct) {}
203cdf0e10cSrcweir 		virtual void		Process_Identifier(
204cdf0e10cSrcweir 								const TokIdentifier &
205cdf0e10cSrcweir 													i_rToken );
206cdf0e10cSrcweir 		virtual void		Process_NameSeparator();
207cdf0e10cSrcweir 		virtual void		Process_BuiltInType(
208cdf0e10cSrcweir 								const TokBuiltInType &
209cdf0e10cSrcweir 													i_rToken );
210cdf0e10cSrcweir 		virtual void		Process_TypeModifier(
211cdf0e10cSrcweir 								const TokTypeModifier &
212cdf0e10cSrcweir 													i_rToken );
213cdf0e10cSrcweir 		virtual void		Process_Punctuation(
214cdf0e10cSrcweir 								const TokPunctuation &
215cdf0e10cSrcweir 													i_rToken );
216cdf0e10cSrcweir 	};
217cdf0e10cSrcweir 	class State_WaitForFinish : public PE_StructState
218cdf0e10cSrcweir 	{ // -> ;
219cdf0e10cSrcweir 	  public:
State_WaitForFinish(PE_Struct & i_rStruct)220cdf0e10cSrcweir 							State_WaitForFinish(
221cdf0e10cSrcweir 								PE_Struct &			i_rStruct )
222cdf0e10cSrcweir 													: 	PE_StructState(i_rStruct) {}
223cdf0e10cSrcweir 		virtual void		Process_Punctuation(
224cdf0e10cSrcweir 								const TokPunctuation &
225cdf0e10cSrcweir 													i_rToken );
226cdf0e10cSrcweir 	};
227cdf0e10cSrcweir 
228cdf0e10cSrcweir 	struct S_Stati
229cdf0e10cSrcweir 	{
230cdf0e10cSrcweir 							S_Stati(
231cdf0e10cSrcweir 								PE_Struct &			io_rStruct );
SetStatecsi::uidl::PE_Struct::S_Stati232cdf0e10cSrcweir 		void				SetState(
233cdf0e10cSrcweir 								ParseEnvState &		i_rNextState )
234cdf0e10cSrcweir 													{ pCurStatus = &i_rNextState; }
235cdf0e10cSrcweir 
236cdf0e10cSrcweir 		State_None			aNone;
237cdf0e10cSrcweir 		State_WaitForName	aWaitForName;
238cdf0e10cSrcweir 		State_GotName       aGotName;
239cdf0e10cSrcweir 		State_WaitForTemplateParam
240cdf0e10cSrcweir 		                    aWaitForTemplateParam;
241cdf0e10cSrcweir 		State_WaitForTemplateEnd
242cdf0e10cSrcweir 		                    aWaitForTemplateEnd;
243cdf0e10cSrcweir 		State_WaitForBase   aWaitForBase;
244cdf0e10cSrcweir 		State_GotBase       aGotBase;
245cdf0e10cSrcweir 		State_WaitForElement
246cdf0e10cSrcweir 							aWaitForElement;
247cdf0e10cSrcweir 		State_WaitForFinish aWaitForFinish;
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 		ParseEnvState *		pCurStatus;
250cdf0e10cSrcweir 	};
251cdf0e10cSrcweir 
252cdf0e10cSrcweir 	virtual void		InitData();
253cdf0e10cSrcweir 	virtual void		TransferData();
254cdf0e10cSrcweir 	virtual void		ReceiveData();
255cdf0e10cSrcweir 
256cdf0e10cSrcweir     public:
257cdf0e10cSrcweir 
258cdf0e10cSrcweir 	void        store_Struct();
259cdf0e10cSrcweir 
260cdf0e10cSrcweir 	private:
261cdf0e10cSrcweir 
Stati()262cdf0e10cSrcweir 	S_Stati &	       	Stati()					{ return *pStati; }
Work()263cdf0e10cSrcweir 	S_Work &			Work()					{ return aWork; }
264cdf0e10cSrcweir 
265cdf0e10cSrcweir 	// DATA
266cdf0e10cSrcweir 	S_Work				aWork;
267cdf0e10cSrcweir 	Dyn<S_Stati>		pStati;
268cdf0e10cSrcweir };
269cdf0e10cSrcweir 
270cdf0e10cSrcweir 
271cdf0e10cSrcweir inline void
MoveState(ParseEnvState & i_rState) const272cdf0e10cSrcweir PE_Struct::PE_StructState::MoveState(
273cdf0e10cSrcweir 								ParseEnvState &	    i_rState ) const
274cdf0e10cSrcweir 													{ rStruct.Stati().SetState(i_rState); }
275cdf0e10cSrcweir 
276cdf0e10cSrcweir }   // namespace uidl
277cdf0e10cSrcweir }   // namespace csi
278cdf0e10cSrcweir 
279cdf0e10cSrcweir 
280cdf0e10cSrcweir #endif
281cdf0e10cSrcweir 
282