1*d291ea28SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*d291ea28SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*d291ea28SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*d291ea28SAndrew Rist  * distributed with this work for additional information
6*d291ea28SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*d291ea28SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*d291ea28SAndrew Rist  * "License"); you may not use this file except in compliance
9*d291ea28SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*d291ea28SAndrew Rist  *
11*d291ea28SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*d291ea28SAndrew Rist  *
13*d291ea28SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*d291ea28SAndrew Rist  * software distributed under the License is distributed on an
15*d291ea28SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d291ea28SAndrew Rist  * KIND, either express or implied.  See the License for the
17*d291ea28SAndrew Rist  * specific language governing permissions and limitations
18*d291ea28SAndrew Rist  * under the License.
19*d291ea28SAndrew Rist  *
20*d291ea28SAndrew Rist  *************************************************************/
21cdf0e10cSrcweir 
22cdf0e10cSrcweir #include <precomp.h>
23cdf0e10cSrcweir #include "hi_linkhelper.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir 
26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
27cdf0e10cSrcweir #include <ary/idl/i_module.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir 
30cdf0e10cSrcweir 
31cdf0e10cSrcweir 
32cdf0e10cSrcweir const ary::idl::Module *
Search_CurModule() const33cdf0e10cSrcweir LinkHelper::Search_CurModule() const
34cdf0e10cSrcweir {
35cdf0e10cSrcweir     return Search_Module( rEnv.CurPosition().RelatedNode() );
36cdf0e10cSrcweir }
37cdf0e10cSrcweir 
38cdf0e10cSrcweir const ary::idl::Module *
Search_Module(output::Node & i_node) const39cdf0e10cSrcweir LinkHelper::Search_Module( output::Node & i_node ) const
40cdf0e10cSrcweir {
41cdf0e10cSrcweir     static StringVector aNames_;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir     output::Node::relative_id
44cdf0e10cSrcweir         nId = i_node.RelatedNameRoom();
45cdf0e10cSrcweir     if (nId == 0)
46cdf0e10cSrcweir     {
47cdf0e10cSrcweir         csv::erase_container(aNames_);
48cdf0e10cSrcweir         i_node.Get_Chain(aNames_);
49cdf0e10cSrcweir         const ary::idl::Module *  pModule =
50cdf0e10cSrcweir             rEnv.Data().Search_Module(aNames_);
51cdf0e10cSrcweir         if ( pModule == 0 )
52cdf0e10cSrcweir             return 0;
53cdf0e10cSrcweir         nId = static_cast<output::Node::relative_id>(pModule->Id());
54cdf0e10cSrcweir         rEnv.CurPosition().RelatedNode().Set_RelatedNameRoom(nId);
55cdf0e10cSrcweir     }
56cdf0e10cSrcweir 
57cdf0e10cSrcweir     return & rEnv.Data().Find_Module( ary::idl::Ce_id(nId) );
58cdf0e10cSrcweir }
59cdf0e10cSrcweir 
60cdf0e10cSrcweir namespace
61cdf0e10cSrcweir {
62cdf0e10cSrcweir     const String C_sXrefsSuffix("-xref");
63cdf0e10cSrcweir }
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 
66cdf0e10cSrcweir LinkHelper::OutPosition
PositionOf_CurXRefs(const String & i_ceName) const67cdf0e10cSrcweir LinkHelper::PositionOf_CurXRefs( const String & i_ceName ) const
68cdf0e10cSrcweir {
69cdf0e10cSrcweir     StreamLock sl(100);
70cdf0e10cSrcweir     return OutPosition( rEnv.CurPosition(),
71cdf0e10cSrcweir                         sl()    << i_ceName
72cdf0e10cSrcweir 								<< C_sXrefsSuffix
73cdf0e10cSrcweir 								<< ".html"
74cdf0e10cSrcweir 								<< c_str );
75cdf0e10cSrcweir }
76cdf0e10cSrcweir 
77cdf0e10cSrcweir const String &
XrefsSuffix() const78cdf0e10cSrcweir LinkHelper::XrefsSuffix() const
79cdf0e10cSrcweir {
80cdf0e10cSrcweir     return C_sXrefsSuffix;
81cdf0e10cSrcweir }
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 
84cdf0e10cSrcweir String
nameChainLinker(const char *)85cdf0e10cSrcweir nameChainLinker( const char * )
86cdf0e10cSrcweir {
87cdf0e10cSrcweir     static const String
88cdf0e10cSrcweir         sModuleFileName_( output::ModuleFileName() );
89cdf0e10cSrcweir     return sModuleFileName_;
90cdf0e10cSrcweir }
91