Bump for 3.6-28
[LibreOffice.git] / autodoc / source / parser_i / idl / pe_singl.cxx
blob292d380323ac15e36abb059eb054bcf80206a693
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_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>
46 namespace csi
48 namespace uidl
52 PE_Singleton::PE_Singleton()
53 : eState(e_none),
54 sData_Name(),
55 bIsPreDeclaration(false),
56 pCurSingleton(0),
57 pCurSiSingleton(0),
58 pPE_Type(0),
59 nCurParsed_Type(0)
61 pPE_Type = new PE_Type(nCurParsed_Type);
64 void
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()
77 void
78 PE_Singleton::ProcessToken( const Token & i_rToken )
80 i_rToken.Trigger(*this);
84 void
85 PE_Singleton::Process_MetaType( const TokMetaType & i_rToken )
87 switch ( i_rToken.Id() )
89 case TokMetaType::mt_service:
90 if (eState == e_std)
92 SetResult(done, push_sure, pPE_Type.Ptr());
93 eState = in_service;
95 else
96 On_Default();
97 break;
98 case TokMetaType::mt_singleton:
99 if (eState == need_name)
100 SetResult(done, stay);
101 else
102 On_Default();
103 break;
104 default:
105 // KORR_FUTURE
106 // Should throw syntax error warning
109 } // end switch
112 void
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;
121 else
122 On_Default();
125 void
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(),
135 sData_Name );
136 PassDocuAt(*pCurSingleton);
137 SetResult(done, stay);
138 eState = e_std;
140 else
141 On_Default();
142 break;
143 case TokPunctuation::CurledBracketClose:
144 if (eState == e_std)
146 SetResult(done, stay);
147 eState = need_finish;
149 else
150 On_Default();
151 break;
152 case TokPunctuation::Semicolon:
153 switch (eState)
155 case e_std: SetResult(done, stay);
156 break;
157 case need_finish:
158 SetResult(done, pop_success);
159 eState = e_none;
160 break;
161 default:
162 On_Default();
163 } // end switch
164 break;
165 case TokPunctuation::Colon:
166 switch (eState)
168 case need_curlbr_open:
169 SetResult(done, push_sure, pPE_Type.Ptr());
170 eState = in_base_interface;
171 break;
172 default:
173 On_Default();
174 } // end switch
175 break;
176 default:
177 On_Default();
178 } // end switch
181 void
182 PE_Singleton::Process_Default()
184 On_Default();
188 void
189 PE_Singleton::On_Default()
191 SetResult(not_done, pop_failure);
194 void
195 PE_Singleton::InitData()
197 eState = need_name;
198 sData_Name.clear();
199 bIsPreDeclaration = false;
200 pCurSingleton = 0;
201 pCurSiSingleton = 0;
202 nCurParsed_Type = 0;
205 void
206 PE_Singleton::TransferData()
208 if (NOT bIsPreDeclaration)
210 csv_assert(sData_Name.size() > 0);
211 csv_assert( (pCurSingleton != 0) != (pCurSiSingleton != 0) );
214 eState = e_none;
217 void
218 PE_Singleton::ReceiveData()
220 switch (eState)
222 case in_service:
223 pCurSingleton->Set_Service(nCurParsed_Type);
224 nCurParsed_Type = 0;
225 eState = e_std;
226 break;
227 case in_base_interface:
228 pCurSiSingleton = &Gate().Ces().Store_SglIfcSingleton(
229 CurNamespace().CeId(),
230 sData_Name,
231 nCurParsed_Type );
232 PassDocuAt(*pCurSiSingleton);
233 nCurParsed_Type = 0;
234 eState = need_finish;
235 break;
236 default:
237 csv_assert(false);
238 } // end switch
241 UnoIDL_PE &
242 PE_Singleton::MyPE()
244 return *this;
247 } // namespace uidl
248 } // namespace csi
250 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */