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 10cdf0e10cSrcweir * 11*d291ea28SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 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. 19cdf0e10cSrcweir * 20*d291ea28SAndrew Rist *************************************************************/ 21cdf0e10cSrcweir 22cdf0e10cSrcweir #include <precomp.h> 23cdf0e10cSrcweir #include "hfi_doc.hxx" 24cdf0e10cSrcweir 25cdf0e10cSrcweir 26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES 27cdf0e10cSrcweir #include <ary/idl/i_ce.hxx> 28cdf0e10cSrcweir #include <ary/doc/d_oldidldocu.hxx> 29cdf0e10cSrcweir #include <ary_i/d_token.hxx> 30cdf0e10cSrcweir #include <toolkit/hf_docentry.hxx> 31cdf0e10cSrcweir #include "hfi_tag.hxx" 32cdf0e10cSrcweir #include "hi_ary.hxx" 33cdf0e10cSrcweir 34cdf0e10cSrcweir 35cdf0e10cSrcweir 36cdf0e10cSrcweir 37cdf0e10cSrcweir HF_IdlDocu::HF_IdlDocu( Environment & io_rEnv, 38cdf0e10cSrcweir HF_DocEntryList & o_rOut ) 39cdf0e10cSrcweir : HtmlFactory_Idl( io_rEnv, &o_rOut.CurOut() ), 40cdf0e10cSrcweir rOut(o_rOut) 41cdf0e10cSrcweir { 42cdf0e10cSrcweir } 43cdf0e10cSrcweir 44cdf0e10cSrcweir HF_IdlDocu::~HF_IdlDocu() 45cdf0e10cSrcweir { 46cdf0e10cSrcweir } 47cdf0e10cSrcweir 48cdf0e10cSrcweir void 49cdf0e10cSrcweir HF_IdlDocu::Produce_fromCodeEntity( const client & i_ce ) const 50cdf0e10cSrcweir { 51cdf0e10cSrcweir const ce_info * 52cdf0e10cSrcweir i_pDocu = Get_IdlDocu(i_ce.Docu()); 53cdf0e10cSrcweir if (i_pDocu != 0) 54cdf0e10cSrcweir Produce_byDocuAndScope(*i_pDocu, &i_ce, i_ce); 55cdf0e10cSrcweir } 56cdf0e10cSrcweir 57cdf0e10cSrcweir void 58cdf0e10cSrcweir HF_IdlDocu::Produce_fromReference( const ce_info & i_rDocuForReference, 59cdf0e10cSrcweir const client & i_rScopeGivingCe ) const 60cdf0e10cSrcweir { 61cdf0e10cSrcweir Produce_byDocuAndScope(i_rDocuForReference, 0, i_rScopeGivingCe ); 62cdf0e10cSrcweir } 63cdf0e10cSrcweir 64cdf0e10cSrcweir void 65cdf0e10cSrcweir HF_IdlDocu::Produce_byDocuAndScope( const ce_info & i_rDocu, 66cdf0e10cSrcweir const client * i_pClient, 67cdf0e10cSrcweir const client & i_rScopeGivingCe ) const 68cdf0e10cSrcweir { 69cdf0e10cSrcweir bool bShort = NOT i_rDocu.Short().IsEmpty(); 70cdf0e10cSrcweir bool bDescr = NOT i_rDocu.Description().IsEmpty(); 71cdf0e10cSrcweir 72cdf0e10cSrcweir if ( i_rDocu.IsDeprecated() 73cdf0e10cSrcweir OR ( 74cdf0e10cSrcweir (i_pClient != 0 ? i_pClient->SightLevel() == ary::idl::sl_File : false) 75cdf0e10cSrcweir AND NOT i_rDocu.IsPublished() 76cdf0e10cSrcweir ) 77cdf0e10cSrcweir OR i_rDocu.IsOptional() ) 78cdf0e10cSrcweir { // any usage restriction 79cdf0e10cSrcweir rOut.Produce_Term("Usage Restrictions"); 80cdf0e10cSrcweir 81cdf0e10cSrcweir if ( i_rDocu.IsDeprecated() ) 82cdf0e10cSrcweir rOut.Produce_Definition() >> *new Html::Italic << "deprecated"; 83cdf0e10cSrcweir if ( (i_pClient != 0 ? i_pClient->SightLevel() == ary::idl::sl_File : false) 84cdf0e10cSrcweir AND NOT i_rDocu.IsPublished() ) 85cdf0e10cSrcweir rOut.Produce_Definition() >> *new Html::Italic << "not published"; 86cdf0e10cSrcweir if ( i_rDocu.IsOptional() ) 87cdf0e10cSrcweir rOut.Produce_Definition() >> *new Html::Italic << "optional"; 88cdf0e10cSrcweir 89cdf0e10cSrcweir if ( i_rDocu.IsDeprecated() AND 90cdf0e10cSrcweir // KORR_FUTURE 91cdf0e10cSrcweir // Workaround, because DocuTex2::IsEmpty() does not 92cdf0e10cSrcweir // calculate whitespace tokens only as empty. 93cdf0e10cSrcweir i_rDocu.DeprecatedText().Tokens().size() > 1 ) 94cdf0e10cSrcweir { 95cdf0e10cSrcweir rOut.Produce_Term("Deprecation Info"); 96cdf0e10cSrcweir 97cdf0e10cSrcweir HF_IdlDocuTextDisplay 98cdf0e10cSrcweir aDescription( Env(), 0, i_rScopeGivingCe); 99cdf0e10cSrcweir aDescription.Out().Enter( rOut.Produce_Definition() ); 100cdf0e10cSrcweir i_rDocu.DeprecatedText().DisplayAt( aDescription ); 101cdf0e10cSrcweir aDescription.Out().Leave(); 102cdf0e10cSrcweir } 103cdf0e10cSrcweir } // end if (<any usage restriction>) 104cdf0e10cSrcweir 105cdf0e10cSrcweir if ( bShort OR bDescr ) 106cdf0e10cSrcweir { 107cdf0e10cSrcweir rOut.Produce_Term("Description"); 108cdf0e10cSrcweir HF_IdlDocuTextDisplay 109cdf0e10cSrcweir aDescription( Env(), 0, i_rScopeGivingCe); 110cdf0e10cSrcweir if (bShort) 111cdf0e10cSrcweir { 112cdf0e10cSrcweir aDescription.Out().Enter( rOut.Produce_Definition() ); 113cdf0e10cSrcweir i_rDocu.Short().DisplayAt( aDescription ); 114cdf0e10cSrcweir aDescription.Out().Leave(); 115cdf0e10cSrcweir } 116cdf0e10cSrcweir if (bDescr) 117cdf0e10cSrcweir { 118cdf0e10cSrcweir aDescription.Out().Enter( rOut.Produce_Definition() ); 119cdf0e10cSrcweir i_rDocu.Description().DisplayAt( aDescription ); 120cdf0e10cSrcweir aDescription.Out().Leave(); 121cdf0e10cSrcweir } 122cdf0e10cSrcweir } 123cdf0e10cSrcweir 124cdf0e10cSrcweir std::vector< csi::dsapi::DT_SeeAlsoAtTag* > 125cdf0e10cSrcweir aSeeAlsosWithoutText; 126cdf0e10cSrcweir std::vector< csi::dsapi::DT_SeeAlsoAtTag* > 127cdf0e10cSrcweir aSeeAlsosWithText; 128cdf0e10cSrcweir 129cdf0e10cSrcweir for ( std::vector< ary::inf::AtTag2* >::const_iterator 130cdf0e10cSrcweir iter = i_rDocu.Tags().begin(); 131cdf0e10cSrcweir iter != i_rDocu.Tags().end(); 132cdf0e10cSrcweir ++iter ) 133cdf0e10cSrcweir { 134cdf0e10cSrcweir csi::dsapi::DT_SeeAlsoAtTag* 135cdf0e10cSrcweir pSeeAlso = dynamic_cast< csi::dsapi::DT_SeeAlsoAtTag * >(*iter); 136cdf0e10cSrcweir if (pSeeAlso != 0 ) 137cdf0e10cSrcweir { 138cdf0e10cSrcweir if ( pSeeAlso->Text().IsEmpty() ) 139cdf0e10cSrcweir { 140cdf0e10cSrcweir aSeeAlsosWithoutText.push_back(pSeeAlso); 141cdf0e10cSrcweir } 142cdf0e10cSrcweir else 143cdf0e10cSrcweir { 144cdf0e10cSrcweir aSeeAlsosWithText.push_back(pSeeAlso); 145cdf0e10cSrcweir } 146cdf0e10cSrcweir continue; 147cdf0e10cSrcweir } 148cdf0e10cSrcweir 149cdf0e10cSrcweir if ( strlen( (*iter)->Title() ) > 0 ) 150cdf0e10cSrcweir { 151cdf0e10cSrcweir HF_IdlTag 152cdf0e10cSrcweir aTag(Env(), i_rScopeGivingCe); 153cdf0e10cSrcweir Xml::Element & 154cdf0e10cSrcweir rTerm = rOut.Produce_Term(); 155cdf0e10cSrcweir aTag.Produce_byData( rTerm, 156cdf0e10cSrcweir rOut.Produce_Definition(), 157cdf0e10cSrcweir *(*iter) ); 158cdf0e10cSrcweir } 159cdf0e10cSrcweir } // end for 160cdf0e10cSrcweir 161cdf0e10cSrcweir if (aSeeAlsosWithoutText.size() > 0) 162cdf0e10cSrcweir { 163cdf0e10cSrcweir HF_IdlTag 164cdf0e10cSrcweir aSeeAlsoTag(Env(), i_rScopeGivingCe); 165cdf0e10cSrcweir Xml::Element & 166cdf0e10cSrcweir rTerm = rOut.Produce_Term(); 167cdf0e10cSrcweir aSeeAlsoTag.Produce_byData( rTerm, 168cdf0e10cSrcweir rOut.Produce_Definition(), 169cdf0e10cSrcweir aSeeAlsosWithoutText ); 170cdf0e10cSrcweir } 171cdf0e10cSrcweir 172cdf0e10cSrcweir for ( std::vector< csi::dsapi::DT_SeeAlsoAtTag* >::const_iterator 173cdf0e10cSrcweir itSee2 = aSeeAlsosWithText.begin(); 174cdf0e10cSrcweir itSee2 != aSeeAlsosWithText.end(); 175cdf0e10cSrcweir ++itSee2 ) 176cdf0e10cSrcweir { 177cdf0e10cSrcweir HF_IdlTag 178cdf0e10cSrcweir aTag(Env(), i_rScopeGivingCe); 179cdf0e10cSrcweir Xml::Element & 180cdf0e10cSrcweir rTerm = rOut.Produce_Term(); 181cdf0e10cSrcweir aTag.Produce_byData( rTerm, 182cdf0e10cSrcweir rOut.Produce_Definition(), 183cdf0e10cSrcweir *(*itSee2) ); 184cdf0e10cSrcweir } // end for 185cdf0e10cSrcweir } 186