1*0841af79SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*0841af79SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*0841af79SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*0841af79SAndrew Rist * distributed with this work for additional information 6*0841af79SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*0841af79SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*0841af79SAndrew Rist * "License"); you may not use this file except in compliance 9*0841af79SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*0841af79SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*0841af79SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*0841af79SAndrew Rist * software distributed under the License is distributed on an 15*0841af79SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*0841af79SAndrew Rist * KIND, either express or implied. See the License for the 17*0841af79SAndrew Rist * specific language governing permissions and limitations 18*0841af79SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*0841af79SAndrew Rist *************************************************************/ 21cdf0e10cSrcweir 22cdf0e10cSrcweir #include <precomp.h> 23cdf0e10cSrcweir #include "dsply_op.hxx" 24cdf0e10cSrcweir 25cdf0e10cSrcweir 26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES 27cdf0e10cSrcweir #include <cosv/tpl/tpltools.hxx> 28cdf0e10cSrcweir #include <ary/cpp/c_funct.hxx> 29cdf0e10cSrcweir #include <ary/cpp/c_gate.hxx> 30cdf0e10cSrcweir #include <ary/loc/locp_le.hxx> 31cdf0e10cSrcweir #include <udm/html/htmlitem.hxx> 32cdf0e10cSrcweir #include "hd_docu.hxx" 33cdf0e10cSrcweir #include "hdimpl.hxx" 34cdf0e10cSrcweir #include "html_kit.hxx" 35cdf0e10cSrcweir #include "opageenv.hxx" 36cdf0e10cSrcweir #include "pagemake.hxx" 37cdf0e10cSrcweir 38cdf0e10cSrcweir using namespace csi; 39cdf0e10cSrcweir using namespace adcdisp; 40cdf0e10cSrcweir 41cdf0e10cSrcweir 42cdf0e10cSrcweir 43cdf0e10cSrcweir 44cdf0e10cSrcweir OperationsDisplay::OperationsDisplay( OuputPage_Environment & io_rEnv ) 45cdf0e10cSrcweir : // aMap_GlobalFunctionsDisplay, 46cdf0e10cSrcweir // pClassMembersDisplay, 47cdf0e10cSrcweir pEnv( &io_rEnv ), 48cdf0e10cSrcweir pDocuShow( new Docu_Display(io_rEnv) ) 49cdf0e10cSrcweir { 50cdf0e10cSrcweir } 51cdf0e10cSrcweir 52cdf0e10cSrcweir OperationsDisplay::~OperationsDisplay() 53cdf0e10cSrcweir { 54cdf0e10cSrcweir csv::erase_map_of_heap_ptrs( aMap_GlobalFunctionsDisplay ); 55cdf0e10cSrcweir } 56cdf0e10cSrcweir 57cdf0e10cSrcweir void 58cdf0e10cSrcweir OperationsDisplay::PrepareForStdMembers() 59cdf0e10cSrcweir { 60cdf0e10cSrcweir csv::erase_map_of_heap_ptrs( aMap_GlobalFunctionsDisplay ); 61cdf0e10cSrcweir 62cdf0e10cSrcweir pClassMembersDisplay = new PageDisplay(*pEnv); 63cdf0e10cSrcweir const ary::cpp::Class * pClass = pEnv->CurClass(); 64cdf0e10cSrcweir csv_assert( pClass != 0 ); 65cdf0e10cSrcweir pClassMembersDisplay->Setup_OperationsFile_for(*pClass); 66cdf0e10cSrcweir } 67cdf0e10cSrcweir 68cdf0e10cSrcweir void 69cdf0e10cSrcweir OperationsDisplay::PrepareForStaticMembers() 70cdf0e10cSrcweir { 71cdf0e10cSrcweir // Doesn't need to do anything yet. 72cdf0e10cSrcweir } 73cdf0e10cSrcweir 74cdf0e10cSrcweir void 75cdf0e10cSrcweir OperationsDisplay::Create_Files() 76cdf0e10cSrcweir { 77cdf0e10cSrcweir if (pClassMembersDisplay) 78cdf0e10cSrcweir pClassMembersDisplay->Create_File(); 79cdf0e10cSrcweir else 80cdf0e10cSrcweir { 81cdf0e10cSrcweir for ( Map_FileId2PagePtr::const_iterator it = aMap_GlobalFunctionsDisplay.begin(); 82cdf0e10cSrcweir it != aMap_GlobalFunctionsDisplay.end(); 83cdf0e10cSrcweir ++it ) 84cdf0e10cSrcweir { 85cdf0e10cSrcweir (*it).second->Create_File(); 86cdf0e10cSrcweir } 87cdf0e10cSrcweir } 88cdf0e10cSrcweir } 89cdf0e10cSrcweir 90cdf0e10cSrcweir void 91cdf0e10cSrcweir OperationsDisplay::do_Process( const ary::cpp::Function & i_rData ) 92cdf0e10cSrcweir { 93cdf0e10cSrcweir if ( Ce_IsInternal(i_rData) ) 94cdf0e10cSrcweir return; 95cdf0e10cSrcweir 96cdf0e10cSrcweir PageDisplay & rPage = FindPage_for( i_rData ); 97cdf0e10cSrcweir 98cdf0e10cSrcweir csi::xml::Element & rOut = rPage.CurOut(); 99cdf0e10cSrcweir Display_SglOperation( rOut, i_rData ); 100cdf0e10cSrcweir } 101cdf0e10cSrcweir 102cdf0e10cSrcweir const ary::cpp::Gate * 103cdf0e10cSrcweir OperationsDisplay::inq_Get_ReFinder() const 104cdf0e10cSrcweir { 105cdf0e10cSrcweir return & pEnv->Gate(); 106cdf0e10cSrcweir } 107cdf0e10cSrcweir 108cdf0e10cSrcweir PageDisplay & 109cdf0e10cSrcweir OperationsDisplay::FindPage_for( const ary::cpp::Function & i_rData ) 110cdf0e10cSrcweir { 111cdf0e10cSrcweir if ( pClassMembersDisplay ) 112cdf0e10cSrcweir return *pClassMembersDisplay; 113cdf0e10cSrcweir 114cdf0e10cSrcweir SourceFileId 115cdf0e10cSrcweir nSourceFile = i_rData.Location(); 116cdf0e10cSrcweir PageDisplay * 117cdf0e10cSrcweir pFound = csv::value_from_map( aMap_GlobalFunctionsDisplay, nSourceFile, (PageDisplay*)0 ); 118cdf0e10cSrcweir if ( pFound == 0 ) 119cdf0e10cSrcweir { 120cdf0e10cSrcweir pFound = new PageDisplay( *pEnv ); 121cdf0e10cSrcweir const ary::loc::File & 122cdf0e10cSrcweir rFile = pEnv->Gate().Locations().Find_File( nSourceFile ); 123cdf0e10cSrcweir pFound->Setup_OperationsFile_for(rFile); 124cdf0e10cSrcweir aMap_GlobalFunctionsDisplay[nSourceFile] = pFound; 125cdf0e10cSrcweir } 126cdf0e10cSrcweir 127cdf0e10cSrcweir return *pFound; 128cdf0e10cSrcweir } 129cdf0e10cSrcweir 130cdf0e10cSrcweir void 131cdf0e10cSrcweir OperationsDisplay::Display_SglOperation( csi::xml::Element & rOut, 132cdf0e10cSrcweir const ary::cpp::Function & i_rData ) 133cdf0e10cSrcweir { 134cdf0e10cSrcweir adcdisp::ExplanationList aDocu(rOut, true); 135cdf0e10cSrcweir aDocu.AddEntry( 0 ); 136cdf0e10cSrcweir 137cdf0e10cSrcweir 138cdf0e10cSrcweir adcdisp::OperationTitle fTitle; 139cdf0e10cSrcweir fTitle( aDocu.Term(), 140cdf0e10cSrcweir i_rData.LocalName(), 141cdf0e10cSrcweir i_rData.CeId(), 142cdf0e10cSrcweir pEnv->Gate() ); 143cdf0e10cSrcweir 144cdf0e10cSrcweir // Syntax 145cdf0e10cSrcweir adcdisp::ExplanationList aSyntaxHeader(aDocu.Def()); 146cdf0e10cSrcweir aSyntaxHeader.AddEntry( 0, "simple" ); 147cdf0e10cSrcweir csi::xml::Element & rHeader = aSyntaxHeader.Term(); 148cdf0e10cSrcweir 149cdf0e10cSrcweir adcdisp::ParameterTable 150cdf0e10cSrcweir aParams( aSyntaxHeader.Def() ); 151cdf0e10cSrcweir 152cdf0e10cSrcweir if (i_rData.TemplateParameters().size() > 0) 153cdf0e10cSrcweir { 154cdf0e10cSrcweir TemplateClause fTemplateClause; 155cdf0e10cSrcweir fTemplateClause( rHeader, i_rData.TemplateParameters() ); 156cdf0e10cSrcweir rHeader << new html::LineBreak; 157cdf0e10cSrcweir } 158cdf0e10cSrcweir if ( i_rData.Flags().IsExternC() ) 159cdf0e10cSrcweir { 160cdf0e10cSrcweir rHeader 161cdf0e10cSrcweir << "extern \"C\"" 162cdf0e10cSrcweir << new html::LineBreak; 163cdf0e10cSrcweir } 164cdf0e10cSrcweir 165cdf0e10cSrcweir bool bConst = false; 166cdf0e10cSrcweir bool bVolatile = false; 167cdf0e10cSrcweir WriteOut_LinkedFunctionText( rHeader, aParams, i_rData, *pEnv, 168cdf0e10cSrcweir &bConst, &bVolatile ); 169cdf0e10cSrcweir aDocu.Def() << new html::LineBreak; 170cdf0e10cSrcweir 171cdf0e10cSrcweir // Flags 172cdf0e10cSrcweir aDocu.AddEntry_NoTerm(); 173cdf0e10cSrcweir adcdisp::FlagTable 174cdf0e10cSrcweir aFlags( aDocu.Def(), 8 ); 175cdf0e10cSrcweir 176cdf0e10cSrcweir const ary::cpp::FunctionFlags & 177cdf0e10cSrcweir rFFlags = i_rData.Flags(); 178cdf0e10cSrcweir aFlags.SetColumn( 0, "virtual", 179cdf0e10cSrcweir i_rData.Virtuality() != ary::cpp::VIRTUAL_none ); 180cdf0e10cSrcweir aFlags.SetColumn( 1, "abstract", 181cdf0e10cSrcweir i_rData.Virtuality() == ary::cpp::VIRTUAL_abstract ); 182cdf0e10cSrcweir aFlags.SetColumn( 2, "const", bConst ); 183cdf0e10cSrcweir aFlags.SetColumn( 3, "volatile", bVolatile ); 184cdf0e10cSrcweir aFlags.SetColumn( 4, "template", 185cdf0e10cSrcweir i_rData.TemplateParameters().size() > 0 ); 186cdf0e10cSrcweir aFlags.SetColumn( 5, "static", 187cdf0e10cSrcweir rFFlags.IsStaticLocal() OR rFFlags.IsStaticMember() ); 188cdf0e10cSrcweir aFlags.SetColumn( 6, "inline", 189cdf0e10cSrcweir rFFlags.IsInline() ); 190cdf0e10cSrcweir aFlags.SetColumn( 7, "C-linkage", 191cdf0e10cSrcweir rFFlags.IsExternC() ); 192cdf0e10cSrcweir aDocu.Def() << new html::LineBreak; 193cdf0e10cSrcweir 194cdf0e10cSrcweir // Docu 195cdf0e10cSrcweir aDocu.AddEntry_NoTerm(); 196cdf0e10cSrcweir pDocuShow->Assign_Out(aDocu.Def()); 197cdf0e10cSrcweir pDocuShow->Process(i_rData.Docu()); 198cdf0e10cSrcweir pDocuShow->Unassign_Out(); 199cdf0e10cSrcweir 200cdf0e10cSrcweir rOut << new html::HorizontalLine; 201cdf0e10cSrcweir } 202