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 "hdimpl.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir 
26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
27cdf0e10cSrcweir #include <stdlib.h>
28cdf0e10cSrcweir #include <stdio.h>
29cdf0e10cSrcweir #include <ary/ceslot.hxx>
30cdf0e10cSrcweir #include <ary/qualiname.hxx>
31cdf0e10cSrcweir #include <ary/cpp/c_class.hxx>
32cdf0e10cSrcweir #include <ary/cpp/c_de.hxx>
33cdf0e10cSrcweir #include <ary/cpp/c_enum.hxx>
34cdf0e10cSrcweir #include <ary/cpp/c_funct.hxx>
35cdf0e10cSrcweir #include <ary/cpp/c_gate.hxx>
36cdf0e10cSrcweir #include <ary/cpp/cp_ce.hxx>
37cdf0e10cSrcweir #include <udm/html/htmlitem.hxx>
38cdf0e10cSrcweir #include "cre_link.hxx"
39cdf0e10cSrcweir #include "hd_docu.hxx"
40cdf0e10cSrcweir #include "html_kit.hxx"
41cdf0e10cSrcweir #include "opageenv.hxx"
42cdf0e10cSrcweir #include "pagemake.hxx"
43cdf0e10cSrcweir #include "strconst.hxx"
44cdf0e10cSrcweir 
45cdf0e10cSrcweir 
46cdf0e10cSrcweir using namespace csi;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 
49cdf0e10cSrcweir //********************       HtmlDisplay_Impl        *********************//
50cdf0e10cSrcweir 
~HtmlDisplay_Impl()51cdf0e10cSrcweir HtmlDisplay_Impl::~HtmlDisplay_Impl()
52cdf0e10cSrcweir {
53cdf0e10cSrcweir }
54cdf0e10cSrcweir 
HtmlDisplay_Impl(OuputPage_Environment & io_rEnv)55cdf0e10cSrcweir HtmlDisplay_Impl::HtmlDisplay_Impl( OuputPage_Environment & io_rEnv )
56cdf0e10cSrcweir     :   pEnv(&io_rEnv)
57cdf0e10cSrcweir         // aWriteHelper
58cdf0e10cSrcweir {
59cdf0e10cSrcweir }
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 
62cdf0e10cSrcweir //********************       Free Functions        *********************//
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 
66cdf0e10cSrcweir namespace dshelp
67cdf0e10cSrcweir {
68cdf0e10cSrcweir 
69cdf0e10cSrcweir void
DisplaySlot(ary::Display & o_rDisplay,const ary::AryGroup & i_rGroup,ary::SlotAccessId i_nSlot)70cdf0e10cSrcweir DisplaySlot( ary::Display &          o_rDisplay,
71cdf0e10cSrcweir              const ary::AryGroup &   i_rGroup,
72cdf0e10cSrcweir              ary::SlotAccessId       i_nSlot )
73cdf0e10cSrcweir {
74cdf0e10cSrcweir  	ary::Slot_AutoPtr pSlot( i_rGroup.Create_Slot(i_nSlot) );
75cdf0e10cSrcweir     pSlot->StoreAt( o_rDisplay );
76cdf0e10cSrcweir }
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 
79cdf0e10cSrcweir const char *
PathUp(uintt i_nLevels)80cdf0e10cSrcweir PathUp( uintt i_nLevels )
81cdf0e10cSrcweir {
82cdf0e10cSrcweir     static char sResult[300];
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     sResult[0] = NULCH;
85cdf0e10cSrcweir     for ( uintt lev = 0; lev < i_nLevels; ++lev )
86cdf0e10cSrcweir     {
87cdf0e10cSrcweir         strcat( sResult, "../");        // SAFE STRCAT (#100211# - checked)
88cdf0e10cSrcweir     }
89cdf0e10cSrcweir     return sResult;
90cdf0e10cSrcweir }
91cdf0e10cSrcweir 
92cdf0e10cSrcweir const char *
PathPerLevelsUp(uintt i_nLevels,const char * i_nPathBelowDestinationLevel)93cdf0e10cSrcweir PathPerLevelsUp( uintt                   i_nLevels,
94cdf0e10cSrcweir                  const char *            i_nPathBelowDestinationLevel )
95cdf0e10cSrcweir {
96cdf0e10cSrcweir     static char sResult[500];
97cdf0e10cSrcweir     strcpy( sResult, PathUp(i_nLevels) );               // SAFE STRCPY (#100211# - checked)
98cdf0e10cSrcweir     // KORR_FUTURE: Make it still safer here:
99cdf0e10cSrcweir     strcat( sResult, i_nPathBelowDestinationLevel );    // SAFE STRCAT (#100211# - checked)
100cdf0e10cSrcweir     return sResult;
101cdf0e10cSrcweir }
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 
104cdf0e10cSrcweir const char *
PathPerRoot(const OuputPage_Environment & i_rEnv,const char * i_sPathFromRootDir)105cdf0e10cSrcweir PathPerRoot( const OuputPage_Environment & i_rEnv,
106cdf0e10cSrcweir              const char *                  i_sPathFromRootDir )
107cdf0e10cSrcweir {
108cdf0e10cSrcweir     return PathPerLevelsUp( i_rEnv.Depth(), i_sPathFromRootDir );
109cdf0e10cSrcweir }
110cdf0e10cSrcweir 
111cdf0e10cSrcweir const char *
PathPerNamespace(const OuputPage_Environment & i_rEnv,const char * i_sPathFromNamespaceDir)112cdf0e10cSrcweir PathPerNamespace( const OuputPage_Environment & i_rEnv,
113cdf0e10cSrcweir                   const char *                  i_sPathFromNamespaceDir )
114cdf0e10cSrcweir {
115cdf0e10cSrcweir     const ary::cpp::Namespace * pNsp = i_rEnv.CurNamespace();
116cdf0e10cSrcweir     if ( pNsp == 0 )
117cdf0e10cSrcweir         return "";
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     uintt nCount = i_rEnv.Depth() - (pNsp->Depth() + 1) ;
120cdf0e10cSrcweir     csv_assert( nCount < 100 );
121cdf0e10cSrcweir     return PathPerLevelsUp( nCount, i_sPathFromNamespaceDir );
122cdf0e10cSrcweir }
123cdf0e10cSrcweir 
124cdf0e10cSrcweir const char *
HtmlFileName(const char * i_sPrefix,const char * i_sEntityName)125cdf0e10cSrcweir HtmlFileName( const char *            i_sPrefix,
126cdf0e10cSrcweir               const char *            i_sEntityName )
127cdf0e10cSrcweir {
128cdf0e10cSrcweir     // KORR_FUTURE: Make it still safer here:
129cdf0e10cSrcweir     static char sResult[300];
130cdf0e10cSrcweir     strcpy( sResult, i_sPrefix );       // SAFE STRCPY (#100211# - checked)
131cdf0e10cSrcweir     strcat( sResult, i_sEntityName );   // SAFE STRCAT (#100211# - checked)
132cdf0e10cSrcweir     strcat( sResult, ".html" );         // SAFE STRCAT (#100211# - checked)
133cdf0e10cSrcweir     return sResult;
134cdf0e10cSrcweir }
135cdf0e10cSrcweir 
136cdf0e10cSrcweir const char *
Path2Class(uintt i_nLevelsUp,const char * i_sClassLocalName)137cdf0e10cSrcweir Path2Class( uintt                   i_nLevelsUp,
138cdf0e10cSrcweir             const char *            i_sClassLocalName )
139cdf0e10cSrcweir {
140cdf0e10cSrcweir     return PathPerLevelsUp( i_nLevelsUp, ClassFileName(i_sClassLocalName) );
141cdf0e10cSrcweir }
142cdf0e10cSrcweir 
143cdf0e10cSrcweir const char *
Path2Child(const char * i_sFileName,const char * i_sSubDir)144cdf0e10cSrcweir Path2Child( const char *            i_sFileName,
145cdf0e10cSrcweir             const char *            i_sSubDir )
146cdf0e10cSrcweir {
147cdf0e10cSrcweir     static char sResult[400];
148cdf0e10cSrcweir     if ( i_sSubDir != 0 )
149cdf0e10cSrcweir     {
150cdf0e10cSrcweir         // KORR_FUTURE: Make it still safer here:
151cdf0e10cSrcweir         strcpy( sResult, i_sSubDir );       // SAFE STRCPY (#100211# - checked)
152cdf0e10cSrcweir         strcat( sResult, "/" );             // SAFE STRCAT (#100211# - checked)
153cdf0e10cSrcweir     }
154cdf0e10cSrcweir     else
155cdf0e10cSrcweir     {
156cdf0e10cSrcweir         sResult[0] = NULCH;
157cdf0e10cSrcweir     }
158cdf0e10cSrcweir 
159cdf0e10cSrcweir     strcat( sResult, i_sFileName );         // SAFE STRCAT (#100211# - checked)
160cdf0e10cSrcweir     return sResult;
161cdf0e10cSrcweir }
162cdf0e10cSrcweir 
163cdf0e10cSrcweir const char *
Path2ChildNamespace(const char * i_sLocalName)164cdf0e10cSrcweir Path2ChildNamespace( const char * i_sLocalName )
165cdf0e10cSrcweir {
166cdf0e10cSrcweir     return Path2Child( C_sHFN_Namespace, i_sLocalName );
167cdf0e10cSrcweir }
168cdf0e10cSrcweir 
169cdf0e10cSrcweir String
OperationLink(const ary::cpp::Gate &,const String & i_sOpName,ary::cpp::Ce_id i_nOpId,const char * i_sPrePath)170cdf0e10cSrcweir OperationLink( const ary::cpp::Gate &               ,
171cdf0e10cSrcweir                const String  &                      i_sOpName,
172cdf0e10cSrcweir                ary::cpp::Ce_id                      i_nOpId,
173cdf0e10cSrcweir                const char *                         i_sPrePath )
174cdf0e10cSrcweir {
175cdf0e10cSrcweir     StreamLock
176cdf0e10cSrcweir         slResult(3000);
177cdf0e10cSrcweir     StreamStr &
178cdf0e10cSrcweir         sResult = slResult();
179cdf0e10cSrcweir 
180cdf0e10cSrcweir     sResult
181cdf0e10cSrcweir         << i_sPrePath
182cdf0e10cSrcweir         << "#"
183cdf0e10cSrcweir         << i_sOpName
184cdf0e10cSrcweir         << "-"
185cdf0e10cSrcweir         << i_nOpId.Value();
186cdf0e10cSrcweir 
187cdf0e10cSrcweir 
188cdf0e10cSrcweir 
189cdf0e10cSrcweir     return sResult.c_str();
190cdf0e10cSrcweir }
191cdf0e10cSrcweir 
192cdf0e10cSrcweir const char *
DataLink(const String & i_sLocalName,const char * i_sPrePath)193cdf0e10cSrcweir DataLink( const String  &         i_sLocalName,
194cdf0e10cSrcweir           const char *            i_sPrePath )
195cdf0e10cSrcweir {
196cdf0e10cSrcweir     StreamLock
197cdf0e10cSrcweir         slResult(3000);
198cdf0e10cSrcweir     StreamStr &
199cdf0e10cSrcweir         sResult = slResult();
200cdf0e10cSrcweir 
201cdf0e10cSrcweir     sResult
202cdf0e10cSrcweir         << i_sPrePath
203cdf0e10cSrcweir         << "#"
204cdf0e10cSrcweir         << i_sLocalName;
205cdf0e10cSrcweir 
206cdf0e10cSrcweir     return sResult.c_str();
207cdf0e10cSrcweir }
208cdf0e10cSrcweir 
209cdf0e10cSrcweir void
Get_LinkedTypeText(csi::xml::Element & o_rOut,const OuputPage_Environment & i_rEnv,ary::cpp::Type_id i_nId,bool i_bWithAbsolutifier)210cdf0e10cSrcweir Get_LinkedTypeText( csi::xml::Element &             o_rOut,
211cdf0e10cSrcweir                     const OuputPage_Environment &   i_rEnv,
212cdf0e10cSrcweir                     ary::cpp::Type_id               i_nId,
213cdf0e10cSrcweir                     bool                            i_bWithAbsolutifier )
214cdf0e10cSrcweir {
215cdf0e10cSrcweir     if (NOT i_nId.IsValid())
216cdf0e10cSrcweir         return;
217cdf0e10cSrcweir 
218cdf0e10cSrcweir  	const char * sPreName = "";
219cdf0e10cSrcweir  	const char * sName = "";
220cdf0e10cSrcweir  	const char * sPostName = "";
221cdf0e10cSrcweir 
222cdf0e10cSrcweir     bool bTypeExists = Get_TypeText( sPreName,
223cdf0e10cSrcweir                                      sName,
224cdf0e10cSrcweir                                      sPostName,
225cdf0e10cSrcweir                                      i_nId,
226cdf0e10cSrcweir                                      i_rEnv.Gate() );
227cdf0e10cSrcweir     if ( NOT bTypeExists )
228cdf0e10cSrcweir         return;
229cdf0e10cSrcweir 
230cdf0e10cSrcweir     if ( NOT i_bWithAbsolutifier AND strncmp(sPreName,"::",2) == 0 )
231cdf0e10cSrcweir         sPreName+=2;
232cdf0e10cSrcweir 
233cdf0e10cSrcweir     const ary::cpp::CodeEntity *
234cdf0e10cSrcweir         pCe = i_rEnv.Gate().Search_RelatedCe(i_nId);
235cdf0e10cSrcweir 
236cdf0e10cSrcweir     String  sLink;
237cdf0e10cSrcweir     if ( pCe != 0 )
238cdf0e10cSrcweir     {
239cdf0e10cSrcweir         sLink = Link2Ce(i_rEnv,*pCe);
240cdf0e10cSrcweir     }
241cdf0e10cSrcweir     else
242cdf0e10cSrcweir     {
243cdf0e10cSrcweir         if ( strstr(sPreName,"com::sun::star") != 0 )
244cdf0e10cSrcweir         {
245cdf0e10cSrcweir             static StreamStr aLink(400);
246cdf0e10cSrcweir             aLink.seekp(0);
247cdf0e10cSrcweir             aLink << PathPerRoot(i_rEnv, "../../common/ref");
248cdf0e10cSrcweir             if ( *sPreName != ':' )
249cdf0e10cSrcweir                 aLink << '/';
250cdf0e10cSrcweir             for ( const char * s = sPreName;
251cdf0e10cSrcweir                   *s != 0;
252cdf0e10cSrcweir                   ++s )
253cdf0e10cSrcweir             {
254cdf0e10cSrcweir                 if ( *s == ':' )
255cdf0e10cSrcweir                 {
256cdf0e10cSrcweir                  	aLink << '/';
257cdf0e10cSrcweir                     ++s;
258cdf0e10cSrcweir                 }
259cdf0e10cSrcweir                 else
260cdf0e10cSrcweir                 {
261cdf0e10cSrcweir                  	aLink << *s;
262cdf0e10cSrcweir                 }
263cdf0e10cSrcweir             }   // end for
264cdf0e10cSrcweir             aLink << sName
265cdf0e10cSrcweir                   << ".html";
266cdf0e10cSrcweir             sLink = aLink.c_str();
267cdf0e10cSrcweir         }
268cdf0e10cSrcweir     }   // endif( pCe != 0 )
269cdf0e10cSrcweir 
270cdf0e10cSrcweir     o_rOut
271cdf0e10cSrcweir         << sPreName;
272cdf0e10cSrcweir     csi::xml::Element &
273cdf0e10cSrcweir         o_Goon = sLink.length() > 0
274cdf0e10cSrcweir                      ?   o_rOut >> * new html::Link( sLink.c_str() )
275cdf0e10cSrcweir                      :   o_rOut;
276cdf0e10cSrcweir     o_Goon
277cdf0e10cSrcweir         <<  sName;
278cdf0e10cSrcweir     o_rOut
279cdf0e10cSrcweir         << sPostName;
280cdf0e10cSrcweir }
281cdf0e10cSrcweir 
282cdf0e10cSrcweir void
Create_ChildListLabel(csi::xml::Element & o_rParentElement,const char * i_sLabel)283cdf0e10cSrcweir Create_ChildListLabel( csi::xml::Element &     o_rParentElement,
284cdf0e10cSrcweir                        const char *            i_sLabel )
285cdf0e10cSrcweir {
286cdf0e10cSrcweir     if ( NOT csv::no_str(i_sLabel) )
287cdf0e10cSrcweir     {
288cdf0e10cSrcweir         o_rParentElement
289cdf0e10cSrcweir             >> *new html::Label(i_sLabel)
290cdf0e10cSrcweir                     << " ";
291cdf0e10cSrcweir     }
292cdf0e10cSrcweir }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir DYN csi::html::Table &
Create_ChildListTable(const char * i_sTitle)295cdf0e10cSrcweir Create_ChildListTable( const char * i_sTitle )
296cdf0e10cSrcweir {
297cdf0e10cSrcweir     html::Table *
298cdf0e10cSrcweir             dpTable = new html::Table;
299cdf0e10cSrcweir     *dpTable
300cdf0e10cSrcweir         << new html::ClassAttr( "childlist")
301cdf0e10cSrcweir         << new xml::AnAttribute( "border", "1" )
302cdf0e10cSrcweir         << new xml::AnAttribute( "cellpadding", "5" )
303cdf0e10cSrcweir         << new xml::AnAttribute( "cellspacing", "0" )
304cdf0e10cSrcweir         << new html::WidthAttr( "100%" );
305cdf0e10cSrcweir 
306cdf0e10cSrcweir     html::TableRow &
307cdf0e10cSrcweir             rRow = dpTable->AddRow();
308cdf0e10cSrcweir     rRow
309cdf0e10cSrcweir         << new html::ClassAttr("subtitle")
310cdf0e10cSrcweir         >> *new html::TableCell
311cdf0e10cSrcweir                 << new xml::AnAttribute( "colspan","2" )
312cdf0e10cSrcweir                 >> *new html::Headline(4)
313cdf0e10cSrcweir                         << i_sTitle;
314cdf0e10cSrcweir     return *dpTable;
315cdf0e10cSrcweir }
316cdf0e10cSrcweir 
317cdf0e10cSrcweir const char *
Link2Ce(const OuputPage_Environment & i_rEnv,const ary::cpp::CodeEntity & i_rCe)318cdf0e10cSrcweir Link2Ce( const OuputPage_Environment & i_rEnv,
319cdf0e10cSrcweir          const ary::cpp::CodeEntity &  i_rCe )
320cdf0e10cSrcweir {
321cdf0e10cSrcweir     const uintt         nMaxSize
322cdf0e10cSrcweir                             = 3000;
323cdf0e10cSrcweir     static char         sLink[nMaxSize];
324cdf0e10cSrcweir     static LinkCreator  aLinkCreator( &sLink[0], nMaxSize );
325cdf0e10cSrcweir     sLink[0] = NULCH;
326cdf0e10cSrcweir 
327cdf0e10cSrcweir     aLinkCreator.SetEnv(i_rEnv);
328cdf0e10cSrcweir     i_rCe.Accept(aLinkCreator);
329cdf0e10cSrcweir 
330cdf0e10cSrcweir     return sLink;
331cdf0e10cSrcweir }
332cdf0e10cSrcweir 
333cdf0e10cSrcweir const char *
Link2CppDefinition(const OuputPage_Environment & i_rEnv,const ary::cpp::DefineEntity & i_rDef)334cdf0e10cSrcweir Link2CppDefinition( const OuputPage_Environment & i_rEnv,
335cdf0e10cSrcweir                     const ary::cpp::DefineEntity &    i_rDef )
336cdf0e10cSrcweir {
337cdf0e10cSrcweir     const uintt         nMaxSize
338cdf0e10cSrcweir                             = 1000;
339cdf0e10cSrcweir     static char         sLink[nMaxSize];
340cdf0e10cSrcweir     static LinkCreator  aLinkCreator( &sLink[0], nMaxSize );
341cdf0e10cSrcweir     sLink[0] = NULCH;
342cdf0e10cSrcweir 
343cdf0e10cSrcweir     aLinkCreator.SetEnv(i_rEnv);
344cdf0e10cSrcweir     i_rDef.Accept(aLinkCreator);
345cdf0e10cSrcweir 
346cdf0e10cSrcweir     return sLink;
347cdf0e10cSrcweir }
348cdf0e10cSrcweir 
349cdf0e10cSrcweir const ary::cpp::CodeEntity *
FindUnambiguousCe(const OuputPage_Environment & i_rEnv,const ary::QualifiedName & i_rQuName,const ary::cpp::Class * i_pJustDocumentedClass)350cdf0e10cSrcweir FindUnambiguousCe( const OuputPage_Environment & i_rEnv,
351cdf0e10cSrcweir                    const ary::QualifiedName &    i_rQuName,
352cdf0e10cSrcweir                    const ary::cpp::Class *       i_pJustDocumentedClass )
353cdf0e10cSrcweir {
354cdf0e10cSrcweir  	if ( i_rEnv.CurNamespace() == 0 )
355cdf0e10cSrcweir 		return 0;
356cdf0e10cSrcweir 
357cdf0e10cSrcweir 	const ary::cpp::CodeEntity * ret = 0;
358cdf0e10cSrcweir 
359cdf0e10cSrcweir     if ( NOT i_rQuName.IsQualified() )
360cdf0e10cSrcweir     {
361cdf0e10cSrcweir         if ( i_pJustDocumentedClass != 0 )
362cdf0e10cSrcweir             ret = i_rEnv.Gate().Ces().Search_CeLocal( i_rQuName.LocalName(),
363cdf0e10cSrcweir                                                       i_rQuName.IsFunction(),
364cdf0e10cSrcweir                                                       *i_rEnv.CurNamespace(),
365cdf0e10cSrcweir                                                       i_pJustDocumentedClass );
366cdf0e10cSrcweir         if (ret != 0)
367cdf0e10cSrcweir             return ret;
368cdf0e10cSrcweir 
369cdf0e10cSrcweir         ret = i_rEnv.Gate().Ces().Search_CeLocal( i_rQuName.LocalName(),
370cdf0e10cSrcweir                                                   i_rQuName.IsFunction(),
371cdf0e10cSrcweir                                                   *i_rEnv.CurNamespace(),
372cdf0e10cSrcweir                                                   i_rEnv.CurClass() );
373cdf0e10cSrcweir     }
374cdf0e10cSrcweir     if (ret != 0)
375cdf0e10cSrcweir         return ret;
376cdf0e10cSrcweir 
377cdf0e10cSrcweir     return i_rEnv.Gate().Ces().Search_CeAbsolute( *i_rEnv.CurNamespace(),
378cdf0e10cSrcweir                                                   i_rQuName );
379cdf0e10cSrcweir }
380cdf0e10cSrcweir 
381cdf0e10cSrcweir void
ShowDocu_On(csi::xml::Element & o_rOut,Docu_Display & io_rDisplay,const ary::cpp::CppEntity & i_rRE)382cdf0e10cSrcweir ShowDocu_On( csi::xml::Element &            o_rOut,
383cdf0e10cSrcweir              Docu_Display &                 io_rDisplay,
384cdf0e10cSrcweir              const ary::cpp::CppEntity &    i_rRE )
385cdf0e10cSrcweir {
386cdf0e10cSrcweir     if (i_rRE.Docu().Data() != 0)
387cdf0e10cSrcweir     {
388cdf0e10cSrcweir         io_rDisplay.Assign_Out( o_rOut );
389cdf0e10cSrcweir         io_rDisplay.Process(i_rRE.Docu());
390cdf0e10cSrcweir         io_rDisplay.Unassign_Out();
391cdf0e10cSrcweir     }
392cdf0e10cSrcweir }
393cdf0e10cSrcweir 
394cdf0e10cSrcweir void
WriteOut_TokenList(csi::xml::Element & o_rOut,const StringVector & i_rTokens,const char * i_sSeparator)395cdf0e10cSrcweir WriteOut_TokenList( csi::xml::Element &     o_rOut,
396cdf0e10cSrcweir                     const StringVector &    i_rTokens,
397cdf0e10cSrcweir                     const char *            i_sSeparator )
398cdf0e10cSrcweir {
399cdf0e10cSrcweir     if ( i_rTokens.size() > 0 )
400cdf0e10cSrcweir     {
401cdf0e10cSrcweir         StringVector::const_iterator
402cdf0e10cSrcweir             it      = i_rTokens.begin();
403cdf0e10cSrcweir         StringVector::const_iterator
404cdf0e10cSrcweir             itEnd   = i_rTokens.end();
405cdf0e10cSrcweir 
406cdf0e10cSrcweir         o_rOut << *it;
407cdf0e10cSrcweir         for ( ++it; it != itEnd; ++it )
408cdf0e10cSrcweir         {
409cdf0e10cSrcweir             o_rOut << i_sSeparator << *it;
410cdf0e10cSrcweir         }
411cdf0e10cSrcweir     };
412cdf0e10cSrcweir 
413cdf0e10cSrcweir }
414cdf0e10cSrcweir 
415cdf0e10cSrcweir void
EraseLeadingSpace(String & io_rStr)416cdf0e10cSrcweir EraseLeadingSpace( String  & io_rStr )
417cdf0e10cSrcweir {
418cdf0e10cSrcweir     if ( *io_rStr.c_str() < 33 AND io_rStr.length() > 0 )
419cdf0e10cSrcweir     {
420cdf0e10cSrcweir         const unsigned char * pNew;
421cdf0e10cSrcweir         for ( pNew = (const unsigned char * ) io_rStr.c_str();
422cdf0e10cSrcweir               *pNew < 33 AND *pNew != 0;
423cdf0e10cSrcweir               ++pNew ) {}
424cdf0e10cSrcweir         String  sNew( (const char*)pNew );
425cdf0e10cSrcweir         io_rStr = sNew;
426cdf0e10cSrcweir     }
427cdf0e10cSrcweir }
428cdf0e10cSrcweir 
429cdf0e10cSrcweir void
WriteOut_LinkedFunctionText(csi::xml::Element & o_rTitleOut,adcdisp::ParameterTable & o_rParameters,const ary::cpp::Function & i_rFunction,const OuputPage_Environment & i_rEnv,bool * o_bIsConst,bool * o_bIsVirtual)430cdf0e10cSrcweir WriteOut_LinkedFunctionText( csi::xml::Element &            o_rTitleOut,
431cdf0e10cSrcweir                              adcdisp::ParameterTable &      o_rParameters,
432cdf0e10cSrcweir                              const ary::cpp::Function &     i_rFunction,
433cdf0e10cSrcweir                              const OuputPage_Environment &  i_rEnv,
434cdf0e10cSrcweir                              bool *                         o_bIsConst,
435cdf0e10cSrcweir                              bool *                         o_bIsVirtual )
436cdf0e10cSrcweir {
437cdf0e10cSrcweir     // write pre-name:
438cdf0e10cSrcweir     const ary::cpp::FunctionFlags & rFlags = i_rFunction.Flags();
439cdf0e10cSrcweir     if ( rFlags.IsStaticLocal() OR rFlags.IsStaticMember() )
440cdf0e10cSrcweir         o_rTitleOut << "static ";
441cdf0e10cSrcweir     if ( rFlags.IsExplicit() )
442cdf0e10cSrcweir         o_rTitleOut << "explicit ";
443cdf0e10cSrcweir     if ( rFlags.IsMutable() )
444cdf0e10cSrcweir         o_rTitleOut << "mutable ";
445cdf0e10cSrcweir     if ( i_rFunction.Virtuality() != ary::cpp::VIRTUAL_none )
446cdf0e10cSrcweir         o_rTitleOut << "virtual ";
447cdf0e10cSrcweir //    o_rTitleOut << new html::LineBreak;
448cdf0e10cSrcweir 
449cdf0e10cSrcweir     Get_LinkedTypeText( o_rTitleOut, i_rEnv, i_rFunction.ReturnType() );
450cdf0e10cSrcweir 
451cdf0e10cSrcweir     // write name:
452cdf0e10cSrcweir     o_rTitleOut
453cdf0e10cSrcweir         << " "
454cdf0e10cSrcweir         >> *new html::Strong
455cdf0e10cSrcweir             << i_rFunction.LocalName();
456cdf0e10cSrcweir     o_rTitleOut
457cdf0e10cSrcweir             << "(";
458cdf0e10cSrcweir 
459cdf0e10cSrcweir 
460cdf0e10cSrcweir     csi::xml::Element * pOutLast = &o_rTitleOut;
461cdf0e10cSrcweir 
462cdf0e10cSrcweir     // write post-name:
463cdf0e10cSrcweir     FunctionParam_Iterator fit;
464cdf0e10cSrcweir     fit.Assign(i_rFunction);
465cdf0e10cSrcweir 
466cdf0e10cSrcweir     if (fit)
467cdf0e10cSrcweir     {
468cdf0e10cSrcweir         o_rParameters.AddEntry();
469cdf0e10cSrcweir         Get_LinkedTypeText( o_rParameters.Type(), i_rEnv, fit.CurType() );
470cdf0e10cSrcweir         o_rParameters.Type() << " ";
471cdf0e10cSrcweir         o_rParameters.Name() << " " << fit.CurName();
472cdf0e10cSrcweir 
473cdf0e10cSrcweir         for ( ++fit; fit; ++fit )
474cdf0e10cSrcweir         {
475cdf0e10cSrcweir             o_rParameters.Name() << ",";
476cdf0e10cSrcweir             o_rParameters.AddEntry();
477cdf0e10cSrcweir             Get_LinkedTypeText( o_rParameters.Type(), i_rEnv, fit.CurType() );
478cdf0e10cSrcweir             o_rParameters.Name() << fit.CurName();
479cdf0e10cSrcweir         }
480cdf0e10cSrcweir 
481cdf0e10cSrcweir         pOutLast = &o_rParameters.Name();
482cdf0e10cSrcweir         o_rParameters.Name() << " ";
483cdf0e10cSrcweir     }
484cdf0e10cSrcweir 
485cdf0e10cSrcweir     *pOutLast  << ")";
486cdf0e10cSrcweir     if ( fit.IsFunctionConst() )
487cdf0e10cSrcweir     {
488cdf0e10cSrcweir         *pOutLast << " const";
489cdf0e10cSrcweir         if ( o_bIsConst != 0 )
490cdf0e10cSrcweir             *o_bIsConst = true;
491cdf0e10cSrcweir     }
492cdf0e10cSrcweir     if ( fit.IsFunctionVolatile() )
493cdf0e10cSrcweir     {
494cdf0e10cSrcweir         *pOutLast << " volatile";
495cdf0e10cSrcweir         if ( o_bIsVirtual != 0 )
496cdf0e10cSrcweir             *o_bIsVirtual = true;
497cdf0e10cSrcweir     }
498cdf0e10cSrcweir 
499cdf0e10cSrcweir     // write Exceptions:
500cdf0e10cSrcweir     const std::vector< ary::cpp::Type_id > *
501cdf0e10cSrcweir             pThrow = i_rFunction.Exceptions();
502cdf0e10cSrcweir     if ( pThrow)
503cdf0e10cSrcweir     {
504cdf0e10cSrcweir         std::vector< ary::cpp::Type_id >::const_iterator
505cdf0e10cSrcweir 		    	it = pThrow->begin();
506cdf0e10cSrcweir         std::vector< ary::cpp::Type_id >::const_iterator
507cdf0e10cSrcweir 	    		it_end = pThrow->end();
508cdf0e10cSrcweir 
509cdf0e10cSrcweir         if (it != it_end)
510cdf0e10cSrcweir         {
511cdf0e10cSrcweir             o_rParameters.AddEntry();
512cdf0e10cSrcweir             pOutLast = &o_rParameters.Name();
513cdf0e10cSrcweir 
514cdf0e10cSrcweir             o_rParameters.Name() << " throw( ";
515cdf0e10cSrcweir             Get_LinkedTypeText(o_rParameters.Name(), i_rEnv, *it);
516cdf0e10cSrcweir 
517cdf0e10cSrcweir             for ( ++it; it != it_end; ++it )
518cdf0e10cSrcweir             {
519cdf0e10cSrcweir                 o_rParameters.Name() << ", ";
520cdf0e10cSrcweir                 Get_LinkedTypeText(o_rParameters.Name(), i_rEnv, *it);
521cdf0e10cSrcweir             }
522cdf0e10cSrcweir             o_rParameters.Name() << " )";
523cdf0e10cSrcweir         }
524cdf0e10cSrcweir         else
525cdf0e10cSrcweir         {
526cdf0e10cSrcweir             *pOutLast << " throw()";
527cdf0e10cSrcweir         }
528cdf0e10cSrcweir     }   // endif // pThrow
529cdf0e10cSrcweir 
530cdf0e10cSrcweir     // abstractness:
531cdf0e10cSrcweir     if ( i_rFunction.Virtuality() == ary::cpp::VIRTUAL_abstract )
532cdf0e10cSrcweir         *pOutLast << " = 0";
533cdf0e10cSrcweir 
534cdf0e10cSrcweir     // finish:
535cdf0e10cSrcweir     *pOutLast << ";";
536cdf0e10cSrcweir }
537cdf0e10cSrcweir 
538cdf0e10cSrcweir 
539cdf0e10cSrcweir 
540cdf0e10cSrcweir }   // namespace dshelp
541