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