1*0841af79SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*0841af79SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*0841af79SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*0841af79SAndrew Rist  * distributed with this work for additional information
6*0841af79SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*0841af79SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*0841af79SAndrew Rist  * "License"); you may not use this file except in compliance
9*0841af79SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*0841af79SAndrew Rist  *
11*0841af79SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*0841af79SAndrew Rist  *
13*0841af79SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*0841af79SAndrew Rist  * software distributed under the License is distributed on an
15*0841af79SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*0841af79SAndrew Rist  * KIND, either express or implied.  See the License for the
17*0841af79SAndrew Rist  * specific language governing permissions and limitations
18*0841af79SAndrew Rist  * under the License.
19*0841af79SAndrew Rist  *
20*0841af79SAndrew Rist  *************************************************************/
21cdf0e10cSrcweir 
22cdf0e10cSrcweir #include <precomp.h>
23cdf0e10cSrcweir #include "opageenv.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir 
26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
27cdf0e10cSrcweir #include <cosv/ploc_dir.hxx>
28cdf0e10cSrcweir #include <ary/cpp/c_ce.hxx>
29cdf0e10cSrcweir #include <ary/cpp/c_class.hxx>
30cdf0e10cSrcweir #include <ary/cpp/c_enum.hxx>
31cdf0e10cSrcweir #include <ary/cpp/c_gate.hxx>
32cdf0e10cSrcweir #include <ary/cpp/c_namesp.hxx>
33cdf0e10cSrcweir #include <ary/cpp/c_tydef.hxx>
34cdf0e10cSrcweir #include <ary/cpp/cp_ce.hxx>
35cdf0e10cSrcweir #include <ary/loc/loc_file.hxx>
36cdf0e10cSrcweir #include <udm/html/htmlitem.hxx>
37cdf0e10cSrcweir #include <estack.hxx>
38cdf0e10cSrcweir #include "hdimpl.hxx"
39cdf0e10cSrcweir #include "strconst.hxx"
40cdf0e10cSrcweir 
41cdf0e10cSrcweir 
42cdf0e10cSrcweir const String  C_sCppDir( "names" );
43cdf0e10cSrcweir const String  C_sIndexDir( "ix" );
44cdf0e10cSrcweir 
45cdf0e10cSrcweir 
46cdf0e10cSrcweir //************************         Implementation          ********************//
47cdf0e10cSrcweir 
48cdf0e10cSrcweir namespace
49cdf0e10cSrcweir {
50cdf0e10cSrcweir 
51cdf0e10cSrcweir void    CreateDirectory( const csv::ploc::Path &    i_rPath );
52cdf0e10cSrcweir 
53cdf0e10cSrcweir void
CreateDirectory(const csv::ploc::Path & i_rPath)54cdf0e10cSrcweir CreateDirectory( const csv::ploc::Path & i_rPath )
55cdf0e10cSrcweir {
56cdf0e10cSrcweir     csv::ploc::Directory aDirectory(i_rPath);
57cdf0e10cSrcweir 	if (NOT aDirectory.Exists())
58cdf0e10cSrcweir         aDirectory.PhysicalCreate();
59cdf0e10cSrcweir }
60cdf0e10cSrcweir 
61cdf0e10cSrcweir //************************         CheshireCat          ********************//
62cdf0e10cSrcweir 
63cdf0e10cSrcweir struct InNamespaceTree
64cdf0e10cSrcweir {
65cdf0e10cSrcweir     enum E_Type
66cdf0e10cSrcweir     {
67cdf0e10cSrcweir         t_unknown,
68cdf0e10cSrcweir         t_namespace,
69cdf0e10cSrcweir         t_type,
70cdf0e10cSrcweir         t_operations,
71cdf0e10cSrcweir         t_data
72cdf0e10cSrcweir     };
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     EStack< const ary::cpp::Namespace * >
75cdf0e10cSrcweir                         aNamespaces; /// never empty.
76cdf0e10cSrcweir     EStack< const ary::cpp::Class * >
77cdf0e10cSrcweir                         aClasses;      /// maybe empty.
78cdf0e10cSrcweir     const ary::cpp::CodeEntity *
79cdf0e10cSrcweir                         pCe;        /// CurFileCe, maybe 0
80cdf0e10cSrcweir     E_Type              eType;
81cdf0e10cSrcweir 
82cdf0e10cSrcweir                         InNamespaceTree(
83cdf0e10cSrcweir                             const ary::cpp::Namespace &
84cdf0e10cSrcweir                                                 i_rNsp );
85cdf0e10cSrcweir                         ~InNamespaceTree();
86cdf0e10cSrcweir     void                GoDown(
87cdf0e10cSrcweir                             const ary::cpp::Namespace &
88cdf0e10cSrcweir                                                 i_rNsp );
89cdf0e10cSrcweir     void                GoDown(
90cdf0e10cSrcweir                             const ary::cpp::Class &
91cdf0e10cSrcweir                                                 i_rClass );
92cdf0e10cSrcweir     void                GoUp();
93cdf0e10cSrcweir };
94cdf0e10cSrcweir 
InNamespaceTree(const ary::cpp::Namespace & i_rNsp)95cdf0e10cSrcweir InNamespaceTree::InNamespaceTree( const ary::cpp::Namespace & i_rNsp )
96cdf0e10cSrcweir     :   // aNamespaces,
97cdf0e10cSrcweir         // aClasses,
98cdf0e10cSrcweir         pCe(0),
99cdf0e10cSrcweir         eType(t_unknown)
100cdf0e10cSrcweir {
101cdf0e10cSrcweir     aNamespaces.push( &i_rNsp );
102cdf0e10cSrcweir }
103cdf0e10cSrcweir 
~InNamespaceTree()104cdf0e10cSrcweir InNamespaceTree::~InNamespaceTree()
105cdf0e10cSrcweir {
106cdf0e10cSrcweir }
107cdf0e10cSrcweir 
108cdf0e10cSrcweir void
GoDown(const ary::cpp::Namespace & i_rNsp)109cdf0e10cSrcweir InNamespaceTree::GoDown( const ary::cpp::Namespace & i_rNsp )
110cdf0e10cSrcweir {
111cdf0e10cSrcweir     aNamespaces.push(&i_rNsp);
112cdf0e10cSrcweir     aClasses.erase_all();
113cdf0e10cSrcweir     pCe = 0;
114cdf0e10cSrcweir     eType = t_unknown;
115cdf0e10cSrcweir }
116cdf0e10cSrcweir 
117cdf0e10cSrcweir void
GoDown(const ary::cpp::Class & i_rClass)118cdf0e10cSrcweir InNamespaceTree::GoDown( const ary::cpp::Class & i_rClass )
119cdf0e10cSrcweir {
120cdf0e10cSrcweir     aClasses.push(&i_rClass);
121cdf0e10cSrcweir     pCe = 0;
122cdf0e10cSrcweir     eType = t_unknown;
123cdf0e10cSrcweir }
124cdf0e10cSrcweir 
125cdf0e10cSrcweir void
GoUp()126cdf0e10cSrcweir InNamespaceTree::GoUp()
127cdf0e10cSrcweir {
128cdf0e10cSrcweir     if ( NOT aClasses.empty() )
129cdf0e10cSrcweir         aClasses.pop();
130cdf0e10cSrcweir     else
131cdf0e10cSrcweir         aNamespaces.pop();
132cdf0e10cSrcweir     pCe = 0;
133cdf0e10cSrcweir     eType = t_unknown;
134cdf0e10cSrcweir }
135cdf0e10cSrcweir 
136cdf0e10cSrcweir struct InIndex
137cdf0e10cSrcweir {
138cdf0e10cSrcweir     char                cLetter;
139cdf0e10cSrcweir 
InIndex__anonce403cd40111::InIndex140cdf0e10cSrcweir                         InIndex() : cLetter('A') {}
141cdf0e10cSrcweir };
142cdf0e10cSrcweir 
143cdf0e10cSrcweir 
144cdf0e10cSrcweir }   // anonymous namespace
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 
150cdf0e10cSrcweir struct OuputPage_Environment::CheshireCat
151cdf0e10cSrcweir {
152cdf0e10cSrcweir     csv::ploc::Path     aOutputRoot;
153cdf0e10cSrcweir     csv::ploc::Path     aMyPath;
154cdf0e10cSrcweir     csv::StreamStr      aFileName;
155cdf0e10cSrcweir 
156cdf0e10cSrcweir     const ary::cpp::Gate *
157cdf0e10cSrcweir                         pGate;
158cdf0e10cSrcweir     const display::CorporateFrame *
159cdf0e10cSrcweir                         pLayout;
160cdf0e10cSrcweir     intt                nDepth;
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     Dyn<InNamespaceTree>
163cdf0e10cSrcweir                         pInNamespace;
164cdf0e10cSrcweir     Dyn<InIndex>        pInIndex;
165cdf0e10cSrcweir 
166cdf0e10cSrcweir                         CheshireCat(
167cdf0e10cSrcweir                             const csv::ploc::Path &
168cdf0e10cSrcweir                                                 io_rOutputDir,
169cdf0e10cSrcweir                             const ary::cpp::Gate &
170cdf0e10cSrcweir                                                 i_rGate,
171cdf0e10cSrcweir                             const display::CorporateFrame &
172cdf0e10cSrcweir                                                 i_rLayout );
173cdf0e10cSrcweir                         ~CheshireCat();
174cdf0e10cSrcweir     void                AddQualifiedName2Path(
175cdf0e10cSrcweir                             const ary::cpp::CodeEntity &
176cdf0e10cSrcweir                                                 i_rCe,
177cdf0e10cSrcweir                             bool                i_bIncludeLocalName );
178cdf0e10cSrcweir 
179cdf0e10cSrcweir     const Dyn<InNamespaceTree> &
NspEnvOuputPage_Environment::CheshireCat180cdf0e10cSrcweir                         NspEnv() const          { return pInNamespace; }
181cdf0e10cSrcweir     Dyn<InNamespaceTree> &
NspEnvOuputPage_Environment::CheshireCat182cdf0e10cSrcweir                         NspEnv()                { return pInNamespace; }
183cdf0e10cSrcweir     const ary::cpp::Namespace *
NamespaceOuputPage_Environment::CheshireCat184cdf0e10cSrcweir                         Namespace() const       { return pInNamespace ? pInNamespace->aNamespaces.top() : 0; }
185cdf0e10cSrcweir     const ary::cpp::Class *
ClassOuputPage_Environment::CheshireCat186cdf0e10cSrcweir                         Class() const           { return pInNamespace ? (pInNamespace->aClasses.empty() ? 0 : pInNamespace->aClasses.top()) : 0; }
187cdf0e10cSrcweir };
188cdf0e10cSrcweir 
189cdf0e10cSrcweir OuputPage_Environment::
CheshireCat(const csv::ploc::Path & io_rOutputDir,const ary::cpp::Gate & i_rGate,const display::CorporateFrame & i_rLayout)190cdf0e10cSrcweir CheshireCat::CheshireCat( const csv::ploc::Path &         io_rOutputDir,
191cdf0e10cSrcweir                           const ary::cpp::Gate &   i_rGate,
192cdf0e10cSrcweir                           const display::CorporateFrame & i_rLayout )
193cdf0e10cSrcweir     :   aOutputRoot(io_rOutputDir),
194cdf0e10cSrcweir         aMyPath(io_rOutputDir),
195cdf0e10cSrcweir         aFileName(500),
196cdf0e10cSrcweir         pGate(&i_rGate),
197cdf0e10cSrcweir         pLayout(&i_rLayout),
198cdf0e10cSrcweir         nDepth(0),
199cdf0e10cSrcweir         pInNamespace(),
200cdf0e10cSrcweir         pInIndex()
201cdf0e10cSrcweir {
202cdf0e10cSrcweir }
203cdf0e10cSrcweir 
204cdf0e10cSrcweir OuputPage_Environment::
~CheshireCat()205cdf0e10cSrcweir CheshireCat::~CheshireCat()
206cdf0e10cSrcweir {
207cdf0e10cSrcweir }
208cdf0e10cSrcweir 
209cdf0e10cSrcweir void
210cdf0e10cSrcweir OuputPage_Environment::
AddQualifiedName2Path(const ary::cpp::CodeEntity & i_rCe,bool i_bIncludeLocalName)211cdf0e10cSrcweir CheshireCat::AddQualifiedName2Path( const ary::cpp::CodeEntity & i_rCe,
212cdf0e10cSrcweir                                     bool                    i_bIncludeLocalName )
213cdf0e10cSrcweir {
214cdf0e10cSrcweir     if (NOT i_rCe.Owner().IsValid())
215cdf0e10cSrcweir     {
216cdf0e10cSrcweir         aMyPath.DirChain().PushBack( C_sCppDir );
217cdf0e10cSrcweir         return;
218cdf0e10cSrcweir     }
219cdf0e10cSrcweir 
220cdf0e10cSrcweir     const ary::cpp::CodeEntity &
221cdf0e10cSrcweir         rParent = pGate->Ces().Find_Ce( i_rCe.Owner() );
222cdf0e10cSrcweir     AddQualifiedName2Path( rParent, true );
223cdf0e10cSrcweir 
224cdf0e10cSrcweir     if ( i_bIncludeLocalName )
225cdf0e10cSrcweir         aMyPath.DirChain().PushBack( i_rCe.LocalName() );
226cdf0e10cSrcweir }
227cdf0e10cSrcweir 
228cdf0e10cSrcweir 
229cdf0e10cSrcweir 
230cdf0e10cSrcweir //************************         OuputPage_Environment          ********************//
231cdf0e10cSrcweir 
OuputPage_Environment(const csv::ploc::Path & io_rOutputDir,const ary::cpp::Gate & i_rGate,const display::CorporateFrame & i_rLayout)232cdf0e10cSrcweir OuputPage_Environment::OuputPage_Environment( const csv::ploc::Path &           io_rOutputDir,
233cdf0e10cSrcweir                                               const ary::cpp::Gate &            i_rGate,
234cdf0e10cSrcweir                                               const display::CorporateFrame &   i_rLayout )
235cdf0e10cSrcweir     :   pi( new CheshireCat(io_rOutputDir, i_rGate, i_rLayout) )
236cdf0e10cSrcweir {
237cdf0e10cSrcweir }
238cdf0e10cSrcweir 
~OuputPage_Environment()239cdf0e10cSrcweir OuputPage_Environment::~OuputPage_Environment()
240cdf0e10cSrcweir {
241cdf0e10cSrcweir }
242cdf0e10cSrcweir 
243cdf0e10cSrcweir void
MoveDir_2Root()244cdf0e10cSrcweir OuputPage_Environment::MoveDir_2Root()
245cdf0e10cSrcweir {
246cdf0e10cSrcweir     pi->NspEnv() = 0;
247cdf0e10cSrcweir     pi->pInIndex = 0;
248cdf0e10cSrcweir     pi->nDepth = 0;
249cdf0e10cSrcweir     while ( pi->aMyPath.DirChain().Size() > pi->aOutputRoot.DirChain().Size() )
250cdf0e10cSrcweir         pi->aMyPath.DirChain().PopBack();
251cdf0e10cSrcweir     pi->aMyPath.SetFile(String ::Null_());
252cdf0e10cSrcweir }
253cdf0e10cSrcweir 
254cdf0e10cSrcweir void
MoveDir_2Names()255cdf0e10cSrcweir OuputPage_Environment::MoveDir_2Names()
256cdf0e10cSrcweir {
257cdf0e10cSrcweir     pi->NspEnv() = new InNamespaceTree( Gate().Ces().GlobalNamespace() );
258cdf0e10cSrcweir     pi->aMyPath.DirChain().PushBack( C_sCppDir );
259cdf0e10cSrcweir     pi->aMyPath.SetFile(String ::Null_());
260cdf0e10cSrcweir     ++pi->nDepth;
261cdf0e10cSrcweir 
262cdf0e10cSrcweir    	CreateDirectory( pi->aMyPath );
263cdf0e10cSrcweir }
264cdf0e10cSrcweir 
265cdf0e10cSrcweir void
MoveDir_Down2(const ary::cpp::Namespace & i_rNsp)266cdf0e10cSrcweir OuputPage_Environment::MoveDir_Down2( const ary::cpp::Namespace & i_rNsp )
267cdf0e10cSrcweir {
268cdf0e10cSrcweir     csv_assert(i_rNsp.Depth() > 0);
269cdf0e10cSrcweir     csv_assert( pi->NspEnv() );
270cdf0e10cSrcweir     csv_assert( pi->Namespace()->CeId() == i_rNsp.Owner() );
271cdf0e10cSrcweir 
272cdf0e10cSrcweir     pi->NspEnv()->GoDown( i_rNsp );
273cdf0e10cSrcweir     pi->aMyPath.DirChain().PushBack(i_rNsp.LocalName());
274cdf0e10cSrcweir     ++pi->nDepth;
275cdf0e10cSrcweir     pi->aMyPath.SetFile(String ::Null_());
276cdf0e10cSrcweir 
277cdf0e10cSrcweir    	CreateDirectory( pi->aMyPath );
278cdf0e10cSrcweir }
279cdf0e10cSrcweir 
280cdf0e10cSrcweir void
MoveDir_Down2(const ary::cpp::Class & i_rClass)281cdf0e10cSrcweir OuputPage_Environment::MoveDir_Down2( const ary::cpp::Class & i_rClass )
282cdf0e10cSrcweir {
283cdf0e10cSrcweir     csv_assert( pi->NspEnv() );
284cdf0e10cSrcweir     if ( i_rClass.Protection() == ary::cpp::PROTECT_global )
285cdf0e10cSrcweir     {
286cdf0e10cSrcweir         csv_assert( pi->Namespace()->CeId() == i_rClass.Owner() );
287cdf0e10cSrcweir     }
288cdf0e10cSrcweir     else
289cdf0e10cSrcweir     {
290cdf0e10cSrcweir         csv_assert( pi->Class() != 0 );
291cdf0e10cSrcweir         csv_assert( pi->Class()->CeId() == i_rClass.Owner() );
292cdf0e10cSrcweir     }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir     pi->NspEnv()->GoDown(i_rClass);
295cdf0e10cSrcweir     pi->aMyPath.DirChain().PushBack(i_rClass.LocalName());
296cdf0e10cSrcweir     pi->aMyPath.SetFile(String ::Null_());
297cdf0e10cSrcweir     ++pi->nDepth;
298cdf0e10cSrcweir 
299cdf0e10cSrcweir    	CreateDirectory( pi->aMyPath );
300cdf0e10cSrcweir }
301cdf0e10cSrcweir 
302cdf0e10cSrcweir void
MoveDir_2Index()303cdf0e10cSrcweir OuputPage_Environment::MoveDir_2Index()
304cdf0e10cSrcweir {
305cdf0e10cSrcweir     MoveDir_2Root();
306cdf0e10cSrcweir     pi->pInIndex = new InIndex;
307cdf0e10cSrcweir     pi->aMyPath.DirChain().PushBack( String (C_sDIR_Index) );
308cdf0e10cSrcweir     pi->aMyPath.SetFile(String ::Null_());
309cdf0e10cSrcweir     pi->nDepth = 1;
310cdf0e10cSrcweir 
311cdf0e10cSrcweir    	CreateDirectory( pi->aMyPath );
312cdf0e10cSrcweir }
313cdf0e10cSrcweir 
314cdf0e10cSrcweir void
MoveDir_Up()315cdf0e10cSrcweir OuputPage_Environment::MoveDir_Up()
316cdf0e10cSrcweir {
317cdf0e10cSrcweir  	if ( pi->nDepth == 1 )
318cdf0e10cSrcweir     {
319cdf0e10cSrcweir      	MoveDir_2Root();
320cdf0e10cSrcweir         return;
321cdf0e10cSrcweir     }
322cdf0e10cSrcweir     else if ( pi->NspEnv() )
323cdf0e10cSrcweir     {
324cdf0e10cSrcweir         pi->NspEnv()->GoUp();
325cdf0e10cSrcweir         pi->aMyPath.DirChain().PopBack();
326cdf0e10cSrcweir         pi->aMyPath.SetFile(String ::Null_());
327cdf0e10cSrcweir         --pi->nDepth;
328cdf0e10cSrcweir     }
329cdf0e10cSrcweir }
330cdf0e10cSrcweir 
331cdf0e10cSrcweir void
SetFile_Css()332cdf0e10cSrcweir OuputPage_Environment::SetFile_Css()
333cdf0e10cSrcweir {
334cdf0e10cSrcweir     pi->aMyPath.SetFile( C_sHFN_Css );
335cdf0e10cSrcweir }
336cdf0e10cSrcweir 
337cdf0e10cSrcweir void
SetFile_Overview()338cdf0e10cSrcweir OuputPage_Environment::SetFile_Overview()
339cdf0e10cSrcweir {
340cdf0e10cSrcweir     pi->aMyPath.SetFile( C_sHFN_Overview );
341cdf0e10cSrcweir }
342cdf0e10cSrcweir 
343cdf0e10cSrcweir void
SetFile_AllDefs()344cdf0e10cSrcweir OuputPage_Environment::SetFile_AllDefs()
345cdf0e10cSrcweir {
346cdf0e10cSrcweir     // Provisorium
347cdf0e10cSrcweir     pi->aMyPath.SetFile("def-all.html");
348cdf0e10cSrcweir }
349cdf0e10cSrcweir 
350cdf0e10cSrcweir void
SetFile_Index(char i_cLetter)351cdf0e10cSrcweir OuputPage_Environment::SetFile_Index( char i_cLetter )
352cdf0e10cSrcweir {
353cdf0e10cSrcweir     csv_assert( 'A' <= i_cLetter AND i_cLetter <= 'Z' OR i_cLetter == '_' );
354cdf0e10cSrcweir 
355cdf0e10cSrcweir     static StreamStr sIndexFileName(40);
356cdf0e10cSrcweir     sIndexFileName.seekp(0);
357cdf0e10cSrcweir     sIndexFileName << "index-";
358cdf0e10cSrcweir     if ( i_cLetter == '_' )
359cdf0e10cSrcweir     {
360cdf0e10cSrcweir         sIndexFileName << "27";
361cdf0e10cSrcweir     }
362cdf0e10cSrcweir     else
363cdf0e10cSrcweir     {
364cdf0e10cSrcweir         sIndexFileName << int(i_cLetter -'A' + 1);
365cdf0e10cSrcweir     }
366cdf0e10cSrcweir     sIndexFileName << ".html";
367cdf0e10cSrcweir 
368cdf0e10cSrcweir     pi->aMyPath.SetFile( sIndexFileName.c_str() );
369cdf0e10cSrcweir }
370cdf0e10cSrcweir 
371cdf0e10cSrcweir void
SetFile_Help()372cdf0e10cSrcweir OuputPage_Environment::SetFile_Help()
373cdf0e10cSrcweir {
374cdf0e10cSrcweir     pi->aMyPath.SetFile( C_sHFN_Help );
375cdf0e10cSrcweir }
376cdf0e10cSrcweir 
377cdf0e10cSrcweir void
SetFile_CurNamespace()378cdf0e10cSrcweir OuputPage_Environment::SetFile_CurNamespace()
379cdf0e10cSrcweir {
380cdf0e10cSrcweir     csv_assert( pi->NspEnv() );
381cdf0e10cSrcweir     pi->aMyPath.SetFile("index.html");
382cdf0e10cSrcweir     pi->NspEnv()->pCe = pi->Namespace();
383cdf0e10cSrcweir     pi->NspEnv()->eType = InNamespaceTree::t_namespace;
384cdf0e10cSrcweir }
385cdf0e10cSrcweir 
386cdf0e10cSrcweir void
SetFile_Class(const ary::cpp::Class & i_rClass)387cdf0e10cSrcweir OuputPage_Environment::SetFile_Class( const ary::cpp::Class & i_rClass )
388cdf0e10cSrcweir {
389cdf0e10cSrcweir     csv_assert( pi->NspEnv() );
390cdf0e10cSrcweir     pi->aMyPath.SetFile( ClassFileName(i_rClass.LocalName()) );
391cdf0e10cSrcweir     pi->NspEnv()->pCe = &i_rClass;
392cdf0e10cSrcweir     pi->NspEnv()->eType = InNamespaceTree::t_type;
393cdf0e10cSrcweir }
394cdf0e10cSrcweir 
395cdf0e10cSrcweir void
SetFile_Enum(const ary::cpp::Enum & i_rEnum)396cdf0e10cSrcweir OuputPage_Environment::SetFile_Enum( const ary::cpp::Enum & i_rEnum )
397cdf0e10cSrcweir {
398cdf0e10cSrcweir     csv_assert( pi->NspEnv() );
399cdf0e10cSrcweir     pi->aMyPath.SetFile( EnumFileName(i_rEnum.LocalName()) );
400cdf0e10cSrcweir     pi->NspEnv()->pCe = &i_rEnum;
401cdf0e10cSrcweir     pi->NspEnv()->eType = InNamespaceTree::t_type;
402cdf0e10cSrcweir }
403cdf0e10cSrcweir 
404cdf0e10cSrcweir void
SetFile_Typedef(const ary::cpp::Typedef & i_rTypedef)405cdf0e10cSrcweir OuputPage_Environment::SetFile_Typedef( const ary::cpp::Typedef & i_rTypedef )
406cdf0e10cSrcweir {
407cdf0e10cSrcweir     csv_assert( pi->NspEnv() );
408cdf0e10cSrcweir     pi->aMyPath.SetFile( TypedefFileName(i_rTypedef.LocalName()) );
409cdf0e10cSrcweir     pi->NspEnv()->pCe = &i_rTypedef;
410cdf0e10cSrcweir     pi->NspEnv()->eType = InNamespaceTree::t_type;
411cdf0e10cSrcweir }
412cdf0e10cSrcweir 
413cdf0e10cSrcweir void
SetFile_Operations(const ary::loc::File * i_pFile)414cdf0e10cSrcweir OuputPage_Environment::SetFile_Operations( const ary::loc::File * i_pFile )
415cdf0e10cSrcweir {
416cdf0e10cSrcweir     csv_assert( pi->NspEnv() );
417cdf0e10cSrcweir     if ( CurClass() != 0 )
418cdf0e10cSrcweir         pi->aMyPath.SetFile( "o.html" );
419cdf0e10cSrcweir 	else
420cdf0e10cSrcweir     {
421cdf0e10cSrcweir         csv_assert( i_pFile != 0 );
422cdf0e10cSrcweir         pi->aMyPath.SetFile( HtmlFileName("o-", i_pFile->LocalName()) );
423cdf0e10cSrcweir     }
424cdf0e10cSrcweir     pi->NspEnv()->pCe = 0;
425cdf0e10cSrcweir     pi->NspEnv()->eType = InNamespaceTree::t_operations;
426cdf0e10cSrcweir }
427cdf0e10cSrcweir 
428cdf0e10cSrcweir void
SetFile_Data(const ary::loc::File * i_pFile)429cdf0e10cSrcweir OuputPage_Environment::SetFile_Data( const ary::loc::File * i_pFile )
430cdf0e10cSrcweir {
431cdf0e10cSrcweir     csv_assert( pi->NspEnv() );
432cdf0e10cSrcweir     if ( CurClass() != 0 )
433cdf0e10cSrcweir         pi->aMyPath.SetFile( "d.html" );
434cdf0e10cSrcweir     else
435cdf0e10cSrcweir     {
436cdf0e10cSrcweir         csv_assert( i_pFile != 0 );
437cdf0e10cSrcweir         pi->aMyPath.SetFile( HtmlFileName("d-", i_pFile->LocalName()) );
438cdf0e10cSrcweir     }
439cdf0e10cSrcweir     pi->NspEnv()->pCe = 0;
440cdf0e10cSrcweir     pi->NspEnv()->eType = InNamespaceTree::t_data;
441cdf0e10cSrcweir }
442cdf0e10cSrcweir 
443cdf0e10cSrcweir const ary::cpp::Namespace *
CurNamespace() const444cdf0e10cSrcweir OuputPage_Environment::CurNamespace() const
445cdf0e10cSrcweir {
446cdf0e10cSrcweir     return pi->Namespace();
447cdf0e10cSrcweir }
448cdf0e10cSrcweir 
449cdf0e10cSrcweir const ary::cpp::Class *
CurClass() const450cdf0e10cSrcweir OuputPage_Environment::CurClass() const
451cdf0e10cSrcweir {
452cdf0e10cSrcweir     return pi->Class();
453cdf0e10cSrcweir }
454cdf0e10cSrcweir 
455cdf0e10cSrcweir const csv::ploc::Path &
CurPath() const456cdf0e10cSrcweir OuputPage_Environment::CurPath() const
457cdf0e10cSrcweir {
458cdf0e10cSrcweir     return pi->aMyPath;
459cdf0e10cSrcweir }
460cdf0e10cSrcweir 
461cdf0e10cSrcweir const ary::cpp::Gate &
Gate() const462cdf0e10cSrcweir OuputPage_Environment::Gate() const
463cdf0e10cSrcweir {
464cdf0e10cSrcweir     return *pi->pGate;
465cdf0e10cSrcweir }
466cdf0e10cSrcweir 
467cdf0e10cSrcweir const display::CorporateFrame &
Layout() const468cdf0e10cSrcweir OuputPage_Environment::Layout() const
469cdf0e10cSrcweir {
470cdf0e10cSrcweir     return *pi->pLayout;
471cdf0e10cSrcweir }
472cdf0e10cSrcweir 
473cdf0e10cSrcweir uintt
Depth() const474cdf0e10cSrcweir OuputPage_Environment::Depth() const
475cdf0e10cSrcweir {
476cdf0e10cSrcweir     return static_cast<uintt>(pi->nDepth);
477cdf0e10cSrcweir }
478cdf0e10cSrcweir 
479cdf0e10cSrcweir const String &
RepositoryTitle() const480cdf0e10cSrcweir OuputPage_Environment::RepositoryTitle() const
481cdf0e10cSrcweir {
482cdf0e10cSrcweir     return Gate().RepositoryTitle();
483cdf0e10cSrcweir }
484