Update ooo320-m1
[ooovba.git] / autodoc / source / parser / cpp / cxt2ary.cxx
blob23df3e799c5bab5f9126cb0f6fbbda9d279f2ec8
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cxt2ary.cxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <precomp.h>
32 #include "cxt2ary.hxx"
35 // NOT FULLY DEFINED SERVICES
36 #include <ary/entity.hxx>
37 #include <ary/cpp/c_class.hxx>
38 #include <ary/cpp/c_define.hxx>
39 #include <ary/cpp/c_enum.hxx>
40 #include <ary/cpp/c_enuval.hxx>
41 #include <ary/cpp/c_funct.hxx>
42 #include <ary/cpp/c_macro.hxx>
43 #include <ary/cpp/c_tydef.hxx>
44 #include <ary/cpp/c_vari.hxx>
45 #include <ary/cpp/c_gate.hxx>
46 #include <ary/cpp/cp_ce.hxx>
47 #include <ary/loc/loc_file.hxx>
48 #include <ary/doc/d_oldcppdocu.hxx>
49 #include <ary/info/docstore.hxx>
50 #include "icprivow.hxx"
52 // Implementationheaders, only to be used in this file!
53 #include "sfscope.hxx"
54 #include "sownstck.hxx"
55 #include "sdocdist.hxx"
56 #include "srecover.hxx"
62 namespace cpp
65 using ary::cpp::E_Protection;
67 ContextForAry::ContextForAry( ary::cpp::Gate & io_rAryGate )
68 : pGate(&io_rAryGate),
69 aTokenResult(),
70 pFileScopeInfo( new S_FileScopeInfo ),
71 pOwnerStack( new S_OwnerStack ),
72 pDocuDistributor( new S_DocuDistributor ),
73 pRecoveryGuard( new S_RecoveryGuard )
75 OpenNamespace( pGate->Ces().GlobalNamespace() );
78 ContextForAry::~ContextForAry()
82 ary::loc::File &
83 ContextForAry::inq_CurFile() const
85 csv_assert(pFileScopeInfo->pCurFile != 0);
87 return *pFileScopeInfo->pCurFile;
90 ary::cpp::Namespace &
91 ContextForAry::inq_CurNamespace() const
93 return pOwnerStack->CurNamespace();
96 ary::cpp::Class *
97 ContextForAry::inq_CurClass() const
99 return pOwnerStack->CurClass();
102 ary::cpp::Enum *
103 ContextForAry::inq_CurEnum() const
105 return pOwnerStack->CurEnum();
109 ary::cpp::InputContext::Owner &
110 ContextForAry::inq_CurOwner() const
112 return pOwnerStack->CurOwner();
115 E_Protection
116 ContextForAry::inq_CurProtection() const
118 return pOwnerStack->CurProtection();
121 void
122 ContextForAry::do_SetTokenResult( E_TokenDone i_eDone,
123 E_EnvStackAction i_eWhat2DoWithEnvStack,
124 ParseEnvironment * i_pParseEnv2Push )
126 aTokenResult.eDone = i_eDone;
127 aTokenResult.eStackAction = i_eWhat2DoWithEnvStack;
128 aTokenResult.pEnv2Push = i_pParseEnv2Push;
131 void
132 ContextForAry::do_OpenNamespace( ary::cpp::Namespace & io_rOpenedNamespace )
134 pOwnerStack->OpenNamespace( io_rOpenedNamespace );
137 void
138 ContextForAry::do_OpenExternC( bool )
140 pOwnerStack->OpenExternC();
141 // KORR_FUTURE
142 // use i_bOnlyForOneDeclaration
145 void
146 ContextForAry::do_OpenClass( ary::cpp::Class & io_rOpenedClass )
148 pOwnerStack->OpenClass(io_rOpenedClass);
149 pDocuDistributor->SetCurrentlyStoredRe(io_rOpenedClass);
152 void
153 ContextForAry::do_OpenEnum( ary::cpp::Enum & io_rOpenedEnum )
155 pOwnerStack->OpenEnum(io_rOpenedEnum);
156 pDocuDistributor->SetCurrentlyStoredRe(io_rOpenedEnum);
159 void
160 ContextForAry::do_CloseBlock()
162 pOwnerStack->CloseBlock();
165 void
166 ContextForAry::do_CloseClass()
168 pOwnerStack->CloseClass();
171 void
172 ContextForAry::do_CloseEnum()
174 pOwnerStack->CloseEnum();
177 void
178 ContextForAry::do_SetCurProtection( ary::cpp::E_Protection i_eProtection )
180 pOwnerStack->SetCurProtection(i_eProtection);
183 void
184 ContextForAry::do_OpenTemplate( const StringVector & i_rParameters )
186 pFileScopeInfo->pCurTemplateParameters = new StringVector(i_rParameters);
189 DYN StringVector *
190 ContextForAry::do_Get_CurTemplateParameters()
192 return pFileScopeInfo->pCurTemplateParameters.Release();
195 void
196 ContextForAry::do_Close_OpenTemplate()
198 if (pFileScopeInfo->pCurTemplateParameters)
199 delete pFileScopeInfo->pCurTemplateParameters.Release();
202 void
203 ContextForAry::do_Event_Class_FinishedBase( const String & )
205 // KORR_FUTURE
208 void
209 ContextForAry::do_Event_Store_Typedef( ary::cpp::Typedef & io_rTypedef )
211 pDocuDistributor->SetCurrentlyStoredRe(io_rTypedef);
214 void
215 ContextForAry::do_Event_Store_EnumValue( ary::cpp::EnumValue & io_rEnumValue )
217 pDocuDistributor->SetCurrentlyStoredRe(io_rEnumValue);
220 void
221 ContextForAry::do_Event_Store_CppDefinition( ary::cpp::DefineEntity & io_rDefinition )
223 pDocuDistributor->SetCurrentlyStoredRe(io_rDefinition);
226 void
227 ContextForAry::do_Event_EnterFunction_ParameterList()
229 // KORR_FUTURE
230 // Inform pDocuDistributor about possibility of parameters' inline documentation.
233 void
234 ContextForAry::do_Event_Function_FinishedParameter( const String & )
236 // KORR_FUTURE
239 void
240 ContextForAry::do_Event_LeaveFunction_ParameterList()
242 // KORR_FUTURE
245 void
246 ContextForAry::do_Event_EnterFunction_Implementation()
248 // KORR_FUTURE
251 void
252 ContextForAry::do_Event_LeaveFunction_Implementation()
254 // KORR_FUTURE
257 void
258 ContextForAry::do_Event_Store_Function( ary::cpp::Function & io_rFunction )
260 pDocuDistributor->SetCurrentlyStoredRe(io_rFunction);
264 void
265 ContextForAry::do_Event_Store_Variable( ary::cpp::Variable & io_rVariable )
267 pDocuDistributor->SetCurrentlyStoredRe(io_rVariable);
270 void
271 ContextForAry::do_TakeDocu( DYN ary::doc::OldCppDocu & let_drInfo )
273 let_drInfo.Store2(*pDocuDistributor);
276 void
277 ContextForAry::do_StartWaitingFor_Recovery()
279 pRecoveryGuard->StartWaitingFor_Recovery();
282 ary::cpp::Gate &
283 ContextForAry::inq_AryGate() const
285 return * const_cast< ary::cpp::Gate* >(pGate);
288 const ary::cpp::InputContext &
289 ContextForAry::inq_Context() const
291 return *this;
294 String
295 ContextForAry::inq_CurFileName() const
297 return pFileScopeInfo->pCurFile != 0
298 ? pFileScopeInfo->pCurFile->LocalName()
299 : String::Null_();
302 uintt
303 ContextForAry::inq_LineCount() const
305 return pFileScopeInfo->nLineCount;
308 bool
309 ContextForAry::inq_IsWaitingFor_Recovery() const
311 return pRecoveryGuard->IsWithinRecovery();
314 bool
315 ContextForAry::inq_IsExternC() const
317 return pOwnerStack->IsExternC();
320 void
321 ContextForAry::do_SetCurFile( ary::loc::File & io_rCurFile )
323 pFileScopeInfo->pCurFile = &io_rCurFile;
324 pFileScopeInfo->nLineCount = 0;
325 pFileScopeInfo->pCurTemplateParameters = 0;
327 pOwnerStack->Reset();
328 pDocuDistributor->Reset();
329 pRecoveryGuard->Reset();
332 void
333 ContextForAry::do_Event_IncrLineCount()
335 ++pFileScopeInfo->nLineCount;
336 pDocuDistributor->Event_LineBreak();
339 void
340 ContextForAry::do_Event_SwBracketOpen()
342 pRecoveryGuard->Hdl_SwBracketOpen();
345 void
346 ContextForAry::do_Event_SwBracketClose()
348 pRecoveryGuard->Hdl_SwBracketClose();
351 void
352 ContextForAry::do_Event_Semicolon()
354 pRecoveryGuard->Hdl_Semicolon();
360 } // namespace cpp