1*1c78a5d6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1c78a5d6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1c78a5d6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1c78a5d6SAndrew Rist  * distributed with this work for additional information
6*1c78a5d6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1c78a5d6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1c78a5d6SAndrew Rist  * "License"); you may not use this file except in compliance
9*1c78a5d6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*1c78a5d6SAndrew Rist  *
11*1c78a5d6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*1c78a5d6SAndrew Rist  *
13*1c78a5d6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1c78a5d6SAndrew Rist  * software distributed under the License is distributed on an
15*1c78a5d6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1c78a5d6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1c78a5d6SAndrew Rist  * specific language governing permissions and limitations
18*1c78a5d6SAndrew Rist  * under the License.
19*1c78a5d6SAndrew Rist  *
20*1c78a5d6SAndrew Rist  *************************************************************/
21*1c78a5d6SAndrew Rist 
22*1c78a5d6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef ADC_CPP_CTX2ARY_HXX
25cdf0e10cSrcweir #define ADC_CPP_CTX2ARY_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir 
29cdf0e10cSrcweir // USED SERVICES
30cdf0e10cSrcweir 	// BASE CLASSES
31cdf0e10cSrcweir #include <ary/cpp/inpcontx.hxx>
32cdf0e10cSrcweir #include <doc_deal.hxx>
33cdf0e10cSrcweir #include "pev.hxx"
34cdf0e10cSrcweir #include "fevnthdl.hxx"
35cdf0e10cSrcweir 	// COMPONENTS
36cdf0e10cSrcweir 	// PARAMETERS
37cdf0e10cSrcweir 
38cdf0e10cSrcweir namespace ary
39cdf0e10cSrcweir {
40cdf0e10cSrcweir namespace loc
41cdf0e10cSrcweir {
42cdf0e10cSrcweir     class File;
43cdf0e10cSrcweir }
44cdf0e10cSrcweir }
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 
48cdf0e10cSrcweir namespace cpp
49cdf0e10cSrcweir {
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 
52cdf0e10cSrcweir /** @descr
53cdf0e10cSrcweir     This class provides information about the context of an
54cdf0e10cSrcweir     CodeEntity, which is going to be stored in the repository.
55cdf0e10cSrcweir     The information is used mainly by class ary::cpp::Gate.
56cdf0e10cSrcweir 
57cdf0e10cSrcweir     Also it provides information for the parser about actual
58cdf0e10cSrcweir     state of several public variables.
59cdf0e10cSrcweir 
60cdf0e10cSrcweir     @todo
61cdf0e10cSrcweir     Include events, which allow correct storing of inline
62cdf0e10cSrcweir     documentation after enum values, parameters,
63cdf0e10cSrcweir     base classes.
64cdf0e10cSrcweir */
65cdf0e10cSrcweir class ContextForAry : public ary::cpp::InputContext,
66cdf0e10cSrcweir                       public cpp::PeEnvironment,
67cdf0e10cSrcweir                       public cpp::FileScope_EventHandler,
68cdf0e10cSrcweir                       public DocuDealer
69cdf0e10cSrcweir {
70cdf0e10cSrcweir   public:
71cdf0e10cSrcweir     // LIFECYCLE
72cdf0e10cSrcweir                         ContextForAry(
73cdf0e10cSrcweir                             ary::cpp::Gate &  io_rAryGate );
74cdf0e10cSrcweir 	virtual				~ContextForAry();
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     // OPERATIONS
ResetResult()77cdf0e10cSrcweir     void                ResetResult()           { aTokenResult.Reset(); }
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     // INQUIRY
80cdf0e10cSrcweir     const TokenProcessing_Result &
CurResult() const81cdf0e10cSrcweir                         CurResult() const       { return aTokenResult; }
82cdf0e10cSrcweir     // ACCESS
83cdf0e10cSrcweir     TokenProcessing_Result &
CurResult()84cdf0e10cSrcweir                         CurResult()             { return aTokenResult; }
85cdf0e10cSrcweir 
86cdf0e10cSrcweir   private:
87cdf0e10cSrcweir     // Interface ary::cpp::InputContext:
88cdf0e10cSrcweir     virtual ary::loc::File &
89cdf0e10cSrcweir                         inq_CurFile() const;
90cdf0e10cSrcweir     virtual ary::cpp::Namespace &
91cdf0e10cSrcweir                         inq_CurNamespace() const;
92cdf0e10cSrcweir     virtual ary::cpp::Class *
93cdf0e10cSrcweir                         inq_CurClass() const;
94cdf0e10cSrcweir     virtual ary::cpp::Enum *
95cdf0e10cSrcweir                         inq_CurEnum() const;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     virtual Owner &     inq_CurOwner() const;
98cdf0e10cSrcweir     virtual ary::cpp::E_Protection
99cdf0e10cSrcweir                         inq_CurProtection() const;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     // Interface PeEnvironment
102cdf0e10cSrcweir 	virtual void        do_SetTokenResult(
103cdf0e10cSrcweir 							E_TokenDone			i_eDone,
104cdf0e10cSrcweir 							E_EnvStackAction	i_eWhat2DoWithEnvStack,
105cdf0e10cSrcweir 							ParseEnvironment *	i_pParseEnv2Push );
106cdf0e10cSrcweir 	virtual void        do_OpenNamespace(
107cdf0e10cSrcweir 							ary::cpp::Namespace &
108cdf0e10cSrcweir                                                 io_rOpenedNamespace );
109cdf0e10cSrcweir 	virtual void        do_OpenExternC(
110cdf0e10cSrcweir 		                	bool				i_bOnlyForOneDeclaration );
111cdf0e10cSrcweir 	virtual void        do_OpenClass(
112cdf0e10cSrcweir 							ary::cpp::Class &	io_rOpenedClass );
113cdf0e10cSrcweir 	virtual void        do_OpenEnum(
114cdf0e10cSrcweir 							ary::cpp::Enum &	io_rOpenedEnum );
115cdf0e10cSrcweir 	virtual void        do_CloseBlock();
116cdf0e10cSrcweir 	virtual void        do_CloseClass();
117cdf0e10cSrcweir 	virtual void        do_CloseEnum();
118cdf0e10cSrcweir     virtual void        do_SetCurProtection(
119cdf0e10cSrcweir                             ary::cpp::E_Protection
120cdf0e10cSrcweir                                                 i_eProtection );
121cdf0e10cSrcweir     virtual void        do_OpenTemplate(
122cdf0e10cSrcweir                             const StringVector &
123cdf0e10cSrcweir                                                 i_rParameters );
124cdf0e10cSrcweir     virtual DYN StringVector *
125cdf0e10cSrcweir                         do_Get_CurTemplateParameters();
126cdf0e10cSrcweir     virtual void        do_Close_OpenTemplate();
127cdf0e10cSrcweir     virtual void        do_Event_Class_FinishedBase(
128cdf0e10cSrcweir                             const String  &     i_sBaseName );
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     virtual void        do_Event_Store_Typedef(
131cdf0e10cSrcweir                             ary::cpp::Typedef & io_rTypedef );
132cdf0e10cSrcweir     virtual void        do_Event_Store_EnumValue(
133cdf0e10cSrcweir                             ary::cpp::EnumValue &
134cdf0e10cSrcweir                                                 io_rEnumValue );
135cdf0e10cSrcweir     virtual void        do_Event_Store_CppDefinition(
136cdf0e10cSrcweir                             ary::cpp::DefineEntity &
137cdf0e10cSrcweir                                                 io_rDefinition );
138cdf0e10cSrcweir     virtual void        do_Event_EnterFunction_ParameterList();
139cdf0e10cSrcweir     virtual void        do_Event_Function_FinishedParameter(
140cdf0e10cSrcweir                             const String  &     i_sParameterName );
141cdf0e10cSrcweir     virtual void        do_Event_LeaveFunction_ParameterList();
142cdf0e10cSrcweir     virtual void        do_Event_EnterFunction_Implementation();
143cdf0e10cSrcweir     virtual void        do_Event_LeaveFunction_Implementation();
144cdf0e10cSrcweir     virtual void        do_Event_Store_Function(
145cdf0e10cSrcweir                             ary::cpp::Function &
146cdf0e10cSrcweir                                                 io_rFunction );
147cdf0e10cSrcweir     virtual void        do_Event_Store_Variable(
148cdf0e10cSrcweir                             ary::cpp::Variable &
149cdf0e10cSrcweir                                                 io_rVariable );
150cdf0e10cSrcweir     virtual void        do_TakeDocu(
151cdf0e10cSrcweir 							DYN ary::doc::OldCppDocu &
152cdf0e10cSrcweir                                                 let_drInfo );
153cdf0e10cSrcweir     virtual void        do_StartWaitingFor_Recovery();
154cdf0e10cSrcweir     virtual ary::cpp::Gate &
155cdf0e10cSrcweir                         inq_AryGate() const;
156cdf0e10cSrcweir 	virtual const ary::cpp::InputContext &
157cdf0e10cSrcweir 						inq_Context() const;
158cdf0e10cSrcweir 	virtual String		inq_CurFileName() const;
159cdf0e10cSrcweir     virtual uintt       inq_LineCount() const;
160cdf0e10cSrcweir     virtual bool        inq_IsWaitingFor_Recovery() const;
161cdf0e10cSrcweir 	virtual bool        inq_IsExternC() const;
162cdf0e10cSrcweir 
163cdf0e10cSrcweir     // Interface FileScope_EventHandler
164cdf0e10cSrcweir     virtual void        do_SetCurFile(
165cdf0e10cSrcweir                             ary::loc::File &    io_rCurFile );
166cdf0e10cSrcweir     virtual void        do_Event_IncrLineCount();
167cdf0e10cSrcweir 	virtual void        do_Event_SwBracketOpen();
168cdf0e10cSrcweir 	virtual void        do_Event_SwBracketClose();
169cdf0e10cSrcweir 	virtual void        do_Event_Semicolon();
170cdf0e10cSrcweir 
171cdf0e10cSrcweir 	// Local types
172cdf0e10cSrcweir     struct S_FileScopeInfo;
173cdf0e10cSrcweir     struct S_OwnerStack;
174cdf0e10cSrcweir     struct S_DocuDistributor;
175cdf0e10cSrcweir 	struct S_RecoveryGuard;
176cdf0e10cSrcweir 
177cdf0e10cSrcweir     // DATA
178cdf0e10cSrcweir     ary::cpp::Gate *    pGate;
179cdf0e10cSrcweir 	TokenProcessing_Result
180cdf0e10cSrcweir 						aTokenResult;
181cdf0e10cSrcweir     Dyn<S_FileScopeInfo>
182cdf0e10cSrcweir 						pFileScopeInfo;
183cdf0e10cSrcweir     Dyn<S_OwnerStack>   pOwnerStack;
184cdf0e10cSrcweir     Dyn<S_DocuDistributor>
185cdf0e10cSrcweir                         pDocuDistributor;
186cdf0e10cSrcweir     Dyn<S_RecoveryGuard>
187cdf0e10cSrcweir                         pRecoveryGuard;
188cdf0e10cSrcweir };
189cdf0e10cSrcweir 
190cdf0e10cSrcweir 
191cdf0e10cSrcweir 
192cdf0e10cSrcweir 
193cdf0e10cSrcweir }   // namespace cpp
194cdf0e10cSrcweir #endif
195