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 "pm_class.hxx" 24cdf0e10cSrcweir 25cdf0e10cSrcweir 26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES 27cdf0e10cSrcweir #include <ary/cpp/c_gate.hxx> 28cdf0e10cSrcweir #include <ary/cpp/c_class.hxx> 29cdf0e10cSrcweir #include <ary/cpp/c_tydef.hxx> 30cdf0e10cSrcweir #include <ary/cpp/cp_ce.hxx> 31cdf0e10cSrcweir #include <ary/loc/loc_file.hxx> 32cdf0e10cSrcweir #include <ary/loc/locp_le.hxx> 33cdf0e10cSrcweir #include <ary/getncast.hxx> 34cdf0e10cSrcweir #include "hd_chlst.hxx" 35cdf0e10cSrcweir #include "hd_docu.hxx" 36cdf0e10cSrcweir #include "hdimpl.hxx" 37cdf0e10cSrcweir #include "html_kit.hxx" 38cdf0e10cSrcweir #include "navibar.hxx" 39cdf0e10cSrcweir #include "opageenv.hxx" 40cdf0e10cSrcweir #include "pagemake.hxx" 41cdf0e10cSrcweir #include "strconst.hxx" 42cdf0e10cSrcweir 43cdf0e10cSrcweir using namespace adcdisp; 44cdf0e10cSrcweir 45cdf0e10cSrcweir using namespace csi; 46cdf0e10cSrcweir using csi::html::HorizontalLine; 47cdf0e10cSrcweir using csi::html::LineBreak; 48cdf0e10cSrcweir using csi::html::Link; 49cdf0e10cSrcweir using csi::html::Table; 50cdf0e10cSrcweir using csi::html::TableRow; 51cdf0e10cSrcweir using csi::html::TableCell; 52cdf0e10cSrcweir 53cdf0e10cSrcweir using ary::cpp::CesConstIterator; 54cdf0e10cSrcweir using ary::doc::OldCppDocu; 55cdf0e10cSrcweir 56cdf0e10cSrcweir const char * const C_sTitle_InnerClasses = "Classes"; 57cdf0e10cSrcweir const char * const C_sTitle_InnerStructs = "Structs"; 58cdf0e10cSrcweir const char * const C_sTitle_InnerUnions = "Unions"; 59cdf0e10cSrcweir const char * const C_sTitle_Methods = "Methods"; 60cdf0e10cSrcweir const char * const C_sTitle_StaticMethods = "Static Methods"; 61cdf0e10cSrcweir const char * const C_sTitle_Data = "Data"; 62cdf0e10cSrcweir const char * const C_sTitle_StaticData = "Static Data"; 63cdf0e10cSrcweir 64cdf0e10cSrcweir const char * const C_sLabel_StaticOperations = "static_ops"; 65cdf0e10cSrcweir const char * const C_sLabel_StaticVariables = "static_vars"; 66cdf0e10cSrcweir 67cdf0e10cSrcweir const char * const C_sTitlePublic = "Public Members"; 68cdf0e10cSrcweir const char * const C_sTitleProtected = "Protected Members"; 69cdf0e10cSrcweir const char * const C_sTitlePrivate = "Private Members"; 70cdf0e10cSrcweir const char * const C_sMprTitles[3] = { C_sTitlePublic, 71cdf0e10cSrcweir C_sTitleProtected, 72cdf0e10cSrcweir C_sTitlePrivate 73cdf0e10cSrcweir }; 74cdf0e10cSrcweir const char * const C_sSummaryTitlePublic = "Public Members"; 75cdf0e10cSrcweir const char * const C_sSummaryTitleProtected = "Protected Members"; 76cdf0e10cSrcweir const char * const C_sSummaryTitlePrivate = "Private Members"; 77cdf0e10cSrcweir const char * 78cdf0e10cSrcweir C_sMprSummaryTitles[3] = 79cdf0e10cSrcweir { C_sSummaryTitlePublic, C_sSummaryTitleProtected, C_sSummaryTitlePrivate }; 80cdf0e10cSrcweir const char * 81cdf0e10cSrcweir C_sMprPrefixes[3] = 82cdf0e10cSrcweir { "publ_", "prot_", "priv_" }; 83cdf0e10cSrcweir const char * 84cdf0e10cSrcweir C_sSummaryItems_Titles[PageMaker_Class::cl_MAX] = 85cdf0e10cSrcweir { C_sTitle_InnerClasses, C_sTitle_InnerStructs, C_sTitle_InnerUnions, 86cdf0e10cSrcweir C_sTitle_Enums, C_sTitle_Typedefs, 87cdf0e10cSrcweir C_sTitle_Methods, C_sTitle_StaticMethods, C_sTitle_Data, C_sTitle_StaticData }; 88cdf0e10cSrcweir const char * 89cdf0e10cSrcweir C_sSummaryItems_Labels[PageMaker_Class::cl_MAX] = 90cdf0e10cSrcweir { C_sLabel_Classes, C_sLabel_Structs, C_sLabel_Unions, 91cdf0e10cSrcweir C_sLabel_Enums, C_sLabel_Typedefs, 92cdf0e10cSrcweir C_sLabel_Operations, C_sLabel_StaticOperations, 93cdf0e10cSrcweir C_sLabel_Variables, C_sLabel_StaticVariables }; 94cdf0e10cSrcweir 95cdf0e10cSrcweir 96cdf0e10cSrcweir const ary::cpp::E_Protection 97cdf0e10cSrcweir aProt[3] = { ary::cpp::PROTECT_public, 98cdf0e10cSrcweir ary::cpp::PROTECT_protected, 99cdf0e10cSrcweir ary::cpp::PROTECT_private }; 100cdf0e10cSrcweir 101cdf0e10cSrcweir 102cdf0e10cSrcweir PageMaker_Class::PageMaker_Class( PageDisplay & io_rPage, 103cdf0e10cSrcweir const ary::cpp::Class & i_rClass ) 104cdf0e10cSrcweir : SpecializedPageMaker(io_rPage), 105cdf0e10cSrcweir pMe( &i_rClass ), 106cdf0e10cSrcweir pChildDisplay( new ChildList_Display(io_rPage.Env(), i_rClass) ), 107cdf0e10cSrcweir pNavi(0) 108cdf0e10cSrcweir // pProtectionArea, 109cdf0e10cSrcweir // bChildLists_Exist 110cdf0e10cSrcweir { 111cdf0e10cSrcweir int i_max = 3 * cl_MAX; 112cdf0e10cSrcweir for (int i = 0; i < i_max; i++) 113cdf0e10cSrcweir { 114cdf0e10cSrcweir bChildLists_Exist[i] = false; 115cdf0e10cSrcweir } // end for 116cdf0e10cSrcweir } 117cdf0e10cSrcweir 118cdf0e10cSrcweir PageMaker_Class::~PageMaker_Class() 119cdf0e10cSrcweir { 120cdf0e10cSrcweir } 121cdf0e10cSrcweir 122cdf0e10cSrcweir void 123cdf0e10cSrcweir PageMaker_Class::MakePage() 124cdf0e10cSrcweir { 125cdf0e10cSrcweir pNavi = new NavigationBar( Env(), Me() ); 126cdf0e10cSrcweir 127cdf0e10cSrcweir Write_NavBar(); 128cdf0e10cSrcweir Write_TopArea(); 129cdf0e10cSrcweir Write_DocuArea(); 130cdf0e10cSrcweir Write_ChildLists(); 131cdf0e10cSrcweir 132cdf0e10cSrcweir pNavi->Write_SubRows(); 133cdf0e10cSrcweir pNavi = 0; 134cdf0e10cSrcweir } 135cdf0e10cSrcweir 136cdf0e10cSrcweir void 137cdf0e10cSrcweir PageMaker_Class::Write_NavBar() 138cdf0e10cSrcweir { 139cdf0e10cSrcweir NavigationBar aNavi( Env(), Me() ); 140cdf0e10cSrcweir pNavi->Write( CurOut() ); 141cdf0e10cSrcweir CurOut() << new HorizontalLine; 142cdf0e10cSrcweir } 143cdf0e10cSrcweir 144cdf0e10cSrcweir inline bool 145cdf0e10cSrcweir IsInterface(const ary::doc::Documentation & i_doc) 146cdf0e10cSrcweir { 147cdf0e10cSrcweir const OldCppDocu * 148cdf0e10cSrcweir doc = Get_CppDocu(i_doc); 149cdf0e10cSrcweir return doc != 0 150cdf0e10cSrcweir ? doc->IsInterface() 151cdf0e10cSrcweir : false; 152cdf0e10cSrcweir } 153cdf0e10cSrcweir 154cdf0e10cSrcweir void 155cdf0e10cSrcweir PageMaker_Class::Write_TopArea() 156cdf0e10cSrcweir { 157cdf0e10cSrcweir TemplateClause fTemplateClause; 158cdf0e10cSrcweir PageTitle_Std fTitle; 159cdf0e10cSrcweir 160cdf0e10cSrcweir Page().Write_NameChainWithLinks( Me() ); 161cdf0e10cSrcweir 162cdf0e10cSrcweir fTemplateClause( CurOut(), Me().TemplateParameters() ); 163cdf0e10cSrcweir fTitle( CurOut(), Get_ClassTypeKey(Me()), Me().LocalName() ); 164cdf0e10cSrcweir 165cdf0e10cSrcweir CurOut() << new HorizontalLine; 166cdf0e10cSrcweir 167cdf0e10cSrcweir Write_BaseHierarchy(); 168cdf0e10cSrcweir Write_DerivedList(); 169cdf0e10cSrcweir 170cdf0e10cSrcweir CurOut() << new LineBreak; 171cdf0e10cSrcweir 172cdf0e10cSrcweir adcdisp::FlagTable 173cdf0e10cSrcweir aFlags( CurOut(), 4 ); 174cdf0e10cSrcweir aFlags.SetColumn( 0, "virtual", 175cdf0e10cSrcweir Me().Virtuality() != ary::cpp::VIRTUAL_none ); 176cdf0e10cSrcweir aFlags.SetColumn( 1, "abstract", 177cdf0e10cSrcweir Me().Virtuality() == ary::cpp::VIRTUAL_abstract ); 178cdf0e10cSrcweir aFlags.SetColumn( 2, "interface", 179cdf0e10cSrcweir IsInterface(Me().Docu()) 180cdf0e10cSrcweir OR Me().Virtuality() == ary::cpp::VIRTUAL_abstract ); 181cdf0e10cSrcweir aFlags.SetColumn( 3, "template", 182cdf0e10cSrcweir Me().TemplateParameters().size() > 0 ); 183cdf0e10cSrcweir } 184cdf0e10cSrcweir 185cdf0e10cSrcweir void 186cdf0e10cSrcweir PageMaker_Class::Write_DocuArea() 187cdf0e10cSrcweir { 188cdf0e10cSrcweir Docu_Display aDocuShow( Env() ); 189cdf0e10cSrcweir 190cdf0e10cSrcweir aDocuShow.Assign_Out(CurOut()); 191cdf0e10cSrcweir Me().Accept( aDocuShow ); 192cdf0e10cSrcweir aDocuShow.Unassign_Out(); 193cdf0e10cSrcweir 194cdf0e10cSrcweir ary::loc::File & 195cdf0e10cSrcweir rFile = Env().Gate().Locations().Find_File( Me().Location() ); 196cdf0e10cSrcweir 197cdf0e10cSrcweir adcdisp::ExplanationList 198cdf0e10cSrcweir aFileText( CurOut() ); 199cdf0e10cSrcweir aFileText.AddEntry("File"); 200cdf0e10cSrcweir aFileText.Def() 201cdf0e10cSrcweir << rFile.LocalName(); 202cdf0e10cSrcweir 203cdf0e10cSrcweir CurOut() << new HorizontalLine; 204cdf0e10cSrcweir } 205cdf0e10cSrcweir 206cdf0e10cSrcweir void 207cdf0e10cSrcweir PageMaker_Class::Write_ChildLists() 208cdf0e10cSrcweir { 209cdf0e10cSrcweir int i_max = 3 * cl_MAX; 210cdf0e10cSrcweir for (int i = 0; i < i_max; i++) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir bChildLists_Exist[i] = false; 213cdf0e10cSrcweir } // end for 214cdf0e10cSrcweir 215cdf0e10cSrcweir csi::html::DefListDefinition & 216cdf0e10cSrcweir rPublic = Setup_MemberSegment_Out( mp_public ); 217cdf0e10cSrcweir csi::html::DefListDefinition & 218cdf0e10cSrcweir rProtected = Setup_MemberSegment_Out( mp_protected ); 219cdf0e10cSrcweir csi::html::DefListDefinition & 220cdf0e10cSrcweir rPrivate = Setup_MemberSegment_Out( mp_private ); 221cdf0e10cSrcweir 222cdf0e10cSrcweir Write_ChildList_forClasses( rPublic, 223cdf0e10cSrcweir rProtected, 224cdf0e10cSrcweir rPrivate, 225cdf0e10cSrcweir C_sLabel_Classes, 226cdf0e10cSrcweir C_sTitle_InnerClasses, 227cdf0e10cSrcweir ary::cpp::CK_class ); 228cdf0e10cSrcweir Write_ChildList_forClasses( rPublic, 229cdf0e10cSrcweir rProtected, 230cdf0e10cSrcweir rPrivate, 231cdf0e10cSrcweir C_sLabel_Structs, 232cdf0e10cSrcweir C_sTitle_InnerStructs, 233cdf0e10cSrcweir ary::cpp::CK_struct ); 234cdf0e10cSrcweir Write_ChildList_forClasses( rPublic, 235cdf0e10cSrcweir rProtected, 236cdf0e10cSrcweir rPrivate, 237cdf0e10cSrcweir C_sLabel_Unions, 238cdf0e10cSrcweir C_sTitle_InnerUnions, 239cdf0e10cSrcweir ary::cpp::CK_union ); 240cdf0e10cSrcweir 241cdf0e10cSrcweir Write_ChildList( ary::cpp::Class::SLOT_Enums, 242cdf0e10cSrcweir cl_Enums, 243cdf0e10cSrcweir C_sLabel_Enums, 244cdf0e10cSrcweir C_sTitle_Enums, 245cdf0e10cSrcweir rPublic, 246cdf0e10cSrcweir rProtected, 247cdf0e10cSrcweir rPrivate ); 248cdf0e10cSrcweir Write_ChildList( ary::cpp::Class::SLOT_Typedefs, 249cdf0e10cSrcweir cl_Typedefs, 250cdf0e10cSrcweir C_sLabel_Typedefs, 251cdf0e10cSrcweir C_sTitle_Typedefs, 252cdf0e10cSrcweir rPublic, 253cdf0e10cSrcweir rProtected, 254cdf0e10cSrcweir rPrivate ); 255cdf0e10cSrcweir 256cdf0e10cSrcweir Write_ChildList( ary::cpp::Class::SLOT_Operations, 257cdf0e10cSrcweir cl_Operations, 258cdf0e10cSrcweir C_sLabel_Operations, 259cdf0e10cSrcweir C_sTitle_Methods, 260cdf0e10cSrcweir rPublic, 261cdf0e10cSrcweir rProtected, 262cdf0e10cSrcweir rPrivate ); 263cdf0e10cSrcweir Write_ChildList( ary::cpp::Class::SLOT_StaticOperations, 264cdf0e10cSrcweir cl_StaticOperations, 265cdf0e10cSrcweir C_sLabel_StaticOperations, 266cdf0e10cSrcweir C_sTitle_StaticMethods, 267cdf0e10cSrcweir rPublic, 268cdf0e10cSrcweir rProtected, 269cdf0e10cSrcweir rPrivate ); 270cdf0e10cSrcweir Write_ChildList( ary::cpp::Class::SLOT_Data, 271cdf0e10cSrcweir cl_Data, 272cdf0e10cSrcweir C_sLabel_Variables, 273cdf0e10cSrcweir C_sTitle_Data, 274cdf0e10cSrcweir rPublic, 275cdf0e10cSrcweir rProtected, 276cdf0e10cSrcweir rPrivate ); 277cdf0e10cSrcweir Write_ChildList( ary::cpp::Class::SLOT_StaticData, 278cdf0e10cSrcweir cl_StaticData, 279cdf0e10cSrcweir C_sLabel_StaticVariables, 280cdf0e10cSrcweir C_sTitle_StaticData, 281cdf0e10cSrcweir rPublic, 282cdf0e10cSrcweir rProtected, 283cdf0e10cSrcweir rPrivate ); 284cdf0e10cSrcweir 285cdf0e10cSrcweir Create_NaviSubRow(mp_public); // Also puts out or deletes pPublic. 286cdf0e10cSrcweir Create_NaviSubRow(mp_protected); // Also puts out or deletes pProtected. 287cdf0e10cSrcweir Create_NaviSubRow(mp_private); // Also puts out or deletes pPrivate. 288cdf0e10cSrcweir } 289cdf0e10cSrcweir 290cdf0e10cSrcweir void 291cdf0e10cSrcweir PageMaker_Class::Write_ChildList( ary::SlotAccessId i_nSlot, 292cdf0e10cSrcweir E_ChidList i_eChildListIndex, 293cdf0e10cSrcweir const char * i_sLabel, 294cdf0e10cSrcweir const char * i_sListTitle, 295cdf0e10cSrcweir csi::xml::Element & o_rPublic, 296cdf0e10cSrcweir csi::xml::Element & o_rProtected, 297cdf0e10cSrcweir csi::xml::Element & o_rPrivate ) 298cdf0e10cSrcweir 299cdf0e10cSrcweir { 300cdf0e10cSrcweir bool bPublic_ChildrenExist = false; 301cdf0e10cSrcweir bool bProtected_ChildrenExist = false; 302cdf0e10cSrcweir bool bPrivate_ChildrenExist = false; 303cdf0e10cSrcweir 304cdf0e10cSrcweir ChildList_Display::Area_Result 305cdf0e10cSrcweir aPublic_Result( bPublic_ChildrenExist, o_rPublic ); 306cdf0e10cSrcweir ChildList_Display::Area_Result 307cdf0e10cSrcweir aProtected_Result( bProtected_ChildrenExist, o_rProtected ); 308cdf0e10cSrcweir ChildList_Display::Area_Result 309cdf0e10cSrcweir aPrivate_Result( bPrivate_ChildrenExist, o_rPrivate ); 310cdf0e10cSrcweir 311cdf0e10cSrcweir String sLabelPublic = ChildListLabel(i_sLabel, mp_public); 312cdf0e10cSrcweir String sLabelProtected = ChildListLabel(i_sLabel, mp_protected); 313cdf0e10cSrcweir String sLabelPrivate = ChildListLabel(i_sLabel, mp_private); 314cdf0e10cSrcweir 315cdf0e10cSrcweir pChildDisplay->Run_Members( aPublic_Result, 316cdf0e10cSrcweir aProtected_Result, 317cdf0e10cSrcweir aPrivate_Result, 318cdf0e10cSrcweir i_nSlot, 319cdf0e10cSrcweir sLabelPublic, 320cdf0e10cSrcweir sLabelProtected, 321cdf0e10cSrcweir sLabelPrivate, 322cdf0e10cSrcweir i_sListTitle ); 323cdf0e10cSrcweir 324cdf0e10cSrcweir bChildLists_Exist[i_eChildListIndex] 325cdf0e10cSrcweir = bPublic_ChildrenExist; 326cdf0e10cSrcweir bChildLists_Exist[i_eChildListIndex + cl_MAX] 327cdf0e10cSrcweir = bProtected_ChildrenExist; 328cdf0e10cSrcweir bChildLists_Exist[i_eChildListIndex + 2*cl_MAX] 329cdf0e10cSrcweir = bPrivate_ChildrenExist; 330cdf0e10cSrcweir 331cdf0e10cSrcweir if (bPublic_ChildrenExist) 332cdf0e10cSrcweir o_rPublic << new HorizontalLine; 333cdf0e10cSrcweir if (bProtected_ChildrenExist) 334cdf0e10cSrcweir o_rProtected << new HorizontalLine; 335cdf0e10cSrcweir if (bPrivate_ChildrenExist) 336cdf0e10cSrcweir o_rPrivate << new HorizontalLine; 337cdf0e10cSrcweir } 338cdf0e10cSrcweir 339cdf0e10cSrcweir void 340cdf0e10cSrcweir PageMaker_Class::Write_ChildList_forClasses( csi::xml::Element & o_rPublic, 341cdf0e10cSrcweir csi::xml::Element & o_rProtected, 342cdf0e10cSrcweir csi::xml::Element & o_rPrivate, 343cdf0e10cSrcweir const char * i_sLabel, 344cdf0e10cSrcweir const char * i_sListTitle, 345cdf0e10cSrcweir ary::cpp::E_ClassKey i_eFilter ) 346cdf0e10cSrcweir { 347cdf0e10cSrcweir bool bPublic_ChildrenExist = false; 348cdf0e10cSrcweir bool bProtected_ChildrenExist = false; 349cdf0e10cSrcweir bool bPrivate_ChildrenExist = false; 350cdf0e10cSrcweir 351cdf0e10cSrcweir ChildList_Display::Area_Result 352cdf0e10cSrcweir aPublic_Result( bPublic_ChildrenExist, o_rPublic ); 353cdf0e10cSrcweir ChildList_Display::Area_Result 354cdf0e10cSrcweir aProtected_Result( bProtected_ChildrenExist, o_rProtected ); 355cdf0e10cSrcweir ChildList_Display::Area_Result 356cdf0e10cSrcweir aPrivate_Result( bPrivate_ChildrenExist, o_rPrivate ); 357cdf0e10cSrcweir 358cdf0e10cSrcweir String sLabelPublic = ChildListLabel(i_sLabel, mp_public); 359cdf0e10cSrcweir String sLabelProtected = ChildListLabel(i_sLabel, mp_protected); 360cdf0e10cSrcweir String sLabelPrivate = ChildListLabel(i_sLabel, mp_private); 361cdf0e10cSrcweir 362cdf0e10cSrcweir pChildDisplay->Run_MemberClasses( aPublic_Result, 363cdf0e10cSrcweir aProtected_Result, 364cdf0e10cSrcweir aPrivate_Result, 365cdf0e10cSrcweir ary::cpp::Class::SLOT_NestedClasses, 366cdf0e10cSrcweir sLabelPublic, 367cdf0e10cSrcweir sLabelProtected, 368cdf0e10cSrcweir sLabelPrivate, 369cdf0e10cSrcweir i_sListTitle, 370cdf0e10cSrcweir i_eFilter ); 371cdf0e10cSrcweir 372cdf0e10cSrcweir bChildLists_Exist[int(cl_NestedClasses)+int(i_eFilter)] 373cdf0e10cSrcweir = bPublic_ChildrenExist; 374cdf0e10cSrcweir bChildLists_Exist[int(cl_NestedClasses)+int(i_eFilter) + cl_MAX] 375cdf0e10cSrcweir = bProtected_ChildrenExist; 376cdf0e10cSrcweir bChildLists_Exist[int(cl_NestedClasses)+int(i_eFilter) + 2*cl_MAX] 377cdf0e10cSrcweir = bPrivate_ChildrenExist; 378cdf0e10cSrcweir 379cdf0e10cSrcweir if (bPublic_ChildrenExist) 380cdf0e10cSrcweir o_rPublic << new HorizontalLine; 381cdf0e10cSrcweir if (bProtected_ChildrenExist) 382cdf0e10cSrcweir o_rProtected << new HorizontalLine; 383cdf0e10cSrcweir if (bPrivate_ChildrenExist) 384cdf0e10cSrcweir o_rPrivate << new HorizontalLine; 385cdf0e10cSrcweir } 386cdf0e10cSrcweir 387cdf0e10cSrcweir const char * 388cdf0e10cSrcweir PageMaker_Class::ChildListLabel( const char * i_sLabel, E_MemberProtection i_eMpr ) 389cdf0e10cSrcweir { 390cdf0e10cSrcweir static char sResult[100]; 391cdf0e10cSrcweir strcpy( sResult, C_sMprPrefixes[i_eMpr] ); // SAFE STRCPY (#100211# - checked) 392cdf0e10cSrcweir strcat( sResult, i_sLabel ); // SAFE STRCAT (#100211# - checked) 393cdf0e10cSrcweir return sResult; 394cdf0e10cSrcweir } 395cdf0e10cSrcweir 396cdf0e10cSrcweir csi::html::DefListDefinition & 397cdf0e10cSrcweir PageMaker_Class::Setup_MemberSegment_Out( E_MemberProtection i_eMpr ) 398cdf0e10cSrcweir { 399cdf0e10cSrcweir html::DefList * pDefList = new html::DefList; 400cdf0e10cSrcweir pProtectionArea[i_eMpr] = pDefList; 401cdf0e10cSrcweir 402cdf0e10cSrcweir pDefList->AddTerm() 403cdf0e10cSrcweir << new html::ClassAttr("subtitle") 404cdf0e10cSrcweir >> *new html::Label( C_sMprPrefixes[i_eMpr] ) 405cdf0e10cSrcweir >> *new html::Headline(3) 406cdf0e10cSrcweir << C_sMprTitles[i_eMpr]; 407cdf0e10cSrcweir return pDefList->AddDefinition(); 408cdf0e10cSrcweir } 409cdf0e10cSrcweir 410cdf0e10cSrcweir void 411cdf0e10cSrcweir PageMaker_Class::Create_NaviSubRow( E_MemberProtection i_eMpr ) 412cdf0e10cSrcweir { 413cdf0e10cSrcweir int nIndexAdd = int(cl_MAX) * int(i_eMpr); 414cdf0e10cSrcweir 415cdf0e10cSrcweir bool bEmpty = true; 416cdf0e10cSrcweir for (int e = 0; e < cl_MAX; e++) 417cdf0e10cSrcweir { 418cdf0e10cSrcweir if ( bChildLists_Exist[e + nIndexAdd] ) 419cdf0e10cSrcweir { 420cdf0e10cSrcweir bEmpty = false; 421cdf0e10cSrcweir break; 422cdf0e10cSrcweir } 423cdf0e10cSrcweir } // end for 424cdf0e10cSrcweir if (bEmpty) 425cdf0e10cSrcweir { 426cdf0e10cSrcweir pProtectionArea[i_eMpr] = 0; 427cdf0e10cSrcweir return; 428cdf0e10cSrcweir } 429cdf0e10cSrcweir else // 430cdf0e10cSrcweir { 431cdf0e10cSrcweir CurOut() << pProtectionArea[i_eMpr].Release(); 432cdf0e10cSrcweir } // endif 433cdf0e10cSrcweir 434cdf0e10cSrcweir pNavi->MakeSubRow( C_sMprSummaryTitles[i_eMpr] ); 435cdf0e10cSrcweir for (int i = 0; i < cl_MAX; i++) 436cdf0e10cSrcweir { 437cdf0e10cSrcweir pNavi->AddItem( C_sSummaryItems_Titles[i], 438cdf0e10cSrcweir ChildListLabel( C_sSummaryItems_Labels[i], i_eMpr ), 439cdf0e10cSrcweir bChildLists_Exist[i+nIndexAdd] ); 440cdf0e10cSrcweir } // end for 441cdf0e10cSrcweir } 442cdf0e10cSrcweir 443cdf0e10cSrcweir void 444cdf0e10cSrcweir PageMaker_Class::Write_DerivedList() 445cdf0e10cSrcweir { 446cdf0e10cSrcweir adcdisp::ExplanationList 447cdf0e10cSrcweir aDeriveds( CurOut() ); 448cdf0e10cSrcweir aDeriveds.AddEntry( "Known Derived Classes" ); 449cdf0e10cSrcweir 450cdf0e10cSrcweir if ( Me().KnownDerivatives().Size() == 0 ) 451cdf0e10cSrcweir { 452cdf0e10cSrcweir aDeriveds.Def() << "None."; 453cdf0e10cSrcweir return; 454cdf0e10cSrcweir } 455cdf0e10cSrcweir 456cdf0e10cSrcweir typedef ary::List_Rid RidList; 457cdf0e10cSrcweir 458cdf0e10cSrcweir CesConstIterator 459cdf0e10cSrcweir itEnd = Me().KnownDerivatives().End(); 460cdf0e10cSrcweir for ( CesConstIterator it = Me().KnownDerivatives().Begin(); 461cdf0e10cSrcweir it != itEnd; 462cdf0e10cSrcweir ++it ) 463cdf0e10cSrcweir { 464cdf0e10cSrcweir const ary::cpp::CodeEntity & 465cdf0e10cSrcweir rCe = Env().Gate().Ces().Find_Ce(*it); 466cdf0e10cSrcweir 467cdf0e10cSrcweir aDeriveds.Def() 468cdf0e10cSrcweir >> *new html::Link( Link2Ce(Env(),rCe) ) 469cdf0e10cSrcweir << rCe.LocalName(); 470cdf0e10cSrcweir aDeriveds.Def() 471cdf0e10cSrcweir << new html::LineBreak; 472cdf0e10cSrcweir } // end for 473cdf0e10cSrcweir } 474cdf0e10cSrcweir 475cdf0e10cSrcweir 476cdf0e10cSrcweir // ============== Creating a classes base hierarchy ====================== // 477cdf0e10cSrcweir 478cdf0e10cSrcweir 479cdf0e10cSrcweir namespace 480cdf0e10cSrcweir { 481cdf0e10cSrcweir 482cdf0e10cSrcweir class Node 483cdf0e10cSrcweir { 484cdf0e10cSrcweir public: 485cdf0e10cSrcweir Node( 486cdf0e10cSrcweir const ary::cpp::Class & 487cdf0e10cSrcweir i_rClass, 488cdf0e10cSrcweir ary::cpp::Type_id i_nClassType, 489cdf0e10cSrcweir const ary::cpp::Gate & 490cdf0e10cSrcweir i_rGate, 491cdf0e10cSrcweir intt i_nPositionOffset, 492cdf0e10cSrcweir Node * io_pDerived = 0, 493cdf0e10cSrcweir ary::cpp::E_Protection 494cdf0e10cSrcweir i_eProtection = ary::cpp::PROTECT_global, 495cdf0e10cSrcweir bool i_bVirtual = false ); 496cdf0e10cSrcweir ~Node(); 497cdf0e10cSrcweir 498cdf0e10cSrcweir void FillPositionList( 499cdf0e10cSrcweir std::vector< const Node* > & 500cdf0e10cSrcweir o_rPositionList ) const; 501cdf0e10cSrcweir void Write2( 502cdf0e10cSrcweir csi::xml::Element & o_rOut, 503cdf0e10cSrcweir const OuputPage_Environment & 504cdf0e10cSrcweir i_rEnv ) const; 505cdf0e10cSrcweir 506cdf0e10cSrcweir intt BaseCount() const { return nCountBases; } 507cdf0e10cSrcweir intt Position() const { return nPosition; } 508cdf0e10cSrcweir int Xpos() const { return 3*Position(); } 509cdf0e10cSrcweir int Ypos() const { return 2*Position(); } 510cdf0e10cSrcweir const Node * Derived() const { return pDerived; } 511cdf0e10cSrcweir 512cdf0e10cSrcweir private: 513cdf0e10cSrcweir typedef std::vector< DYN Node* > BaseList; 514cdf0e10cSrcweir 515cdf0e10cSrcweir void IncrBaseCount(); 516cdf0e10cSrcweir 517cdf0e10cSrcweir // DATA 518cdf0e10cSrcweir BaseList aBases; 519cdf0e10cSrcweir intt nCountBases; 520cdf0e10cSrcweir Node * pDerived; 521cdf0e10cSrcweir 522cdf0e10cSrcweir String sName; 523cdf0e10cSrcweir const ary::cpp::Class * 524cdf0e10cSrcweir pClass; 525cdf0e10cSrcweir ary::cpp::Type_id nClassType; 526cdf0e10cSrcweir ary::cpp::E_Protection 527cdf0e10cSrcweir eProtection; 528cdf0e10cSrcweir bool bVirtual; 529cdf0e10cSrcweir 530cdf0e10cSrcweir intt nPosition; 531cdf0e10cSrcweir }; 532cdf0e10cSrcweir 533cdf0e10cSrcweir void WriteNodeHierarchy( 534cdf0e10cSrcweir csi::xml::Element & o_rOut, 535cdf0e10cSrcweir const OuputPage_Environment & 536cdf0e10cSrcweir i_rEnv, 537cdf0e10cSrcweir const Node & i_rClass ); 538cdf0e10cSrcweir 539cdf0e10cSrcweir const ary::cpp::Class * 540cdf0e10cSrcweir HereFind_Class( 541cdf0e10cSrcweir const ary::cpp::Gate & 542cdf0e10cSrcweir i_rGate, 543cdf0e10cSrcweir ary::cpp::Type_id i_nReferingTypeId ); 544cdf0e10cSrcweir 545cdf0e10cSrcweir } // anonymous namespace 546cdf0e10cSrcweir 547cdf0e10cSrcweir void 548cdf0e10cSrcweir PageMaker_Class::Write_BaseHierarchy() 549cdf0e10cSrcweir { 550cdf0e10cSrcweir adcdisp::ExplanationList aBases( CurOut() ); 551cdf0e10cSrcweir aBases.AddEntry( "Base Classes" ); 552cdf0e10cSrcweir 553cdf0e10cSrcweir if ( Me().BaseClasses().size() == 0 ) 554cdf0e10cSrcweir { 555cdf0e10cSrcweir aBases.Def() << "None."; 556cdf0e10cSrcweir } 557cdf0e10cSrcweir else 558cdf0e10cSrcweir { 559cdf0e10cSrcweir Dyn< Node > 560cdf0e10cSrcweir pBaseGraph( new Node(Me(), ary::cpp::Type_id(0), Env().Gate(), 0) ); 561cdf0e10cSrcweir WriteNodeHierarchy( aBases.Def(), Env(), *pBaseGraph ); 562cdf0e10cSrcweir } 563cdf0e10cSrcweir } 564cdf0e10cSrcweir 565cdf0e10cSrcweir 566cdf0e10cSrcweir 567cdf0e10cSrcweir namespace 568cdf0e10cSrcweir { 569cdf0e10cSrcweir 570cdf0e10cSrcweir void 571cdf0e10cSrcweir WriteNodeHierarchy( csi::xml::Element & o_rOut, 572cdf0e10cSrcweir const OuputPage_Environment & i_rEnv, 573cdf0e10cSrcweir const Node & i_rClass ) 574cdf0e10cSrcweir { 575cdf0e10cSrcweir typedef const Node * NodePtr; 576cdf0e10cSrcweir typedef std::vector<NodePtr> NodeList; 577cdf0e10cSrcweir 578cdf0e10cSrcweir NodeList aPositionList; 579cdf0e10cSrcweir intt nSize = i_rClass.Position()+1; 580cdf0e10cSrcweir aPositionList.reserve(nSize); 581cdf0e10cSrcweir i_rClass.FillPositionList( aPositionList ); 582cdf0e10cSrcweir 583cdf0e10cSrcweir xml::Element & 584cdf0e10cSrcweir rPre = o_rOut 585cdf0e10cSrcweir >> *new xml::AnElement("pre") 586cdf0e10cSrcweir << new html::StyleAttr("font-family:monospace;"); 587cdf0e10cSrcweir 588cdf0e10cSrcweir for ( int line = 0; line < nSize; ++line ) 589cdf0e10cSrcweir { 590cdf0e10cSrcweir char * sLine1 = new char[2 + line*5]; 591cdf0e10cSrcweir char * sLine2 = new char[1 + line*5]; 592cdf0e10cSrcweir *sLine1 = '\0'; 593cdf0e10cSrcweir *sLine2 = '\0'; 594cdf0e10cSrcweir 595cdf0e10cSrcweir bool bBaseForThisLineReached = false; 596cdf0e10cSrcweir for ( int col = 0; col < line; ++col ) 597cdf0e10cSrcweir { 598cdf0e10cSrcweir intt nDerivPos = aPositionList[col]->Derived()->Position(); 599cdf0e10cSrcweir 600cdf0e10cSrcweir if ( nDerivPos >= line ) 601cdf0e10cSrcweir strcat(sLine1, " | "); 602cdf0e10cSrcweir else 603cdf0e10cSrcweir strcat(sLine1, " "); 604cdf0e10cSrcweir 605cdf0e10cSrcweir if ( nDerivPos > line ) 606cdf0e10cSrcweir { 607cdf0e10cSrcweir strcat(sLine2, " | "); 608cdf0e10cSrcweir } 609cdf0e10cSrcweir else if ( nDerivPos == line ) 610cdf0e10cSrcweir { 611cdf0e10cSrcweir if (bBaseForThisLineReached) 612cdf0e10cSrcweir strcat(sLine2, "--+--"); 613cdf0e10cSrcweir else 614cdf0e10cSrcweir { 615cdf0e10cSrcweir bBaseForThisLineReached = true; 616cdf0e10cSrcweir strcat(sLine2, " +--"); 617cdf0e10cSrcweir } 618cdf0e10cSrcweir } 619cdf0e10cSrcweir else // nDerivPos < line 620cdf0e10cSrcweir { 621cdf0e10cSrcweir if (bBaseForThisLineReached) 622cdf0e10cSrcweir strcat(sLine2, "-----"); 623cdf0e10cSrcweir else 624cdf0e10cSrcweir strcat(sLine2, " "); 625cdf0e10cSrcweir } 626cdf0e10cSrcweir } // end for (col) 627cdf0e10cSrcweir strcat(sLine1,"\n"); 628cdf0e10cSrcweir rPre 629cdf0e10cSrcweir << sLine1 630cdf0e10cSrcweir << sLine2; 631cdf0e10cSrcweir delete [] sLine1; 632cdf0e10cSrcweir delete [] sLine2; 633cdf0e10cSrcweir 634cdf0e10cSrcweir aPositionList[line]->Write2( rPre, i_rEnv ); 635cdf0e10cSrcweir rPre << "\n"; 636cdf0e10cSrcweir } // end for (line) 637cdf0e10cSrcweir } 638cdf0e10cSrcweir 639cdf0e10cSrcweir const ary::cpp::Class * 640cdf0e10cSrcweir HereFind_Class( const ary::cpp::Gate & i_rGate, 641cdf0e10cSrcweir ary::cpp::Type_id i_nReferingTypeId ) 642cdf0e10cSrcweir { 643cdf0e10cSrcweir const ary::cpp::CodeEntity * 644cdf0e10cSrcweir pCe = i_rGate.Search_RelatedCe( i_nReferingTypeId ); 645cdf0e10cSrcweir 646cdf0e10cSrcweir if ( pCe != 0 ) 647cdf0e10cSrcweir { 648cdf0e10cSrcweir if ( ary::is_type<ary::cpp::Class>(*pCe) ) 649cdf0e10cSrcweir { 650cdf0e10cSrcweir return ary::ary_cast<ary::cpp::Class>(pCe); 651cdf0e10cSrcweir } 652cdf0e10cSrcweir else if ( ary::is_type<ary::cpp::Typedef>(*pCe) ) 653cdf0e10cSrcweir { 654cdf0e10cSrcweir const ary::cpp::Typedef * 655cdf0e10cSrcweir pTydef = ary::ary_cast<ary::cpp::Typedef>(pCe); 656cdf0e10cSrcweir return HereFind_Class( i_rGate, pTydef->DescribingType() ); 657cdf0e10cSrcweir } 658cdf0e10cSrcweir } 659cdf0e10cSrcweir 660cdf0e10cSrcweir static const ary::cpp::Class aClassNull_( "Base class not found", 661cdf0e10cSrcweir ary::cpp::Ce_id(0), 662cdf0e10cSrcweir ary::cpp::PROTECT_global, 663cdf0e10cSrcweir ary::loc::Le_id(0), 664cdf0e10cSrcweir ary::cpp::CK_class ); 665cdf0e10cSrcweir return &aClassNull_; 666cdf0e10cSrcweir } 667cdf0e10cSrcweir 668cdf0e10cSrcweir 669cdf0e10cSrcweir 670cdf0e10cSrcweir //********************* Node ***********************// 671cdf0e10cSrcweir 672cdf0e10cSrcweir Node::Node( const ary::cpp::Class & i_rClass, 673cdf0e10cSrcweir ary::cpp::Type_id i_nClassType, 674cdf0e10cSrcweir const ary::cpp::Gate & i_rGate, 675cdf0e10cSrcweir intt i_nPositionOffset, 676cdf0e10cSrcweir Node * io_pDerived, 677cdf0e10cSrcweir ary::cpp::E_Protection i_eProtection, 678cdf0e10cSrcweir bool i_bVirtual ) 679cdf0e10cSrcweir : aBases(), 680cdf0e10cSrcweir nCountBases(0), 681cdf0e10cSrcweir pDerived(io_pDerived), 682cdf0e10cSrcweir pClass(&i_rClass), 683cdf0e10cSrcweir nClassType(i_nClassType), 684cdf0e10cSrcweir eProtection(i_eProtection), 685cdf0e10cSrcweir bVirtual(i_bVirtual), 686cdf0e10cSrcweir nPosition(i_nPositionOffset) 687cdf0e10cSrcweir { 688cdf0e10cSrcweir typedef ary::cpp::List_Bases BList; 689cdf0e10cSrcweir 690cdf0e10cSrcweir for ( BList::const_iterator it = i_rClass.BaseClasses().begin(); 691cdf0e10cSrcweir it != i_rClass.BaseClasses().end(); 692cdf0e10cSrcweir ++it ) 693cdf0e10cSrcweir { 694cdf0e10cSrcweir const ary::cpp::Class * 695cdf0e10cSrcweir pBaseClass = HereFind_Class( i_rGate, (*it).nId ); 696cdf0e10cSrcweir 697cdf0e10cSrcweir Dyn<Node> 698cdf0e10cSrcweir pBase( new Node(*pBaseClass, 699cdf0e10cSrcweir (*it).nId, 700cdf0e10cSrcweir i_rGate, 701cdf0e10cSrcweir nPosition, 702cdf0e10cSrcweir this, 703cdf0e10cSrcweir (*it).eProtection, 704cdf0e10cSrcweir (*it).eVirtuality == ary::cpp::VIRTUAL_virtual) 705cdf0e10cSrcweir ); 706cdf0e10cSrcweir IncrBaseCount(); 707cdf0e10cSrcweir nPosition += pBase->BaseCount() + 1; 708cdf0e10cSrcweir aBases.push_back( pBase.Release() ); 709cdf0e10cSrcweir } // end for 710cdf0e10cSrcweir } 711cdf0e10cSrcweir 712cdf0e10cSrcweir Node::~Node() 713cdf0e10cSrcweir { 714cdf0e10cSrcweir } 715cdf0e10cSrcweir 716cdf0e10cSrcweir void 717cdf0e10cSrcweir Node::FillPositionList( std::vector< const Node* > & o_rPositionList ) const 718cdf0e10cSrcweir { 719cdf0e10cSrcweir for ( BaseList::const_iterator it = aBases.begin(); 720cdf0e10cSrcweir it != aBases.end(); 721cdf0e10cSrcweir ++it ) 722cdf0e10cSrcweir { 723cdf0e10cSrcweir (*it)->FillPositionList(o_rPositionList); 724cdf0e10cSrcweir } // end for 725cdf0e10cSrcweir 726cdf0e10cSrcweir if( o_rPositionList.size() != uintt(Position()) ) 727cdf0e10cSrcweir { 728cdf0e10cSrcweir csv_assert(false); 729cdf0e10cSrcweir } 730cdf0e10cSrcweir o_rPositionList.push_back(this); 731cdf0e10cSrcweir } 732cdf0e10cSrcweir 733cdf0e10cSrcweir void 734cdf0e10cSrcweir Node::Write2( csi::xml::Element & o_rOut, 735cdf0e10cSrcweir const OuputPage_Environment & i_rEnv ) const 736cdf0e10cSrcweir { 737cdf0e10cSrcweir if ( Derived() == 0 ) 738cdf0e10cSrcweir { 739cdf0e10cSrcweir o_rOut 740cdf0e10cSrcweir >> *new xml::AnElement("span") 741cdf0e10cSrcweir << new html::ClassAttr("btself") 742cdf0e10cSrcweir << pClass->LocalName(); 743cdf0e10cSrcweir return; 744cdf0e10cSrcweir } 745cdf0e10cSrcweir 746cdf0e10cSrcweir csi::xml::Element * 747cdf0e10cSrcweir pOut = & ( o_rOut >> *new xml::AnElement("span") ); 748cdf0e10cSrcweir switch ( eProtection ) 749cdf0e10cSrcweir { 750cdf0e10cSrcweir case ary::cpp::PROTECT_public: 751cdf0e10cSrcweir if (bVirtual) 752cdf0e10cSrcweir *pOut << new html::ClassAttr("btvpubl"); 753cdf0e10cSrcweir else 754cdf0e10cSrcweir *pOut << new html::ClassAttr("btpubl"); 755cdf0e10cSrcweir break; 756cdf0e10cSrcweir case ary::cpp::PROTECT_protected: 757cdf0e10cSrcweir if (bVirtual) 758cdf0e10cSrcweir *pOut << new html::ClassAttr("btvprot"); 759cdf0e10cSrcweir else 760cdf0e10cSrcweir *pOut << new html::ClassAttr("btprot"); 761cdf0e10cSrcweir break; 762cdf0e10cSrcweir case ary::cpp::PROTECT_private: 763cdf0e10cSrcweir if (bVirtual) 764cdf0e10cSrcweir *pOut << new html::ClassAttr("btvpriv"); 765cdf0e10cSrcweir else 766cdf0e10cSrcweir *pOut << new html::ClassAttr("btpriv"); 767cdf0e10cSrcweir break; 768cdf0e10cSrcweir default: // do nothing. 769cdf0e10cSrcweir ; 770cdf0e10cSrcweir } // end switch 771cdf0e10cSrcweir 772cdf0e10cSrcweir csi::xml::Element & rOut = *pOut; 773cdf0e10cSrcweir 774cdf0e10cSrcweir Get_LinkedTypeText( rOut, i_rEnv, nClassType, false ); 775cdf0e10cSrcweir rOut << " ("; 776cdf0e10cSrcweir if ( bVirtual ) 777cdf0e10cSrcweir rOut << "virtual "; 778cdf0e10cSrcweir switch ( eProtection ) 779cdf0e10cSrcweir { 780cdf0e10cSrcweir case ary::cpp::PROTECT_public: 781cdf0e10cSrcweir rOut << "public)"; 782cdf0e10cSrcweir break; 783cdf0e10cSrcweir case ary::cpp::PROTECT_protected: 784cdf0e10cSrcweir rOut << "protected)"; 785cdf0e10cSrcweir break; 786cdf0e10cSrcweir case ary::cpp::PROTECT_private: 787cdf0e10cSrcweir rOut << "private)"; 788cdf0e10cSrcweir break; 789cdf0e10cSrcweir default: // do nothing. 790cdf0e10cSrcweir ; 791cdf0e10cSrcweir } // end switch 792cdf0e10cSrcweir } 793cdf0e10cSrcweir 794cdf0e10cSrcweir void 795cdf0e10cSrcweir Node::IncrBaseCount() 796cdf0e10cSrcweir { 797cdf0e10cSrcweir ++nCountBases; 798cdf0e10cSrcweir if (pDerived != 0) 799cdf0e10cSrcweir pDerived->IncrBaseCount(); 800cdf0e10cSrcweir } 801cdf0e10cSrcweir 802cdf0e10cSrcweir 803cdf0e10cSrcweir } // anonymous namespace 804cdf0e10cSrcweir 805cdf0e10cSrcweir 806