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_STRUC_HXX
21 : #define LUIDL_PE_STRUC_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_Struct : public UnoIDL_PE
47 : {
48 : public:
49 : PE_Struct();
50 : virtual void EstablishContacts(
51 : UnoIDL_PE * io_pParentPE,
52 : ary::Repository & io_rRepository,
53 : TokenProcessing_Result &
54 : o_rResult );
55 : ~PE_Struct();
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 : void Data_Set_TemplateParam(
70 : const char * i_sTemplateParam );
71 :
72 : String sData_Name;
73 : String sData_TemplateParam;
74 : bool bIsPreDeclaration;
75 : ary::idl::Ce_id nCurStruct;
76 :
77 : Dyn<PE_StructElement>
78 : pPE_Element;
79 : ary::idl::Ce_id nCurParsed_ElementRef;
80 : Dyn<PE_Type> pPE_Type;
81 : ary::idl::Type_id nCurParsed_Base;
82 : };
83 :
84 : struct S_Stati;
85 : class PE_StructState;
86 : friend struct S_Stati;
87 : friend class PE_StructState;
88 :
89 :
90 27 : class PE_StructState : public ParseEnvState
91 : {
92 : public:
93 :
94 : protected:
95 27 : PE_StructState(
96 : PE_Struct & i_rStruct )
97 27 : : rStruct(i_rStruct) {}
98 : void MoveState(
99 : ParseEnvState & i_rState ) const;
100 2964 : void SetResult(
101 : E_TokenDone i_eDone,
102 : E_EnvStackAction i_eWhat2DoWithEnvStack,
103 : UnoIDL_PE * i_pParseEnv2Push = 0 ) const
104 2964 : { rStruct.SetResult(i_eDone, i_eWhat2DoWithEnvStack, i_pParseEnv2Push); }
105 :
106 1729 : S_Stati & Stati() const { return *rStruct.pStati; }
107 3240 : S_Work & Work() const { return rStruct.aWork; }
108 381 : PE_Struct & PE() const { return rStruct; }
109 :
110 : private:
111 : virtual UnoIDL_PE & MyPE();
112 : // DATA
113 : PE_Struct & rStruct;
114 : };
115 :
116 3 : class State_None : public PE_StructState
117 : {
118 : public:
119 3 : State_None(
120 : PE_Struct & i_rStruct )
121 3 : : PE_StructState(i_rStruct) {}
122 : };
123 3 : class State_WaitForName : public PE_StructState
124 : { // -> Name
125 : public:
126 3 : State_WaitForName(
127 : PE_Struct & i_rStruct )
128 3 : : PE_StructState(i_rStruct) {}
129 : virtual void Process_Identifier(
130 : const TokIdentifier &
131 : i_rToken );
132 : };
133 3 : class State_GotName : public PE_StructState
134 : { // -> : { ; <
135 : public:
136 3 : State_GotName(
137 : PE_Struct & i_rStruct )
138 3 : : PE_StructState(i_rStruct) {}
139 : virtual void Process_Punctuation(
140 : const TokPunctuation &
141 : i_rToken );
142 : };
143 3 : class State_WaitForTemplateParam : public PE_StructState
144 : { // -> Template parameter identifier
145 : public:
146 3 : State_WaitForTemplateParam(
147 : PE_Struct & i_rStruct )
148 3 : : PE_StructState(i_rStruct) {}
149 : virtual void Process_Identifier(
150 : const TokIdentifier &
151 : i_rToken );
152 : };
153 3 : class State_WaitForTemplateEnd : public PE_StructState
154 : { // -> >
155 : public:
156 3 : State_WaitForTemplateEnd(
157 : PE_Struct & i_rStruct )
158 3 : : PE_StructState(i_rStruct) {}
159 : virtual void Process_Punctuation(
160 : const TokPunctuation &
161 : i_rToken );
162 : };
163 3 : class State_WaitForBase : public PE_StructState
164 : { // -> Base
165 : public:
166 3 : State_WaitForBase(
167 : PE_Struct & i_rStruct )
168 3 : : PE_StructState(i_rStruct) {}
169 : virtual void On_SubPE_Left();
170 : };
171 3 : class State_GotBase : public PE_StructState
172 : { // -> {
173 : public:
174 3 : State_GotBase(
175 : PE_Struct & i_rStruct )
176 3 : : PE_StructState(i_rStruct) {}
177 : virtual void Process_Punctuation(
178 : const TokPunctuation &
179 : i_rToken );
180 : };
181 3 : class State_WaitForElement : public PE_StructState
182 : { // -> Typ }
183 : public:
184 3 : State_WaitForElement(
185 : PE_Struct & i_rStruct )
186 3 : : PE_StructState(i_rStruct) {}
187 : virtual void Process_Identifier(
188 : const TokIdentifier &
189 : i_rToken );
190 : virtual void Process_NameSeparator();
191 : virtual void Process_BuiltInType(
192 : const TokBuiltInType &
193 : i_rToken );
194 : virtual void Process_TypeModifier(
195 : const TokTypeModifier &
196 : i_rToken );
197 : virtual void Process_Punctuation(
198 : const TokPunctuation &
199 : i_rToken );
200 : };
201 3 : class State_WaitForFinish : public PE_StructState
202 : { // -> ;
203 : public:
204 3 : State_WaitForFinish(
205 : PE_Struct & i_rStruct )
206 3 : : PE_StructState(i_rStruct) {}
207 : virtual void Process_Punctuation(
208 : const TokPunctuation &
209 : i_rToken );
210 : };
211 :
212 3 : struct S_Stati
213 : {
214 : S_Stati(
215 : PE_Struct & io_rStruct );
216 1729 : void SetState(
217 : ParseEnvState & i_rNextState )
218 1729 : { pCurStatus = &i_rNextState; }
219 :
220 : State_None aNone;
221 : State_WaitForName aWaitForName;
222 : State_GotName aGotName;
223 : State_WaitForTemplateParam
224 : aWaitForTemplateParam;
225 : State_WaitForTemplateEnd
226 : aWaitForTemplateEnd;
227 : State_WaitForBase aWaitForBase;
228 : State_GotBase aGotBase;
229 : State_WaitForElement
230 : aWaitForElement;
231 : State_WaitForFinish aWaitForFinish;
232 :
233 : ParseEnvState * pCurStatus;
234 : };
235 :
236 : virtual void InitData();
237 : virtual void TransferData();
238 : virtual void ReceiveData();
239 :
240 : public:
241 :
242 : void store_Struct();
243 :
244 : private:
245 :
246 12213 : S_Stati & Stati() { return *pStati; }
247 2293 : S_Work & Work() { return aWork; }
248 :
249 : // DATA
250 : S_Work aWork;
251 : Dyn<S_Stati> pStati;
252 : };
253 :
254 :
255 : inline void
256 1729 : PE_Struct::PE_StructState::MoveState(
257 : ParseEnvState & i_rState ) const
258 1729 : { rStruct.Stati().SetState(i_rState); }
259 :
260 : } // namespace uidl
261 : } // namespace csi
262 :
263 :
264 : #endif
265 :
266 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|