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 ************************************************************************/
30 #include <s2_luidl/pe_singl.hxx>
33 // NOT FULLY DEFINED SERVICES
34 #include <ary/idl/i_gate.hxx>
35 #include <ary/idl/i_singleton.hxx>
36 #include <ary/idl/i_sisingleton.hxx>
37 #include <ary/idl/ip_ce.hxx>
38 #include <ary/doc/d_oldidldocu.hxx>
39 #include <s2_luidl/pe_type2.hxx>
40 #include <s2_luidl/tk_keyw.hxx>
41 #include <s2_luidl/tk_ident.hxx>
42 #include <s2_luidl/tk_punct.hxx>
52 PE_Singleton::PE_Singleton()
55 bIsPreDeclaration(false),
61 pPE_Type
= new PE_Type(nCurParsed_Type
);
65 PE_Singleton::EstablishContacts( UnoIDL_PE
* io_pParentPE
,
66 ary::Repository
& io_rRepository
,
67 TokenProcessing_Result
& o_rResult
)
69 UnoIDL_PE::EstablishContacts(io_pParentPE
,io_rRepository
,o_rResult
);
70 pPE_Type
->EstablishContacts(this,io_rRepository
,o_rResult
);
73 PE_Singleton::~PE_Singleton()
78 PE_Singleton::ProcessToken( const Token
& i_rToken
)
80 i_rToken
.Trigger(*this);
85 PE_Singleton::Process_MetaType( const TokMetaType
& i_rToken
)
87 switch ( i_rToken
.Id() )
89 case TokMetaType::mt_service
:
92 SetResult(done
, push_sure
, pPE_Type
.Ptr());
98 case TokMetaType::mt_singleton
:
99 if (eState
== need_name
)
100 SetResult(done
, stay
);
106 // Should throw syntax error warning
113 PE_Singleton::Process_Identifier( const TokIdentifier
& i_rToken
)
115 if (eState
== need_name
)
117 sData_Name
= i_rToken
.Text();
118 SetResult(done
, stay
);
119 eState
= need_curlbr_open
;
126 PE_Singleton::Process_Punctuation( const TokPunctuation
& i_rToken
)
128 switch (i_rToken
.Id())
130 case TokPunctuation::CurledBracketOpen
:
131 if (eState
== need_curlbr_open
)
133 pCurSingleton
= &Gate().Ces().Store_Singleton(
134 CurNamespace().CeId(),
136 PassDocuAt(*pCurSingleton
);
137 SetResult(done
, stay
);
143 case TokPunctuation::CurledBracketClose
:
146 SetResult(done
, stay
);
147 eState
= need_finish
;
152 case TokPunctuation::Semicolon
:
155 case e_std
: SetResult(done
, stay
);
158 SetResult(done
, pop_success
);
165 case TokPunctuation::Colon
:
168 case need_curlbr_open
:
169 SetResult(done
, push_sure
, pPE_Type
.Ptr());
170 eState
= in_base_interface
;
182 PE_Singleton::Process_Default()
189 PE_Singleton::On_Default()
191 SetResult(not_done
, pop_failure
);
195 PE_Singleton::InitData()
199 bIsPreDeclaration
= false;
206 PE_Singleton::TransferData()
208 if (NOT bIsPreDeclaration
)
210 csv_assert(sData_Name
.size() > 0);
211 csv_assert( (pCurSingleton
!= 0) != (pCurSiSingleton
!= 0) );
218 PE_Singleton::ReceiveData()
223 pCurSingleton
->Set_Service(nCurParsed_Type
);
227 case in_base_interface
:
228 pCurSiSingleton
= &Gate().Ces().Store_SglIfcSingleton(
229 CurNamespace().CeId(),
232 PassDocuAt(*pCurSiSingleton
);
234 eState
= need_finish
;
250 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */