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
10*0841af79SAndrew Rist  *
11*0841af79SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*0841af79SAndrew Rist  *
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.
19*0841af79SAndrew Rist  *
20*0841af79SAndrew Rist  *************************************************************/
21cdf0e10cSrcweir 
22cdf0e10cSrcweir #include <precomp.h>
23cdf0e10cSrcweir #include "hfi_linklist.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir 
26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
27cdf0e10cSrcweir #include <ary/idl/i_ce.hxx>
28cdf0e10cSrcweir #include <ary/idl/i_gate.hxx>
29cdf0e10cSrcweir #include <ary/idl/ip_ce.hxx>
30cdf0e10cSrcweir #include <ary/idl/ip_type.hxx>
31cdf0e10cSrcweir #include <toolkit/hf_docentry.hxx>
32cdf0e10cSrcweir #include <toolkit/hf_title.hxx>
33cdf0e10cSrcweir #include "hfi_doc.hxx"
34cdf0e10cSrcweir #include "hfi_tag.hxx"
35cdf0e10cSrcweir #include "hfi_typetext.hxx"
36cdf0e10cSrcweir #include "hi_ary.hxx"
37cdf0e10cSrcweir #include "hi_env.hxx"
38cdf0e10cSrcweir 
39cdf0e10cSrcweir 
40cdf0e10cSrcweir 
41cdf0e10cSrcweir 
42cdf0e10cSrcweir //*******************           HF_CommentedLink_Table         **********************************//
43cdf0e10cSrcweir 
HF_CommentedLink_Table(Environment & io_rEnv,Xml::Element & o_rOut,const String & i_sTitle,const String & i_sLabel,bool i_bBorder)44cdf0e10cSrcweir HF_CommentedLink_Table::HF_CommentedLink_Table( Environment  &          io_rEnv,
45cdf0e10cSrcweir                                                 Xml::Element &          o_rOut,
46cdf0e10cSrcweir                                                 const String &          i_sTitle,
47cdf0e10cSrcweir                                                 const String &          i_sLabel,
48cdf0e10cSrcweir                                                 bool                    i_bBorder )
49cdf0e10cSrcweir     :    HtmlFactory_Idl(io_rEnv,&o_rOut),
50cdf0e10cSrcweir          pTable( new Html::Table( (i_bBorder ? "1" : "0"), "100%", "5", "0") ),
51cdf0e10cSrcweir          pCurLinkColumn(0),
52cdf0e10cSrcweir          pCurCommentColumn(0)
53cdf0e10cSrcweir {
54cdf0e10cSrcweir     *pTable
55cdf0e10cSrcweir         << new Html::ClassAttr("commentedlinks");
56cdf0e10cSrcweir 
57cdf0e10cSrcweir     CurOut()
58cdf0e10cSrcweir         >> *new Html::Label(i_sLabel)
59cdf0e10cSrcweir            << new Html::LineBreak;
60cdf0e10cSrcweir     CurOut()
61cdf0e10cSrcweir         << pTable;
62cdf0e10cSrcweir //    HF_SubTitle aTitle(*pTable);
63cdf0e10cSrcweir //    aTitle.Produce_it(i_sTitle);
64cdf0e10cSrcweir }
65cdf0e10cSrcweir 
~HF_CommentedLink_Table()66cdf0e10cSrcweir HF_CommentedLink_Table::~HF_CommentedLink_Table()
67cdf0e10cSrcweir {
68cdf0e10cSrcweir }
69cdf0e10cSrcweir 
70cdf0e10cSrcweir void
Add_Line()71cdf0e10cSrcweir HF_CommentedLink_Table::Add_Line()
72cdf0e10cSrcweir {
73cdf0e10cSrcweir     Html::TableRow &
74cdf0e10cSrcweir         rRow = pTable->AddRow();
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     pCurLinkColumn = & (rRow.AddCell()
77cdf0e10cSrcweir                             << new Html::WidthAttr("30%")
78cdf0e10cSrcweir                             << new Xml::AnAttribute("valign","top") );
79cdf0e10cSrcweir     pCurCommentColumn  = & rRow.AddCell();
80cdf0e10cSrcweir }
81cdf0e10cSrcweir 
82cdf0e10cSrcweir Xml::Element &
Cur_LinkColumn()83cdf0e10cSrcweir HF_CommentedLink_Table::Cur_LinkColumn()
84cdf0e10cSrcweir {
85cdf0e10cSrcweir     csv_assert(pCurLinkColumn != 0);
86cdf0e10cSrcweir     return *pCurLinkColumn;
87cdf0e10cSrcweir }
88cdf0e10cSrcweir 
89cdf0e10cSrcweir Xml::Element &
Cur_CommentColumn()90cdf0e10cSrcweir HF_CommentedLink_Table::Cur_CommentColumn()
91cdf0e10cSrcweir {
92cdf0e10cSrcweir     csv_assert(pCurCommentColumn != 0);
93cdf0e10cSrcweir     return *pCurCommentColumn;
94cdf0e10cSrcweir }
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 
97cdf0e10cSrcweir //*******************           HF_MemberTable         **********************************//
98cdf0e10cSrcweir 
HF_MemberTable(Environment & io_rEnv,Xml::Element & o_rOut,const String & i_sTitle,const String & i_sLabel,bool i_bInline)99cdf0e10cSrcweir HF_MemberTable::HF_MemberTable( Environment  &      io_rEnv,
100cdf0e10cSrcweir                                 Xml::Element &      o_rOut,
101cdf0e10cSrcweir                                 const String &      i_sTitle,
102cdf0e10cSrcweir                                 const String &      i_sLabel,
103cdf0e10cSrcweir                                 bool                i_bInline )
104cdf0e10cSrcweir     :    HtmlFactory_Idl(io_rEnv,&o_rOut),
105cdf0e10cSrcweir          pTable( new Html::Table("1", "100%", "5", "0") ),
106cdf0e10cSrcweir          pCurDeclaration(0),
107cdf0e10cSrcweir          pCurDescription(0),
108cdf0e10cSrcweir          bInline(i_bInline)
109cdf0e10cSrcweir {
110cdf0e10cSrcweir     *pTable
111cdf0e10cSrcweir         << new Html::ClassAttr("memberlist");
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     CurOut()
114cdf0e10cSrcweir         >> *new Html::Label(i_sLabel)
115cdf0e10cSrcweir            << new Html::LineBreak;
116cdf0e10cSrcweir     CurOut()
117cdf0e10cSrcweir         << pTable;
118cdf0e10cSrcweir //    HF_SubTitle aTitle(*pTable);
119cdf0e10cSrcweir //    aTitle.Produce_it(i_sTitle);
120cdf0e10cSrcweir }
121cdf0e10cSrcweir 
~HF_MemberTable()122cdf0e10cSrcweir HF_MemberTable::~HF_MemberTable()
123cdf0e10cSrcweir {
124cdf0e10cSrcweir }
125cdf0e10cSrcweir 
126cdf0e10cSrcweir void
Add_Line()127cdf0e10cSrcweir HF_MemberTable::Add_Line()
128cdf0e10cSrcweir {
129cdf0e10cSrcweir     if (bInline)
130cdf0e10cSrcweir     {
131cdf0e10cSrcweir         Html::TableRow & rRow = pTable->AddRow();
132cdf0e10cSrcweir 
133cdf0e10cSrcweir         pCurDeclaration = &( rRow.AddCell()
134cdf0e10cSrcweir                                 << new Xml::AnAttribute("valign","top")
135cdf0e10cSrcweir                                 << new Html::WidthAttr("30%") );
136cdf0e10cSrcweir         pCurDescription = & rRow.AddCell();
137cdf0e10cSrcweir     }
138cdf0e10cSrcweir     else
139cdf0e10cSrcweir     {
140cdf0e10cSrcweir         Html::DefList *
141cdf0e10cSrcweir             pMemberSpace = new Html::DefList;
142cdf0e10cSrcweir         *pMemberSpace
143cdf0e10cSrcweir             << new Html::ClassAttr("member");
144cdf0e10cSrcweir 
145cdf0e10cSrcweir         pTable->AddRow().AddCell() << pMemberSpace;
146cdf0e10cSrcweir 
147cdf0e10cSrcweir         pCurDeclaration =
148cdf0e10cSrcweir             & ( *pMemberSpace
149cdf0e10cSrcweir                     >> *new Html::DefListTerm
150cdf0e10cSrcweir                         << new Html::ClassAttr("member") );
151cdf0e10cSrcweir         pCurDescription =
152cdf0e10cSrcweir             & ( *pMemberSpace
153cdf0e10cSrcweir                     >> *new Html::DefListDefinition()
154cdf0e10cSrcweir                         << new Html::ClassAttr("member") );
155cdf0e10cSrcweir     }
156cdf0e10cSrcweir }
157cdf0e10cSrcweir 
158cdf0e10cSrcweir Xml::Element &
Cur_Declaration()159cdf0e10cSrcweir HF_MemberTable::Cur_Declaration()
160cdf0e10cSrcweir {
161cdf0e10cSrcweir     csv_assert(pCurDeclaration != 0);
162cdf0e10cSrcweir     return *pCurDeclaration;
163cdf0e10cSrcweir }
164cdf0e10cSrcweir 
165cdf0e10cSrcweir Xml::Element &
Cur_Description()166cdf0e10cSrcweir HF_MemberTable::Cur_Description()
167cdf0e10cSrcweir {
168cdf0e10cSrcweir     csv_assert(pCurDescription != 0);
169cdf0e10cSrcweir     return *pCurDescription;
170cdf0e10cSrcweir }
171cdf0e10cSrcweir 
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 
174cdf0e10cSrcweir //*******************           HF_IdlLinkList         **********************************//
175cdf0e10cSrcweir 
HF_IdlLinkList(Environment & io_rEnv,Xml::Element * o_pOut)176cdf0e10cSrcweir HF_IdlLinkList::HF_IdlLinkList( Environment  &   io_rEnv,
177cdf0e10cSrcweir                                 Xml::Element *   o_pOut )
178cdf0e10cSrcweir     :    HtmlFactory_Idl(io_rEnv,o_pOut)
179cdf0e10cSrcweir {
180cdf0e10cSrcweir }
181cdf0e10cSrcweir 
~HF_IdlLinkList()182cdf0e10cSrcweir HF_IdlLinkList::~HF_IdlLinkList()
183cdf0e10cSrcweir {
184cdf0e10cSrcweir }
185cdf0e10cSrcweir 
186cdf0e10cSrcweir void
Produce_NamespaceMembers(const String & i_sTitle,const String & i_sLabel,const std::vector<ary::idl::Ce_id> & i_rList,bool i_bNestedNamespaces) const187cdf0e10cSrcweir HF_IdlLinkList::Produce_NamespaceMembers( const String &                        i_sTitle,
188cdf0e10cSrcweir                                           const String &                        i_sLabel,
189cdf0e10cSrcweir                                           const std::vector<ary::idl::Ce_id> &  i_rList,
190cdf0e10cSrcweir                                           bool                                  i_bNestedNamespaces ) const
191cdf0e10cSrcweir {
192cdf0e10cSrcweir     HF_CommentedLink_Table
193cdf0e10cSrcweir         aTableMaker( Env(), CurOut(),
194cdf0e10cSrcweir                      i_sTitle, i_sLabel,
195cdf0e10cSrcweir                      true );
196cdf0e10cSrcweir 
197cdf0e10cSrcweir     std::vector<ary::idl::Ce_id>::const_iterator itEnd = i_rList.end();
198cdf0e10cSrcweir     for ( std::vector<ary::idl::Ce_id>::const_iterator it = i_rList.begin();
199cdf0e10cSrcweir           it != itEnd;
200cdf0e10cSrcweir           ++it )
201cdf0e10cSrcweir     {
202cdf0e10cSrcweir         static String   sEntryName;
203cdf0e10cSrcweir         static String   sEntryLink;
204cdf0e10cSrcweir         const ce_info *
205cdf0e10cSrcweir                         pDocu = 0;
206cdf0e10cSrcweir         Get_EntryData_NamespaceMembers( sEntryName, sEntryLink, pDocu, *it, i_bNestedNamespaces );
207cdf0e10cSrcweir         aTableMaker.Add_Line();
208cdf0e10cSrcweir 
209cdf0e10cSrcweir         aTableMaker.Cur_LinkColumn()
210cdf0e10cSrcweir            >> *new Html::Link(sEntryLink)
211cdf0e10cSrcweir               << sEntryName;
212cdf0e10cSrcweir 
213cdf0e10cSrcweir         if ( pDocu != 0 )
214cdf0e10cSrcweir         {
215cdf0e10cSrcweir             HF_IdlShortDocu
216cdf0e10cSrcweir                 aTextDisplay(Env(), aTableMaker.Cur_CommentColumn() );
217cdf0e10cSrcweir             aTextDisplay.Produce_byData( pDocu );
218cdf0e10cSrcweir         }
219cdf0e10cSrcweir     }   // end for
220cdf0e10cSrcweir }
221cdf0e10cSrcweir 
222cdf0e10cSrcweir void
Produce_GlobalLinks(const String & i_sTitle,const String & i_sLabel,ce_list & i_rList) const223cdf0e10cSrcweir HF_IdlLinkList::Produce_GlobalLinks( const String &      i_sTitle,
224cdf0e10cSrcweir                                      const String &      i_sLabel,
225cdf0e10cSrcweir                                      ce_list &           i_rList ) const
226cdf0e10cSrcweir {
227cdf0e10cSrcweir     HF_CommentedLink_Table
228cdf0e10cSrcweir         aTableMaker( Env(), CurOut(),
229cdf0e10cSrcweir                      i_sTitle, i_sLabel,
230cdf0e10cSrcweir                      true );
231cdf0e10cSrcweir 
232cdf0e10cSrcweir     for ( ; i_rList; ++i_rList )
233cdf0e10cSrcweir     {
234cdf0e10cSrcweir         aTableMaker.Add_Line();
235cdf0e10cSrcweir         HF_IdlTypeText
236cdf0e10cSrcweir             aLinkText( Env(), aTableMaker.Cur_LinkColumn(), true );
237cdf0e10cSrcweir         aLinkText.Produce_byData(*i_rList);
238cdf0e10cSrcweir 
239cdf0e10cSrcweir         const ce_info *
240cdf0e10cSrcweir             pDocu = Get_EntryDocu(*i_rList);
241cdf0e10cSrcweir         if ( pDocu != 0 )
242cdf0e10cSrcweir         {
243cdf0e10cSrcweir             HF_IdlShortDocu
244cdf0e10cSrcweir                 aTextDisplay(Env(), aTableMaker.Cur_CommentColumn() );
245cdf0e10cSrcweir             aTextDisplay.Produce_byData( pDocu, *i_rList );
246cdf0e10cSrcweir         }
247cdf0e10cSrcweir     }
248cdf0e10cSrcweir }
249cdf0e10cSrcweir 
250cdf0e10cSrcweir void
Produce_GlobalCommentedLinks(const String & i_sTitle,const String & i_sLabel,comref_list & i_rList) const251cdf0e10cSrcweir HF_IdlLinkList::Produce_GlobalCommentedLinks( const String &          i_sTitle,
252cdf0e10cSrcweir                                               const String &          i_sLabel,
253cdf0e10cSrcweir                                               comref_list &           i_rList ) const
254cdf0e10cSrcweir {
255cdf0e10cSrcweir     HF_CommentedLink_Table
256cdf0e10cSrcweir         aTableMaker( Env(), CurOut(),
257cdf0e10cSrcweir                      i_sTitle, i_sLabel,
258cdf0e10cSrcweir                      true );
259cdf0e10cSrcweir /*
260cdf0e10cSrcweir     for ( ; i_rList; ++i_rList )
261cdf0e10cSrcweir     {
262cdf0e10cSrcweir         aTableMaker.Add_Line();
263cdf0e10cSrcweir         HF_IdlTypeText
264cdf0e10cSrcweir             aLinkText( Env(), aTableMaker.Cur_LinkColumn(), true );
265cdf0e10cSrcweir         aLinkText.Produce_byData( (*i_rList).first );
266cdf0e10cSrcweir 
267cdf0e10cSrcweir         HF_DocEntryList
268cdf0e10cSrcweir             aDocList( aTableMaker.Cur_CommentColumn() );
269cdf0e10cSrcweir         if ( (*i_rList).second != 0 )
270cdf0e10cSrcweir         {
271cdf0e10cSrcweir             HF_IdlDocu
272cdf0e10cSrcweir                 aDocuDisplay( Env(), aDocList );
273cdf0e10cSrcweir             aDocuDisplay.Produce_byData( (*i_rList).second );
274cdf0e10cSrcweir         }
275cdf0e10cSrcweir         else
276cdf0e10cSrcweir         {
277cdf0e10cSrcweir             const ce_info *
278cdf0e10cSrcweir                 pShort = Get_EntryDocu(
279cdf0e10cSrcweir                             Env().Gate().Types().Search_CeRelatedTo(
280cdf0e10cSrcweir                                             (*i_rList).first) );
281cdf0e10cSrcweir             if ( pShort != 0 )
282cdf0e10cSrcweir             {
283cdf0e10cSrcweir                 if (pShort->IsDeprecated())
284cdf0e10cSrcweir                 {
285cdf0e10cSrcweir                     aDocList.Produce_Term()
286cdf0e10cSrcweir                         << "[ DEPRECATED ]";
287cdf0e10cSrcweir                 }
288cdf0e10cSrcweir                 if (pShort->IsOptional())
289cdf0e10cSrcweir                 {
290cdf0e10cSrcweir                     aDocList.Produce_Term()
291cdf0e10cSrcweir                         << "[ OPTIONAL ]";
292cdf0e10cSrcweir                 }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir                 aDocList.Produce_Term()
295cdf0e10cSrcweir                     << "Description";
296cdf0e10cSrcweir 
297cdf0e10cSrcweir                 HF_IdlDocuTextDisplay
298cdf0e10cSrcweir                     aShortDisplay( Env(), &aDocList.Produce_Definition() );
299cdf0e10cSrcweir                 aShortDisplay.Set_CurScopeTo(
300cdf0e10cSrcweir                         Env().Gate().Types().Search_CeRelatedTo((*i_rList).first) );
301cdf0e10cSrcweir                 pShort->Short().DisplayAt(aShortDisplay);
302cdf0e10cSrcweir             }
303cdf0e10cSrcweir         }
304cdf0e10cSrcweir     }
305cdf0e10cSrcweir */
306cdf0e10cSrcweir }
307cdf0e10cSrcweir 
308cdf0e10cSrcweir void
Produce_MemberLinks(const String & i_sTitle,const String & i_sLabel,ce_list & i_rList) const309cdf0e10cSrcweir HF_IdlLinkList::Produce_MemberLinks( const String &     i_sTitle,
310cdf0e10cSrcweir                                      const String &     i_sLabel,
311cdf0e10cSrcweir                                      ce_list &          i_rList ) const
312cdf0e10cSrcweir {
313cdf0e10cSrcweir     HF_CommentedLink_Table
314cdf0e10cSrcweir         aTableMaker( Env(), CurOut(),
315cdf0e10cSrcweir                      i_sTitle, i_sLabel,
316cdf0e10cSrcweir                      true );
317cdf0e10cSrcweir 
318cdf0e10cSrcweir /*
319cdf0e10cSrcweir     for ( ; i_rList; ++i_rList )
320cdf0e10cSrcweir     {
321cdf0e10cSrcweir         const ary::idl::CodeEntity &
322cdf0e10cSrcweir             rCe = Env().Gate().Ces().Find_Ce(*i_rList);
323cdf0e10cSrcweir 
324cdf0e10cSrcweir         aTableMaker.Add_Line();
325cdf0e10cSrcweir         aTableMaker.Cur_LinkColumn()
326cdf0e10cSrcweir             >> *new Html::Link(
327cdf0e10cSrcweir                     StreamLock(200)() << "#" << rCe.LocalName() << c_str)
328cdf0e10cSrcweir                << rCe.LocalName();
329cdf0e10cSrcweir 
330cdf0e10cSrcweir         const ce_info *
331cdf0e10cSrcweir             pDocu = rCe.Docu();
332cdf0e10cSrcweir         if ( pDocu != 0 )
333cdf0e10cSrcweir         {
334cdf0e10cSrcweir             HF_IdlShortDocu
335cdf0e10cSrcweir                 aTextDisplay(Env(), aTableMaker.Cur_CommentColumn() );
336cdf0e10cSrcweir             aTextDisplay.Produce_byData( *pDocu );
337cdf0e10cSrcweir         }
338cdf0e10cSrcweir     }   // end for
339cdf0e10cSrcweir */
340cdf0e10cSrcweir }
341cdf0e10cSrcweir 
342cdf0e10cSrcweir void
Get_EntryData_NamespaceMembers(String & o_sEntryName,String & o_sEntryLink,const ce_info * & o_pDocu,ce_id i_nMemberId,bool i_bIsNestedNamespace) const343cdf0e10cSrcweir HF_IdlLinkList::Get_EntryData_NamespaceMembers(
344cdf0e10cSrcweir                             String &                o_sEntryName,
345cdf0e10cSrcweir                             String &                o_sEntryLink,
346cdf0e10cSrcweir                             const ce_info * &       o_pDocu,
347cdf0e10cSrcweir                             ce_id                   i_nMemberId,
348cdf0e10cSrcweir                             bool                    i_bIsNestedNamespace  ) const
349cdf0e10cSrcweir {
350cdf0e10cSrcweir     const ary::idl::CodeEntity &
351cdf0e10cSrcweir         rCe = Env().Data().Find_Ce(i_nMemberId);
352cdf0e10cSrcweir 
353cdf0e10cSrcweir     o_sEntryName = rCe.LocalName();
354cdf0e10cSrcweir     o_sEntryLink = StreamLock(200)() << rCe.LocalName()
355cdf0e10cSrcweir                                      << ( i_bIsNestedNamespace
356cdf0e10cSrcweir                                                 ?   "/module-ix"
357cdf0e10cSrcweir                                                 :   "" )
358cdf0e10cSrcweir                                      << ".html"
359cdf0e10cSrcweir                                      << c_str;
360cdf0e10cSrcweir     o_pDocu = rCe.Docu();
361cdf0e10cSrcweir }
362cdf0e10cSrcweir 
363cdf0e10cSrcweir const ary::doc::OldIdlDocu *
Get_EntryDocu(ce_id i_nMemberId) const364cdf0e10cSrcweir HF_IdlLinkList::Get_EntryDocu(ce_id i_nMemberId) const
365cdf0e10cSrcweir {
366cdf0e10cSrcweir     if (i_nMemberId.IsValid())
367cdf0e10cSrcweir         return Env().Data().Find_Ce(i_nMemberId).Docu();
368cdf0e10cSrcweir     else
369cdf0e10cSrcweir         return 0;
370cdf0e10cSrcweir }
371cdf0e10cSrcweir 
372cdf0e10cSrcweir 
373