Bump for 3.6-28
[LibreOffice.git] / autodoc / source / parser_i / idl / pe_excp.cxx
blob23d3843583bb7553f2132bae802f94de02b54cc8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include <precomp.h>
30 #include <s2_luidl/pe_excp.hxx>
33 // NOT FULLY DECLARED SERVICES
34 #include <ary/idl/i_exception.hxx>
35 #include <ary/idl/i_gate.hxx>
36 #include <ary/idl/i_structelem.hxx>
37 #include <ary/idl/ip_ce.hxx>
38 #include <ary/doc/d_oldidldocu.hxx>
39 #include <s2_luidl/tk_ident.hxx>
40 #include <s2_luidl/tk_punct.hxx>
41 #include <s2_luidl/tk_keyw.hxx>
42 #include <s2_luidl/pe_type2.hxx>
43 #include <s2_luidl/pe_selem.hxx>
47 namespace csi
49 namespace uidl
53 PE_Exception::PE_Exception()
54 // : aWork,
55 // pStati
57 pStati = new S_Stati(*this);
60 void
61 PE_Exception::EstablishContacts( UnoIDL_PE * io_pParentPE,
62 ary::Repository & io_rRepository,
63 TokenProcessing_Result & o_rResult )
65 UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult);
66 Work().pPE_Element->EstablishContacts(this,io_rRepository,o_rResult);
67 Work().pPE_Type->EstablishContacts(this,io_rRepository,o_rResult);
70 PE_Exception::~PE_Exception()
74 void
75 PE_Exception::ProcessToken( const Token & i_rToken )
77 i_rToken.Trigger(*Stati().pCurStatus);
81 void
82 PE_Exception::InitData()
84 Work().InitData();
85 Stati().pCurStatus = &Stati().aWaitForName;
88 void
89 PE_Exception::TransferData()
91 if (NOT Work().bIsPreDeclaration)
93 csv_assert(Work().sData_Name.size() > 0);
94 csv_assert(Work().nCurStruct.IsValid());
96 Stati().pCurStatus = &Stati().aNone;
99 void
100 PE_Exception::ReceiveData()
102 Stati().pCurStatus->On_SubPE_Left();
105 PE_Exception::S_Work::S_Work()
106 : sData_Name(),
107 bIsPreDeclaration(false),
108 nCurStruct(0),
109 pPE_Element(0),
110 nCurParsed_ElementRef(0),
111 pPE_Type(0),
112 nCurParsed_Base(0)
115 pPE_Element = new PE_StructElement(nCurParsed_ElementRef,nCurStruct);
116 pPE_Type = new PE_Type(nCurParsed_Base);
119 void
120 PE_Exception::S_Work::InitData()
122 sData_Name.clear();
123 bIsPreDeclaration = false;
124 nCurStruct = 0;
126 nCurParsed_ElementRef = 0;
127 nCurParsed_Base = 0;
130 void
131 PE_Exception::S_Work::Prepare_PE_QualifiedName()
133 nCurParsed_ElementRef = 0;
136 void
137 PE_Exception::S_Work::Prepare_PE_Element()
139 nCurParsed_Base = 0;
142 void
143 PE_Exception::S_Work::Data_Set_Name( const char * i_sName )
145 sData_Name = i_sName;
148 PE_Exception::S_Stati::S_Stati(PE_Exception & io_rStruct)
149 : aNone(io_rStruct),
150 aWaitForName(io_rStruct),
151 aGotName(io_rStruct),
152 aWaitForBase(io_rStruct),
153 aGotBase(io_rStruct),
154 aWaitForElement(io_rStruct),
155 aWaitForFinish(io_rStruct),
156 pCurStatus(0)
158 pCurStatus = &aNone;
162 //*********************** Stati ***************************//
165 UnoIDL_PE &
166 PE_Exception::PE_StructState::MyPE()
168 return rStruct;
172 void
173 PE_Exception::State_WaitForName::Process_Identifier( const TokIdentifier & i_rToken )
175 Work().Data_Set_Name(i_rToken.Text());
176 MoveState( Stati().aGotName );
177 SetResult(done,stay);
180 void
181 PE_Exception::State_GotName::Process_Punctuation( const TokPunctuation & i_rToken )
183 if ( i_rToken.Id() != TokPunctuation::Semicolon )
185 switch (i_rToken.Id())
187 case TokPunctuation::Colon:
188 MoveState( Stati().aWaitForBase );
189 SetResult(done,push_sure,Work().pPE_Type.Ptr());
190 Work().Prepare_PE_QualifiedName();
191 break;
192 case TokPunctuation::CurledBracketOpen:
193 PE().store_Exception();
194 MoveState( Stati().aWaitForElement );
195 SetResult(done,stay);
196 break;
197 default:
198 SetResult(not_done,pop_failure);
199 } // end switch
201 else
203 Work().sData_Name.clear();
204 SetResult(done,pop_success);
208 void
209 PE_Exception::State_WaitForBase::On_SubPE_Left()
211 MoveState(Stati().aGotBase);
214 void
215 PE_Exception::State_GotBase::Process_Punctuation( const TokPunctuation & i_rToken )
217 if ( i_rToken.Id() == TokPunctuation::CurledBracketOpen )
219 PE().store_Exception();
220 MoveState( Stati().aWaitForElement );
221 SetResult(done,stay);
223 else
225 SetResult(not_done,pop_failure);
229 void
230 PE_Exception::State_WaitForElement::Process_Identifier( const TokIdentifier & )
232 SetResult( not_done, push_sure, Work().pPE_Element.Ptr() );
233 Work().Prepare_PE_Element();
236 void
237 PE_Exception::State_WaitForElement::Process_NameSeparator()
239 SetResult( not_done, push_sure, Work().pPE_Element.Ptr());
240 Work().Prepare_PE_Element();
243 void
244 PE_Exception::State_WaitForElement::Process_BuiltInType( const TokBuiltInType & )
246 SetResult( not_done, push_sure, Work().pPE_Element.Ptr());
247 Work().Prepare_PE_Element();
250 void
251 PE_Exception::State_WaitForElement::Process_TypeModifier(const TokTypeModifier & )
253 SetResult( not_done, push_sure, Work().pPE_Element.Ptr());
254 Work().Prepare_PE_Element();
257 void
258 PE_Exception::State_WaitForElement::Process_Punctuation( const TokPunctuation & i_rToken )
260 if ( i_rToken.Id() == TokPunctuation::CurledBracketClose )
262 MoveState( Stati().aWaitForFinish );
263 SetResult( done, stay );
265 else
267 SetResult( not_done, pop_failure );
271 void
272 PE_Exception::State_WaitForFinish::Process_Punctuation( const TokPunctuation & i_rToken )
274 if (i_rToken.Id() == TokPunctuation::Semicolon)
276 MoveState( Stati().aNone );
277 SetResult( done, pop_success );
279 else
281 SetResult( not_done, pop_failure );
285 void
286 PE_Exception::store_Exception()
288 ary::idl::Exception &
289 rCe = Gate().Ces().Store_Exception(
290 CurNamespace().CeId(),
291 Work().sData_Name,
292 Work().nCurParsed_Base );
293 PassDocuAt(rCe);
294 Work().nCurStruct = rCe.Id();
298 } // namespace uidl
299 } // namespace csi
301 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */