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_LINKHELPER_HXX
25 #define ADC_DISPLAY_HI_LINKHELPER_HXX
26 
27 
28 // USED SERVICES
29     // BASE CLASSES
30     // COMPONENTS
31     // PARAMETERS
32 #include "hi_ary.hxx"
33 #include "hi_env.hxx"
34 #include <toolkit/out_position.hxx>
35 #include <toolkit/out_tree.hxx>
36 
37 
38 class LinkHelper
39 {
40   public:
41     typedef ary::idl::CodeEntity                CE;
42     typedef output::Position                    OutPosition;
43 
LinkHelper(HtmlEnvironment_Idl & io_rEnv)44                         LinkHelper(
45                             HtmlEnvironment_Idl &
46                                                 io_rEnv )
47                             :   rEnv(io_rEnv) {}
48 
PositionOf_CurModule() const49     OutPosition         PositionOf_CurModule() const
50 	                    { return OutPosition( rEnv.CurPosition(),
51 											  output::ModuleFileName()); }
52 
53     OutPosition         PositionOf_CurXRefs(
54 						    const String &      i_ceName) const;
PositionOf_Index() const55     OutPosition         PositionOf_Index() const
56 	                    { OutPosition ret1 = rEnv.OutputTree().IndexRoot();
57 	                      return OutPosition( ret1, String(output::IndexFile_A()) ); }
58 
59 
60     const ary::idl::Module *
61                         Search_CurModule() const;
62     const ary::idl::Module *
63                         Search_Module(
64                             output::Node &      i_node ) const;
65 
66     const CE *          Search_CeFromType(
67                             ary::idl::Type_id   i_type ) const;
68 
Get_Link2Position(StreamStr & o_link,OutPosition & i_pos) const69     void                Get_Link2Position(
70                             StreamStr &         o_link,
71                             OutPosition &       i_pos ) const
72                         { rEnv.CurPosition().Get_LinkTo(o_link, i_pos); }
73 
Get_Link2Member(StreamStr & o_link,OutPosition & i_ownerPos,const String & i_memberName) const74     void                Get_Link2Member(
75                             StreamStr &         o_link,
76                             OutPosition &       i_ownerPos,
77                             const String &      i_memberName ) const
78                         { Get_Link2Position(o_link, i_ownerPos);
79                           o_link << "#" << i_memberName; }
80     const String &      XrefsSuffix() const;
81 
82   private:
83     // DATA
84     HtmlEnvironment_Idl & rEnv;
85 };
86 
87 inline const ary::idl::CodeEntity *
Search_CeFromType(ary::idl::Type_id i_type) const88 LinkHelper::Search_CeFromType( ary::idl::Type_id i_type ) const
89 {
90     ary::idl::Ce_id nCe = rEnv.Data().CeFromType(i_type);
91     if (nCe.IsValid())
92         return &rEnv.Data().Find_Ce(nCe);
93     return 0;
94 }
95 
96 
97 
98 String              nameChainLinker(
99                         const char *        i_levelName );
100 
101 
102 #endif
103