1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef ADC_CPP_CTX2ARY_HXX 29*cdf0e10cSrcweir #define ADC_CPP_CTX2ARY_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir // USED SERVICES 34*cdf0e10cSrcweir // BASE CLASSES 35*cdf0e10cSrcweir #include <ary/cpp/inpcontx.hxx> 36*cdf0e10cSrcweir #include <doc_deal.hxx> 37*cdf0e10cSrcweir #include "pev.hxx" 38*cdf0e10cSrcweir #include "fevnthdl.hxx" 39*cdf0e10cSrcweir // COMPONENTS 40*cdf0e10cSrcweir // PARAMETERS 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir namespace ary 43*cdf0e10cSrcweir { 44*cdf0e10cSrcweir namespace loc 45*cdf0e10cSrcweir { 46*cdf0e10cSrcweir class File; 47*cdf0e10cSrcweir } 48*cdf0e10cSrcweir } 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir namespace cpp 53*cdf0e10cSrcweir { 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir /** @descr 57*cdf0e10cSrcweir This class provides information about the context of an 58*cdf0e10cSrcweir CodeEntity, which is going to be stored in the repository. 59*cdf0e10cSrcweir The information is used mainly by class ary::cpp::Gate. 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir Also it provides information for the parser about actual 62*cdf0e10cSrcweir state of several public variables. 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir @todo 65*cdf0e10cSrcweir Include events, which allow correct storing of inline 66*cdf0e10cSrcweir documentation after enum values, parameters, 67*cdf0e10cSrcweir base classes. 68*cdf0e10cSrcweir */ 69*cdf0e10cSrcweir class ContextForAry : public ary::cpp::InputContext, 70*cdf0e10cSrcweir public cpp::PeEnvironment, 71*cdf0e10cSrcweir public cpp::FileScope_EventHandler, 72*cdf0e10cSrcweir public DocuDealer 73*cdf0e10cSrcweir { 74*cdf0e10cSrcweir public: 75*cdf0e10cSrcweir // LIFECYCLE 76*cdf0e10cSrcweir ContextForAry( 77*cdf0e10cSrcweir ary::cpp::Gate & io_rAryGate ); 78*cdf0e10cSrcweir virtual ~ContextForAry(); 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir // OPERATIONS 81*cdf0e10cSrcweir void ResetResult() { aTokenResult.Reset(); } 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir // INQUIRY 84*cdf0e10cSrcweir const TokenProcessing_Result & 85*cdf0e10cSrcweir CurResult() const { return aTokenResult; } 86*cdf0e10cSrcweir // ACCESS 87*cdf0e10cSrcweir TokenProcessing_Result & 88*cdf0e10cSrcweir CurResult() { return aTokenResult; } 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir private: 91*cdf0e10cSrcweir // Interface ary::cpp::InputContext: 92*cdf0e10cSrcweir virtual ary::loc::File & 93*cdf0e10cSrcweir inq_CurFile() const; 94*cdf0e10cSrcweir virtual ary::cpp::Namespace & 95*cdf0e10cSrcweir inq_CurNamespace() const; 96*cdf0e10cSrcweir virtual ary::cpp::Class * 97*cdf0e10cSrcweir inq_CurClass() const; 98*cdf0e10cSrcweir virtual ary::cpp::Enum * 99*cdf0e10cSrcweir inq_CurEnum() const; 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir virtual Owner & inq_CurOwner() const; 102*cdf0e10cSrcweir virtual ary::cpp::E_Protection 103*cdf0e10cSrcweir inq_CurProtection() const; 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir // Interface PeEnvironment 106*cdf0e10cSrcweir virtual void do_SetTokenResult( 107*cdf0e10cSrcweir E_TokenDone i_eDone, 108*cdf0e10cSrcweir E_EnvStackAction i_eWhat2DoWithEnvStack, 109*cdf0e10cSrcweir ParseEnvironment * i_pParseEnv2Push ); 110*cdf0e10cSrcweir virtual void do_OpenNamespace( 111*cdf0e10cSrcweir ary::cpp::Namespace & 112*cdf0e10cSrcweir io_rOpenedNamespace ); 113*cdf0e10cSrcweir virtual void do_OpenExternC( 114*cdf0e10cSrcweir bool i_bOnlyForOneDeclaration ); 115*cdf0e10cSrcweir virtual void do_OpenClass( 116*cdf0e10cSrcweir ary::cpp::Class & io_rOpenedClass ); 117*cdf0e10cSrcweir virtual void do_OpenEnum( 118*cdf0e10cSrcweir ary::cpp::Enum & io_rOpenedEnum ); 119*cdf0e10cSrcweir virtual void do_CloseBlock(); 120*cdf0e10cSrcweir virtual void do_CloseClass(); 121*cdf0e10cSrcweir virtual void do_CloseEnum(); 122*cdf0e10cSrcweir virtual void do_SetCurProtection( 123*cdf0e10cSrcweir ary::cpp::E_Protection 124*cdf0e10cSrcweir i_eProtection ); 125*cdf0e10cSrcweir virtual void do_OpenTemplate( 126*cdf0e10cSrcweir const StringVector & 127*cdf0e10cSrcweir i_rParameters ); 128*cdf0e10cSrcweir virtual DYN StringVector * 129*cdf0e10cSrcweir do_Get_CurTemplateParameters(); 130*cdf0e10cSrcweir virtual void do_Close_OpenTemplate(); 131*cdf0e10cSrcweir virtual void do_Event_Class_FinishedBase( 132*cdf0e10cSrcweir const String & i_sBaseName ); 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir virtual void do_Event_Store_Typedef( 135*cdf0e10cSrcweir ary::cpp::Typedef & io_rTypedef ); 136*cdf0e10cSrcweir virtual void do_Event_Store_EnumValue( 137*cdf0e10cSrcweir ary::cpp::EnumValue & 138*cdf0e10cSrcweir io_rEnumValue ); 139*cdf0e10cSrcweir virtual void do_Event_Store_CppDefinition( 140*cdf0e10cSrcweir ary::cpp::DefineEntity & 141*cdf0e10cSrcweir io_rDefinition ); 142*cdf0e10cSrcweir virtual void do_Event_EnterFunction_ParameterList(); 143*cdf0e10cSrcweir virtual void do_Event_Function_FinishedParameter( 144*cdf0e10cSrcweir const String & i_sParameterName ); 145*cdf0e10cSrcweir virtual void do_Event_LeaveFunction_ParameterList(); 146*cdf0e10cSrcweir virtual void do_Event_EnterFunction_Implementation(); 147*cdf0e10cSrcweir virtual void do_Event_LeaveFunction_Implementation(); 148*cdf0e10cSrcweir virtual void do_Event_Store_Function( 149*cdf0e10cSrcweir ary::cpp::Function & 150*cdf0e10cSrcweir io_rFunction ); 151*cdf0e10cSrcweir virtual void do_Event_Store_Variable( 152*cdf0e10cSrcweir ary::cpp::Variable & 153*cdf0e10cSrcweir io_rVariable ); 154*cdf0e10cSrcweir virtual void do_TakeDocu( 155*cdf0e10cSrcweir DYN ary::doc::OldCppDocu & 156*cdf0e10cSrcweir let_drInfo ); 157*cdf0e10cSrcweir virtual void do_StartWaitingFor_Recovery(); 158*cdf0e10cSrcweir virtual ary::cpp::Gate & 159*cdf0e10cSrcweir inq_AryGate() const; 160*cdf0e10cSrcweir virtual const ary::cpp::InputContext & 161*cdf0e10cSrcweir inq_Context() const; 162*cdf0e10cSrcweir virtual String inq_CurFileName() const; 163*cdf0e10cSrcweir virtual uintt inq_LineCount() const; 164*cdf0e10cSrcweir virtual bool inq_IsWaitingFor_Recovery() const; 165*cdf0e10cSrcweir virtual bool inq_IsExternC() const; 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir // Interface FileScope_EventHandler 168*cdf0e10cSrcweir virtual void do_SetCurFile( 169*cdf0e10cSrcweir ary::loc::File & io_rCurFile ); 170*cdf0e10cSrcweir virtual void do_Event_IncrLineCount(); 171*cdf0e10cSrcweir virtual void do_Event_SwBracketOpen(); 172*cdf0e10cSrcweir virtual void do_Event_SwBracketClose(); 173*cdf0e10cSrcweir virtual void do_Event_Semicolon(); 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir // Local types 176*cdf0e10cSrcweir struct S_FileScopeInfo; 177*cdf0e10cSrcweir struct S_OwnerStack; 178*cdf0e10cSrcweir struct S_DocuDistributor; 179*cdf0e10cSrcweir struct S_RecoveryGuard; 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir // DATA 182*cdf0e10cSrcweir ary::cpp::Gate * pGate; 183*cdf0e10cSrcweir TokenProcessing_Result 184*cdf0e10cSrcweir aTokenResult; 185*cdf0e10cSrcweir Dyn<S_FileScopeInfo> 186*cdf0e10cSrcweir pFileScopeInfo; 187*cdf0e10cSrcweir Dyn<S_OwnerStack> pOwnerStack; 188*cdf0e10cSrcweir Dyn<S_DocuDistributor> 189*cdf0e10cSrcweir pDocuDistributor; 190*cdf0e10cSrcweir Dyn<S_RecoveryGuard> 191*cdf0e10cSrcweir pRecoveryGuard; 192*cdf0e10cSrcweir }; 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir } // namespace cpp 198*cdf0e10cSrcweir #endif 199