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_service.hxx" 24cdf0e10cSrcweir 25cdf0e10cSrcweir 26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES 27cdf0e10cSrcweir #include <ary/idl/i_ce.hxx> 28cdf0e10cSrcweir #include <ary/idl/ik_property.hxx> 29cdf0e10cSrcweir #include <ary/idl/ik_service.hxx> 30cdf0e10cSrcweir #include <toolkit/hf_docentry.hxx> 31cdf0e10cSrcweir #include <toolkit/hf_linachain.hxx> 32cdf0e10cSrcweir #include <toolkit/hf_navi_sub.hxx> 33cdf0e10cSrcweir #include <toolkit/hf_title.hxx> 34cdf0e10cSrcweir #include "hfi_doc.hxx" 35cdf0e10cSrcweir #include "hfi_navibar.hxx" 36cdf0e10cSrcweir #include "hfi_property.hxx" 37cdf0e10cSrcweir #include "hfi_tag.hxx" 38cdf0e10cSrcweir #include "hfi_typetext.hxx" 39cdf0e10cSrcweir #include "hi_linkhelper.hxx" 40cdf0e10cSrcweir 41cdf0e10cSrcweir 42cdf0e10cSrcweir 43cdf0e10cSrcweir 44cdf0e10cSrcweir extern const String 45cdf0e10cSrcweir C_sCePrefix_Service("service"); 46cdf0e10cSrcweir 47cdf0e10cSrcweir namespace 48cdf0e10cSrcweir { 49cdf0e10cSrcweir 50cdf0e10cSrcweir const String 51cdf0e10cSrcweir C_sList_IncludedServices("Services' Summary"); 52cdf0e10cSrcweir const String 53cdf0e10cSrcweir C_sList_IncludedServices_Heading("Included Services - Summary"); 54cdf0e10cSrcweir const String 55cdf0e10cSrcweir C_sList_IncludedServices_Label("ServicesSummary"); 56cdf0e10cSrcweir const String 57cdf0e10cSrcweir C_sList_IncludedServicesDetails("Services' Details"); 58cdf0e10cSrcweir const String 59cdf0e10cSrcweir C_sList_IncludedServicesDetails_Heading("Included Services - Details"); 60cdf0e10cSrcweir const String 61cdf0e10cSrcweir C_sList_IncludedServicesDetails_Label("ServicesDetails"); 62cdf0e10cSrcweir const String 63cdf0e10cSrcweir C_sList_ExportedInterfaces("Interfaces' Summary"); 64cdf0e10cSrcweir const String 65cdf0e10cSrcweir C_sList_ExportedInterfaces_Heading("Exported Interfaces - Summary"); 66cdf0e10cSrcweir const String 67cdf0e10cSrcweir C_sList_ExportedInterfaces_Label("InterfacesSummary"); 68cdf0e10cSrcweir const String 69cdf0e10cSrcweir C_sList_ExportedInterfacesDetails("Interfaces' Details"); 70cdf0e10cSrcweir const String 71cdf0e10cSrcweir C_sList_ExportedInterfacesDetails_Heading("Exported Interfaces - Details"); 72cdf0e10cSrcweir const String 73cdf0e10cSrcweir C_sList_ExportedInterfacesDetails_Label("InterfacesDetails"); 74cdf0e10cSrcweir const String 75cdf0e10cSrcweir C_sList_Properties("Properties' Summary"); 76cdf0e10cSrcweir const String 77cdf0e10cSrcweir C_sList_Properties_Label("PropertiesSummary"); 78cdf0e10cSrcweir const String 79cdf0e10cSrcweir C_sList_PropertiesDetails("Properties' Details"); 80cdf0e10cSrcweir const String 81cdf0e10cSrcweir C_sList_PropertiesDetails_Label("PropertiesDetails"); 82cdf0e10cSrcweir 83cdf0e10cSrcweir 84cdf0e10cSrcweir enum E_SubListIndices 85cdf0e10cSrcweir { 86cdf0e10cSrcweir sli_IncludedServicesSummary = 0, 87cdf0e10cSrcweir sli_InterfacesSummary = 1, 88cdf0e10cSrcweir sli_PropertiesSummary = 2, 89cdf0e10cSrcweir sli_IncludedServicesDetails = 3, 90cdf0e10cSrcweir sli_InterfacesDetails = 4, 91cdf0e10cSrcweir sli_PropertiesDetails = 5 92cdf0e10cSrcweir }; 93cdf0e10cSrcweir 94cdf0e10cSrcweir } //anonymous namespace 95cdf0e10cSrcweir 96cdf0e10cSrcweir 97cdf0e10cSrcweir HF_IdlService::HF_IdlService( Environment & io_rEnv, 98cdf0e10cSrcweir Xml::Element & o_rOut ) 99cdf0e10cSrcweir : HtmlFactory_Idl(io_rEnv, &o_rOut) 100cdf0e10cSrcweir { 101cdf0e10cSrcweir } 102cdf0e10cSrcweir 103cdf0e10cSrcweir HF_IdlService::~HF_IdlService() 104cdf0e10cSrcweir { 105cdf0e10cSrcweir 106cdf0e10cSrcweir } 107cdf0e10cSrcweir 108cdf0e10cSrcweir typedef ::ary::idl::ifc_service::attr 109cdf0e10cSrcweir ServiceAttr; 110cdf0e10cSrcweir typedef ::ary::Dyn_StdConstIterator< ::ary::idl::CommentedRelation > 111cdf0e10cSrcweir dyn_comref_list; 112cdf0e10cSrcweir 113cdf0e10cSrcweir void 114cdf0e10cSrcweir HF_IdlService::produce_CommentedRelations( const client & i_ce, 115cdf0e10cSrcweir comref_list & it_list, 116cdf0e10cSrcweir const String & i_summaryTitle, 117cdf0e10cSrcweir const String & i_summaryLabel, 118cdf0e10cSrcweir const String & i_detailsTitle, 119cdf0e10cSrcweir const String & i_detailsLabel, 120cdf0e10cSrcweir const E_DocType i_docType ) const 121cdf0e10cSrcweir { 122cdf0e10cSrcweir csv_assert( it_list ); 123cdf0e10cSrcweir 124cdf0e10cSrcweir bool bSummaryOnly = ( i_docType == doctype_summaryOnly ); 125cdf0e10cSrcweir HF_SubTitleTable aTable( 126cdf0e10cSrcweir CurOut(), 127cdf0e10cSrcweir bSummaryOnly ? i_summaryLabel : i_detailsLabel, 128cdf0e10cSrcweir bSummaryOnly ? i_summaryTitle : i_detailsTitle, 129cdf0e10cSrcweir 2 ); 130cdf0e10cSrcweir 131cdf0e10cSrcweir for ( ; it_list; ++it_list ) 132cdf0e10cSrcweir { 133cdf0e10cSrcweir Xml::Element & 134cdf0e10cSrcweir rRow = aTable.Add_Row(); 135cdf0e10cSrcweir 136cdf0e10cSrcweir if ( bSummaryOnly ) 137cdf0e10cSrcweir { 138cdf0e10cSrcweir produce_Link(rRow, (*it_list).Type()); 139cdf0e10cSrcweir produce_LinkSummary(i_ce, rRow, *it_list); 140cdf0e10cSrcweir } 141cdf0e10cSrcweir else 142cdf0e10cSrcweir { 143cdf0e10cSrcweir HF_IdlCommentedRelationElement 144cdf0e10cSrcweir aRelation( Env(), aTable, *it_list ); 145cdf0e10cSrcweir aRelation.Produce_byData( i_ce ); 146cdf0e10cSrcweir } 147cdf0e10cSrcweir } // end for 148cdf0e10cSrcweir } 149cdf0e10cSrcweir 150cdf0e10cSrcweir void 151cdf0e10cSrcweir HF_IdlService::Produce_byData( const client & i_ce ) const 152cdf0e10cSrcweir { 153cdf0e10cSrcweir Dyn<HF_NaviSubRow> 154cdf0e10cSrcweir pNaviSubRow( &make_Navibar(i_ce) ); 155cdf0e10cSrcweir 156cdf0e10cSrcweir HF_TitleTable 157cdf0e10cSrcweir aTitle(CurOut()); 158cdf0e10cSrcweir HF_LinkedNameChain 159cdf0e10cSrcweir aNameChain(aTitle.Add_Row()); 160cdf0e10cSrcweir 161cdf0e10cSrcweir aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); 162cdf0e10cSrcweir produce_Title(aTitle, C_sCePrefix_Service, i_ce); 163cdf0e10cSrcweir 164cdf0e10cSrcweir write_Docu(aTitle.Add_Row(), i_ce); 165cdf0e10cSrcweir CurOut() << new Html::HorizontalLine(); 166cdf0e10cSrcweir 167cdf0e10cSrcweir // produce ... 168cdf0e10cSrcweir // - included services: summary 169cdf0e10cSrcweir dyn_comref_list dpIncludedServices; 170cdf0e10cSrcweir ServiceAttr::Get_IncludedServices(dpIncludedServices, i_ce); 171cdf0e10cSrcweir if ( (*dpIncludedServices).operator bool() ) 172cdf0e10cSrcweir { 173cdf0e10cSrcweir produce_CommentedRelations( i_ce, *dpIncludedServices, 174cdf0e10cSrcweir C_sList_IncludedServices_Heading, 175cdf0e10cSrcweir C_sList_IncludedServices_Label, 176cdf0e10cSrcweir C_sList_IncludedServicesDetails_Heading, 177cdf0e10cSrcweir C_sList_IncludedServicesDetails_Label, 178cdf0e10cSrcweir doctype_summaryOnly ); 179cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_IncludedServicesSummary); 180cdf0e10cSrcweir } 181cdf0e10cSrcweir 182cdf0e10cSrcweir // - exported interfaces: summary 183cdf0e10cSrcweir dyn_comref_list dpExportedInterfaces; 184cdf0e10cSrcweir ServiceAttr::Get_ExportedInterfaces(dpExportedInterfaces, i_ce); 185cdf0e10cSrcweir if ( (*dpExportedInterfaces).operator bool() ) 186cdf0e10cSrcweir { 187cdf0e10cSrcweir produce_CommentedRelations( i_ce, *dpExportedInterfaces, 188cdf0e10cSrcweir C_sList_ExportedInterfaces_Heading, 189cdf0e10cSrcweir C_sList_ExportedInterfaces_Label, 190cdf0e10cSrcweir C_sList_ExportedInterfacesDetails_Heading, 191cdf0e10cSrcweir C_sList_ExportedInterfacesDetails_Label, 192cdf0e10cSrcweir doctype_summaryOnly ); 193cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_InterfacesSummary); 194cdf0e10cSrcweir } 195cdf0e10cSrcweir 196cdf0e10cSrcweir // - supported properties: summary 197cdf0e10cSrcweir dyn_ce_list dpProperties; 198cdf0e10cSrcweir ServiceAttr::Get_Properties(dpProperties, i_ce); 199cdf0e10cSrcweir if ( (*dpProperties).operator bool() ) 200cdf0e10cSrcweir { 201cdf0e10cSrcweir produce_Members( *dpProperties, 202cdf0e10cSrcweir C_sList_Properties, 203cdf0e10cSrcweir C_sList_Properties_Label, 204cdf0e10cSrcweir C_sList_PropertiesDetails, 205cdf0e10cSrcweir C_sList_PropertiesDetails_Label, 206cdf0e10cSrcweir viewtype_summary ); 207cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_PropertiesSummary); 208cdf0e10cSrcweir } 209cdf0e10cSrcweir 210cdf0e10cSrcweir // - included services: details 211cdf0e10cSrcweir ServiceAttr::Get_IncludedServices(dpIncludedServices, i_ce); 212cdf0e10cSrcweir if ( (*dpIncludedServices).operator bool() ) 213cdf0e10cSrcweir { 214cdf0e10cSrcweir produce_CommentedRelations( i_ce, *dpIncludedServices, 215cdf0e10cSrcweir C_sList_IncludedServices_Heading, 216cdf0e10cSrcweir C_sList_IncludedServices_Label, 217cdf0e10cSrcweir C_sList_IncludedServicesDetails_Heading, 218cdf0e10cSrcweir C_sList_IncludedServicesDetails_Label, 219cdf0e10cSrcweir doctype_complete ); 220cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_IncludedServicesDetails); 221cdf0e10cSrcweir } 222cdf0e10cSrcweir 223cdf0e10cSrcweir // - exported interfaces: details 224cdf0e10cSrcweir ServiceAttr::Get_ExportedInterfaces(dpExportedInterfaces, i_ce); 225cdf0e10cSrcweir if ( (*dpExportedInterfaces).operator bool() ) 226cdf0e10cSrcweir { 227cdf0e10cSrcweir produce_CommentedRelations( i_ce, *dpExportedInterfaces, 228cdf0e10cSrcweir C_sList_ExportedInterfaces_Heading, 229cdf0e10cSrcweir C_sList_ExportedInterfaces_Label, 230cdf0e10cSrcweir C_sList_ExportedInterfacesDetails_Heading, 231cdf0e10cSrcweir C_sList_ExportedInterfacesDetails_Label, 232cdf0e10cSrcweir doctype_complete ); 233cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_InterfacesDetails); 234cdf0e10cSrcweir } 235cdf0e10cSrcweir 236cdf0e10cSrcweir // supported properties: details 237cdf0e10cSrcweir ServiceAttr::Get_Properties(dpProperties, i_ce); 238cdf0e10cSrcweir if ( (*dpProperties).operator bool() ) 239cdf0e10cSrcweir { 240cdf0e10cSrcweir produce_Members( *dpProperties, 241cdf0e10cSrcweir C_sList_Properties, 242cdf0e10cSrcweir C_sList_Properties_Label, 243cdf0e10cSrcweir C_sList_PropertiesDetails, 244cdf0e10cSrcweir C_sList_PropertiesDetails_Label, 245cdf0e10cSrcweir viewtype_details ); 246cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_PropertiesDetails); 247cdf0e10cSrcweir } 248cdf0e10cSrcweir 249cdf0e10cSrcweir pNaviSubRow->Produce_Row(); 250cdf0e10cSrcweir CurOut() << new Xml::XmlCode("<br> "); 251cdf0e10cSrcweir } 252cdf0e10cSrcweir 253cdf0e10cSrcweir typedef ary::idl::ifc_property::attr PropertyAttr; 254cdf0e10cSrcweir 255cdf0e10cSrcweir void 256cdf0e10cSrcweir HF_IdlService::produce_SummaryDeclaration( Xml::Element & o_row, 257cdf0e10cSrcweir const client & i_property ) const 258cdf0e10cSrcweir { 259cdf0e10cSrcweir // KORR_FUTURE 260cdf0e10cSrcweir // Put this in to HF_IdlProperty! 261cdf0e10cSrcweir 262cdf0e10cSrcweir Xml::Element & 263cdf0e10cSrcweir rCell = o_row 264cdf0e10cSrcweir >> *new Html::TableCell 265cdf0e10cSrcweir << new Html::ClassAttr( C_sCellStyle_SummaryLeft ); 266cdf0e10cSrcweir 267cdf0e10cSrcweir if (PropertyAttr::HasAnyStereotype(i_property)) 268cdf0e10cSrcweir { 269cdf0e10cSrcweir rCell << "[ "; 270cdf0e10cSrcweir if (PropertyAttr::IsReadOnly(i_property)) 271cdf0e10cSrcweir rCell << "readonly "; 272cdf0e10cSrcweir if (PropertyAttr::IsBound(i_property)) 273cdf0e10cSrcweir rCell << "bound "; 274cdf0e10cSrcweir if (PropertyAttr::IsConstrained(i_property)) 275cdf0e10cSrcweir rCell << "constrained "; 276cdf0e10cSrcweir if (PropertyAttr::IsMayBeAmbiguous(i_property)) 277cdf0e10cSrcweir rCell << "maybeambiguous "; 278cdf0e10cSrcweir if (PropertyAttr::IsMayBeDefault(i_property)) 279cdf0e10cSrcweir rCell << "maybedefault "; 280cdf0e10cSrcweir if (PropertyAttr::IsMayBeVoid(i_property)) 281cdf0e10cSrcweir rCell << "maybevoid "; 282cdf0e10cSrcweir if (PropertyAttr::IsRemovable(i_property)) 283cdf0e10cSrcweir rCell << "removable "; 284cdf0e10cSrcweir if (PropertyAttr::IsTransient(i_property)) 285cdf0e10cSrcweir rCell << "transient "; 286cdf0e10cSrcweir rCell << "] "; 287cdf0e10cSrcweir } // end if 288cdf0e10cSrcweir 289cdf0e10cSrcweir HF_IdlTypeText 290cdf0e10cSrcweir aType( Env(), rCell, true ); 291cdf0e10cSrcweir aType.Produce_byData( PropertyAttr::Type(i_property) ); 292cdf0e10cSrcweir 293cdf0e10cSrcweir StreamLock aLocalLink(100); 294cdf0e10cSrcweir aLocalLink() << "#" << i_property.LocalName(); 295cdf0e10cSrcweir rCell 296cdf0e10cSrcweir << new Html::LineBreak 297cdf0e10cSrcweir >> *new Html::Link( aLocalLink().c_str() ) 298cdf0e10cSrcweir << i_property.LocalName(); 299cdf0e10cSrcweir } 300cdf0e10cSrcweir 301cdf0e10cSrcweir DYN HF_NaviSubRow & 302cdf0e10cSrcweir HF_IdlService::make_Navibar( const client & i_ce ) const 303cdf0e10cSrcweir { 304cdf0e10cSrcweir HF_IdlNavigationBar 305cdf0e10cSrcweir aNaviBar(Env(), CurOut()); 306cdf0e10cSrcweir aNaviBar.Produce_CeMainRow(i_ce); 307cdf0e10cSrcweir 308cdf0e10cSrcweir DYN HF_NaviSubRow & 309cdf0e10cSrcweir ret = aNaviBar.Add_SubRow(); 310cdf0e10cSrcweir ret.AddItem(C_sList_IncludedServices, C_sList_IncludedServices_Label, false); 311cdf0e10cSrcweir ret.AddItem(C_sList_ExportedInterfaces, C_sList_ExportedInterfaces_Label, false); 312cdf0e10cSrcweir ret.AddItem(C_sList_Properties, C_sList_Properties_Label, false); 313cdf0e10cSrcweir ret.AddItem(C_sList_IncludedServicesDetails, C_sList_IncludedServicesDetails_Label, false); 314cdf0e10cSrcweir ret.AddItem(C_sList_ExportedInterfacesDetails, C_sList_ExportedInterfacesDetails_Label, false); 315cdf0e10cSrcweir ret.AddItem(C_sList_PropertiesDetails, C_sList_PropertiesDetails_Label, false); 316cdf0e10cSrcweir 317cdf0e10cSrcweir CurOut() << new Html::HorizontalLine(); 318cdf0e10cSrcweir return ret; 319cdf0e10cSrcweir } 320cdf0e10cSrcweir 321cdf0e10cSrcweir void 322cdf0e10cSrcweir HF_IdlService::produce_Link( Xml::Element & o_row, 323cdf0e10cSrcweir type_id i_type ) const 324cdf0e10cSrcweir { 325cdf0e10cSrcweir Xml::Element & 326cdf0e10cSrcweir rCell = o_row 327cdf0e10cSrcweir >> *new Html::TableCell 328cdf0e10cSrcweir << new Html::ClassAttr(C_sCellStyle_SummaryLeft); 329cdf0e10cSrcweir HF_IdlTypeText 330cdf0e10cSrcweir aText(Env(), rCell, true); 331cdf0e10cSrcweir aText.Produce_byData(i_type); 332cdf0e10cSrcweir } 333cdf0e10cSrcweir 334cdf0e10cSrcweir void 335cdf0e10cSrcweir HF_IdlService::produce_LinkSummary( const client & i_ce, 336cdf0e10cSrcweir Xml::Element & o_row, 337cdf0e10cSrcweir const comref & i_commentedRef ) const 338cdf0e10cSrcweir { 339cdf0e10cSrcweir Xml::Element & 340cdf0e10cSrcweir rCell = o_row 341cdf0e10cSrcweir >> *new Html::TableCell 342cdf0e10cSrcweir << new Html::ClassAttr(C_sCellStyle_SummaryRight); 343cdf0e10cSrcweir 344cdf0e10cSrcweir HF_IdlCommentedRelationElement::produce_LinkDoc( Env(), i_ce, rCell, i_commentedRef, doctype_summaryOnly ); 345cdf0e10cSrcweir } 346cdf0e10cSrcweir 347cdf0e10cSrcweir void 348cdf0e10cSrcweir HF_IdlService::produce_MemberDetails( HF_SubTitleTable & o_table, 349cdf0e10cSrcweir const client & i_ce ) const 350cdf0e10cSrcweir { 351cdf0e10cSrcweir HF_IdlProperty 352cdf0e10cSrcweir aProperty( Env(), o_table); 353cdf0e10cSrcweir aProperty.Produce_byData( i_ce ); 354cdf0e10cSrcweir } 355cdf0e10cSrcweir 356cdf0e10cSrcweir 357cdf0e10cSrcweir 358