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