1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 #include <precomp.h> 23 #include "hfi_module.hxx" 24 25 26 // NOT FULLY DEFINED SERVICES 27 #include <ary/idl/i_ce.hxx> 28 #include <ary/idl/i_module.hxx> 29 #include <ary/idl/ik_module.hxx> 30 #include <ary/doc/d_oldidldocu.hxx> 31 #include <ary/getncast.hxx> 32 #include <toolkit/hf_docentry.hxx> 33 #include <toolkit/hf_linachain.hxx> 34 #include <toolkit/hf_navi_sub.hxx> 35 #include <toolkit/hf_title.hxx> 36 #include "hfi_doc.hxx" 37 #include "hfi_navibar.hxx" 38 #include "hfi_tag.hxx" 39 #include "hfi_typetext.hxx" 40 #include "hi_linkhelper.hxx" 41 42 43 extern const String 44 C_sCePrefix_Module("module"); 45 46 namespace 47 { 48 49 const String 50 C_sList_NestedModules("Nested Modules"); 51 const String 52 C_sList_NestedModules_Label("NestedModules"); 53 const String 54 C_sList_Services("Services"); 55 const String 56 C_sList_Singletons("Singletons"); 57 const String 58 C_sList_Interfaces("Interfaces"); 59 const String 60 C_sList_Structs("Structs"); 61 const String 62 C_sList_Exceptions("Exceptions"); 63 const String 64 C_sList_Enums("Enums"); 65 const String 66 C_sList_Typedefs("Typedefs"); 67 const String 68 C_sList_ConstGroups("Constant Groups"); 69 const String 70 C_sList_ConstGroups_Label("ConstantGroups"); 71 72 73 enum E_SubListIndices 74 { // In case of changes, also adapt make_Navibar() !! 75 sli_NestedModules = 0, 76 sli_Services = 1, 77 sli_Singletons = 2, 78 sli_Interfaces = 3, 79 sli_Structs = 4, 80 sli_Exceptions = 5, 81 sli_Enums = 6, 82 sli_Typedefs = 7, 83 sli_ConstGroups = 8 84 }; 85 86 } //anonymous namespace 87 88 89 HF_IdlModule::HF_IdlModule( Environment & io_rEnv, 90 Xml::Element & o_rOut ) 91 : HtmlFactory_Idl(io_rEnv, &o_rOut) 92 { 93 } 94 95 HF_IdlModule::~HF_IdlModule() 96 { 97 } 98 99 typedef ary::idl::ifc_module::attr ModuleAttr; 100 101 102 void 103 HF_IdlModule::Produce_byData( const client & i_ce ) const 104 { 105 Dyn<HF_NaviSubRow> 106 pNaviSubRow( &make_Navibar(i_ce) ); 107 108 HF_TitleTable 109 aTitle(CurOut()); 110 HF_LinkedNameChain 111 aNameChain(aTitle.Add_Row()); 112 113 if ( Env().CurPosition().Depth() > 0 ) 114 { 115 aNameChain.Produce_CompleteChain_forModule(Env().CurPosition(), nameChainLinker); 116 117 StreamLock 118 sl(200); 119 aTitle.Produce_Title( sl() 120 << C_sCePrefix_Module 121 << " " 122 << i_ce.LocalName() 123 << c_str ); 124 } 125 else 126 { 127 aTitle.Produce_Title( "Global Module" ); 128 } 129 130 write_Docu(aTitle.Add_Row(), i_ce); 131 CurOut() << new Html::HorizontalLine(); 132 133 134 // Write children lists: 135 ce_ptr_list aNestedModules; 136 ce_ptr_list aServices; 137 ce_ptr_list aInterfaces; 138 ce_ptr_list aStructs; 139 ce_ptr_list aExceptions; 140 ce_ptr_list aEnums; 141 ce_ptr_list aTypedefs; 142 ce_ptr_list aConstantGroups; 143 ce_ptr_list aSingletons; 144 145 ModuleAttr::Get_AllChildrenSeparated( 146 aNestedModules, 147 aServices, 148 aInterfaces, 149 aStructs, 150 aExceptions, 151 aEnums, 152 aTypedefs, 153 aConstantGroups, 154 aSingletons, 155 Env().Data().Ces(), 156 i_ce ); 157 158 // Has this to be in the order of enum E_SubListIndices ??? 159 if (produce_ChildList(C_sList_NestedModules, C_sList_NestedModules_Label, aNestedModules )) 160 pNaviSubRow->SwitchOn(sli_NestedModules); 161 if (produce_ChildList(C_sList_Services, C_sList_Services, aServices)) 162 pNaviSubRow->SwitchOn(sli_Services); 163 if (produce_ChildList(C_sList_Singletons, C_sList_Singletons, aSingletons)) 164 pNaviSubRow->SwitchOn(sli_Singletons); 165 if (produce_ChildList(C_sList_Interfaces, C_sList_Interfaces, aInterfaces)) 166 pNaviSubRow->SwitchOn(sli_Interfaces); 167 if (produce_ChildList(C_sList_Structs, C_sList_Structs, aStructs)) 168 pNaviSubRow->SwitchOn(sli_Structs); 169 if (produce_ChildList(C_sList_Exceptions, C_sList_Exceptions, aExceptions)) 170 pNaviSubRow->SwitchOn(sli_Exceptions); 171 if (produce_ChildList(C_sList_Enums, C_sList_Enums, aEnums)) 172 pNaviSubRow->SwitchOn(sli_Enums); 173 if (produce_ChildList(C_sList_Typedefs, C_sList_Typedefs, aTypedefs)) 174 pNaviSubRow->SwitchOn(sli_Typedefs); 175 if (produce_ChildList(C_sList_ConstGroups, C_sList_ConstGroups_Label, aConstantGroups)) 176 pNaviSubRow->SwitchOn(sli_ConstGroups); 177 pNaviSubRow->Produce_Row(); 178 } 179 180 DYN HF_NaviSubRow & 181 HF_IdlModule::make_Navibar( const client & i_ce ) const 182 { 183 HF_IdlNavigationBar 184 aNaviBar(Env(), CurOut()); 185 aNaviBar.Produce_ModuleMainRow(i_ce); 186 187 DYN HF_NaviSubRow & 188 ret = aNaviBar.Add_SubRow(); 189 190 // Has to be in the order of E_SubListIndices: 191 ret.AddItem(C_sList_NestedModules, C_sList_NestedModules_Label, false); 192 ret.AddItem(C_sList_Services, C_sList_Services, false); 193 ret.AddItem(C_sList_Singletons, C_sList_Singletons, false); 194 ret.AddItem(C_sList_Interfaces, C_sList_Interfaces, false); 195 ret.AddItem(C_sList_Structs, C_sList_Structs, false); 196 ret.AddItem(C_sList_Exceptions, C_sList_Exceptions, false); 197 ret.AddItem(C_sList_Enums, C_sList_Enums, false); 198 ret.AddItem(C_sList_Typedefs, C_sList_Typedefs, false); 199 ret.AddItem(C_sList_ConstGroups, C_sList_ConstGroups_Label, false); 200 201 CurOut() << new Html::HorizontalLine(); 202 return ret; 203 } 204 205 bool 206 HF_IdlModule::produce_ChildList( const String & i_sName, 207 const String & i_sLabel, 208 const ce_ptr_list & i_list ) const 209 { 210 if ( i_list.size() == 0 ) 211 return false; 212 213 HF_SubTitleTable 214 aTable( CurOut(), 215 i_sLabel, 216 i_sName, 217 2 ); 218 219 ce_ptr_list::const_iterator 220 itEnd = i_list.end(); 221 for ( ce_ptr_list::const_iterator it = i_list.begin(); 222 it != itEnd; 223 ++it ) 224 { 225 Xml::Element & 226 rRow = aTable.Add_Row(); 227 produce_Link(rRow, *it); 228 produce_LinkDoc(rRow, *it); 229 } // end for 230 231 return true; 232 } 233 234 void 235 HF_IdlModule::produce_Link( Xml::Element & o_row, 236 const client * i_ce ) const 237 { 238 csv_assert(i_ce != 0); 239 Xml::Element & 240 rCell = o_row 241 >> *new Html::TableCell 242 << new Html::ClassAttr(C_sCellStyle_SummaryLeft); 243 244 if ( NOT ary::is_type<ary::idl::Module>(*i_ce) ) 245 { 246 HF_IdlTypeText 247 aText(Env(), rCell, true); 248 aText.Produce_byData(i_ce->CeId()); 249 } 250 else 251 { 252 StreamLock slBuf(100); 253 rCell 254 >> *new Html::Link( slBuf() << i_ce->LocalName() 255 << "/module-ix.html" 256 << c_str ) 257 << i_ce->LocalName(); 258 } 259 } 260 261 void 262 HF_IdlModule::produce_LinkDoc( Xml::Element & o_row, 263 const client * i_ce ) const 264 { 265 csv_assert(i_ce != 0); 266 267 // We need the cell in any case, because, the rendering may be hurt else. 268 Xml::Element & 269 rCell = o_row 270 >> *new Html::TableCell 271 << new Html::ClassAttr(C_sCellStyle_SummaryRight); 272 273 const client & 274 rCe = *i_ce; 275 const ce_info * 276 pShort = Get_IdlDocu(rCe.Docu()); 277 if ( pShort == 0 ) 278 return; 279 280 281 if (pShort->IsDeprecated()) 282 { 283 rCell << "[ DEPRECATED ]" << new Html::LineBreak; 284 } 285 if (pShort->IsOptional()) 286 { 287 rCell << "[ OPTIONAL ]" << new Html::LineBreak; 288 } 289 290 HF_IdlDocuTextDisplay 291 aShortDisplay(Env(), &rCell, *i_ce); 292 pShort->Short().DisplayAt(aShortDisplay); 293 } 294