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