1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef ADC_DISPLAY_HI_ENV_HXX
25 #define ADC_DISPLAY_HI_ENV_HXX
26 
27 
28 // USED SERVICES
29     // BASE CLASSES
30     // COMPONENTS
31 #include <cosv/ploc.hxx>
32 #include <cosv/ploc_dir.hxx>
33     // PARAMETERS
34 #include <toolkit/out_position.hxx>
35 
36 namespace ary
37 {
38 namespace idl
39 {
40     class Gate;
41     class CodeEntity;
42 }
43 }
44 namespace display
45 {
46     class CorporateFrame;
47 }
48 namespace output
49 {
50     class Tree;
51 }
52 
53 class AryAccess;
54 class LinkHelper;
55 
56 /** @resp
57     Provides environment information to the HTML factory
58     classes.
59 
60     @descr
61     All information that is not included in the data, especially
62     about the layout of the output tree and the access to
63     information from the repository are provided here.
64 
65     @see HtmlFactory
66 */
67 class HtmlEnvironment_Idl
68 {
69   public:
70     // LIFECYCLE
71                         HtmlEnvironment_Idl(
72                             const csv::ploc::Path &
73                                                 io_rOutputDir,
74                             const ary::idl::Gate &
75                                                 i_rGate,
76                             const display::CorporateFrame &
77                                                 i_rLayout );
78                         ~HtmlEnvironment_Idl();
79 
80     // OPERATIONS
81     void                Goto_Directory(
82                             output::Position    i_pos,
83                             bool                i_bCreateDirectoryIfNecessary );
84     void                Goto_DirectoryLevelDown(
85                             const String &      i_subDirName,
86                             bool                i_bCreateDirectoryIfNecessary );
87     void                Goto_DirectoryLevelUp();
88     void                Set_CurFile(
89                             const String &      i_fileName );
Set_CurPageCe(const ary::idl::CodeEntity * i_ce)90     void                Set_CurPageCe(
91                             const ary::idl::CodeEntity *
92                                                 i_ce )
93                                                 { pCurPageCe = i_ce; }
94     // INQUIRY
95     const ary::idl::Gate &
Gate() const96                         Gate() const            { return *pGate; }
Data() const97     const AryAccess &   Data() const            { return *pData; }
98     const char *        Link2Manual(
99                             const String &      i_link ) const;
100 
101     /// This may be reimplemented for removing dead links to members.
Is_MemberExistenceCheckRequired() const102     bool                Is_MemberExistenceCheckRequired() const
103                                                 { return false; }
104 
105     /// @return Holds only the current directory, not the current file.
CurPosition() const106     output::Position &  CurPosition() const		{ return aCurPosition; }
Get_CurFilePath(StreamStr & o_buffer) const107     void                Get_CurFilePath(
108                             StreamStr &         o_buffer ) const
109                                                 { o_buffer << aCurPath; }
110 
111     const display::CorporateFrame &
Layout() const112                         Layout() const			{ return *pLayout; }
Linker() const113     const LinkHelper &  Linker() const          { return *pLinker; }
114 
Get_LinkTo(StreamStr & o_result,output::Position i_destination)115     void                Get_LinkTo(
116                             StreamStr &         o_result,
117                             output::Position    i_destination )
118                                                 { CurPosition().Get_LinkTo(o_result, i_destination); }
119     String              CurPageCe_AsText() const;
120     String              CurPageCe_AsFile(
121                             const char *        i_sEnding) const;
122     const ary::idl::CodeEntity *
CurPageCe() const123                         CurPageCe() const       { return pCurPageCe; }
124 
125     // ACCESS
OutputTree()126     output::Tree &      OutputTree()     		{ return *pOutputTree; }
127 
128   private:
129     // Local
130     void                create_Directory(
131                             const csv::ploc::Path &
132                                                 i_path );
133 
134     // DATA
135     csv::ploc::Directory
136                         aOutputRoot;
137     csv::ploc::Path     aCurPath;
138 
139     Dyn<AryAccess>      pData;          /// @invariant *pData is valid.
140     const ary::idl::Gate *
141                         pGate;          /// @invariant pGate != 0.
142     Dyn<output::Tree>   pOutputTree;    /// @invariant *pOutputTree is valid.
143     mutable output::Position
144                         aCurPosition;
145     const ary::idl::CodeEntity *
146                         pCurPageCe;
147 
148     const display::CorporateFrame *
149                         pLayout;
150 
151     Dyn<LinkHelper>     pLinker;
152 };
153 
154 
155 #endif
156 
157 
158