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
10*1c78a5d6SAndrew Rist  *
11*1c78a5d6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*1c78a5d6SAndrew Rist  *
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.
19*1c78a5d6SAndrew Rist  *
20*1c78a5d6SAndrew Rist  *************************************************************/
21*1c78a5d6SAndrew Rist 
22*1c78a5d6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef LUIDL_PE_EXCP_HXX
25cdf0e10cSrcweir #define LUIDL_PE_EXCP_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 Exception;
57cdf0e10cSrcweir class StructElement;
58cdf0e10cSrcweir class PE_StructElement;
59cdf0e10cSrcweir class PE_Type;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 
62cdf0e10cSrcweir class PE_Exception : public UnoIDL_PE
63cdf0e10cSrcweir {
64cdf0e10cSrcweir   public:
65cdf0e10cSrcweir 						PE_Exception();
66cdf0e10cSrcweir 	virtual void	 	EstablishContacts(
67cdf0e10cSrcweir 							UnoIDL_PE *			io_pParentPE,
68cdf0e10cSrcweir 							ary::Repository &	io_rRepository,
69cdf0e10cSrcweir 							TokenProcessing_Result &
70cdf0e10cSrcweir 												o_rResult );
71cdf0e10cSrcweir 						~PE_Exception();
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         // DATA
86cdf0e10cSrcweir 		String              sData_Name;
87cdf0e10cSrcweir 		bool				bIsPreDeclaration;
88cdf0e10cSrcweir 		ary::idl::Ce_id		nCurStruct;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 		Dyn<PE_StructElement>
91cdf0e10cSrcweir 							pPE_Element;
92cdf0e10cSrcweir 		ary::idl::Ce_id		nCurParsed_ElementRef;
93cdf0e10cSrcweir 		Dyn<PE_Type>		pPE_Type;
94cdf0e10cSrcweir 		ary::idl::Type_id	nCurParsed_Base;
95cdf0e10cSrcweir 	};
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 	struct S_Stati;
98cdf0e10cSrcweir     class PE_StructState;
99cdf0e10cSrcweir     friend struct S_Stati;
100cdf0e10cSrcweir     friend class PE_StructState;
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	class PE_StructState : public ParseEnvState
104cdf0e10cSrcweir 	{
105cdf0e10cSrcweir 	  public:
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 	  protected:
PE_StructState(PE_Exception & i_rStruct)108cdf0e10cSrcweir 							PE_StructState(
109cdf0e10cSrcweir 								PE_Exception &			i_rStruct )
110cdf0e10cSrcweir 													: 	rStruct(i_rStruct) {}
111cdf0e10cSrcweir 		void				MoveState(
112cdf0e10cSrcweir 								ParseEnvState &	    i_rState ) const;
SetResult(E_TokenDone i_eDone,E_EnvStackAction i_eWhat2DoWithEnvStack,UnoIDL_PE * i_pParseEnv2Push=0) const113cdf0e10cSrcweir 		void				SetResult(
114cdf0e10cSrcweir 								E_TokenDone			i_eDone,
115cdf0e10cSrcweir 								E_EnvStackAction	i_eWhat2DoWithEnvStack,
116cdf0e10cSrcweir 								UnoIDL_PE *			i_pParseEnv2Push = 0 ) const
117cdf0e10cSrcweir 													{ rStruct.SetResult(i_eDone, i_eWhat2DoWithEnvStack, i_pParseEnv2Push); }
118cdf0e10cSrcweir 
Stati() const119cdf0e10cSrcweir 		S_Stati &          	Stati() const           { return *rStruct.pStati; }
Work() const120cdf0e10cSrcweir 		S_Work &			Work() const			{ return rStruct.aWork; }
PE() const121cdf0e10cSrcweir 		PE_Exception &		PE() const				{ return rStruct; }
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	  private:
124cdf0e10cSrcweir 		virtual UnoIDL_PE &	MyPE();
125cdf0e10cSrcweir 		// DATA
126cdf0e10cSrcweir 		PE_Exception &			rStruct;
127cdf0e10cSrcweir 	};
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 	class State_None : public PE_StructState
130cdf0e10cSrcweir 	{
131cdf0e10cSrcweir 		public:
State_None(PE_Exception & i_rStruct)132cdf0e10cSrcweir 							State_None(
133cdf0e10cSrcweir 								PE_Exception &			i_rStruct )
134cdf0e10cSrcweir 													: 	PE_StructState(i_rStruct) {}
135cdf0e10cSrcweir 	};
136cdf0e10cSrcweir 	class State_WaitForName : public PE_StructState
137cdf0e10cSrcweir 	{  	// -> Name
138cdf0e10cSrcweir 	  public:
State_WaitForName(PE_Exception & i_rStruct)139cdf0e10cSrcweir 							State_WaitForName(
140cdf0e10cSrcweir 								PE_Exception &			i_rStruct )
141cdf0e10cSrcweir 													: 	PE_StructState(i_rStruct) {}
142cdf0e10cSrcweir 		virtual void		Process_Identifier(
143cdf0e10cSrcweir 								const TokIdentifier &
144cdf0e10cSrcweir 													i_rToken );
145cdf0e10cSrcweir 	};
146cdf0e10cSrcweir 	class State_GotName : public PE_StructState
147cdf0e10cSrcweir 	{  	// -> : { ;
148cdf0e10cSrcweir 	  public:
State_GotName(PE_Exception & i_rStruct)149cdf0e10cSrcweir 							State_GotName(
150cdf0e10cSrcweir 								PE_Exception &			i_rStruct )
151cdf0e10cSrcweir 													: 	PE_StructState(i_rStruct) {}
152cdf0e10cSrcweir 		virtual void		Process_Punctuation(
153cdf0e10cSrcweir 								const TokPunctuation &
154cdf0e10cSrcweir 													i_rToken );
155cdf0e10cSrcweir 	};
156cdf0e10cSrcweir 	class State_WaitForBase : public PE_StructState
157cdf0e10cSrcweir 	{   // -> Base
158cdf0e10cSrcweir 	  public:
State_WaitForBase(PE_Exception & i_rStruct)159cdf0e10cSrcweir 							State_WaitForBase(
160cdf0e10cSrcweir 								PE_Exception &			i_rStruct )
161cdf0e10cSrcweir 													: 	PE_StructState(i_rStruct) {}
162cdf0e10cSrcweir 		virtual void		On_SubPE_Left();
163cdf0e10cSrcweir 	};
164cdf0e10cSrcweir 	class State_GotBase : public PE_StructState
165cdf0e10cSrcweir 	{   // -> {
166cdf0e10cSrcweir 	  public:
State_GotBase(PE_Exception & i_rStruct)167cdf0e10cSrcweir 							State_GotBase(
168cdf0e10cSrcweir 								PE_Exception &			i_rStruct )
169cdf0e10cSrcweir 													: 	PE_StructState(i_rStruct) {}
170cdf0e10cSrcweir 		virtual void		Process_Punctuation(
171cdf0e10cSrcweir 								const TokPunctuation &
172cdf0e10cSrcweir 													i_rToken );
173cdf0e10cSrcweir 	};
174cdf0e10cSrcweir 	class State_WaitForElement : public PE_StructState
175cdf0e10cSrcweir 	{   // -> Typ }
176cdf0e10cSrcweir 	  public:
State_WaitForElement(PE_Exception & i_rStruct)177cdf0e10cSrcweir 							State_WaitForElement(
178cdf0e10cSrcweir 								PE_Exception &			i_rStruct )
179cdf0e10cSrcweir 													: 	PE_StructState(i_rStruct) {}
180cdf0e10cSrcweir 		virtual void		Process_Identifier(
181cdf0e10cSrcweir 								const TokIdentifier &
182cdf0e10cSrcweir 												i_rToken );
183cdf0e10cSrcweir 		virtual void		Process_NameSeparator();
184cdf0e10cSrcweir 		virtual void		Process_BuiltInType(
185cdf0e10cSrcweir 								const TokBuiltInType &
186cdf0e10cSrcweir 												i_rToken );
187cdf0e10cSrcweir 		virtual void		Process_TypeModifier(
188cdf0e10cSrcweir 								const TokTypeModifier &
189cdf0e10cSrcweir 													i_rToken );
190cdf0e10cSrcweir 		virtual void		Process_Punctuation(
191cdf0e10cSrcweir 								const TokPunctuation &
192cdf0e10cSrcweir 													i_rToken );
193cdf0e10cSrcweir //		virtual void		On_SubPE_Left();
194cdf0e10cSrcweir 	};
195cdf0e10cSrcweir 	class State_WaitForFinish : public PE_StructState
196cdf0e10cSrcweir 	{ // -> ;
197cdf0e10cSrcweir 	  public:
State_WaitForFinish(PE_Exception & i_rStruct)198cdf0e10cSrcweir 							State_WaitForFinish(
199cdf0e10cSrcweir 								PE_Exception &			i_rStruct )
200cdf0e10cSrcweir 													: 	PE_StructState(i_rStruct) {}
201cdf0e10cSrcweir 		virtual void		Process_Punctuation(
202cdf0e10cSrcweir 								const TokPunctuation &
203cdf0e10cSrcweir 													i_rToken );
204cdf0e10cSrcweir 	};
205cdf0e10cSrcweir 
206cdf0e10cSrcweir 	struct S_Stati
207cdf0e10cSrcweir 	{
208cdf0e10cSrcweir 							S_Stati(
209cdf0e10cSrcweir 								PE_Exception &			io_rStruct );
SetStatecsi::uidl::PE_Exception::S_Stati210cdf0e10cSrcweir 		void				SetState(
211cdf0e10cSrcweir 								ParseEnvState &		i_rNextState )
212cdf0e10cSrcweir 													{ pCurStatus = &i_rNextState; }
213cdf0e10cSrcweir 
214cdf0e10cSrcweir 		State_None			aNone;
215cdf0e10cSrcweir 		State_WaitForName	aWaitForName;
216cdf0e10cSrcweir 		State_GotName       aGotName;
217cdf0e10cSrcweir 		State_WaitForBase   aWaitForBase;
218cdf0e10cSrcweir 		State_GotBase       aGotBase;
219cdf0e10cSrcweir 		State_WaitForElement
220cdf0e10cSrcweir 							aWaitForElement;
221cdf0e10cSrcweir 		State_WaitForFinish aWaitForFinish;
222cdf0e10cSrcweir 
223cdf0e10cSrcweir 		ParseEnvState *		pCurStatus;
224cdf0e10cSrcweir 	};
225cdf0e10cSrcweir 
226cdf0e10cSrcweir 	virtual void		InitData();
227cdf0e10cSrcweir 	virtual void		TransferData();
228cdf0e10cSrcweir 	virtual void		ReceiveData();
229cdf0e10cSrcweir 
230cdf0e10cSrcweir     public:
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 	void        store_Exception();
233cdf0e10cSrcweir 
234cdf0e10cSrcweir 	private:
235cdf0e10cSrcweir 
Stati()236cdf0e10cSrcweir 	S_Stati &	       	Stati()					{ return *pStati; }
Work()237cdf0e10cSrcweir 	S_Work &			Work()					{ return aWork; }
238cdf0e10cSrcweir 
239cdf0e10cSrcweir 	// DATA
240cdf0e10cSrcweir 	S_Work				aWork;
241cdf0e10cSrcweir 	Dyn<S_Stati>		pStati;
242cdf0e10cSrcweir };
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 
245cdf0e10cSrcweir inline void
MoveState(ParseEnvState & i_rState) const246cdf0e10cSrcweir PE_Exception::PE_StructState::MoveState(
247cdf0e10cSrcweir 								ParseEnvState &	    i_rState ) const
248cdf0e10cSrcweir 													{ rStruct.Stati().SetState(i_rState); }
249cdf0e10cSrcweir 
250cdf0e10cSrcweir }   // namespace uidl
251cdf0e10cSrcweir }   // namespace csi
252cdf0e10cSrcweir 
253cdf0e10cSrcweir 
254cdf0e10cSrcweir #endif
255cdf0e10cSrcweir 
256