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 "dsply_da.hxx"
24cdf0e10cSrcweir
25cdf0e10cSrcweir
26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
27cdf0e10cSrcweir #include <cosv/tpl/tpltools.hxx>
28cdf0e10cSrcweir #include <ary/cpp/c_gate.hxx>
29cdf0e10cSrcweir #include <ary/cpp/c_vari.hxx>
30cdf0e10cSrcweir #include <ary/doc/d_docu.hxx>
31cdf0e10cSrcweir #include <ary/loc/loc_file.hxx>
32cdf0e10cSrcweir #include <ary/loc/locp_le.hxx>
33cdf0e10cSrcweir #include <udm/html/htmlitem.hxx>
34cdf0e10cSrcweir #include "hd_docu.hxx"
35cdf0e10cSrcweir #include "hdimpl.hxx"
36cdf0e10cSrcweir #include "html_kit.hxx"
37cdf0e10cSrcweir #include "opageenv.hxx"
38cdf0e10cSrcweir #include "pagemake.hxx"
39cdf0e10cSrcweir
40cdf0e10cSrcweir
41cdf0e10cSrcweir using namespace csi;
42cdf0e10cSrcweir
43cdf0e10cSrcweir
44cdf0e10cSrcweir
DataDisplay(OuputPage_Environment & io_rEnv)45cdf0e10cSrcweir DataDisplay::DataDisplay( OuputPage_Environment & io_rEnv )
46cdf0e10cSrcweir : aMap_GlobalDataDisplay(),
47cdf0e10cSrcweir pClassMembersDisplay(0),
48cdf0e10cSrcweir pEnv( &io_rEnv ),
49cdf0e10cSrcweir pDocuShow( new Docu_Display(io_rEnv) )
50cdf0e10cSrcweir {
51cdf0e10cSrcweir }
52cdf0e10cSrcweir
~DataDisplay()53cdf0e10cSrcweir DataDisplay::~DataDisplay()
54cdf0e10cSrcweir {
55cdf0e10cSrcweir csv::erase_map_of_heap_ptrs( aMap_GlobalDataDisplay );
56cdf0e10cSrcweir }
57cdf0e10cSrcweir
58cdf0e10cSrcweir void
PrepareForConstants()59cdf0e10cSrcweir DataDisplay::PrepareForConstants()
60cdf0e10cSrcweir {
61cdf0e10cSrcweir if (pClassMembersDisplay)
62cdf0e10cSrcweir pClassMembersDisplay = 0;
63cdf0e10cSrcweir
64cdf0e10cSrcweir csv::erase_map_of_heap_ptrs( aMap_GlobalDataDisplay );
65cdf0e10cSrcweir }
66cdf0e10cSrcweir
67cdf0e10cSrcweir void
PrepareForVariables()68cdf0e10cSrcweir DataDisplay::PrepareForVariables()
69cdf0e10cSrcweir {
70cdf0e10cSrcweir // Doesn't need to do anything yet.
71cdf0e10cSrcweir }
72cdf0e10cSrcweir
73cdf0e10cSrcweir void
PrepareForStdMembers()74cdf0e10cSrcweir DataDisplay::PrepareForStdMembers()
75cdf0e10cSrcweir {
76cdf0e10cSrcweir csv::erase_map_of_heap_ptrs( aMap_GlobalDataDisplay );
77cdf0e10cSrcweir
78cdf0e10cSrcweir pClassMembersDisplay = new PageDisplay(*pEnv);
79cdf0e10cSrcweir const ary::cpp::Class * pClass = pEnv->CurClass();
80cdf0e10cSrcweir csv_assert( pClass != 0 );
81cdf0e10cSrcweir pClassMembersDisplay->Setup_DataFile_for(*pClass);
82cdf0e10cSrcweir }
83cdf0e10cSrcweir
84cdf0e10cSrcweir void
PrepareForStaticMembers()85cdf0e10cSrcweir DataDisplay::PrepareForStaticMembers()
86cdf0e10cSrcweir {
87cdf0e10cSrcweir // Doesn't need to do anything yet.
88cdf0e10cSrcweir }
89cdf0e10cSrcweir
90cdf0e10cSrcweir void
Create_Files()91cdf0e10cSrcweir DataDisplay::Create_Files()
92cdf0e10cSrcweir {
93cdf0e10cSrcweir if (pClassMembersDisplay)
94cdf0e10cSrcweir {
95cdf0e10cSrcweir pClassMembersDisplay->Create_File();
96cdf0e10cSrcweir pClassMembersDisplay = 0;
97cdf0e10cSrcweir }
98cdf0e10cSrcweir else
99cdf0e10cSrcweir {
100cdf0e10cSrcweir for ( Map_FileId2PagePtr::const_iterator it = aMap_GlobalDataDisplay.begin();
101cdf0e10cSrcweir it != aMap_GlobalDataDisplay.end();
102cdf0e10cSrcweir ++it )
103cdf0e10cSrcweir {
104cdf0e10cSrcweir (*it).second->Create_File();
105cdf0e10cSrcweir }
106cdf0e10cSrcweir csv::erase_map_of_heap_ptrs( aMap_GlobalDataDisplay );
107cdf0e10cSrcweir }
108cdf0e10cSrcweir }
109cdf0e10cSrcweir
110cdf0e10cSrcweir void
do_Process(const ary::cpp::Variable & i_rData)111cdf0e10cSrcweir DataDisplay::do_Process( const ary::cpp::Variable & i_rData )
112cdf0e10cSrcweir {
113cdf0e10cSrcweir if ( Ce_IsInternal(i_rData) )
114cdf0e10cSrcweir return;
115cdf0e10cSrcweir
116cdf0e10cSrcweir PageDisplay & rPage = FindPage_for( i_rData );
117cdf0e10cSrcweir
118cdf0e10cSrcweir csi::xml::Element & rOut = rPage.CurOut();
119cdf0e10cSrcweir Display_SglDatum( rOut, i_rData );
120cdf0e10cSrcweir }
121cdf0e10cSrcweir
122cdf0e10cSrcweir const ary::cpp::Gate *
inq_Get_ReFinder() const123cdf0e10cSrcweir DataDisplay::inq_Get_ReFinder() const
124cdf0e10cSrcweir {
125cdf0e10cSrcweir return & pEnv->Gate();
126cdf0e10cSrcweir }
127cdf0e10cSrcweir
128cdf0e10cSrcweir PageDisplay &
FindPage_for(const ary::cpp::Variable & i_rData)129cdf0e10cSrcweir DataDisplay::FindPage_for( const ary::cpp::Variable & i_rData )
130cdf0e10cSrcweir {
131cdf0e10cSrcweir if ( pClassMembersDisplay )
132cdf0e10cSrcweir return *pClassMembersDisplay;
133cdf0e10cSrcweir
134cdf0e10cSrcweir SourceFileId
135cdf0e10cSrcweir nSourceFile = i_rData.Location();
136cdf0e10cSrcweir PageDisplay *
137cdf0e10cSrcweir pFound = csv::value_from_map( aMap_GlobalDataDisplay, nSourceFile, (PageDisplay*)0 );
138cdf0e10cSrcweir if ( pFound == 0 )
139cdf0e10cSrcweir {
140cdf0e10cSrcweir pFound = new PageDisplay( *pEnv );
141cdf0e10cSrcweir const ary::loc::File &
142cdf0e10cSrcweir rFile = pEnv->Gate().Locations().Find_File( nSourceFile );
143cdf0e10cSrcweir pFound->Setup_DataFile_for(rFile);
144cdf0e10cSrcweir aMap_GlobalDataDisplay[nSourceFile] = pFound;
145cdf0e10cSrcweir }
146cdf0e10cSrcweir
147cdf0e10cSrcweir return *pFound;
148cdf0e10cSrcweir }
149cdf0e10cSrcweir
150cdf0e10cSrcweir void
Display_SglDatum(csi::xml::Element & rOut,const ary::cpp::Variable & i_rData)151cdf0e10cSrcweir DataDisplay::Display_SglDatum( csi::xml::Element & rOut,
152cdf0e10cSrcweir const ary::cpp::Variable & i_rData )
153cdf0e10cSrcweir {
154cdf0e10cSrcweir adcdisp::ExplanationList aDocu(rOut, true);
155cdf0e10cSrcweir aDocu.AddEntry( 0 );
156cdf0e10cSrcweir
157cdf0e10cSrcweir aDocu.Term()
158cdf0e10cSrcweir >> *new html::Label( DataLabel(i_rData.LocalName()) )
159cdf0e10cSrcweir << " ";
160cdf0e10cSrcweir aDocu.Term()
161cdf0e10cSrcweir << i_rData.LocalName();
162cdf0e10cSrcweir
163cdf0e10cSrcweir dshelp::Get_LinkedTypeText( aDocu.Def(), *pEnv, i_rData.Type() );
164cdf0e10cSrcweir aDocu.Def()
165cdf0e10cSrcweir << " "
166cdf0e10cSrcweir >> *new html::Strong
167cdf0e10cSrcweir << i_rData.LocalName();
168cdf0e10cSrcweir if ( i_rData.ArraySize().length() > 0 )
169cdf0e10cSrcweir {
170cdf0e10cSrcweir aDocu.Def()
171cdf0e10cSrcweir << "["
172cdf0e10cSrcweir << i_rData.ArraySize()
173cdf0e10cSrcweir << "]";
174cdf0e10cSrcweir }
175cdf0e10cSrcweir if ( i_rData.Initialisation().length() > 0 )
176cdf0e10cSrcweir {
177cdf0e10cSrcweir aDocu.Def()
178cdf0e10cSrcweir << " = "
179cdf0e10cSrcweir << i_rData.Initialisation();
180cdf0e10cSrcweir }
181cdf0e10cSrcweir aDocu.Def()
182cdf0e10cSrcweir << ";"
183cdf0e10cSrcweir << new html::LineBreak
184cdf0e10cSrcweir << new html::LineBreak;
185cdf0e10cSrcweir
186cdf0e10cSrcweir aDocu.AddEntry_NoTerm();
187cdf0e10cSrcweir
188cdf0e10cSrcweir pDocuShow->Assign_Out(aDocu.Def());
189cdf0e10cSrcweir pDocuShow->Process(i_rData.Docu());
190cdf0e10cSrcweir pDocuShow->Unassign_Out();
191cdf0e10cSrcweir
192cdf0e10cSrcweir rOut << new html::HorizontalLine;
193cdf0e10cSrcweir }
194