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 #include <precomp.h>
23 #include "hi_linkhelper.hxx"
24 
25 
26 // NOT FULLY DEFINED SERVICES
27 #include <ary/idl/i_module.hxx>
28 
29 
30 
31 
32 const ary::idl::Module *
Search_CurModule() const33 LinkHelper::Search_CurModule() const
34 {
35     return Search_Module( rEnv.CurPosition().RelatedNode() );
36 }
37 
38 const ary::idl::Module *
Search_Module(output::Node & i_node) const39 LinkHelper::Search_Module( output::Node & i_node ) const
40 {
41     static StringVector aNames_;
42 
43     output::Node::relative_id
44         nId = i_node.RelatedNameRoom();
45     if (nId == 0)
46     {
47         csv::erase_container(aNames_);
48         i_node.Get_Chain(aNames_);
49         const ary::idl::Module *  pModule =
50             rEnv.Data().Search_Module(aNames_);
51         if ( pModule == 0 )
52             return 0;
53         nId = static_cast<output::Node::relative_id>(pModule->Id());
54         rEnv.CurPosition().RelatedNode().Set_RelatedNameRoom(nId);
55     }
56 
57     return & rEnv.Data().Find_Module( ary::idl::Ce_id(nId) );
58 }
59 
60 namespace
61 {
62     const String C_sXrefsSuffix("-xref");
63 }
64 
65 
66 LinkHelper::OutPosition
PositionOf_CurXRefs(const String & i_ceName) const67 LinkHelper::PositionOf_CurXRefs( const String & i_ceName ) const
68 {
69     StreamLock sl(100);
70     return OutPosition( rEnv.CurPosition(),
71                         sl()    << i_ceName
72 								<< C_sXrefsSuffix
73 								<< ".html"
74 								<< c_str );
75 }
76 
77 const String &
XrefsSuffix() const78 LinkHelper::XrefsSuffix() const
79 {
80     return C_sXrefsSuffix;
81 }
82 
83 
84 String
nameChainLinker(const char *)85 nameChainLinker( const char * )
86 {
87     static const String
88         sModuleFileName_( output::ModuleFileName() );
89     return sModuleFileName_;
90 }
91