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