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_struct.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir 
26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
27cdf0e10cSrcweir #include <ary/idl/i_ce.hxx>
28cdf0e10cSrcweir #include <ary/idl/i_struct.hxx>
29cdf0e10cSrcweir #include <ary/idl/ik_exception.hxx>
30cdf0e10cSrcweir #include <ary/idl/ik_struct.hxx>
31cdf0e10cSrcweir #include <toolkit/hf_docentry.hxx>
32cdf0e10cSrcweir #include <toolkit/hf_linachain.hxx>
33cdf0e10cSrcweir #include <toolkit/hf_navi_sub.hxx>
34cdf0e10cSrcweir #include <toolkit/hf_title.hxx>
35cdf0e10cSrcweir #include "hfi_navibar.hxx"
36cdf0e10cSrcweir #include "hfi_property.hxx"
37cdf0e10cSrcweir #include "hfi_typetext.hxx"
38cdf0e10cSrcweir #include "hi_linkhelper.hxx"
39cdf0e10cSrcweir 
40cdf0e10cSrcweir 
41cdf0e10cSrcweir extern const String
42cdf0e10cSrcweir     C_sCePrefix_Struct("struct");
43cdf0e10cSrcweir extern const String
44cdf0e10cSrcweir     C_sCePrefix_Exception("exception");
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 
47cdf0e10cSrcweir namespace
48cdf0e10cSrcweir {
49cdf0e10cSrcweir 
50cdf0e10cSrcweir const String
51cdf0e10cSrcweir     C_sBaseStruct("Base Hierarchy");
52cdf0e10cSrcweir const String
53cdf0e10cSrcweir     C_sBaseException("Base Hierarchy");
54cdf0e10cSrcweir 
55cdf0e10cSrcweir const String
56cdf0e10cSrcweir     C_sList_Elements("Elements' Summary");
57cdf0e10cSrcweir const String
58cdf0e10cSrcweir     C_sList_Elements_Label("Elements");
59cdf0e10cSrcweir 
60cdf0e10cSrcweir const String
61cdf0e10cSrcweir     C_sList_ElementDetails("Elements' Details");
62cdf0e10cSrcweir const String
63cdf0e10cSrcweir     C_sList_ElementDetails_Label("ElementDetails");
64cdf0e10cSrcweir 
65cdf0e10cSrcweir enum E_SubListIndices
66cdf0e10cSrcweir {
67cdf0e10cSrcweir     sli_ElementsSummary = 0,
68cdf0e10cSrcweir     sli_ElementsDetails = 1
69cdf0e10cSrcweir };
70cdf0e10cSrcweir 
71cdf0e10cSrcweir }   // anonymous namespace
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 
HF_IdlStruct(Environment & io_rEnv,Xml::Element & o_rOut,bool i_bIsException)75cdf0e10cSrcweir HF_IdlStruct::HF_IdlStruct( Environment &         io_rEnv,
76cdf0e10cSrcweir                             Xml::Element &        o_rOut,
77cdf0e10cSrcweir                             bool                  i_bIsException )
78cdf0e10cSrcweir     :   HtmlFactory_Idl(io_rEnv, &o_rOut),
79cdf0e10cSrcweir         bIsException(i_bIsException)
80cdf0e10cSrcweir {
81cdf0e10cSrcweir }
82cdf0e10cSrcweir 
~HF_IdlStruct()83cdf0e10cSrcweir HF_IdlStruct::~HF_IdlStruct()
84cdf0e10cSrcweir {
85cdf0e10cSrcweir }
86cdf0e10cSrcweir 
87cdf0e10cSrcweir void
Produce_byData(const client & i_ce) const88cdf0e10cSrcweir HF_IdlStruct::Produce_byData( const client & i_ce ) const
89cdf0e10cSrcweir {
90cdf0e10cSrcweir     const ary::idl::Struct *
91cdf0e10cSrcweir         pStruct =
92cdf0e10cSrcweir             bIsException
93cdf0e10cSrcweir                 ?   0
94cdf0e10cSrcweir                 :   static_cast< const ary::idl::Struct* >(&i_ce);
95cdf0e10cSrcweir     bool bIsTemplate =
96cdf0e10cSrcweir             pStruct != 0
97cdf0e10cSrcweir                 ?   pStruct->TemplateParameterType().IsValid()
98cdf0e10cSrcweir                 :   false;
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     Dyn<HF_NaviSubRow>
101cdf0e10cSrcweir         pNaviSubRow( &make_Navibar(i_ce) );
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     HF_TitleTable
104cdf0e10cSrcweir         aTitle(CurOut());
105cdf0e10cSrcweir     HF_LinkedNameChain
106cdf0e10cSrcweir         aNameChain(aTitle.Add_Row());
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker);
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     // Title:
111cdf0e10cSrcweir     StreamLock
112cdf0e10cSrcweir         slAnnotations(200);
113cdf0e10cSrcweir     get_Annotations(slAnnotations(), i_ce);
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     StreamLock rTitle(200);
116cdf0e10cSrcweir     if (bIsTemplate)
117cdf0e10cSrcweir         rTitle() << "template ";
118cdf0e10cSrcweir     rTitle()
119cdf0e10cSrcweir         << (bIsException
120cdf0e10cSrcweir 		    ?   C_sCePrefix_Exception
121cdf0e10cSrcweir 			:   C_sCePrefix_Struct)
122cdf0e10cSrcweir 	    << " "
123cdf0e10cSrcweir 		<< i_ce.LocalName();
124cdf0e10cSrcweir     if (bIsTemplate)
125cdf0e10cSrcweir     {
126cdf0e10cSrcweir         csv_assert(pStruct != 0);
127cdf0e10cSrcweir         rTitle()
128cdf0e10cSrcweir             << "<"
129cdf0e10cSrcweir             << pStruct->TemplateParameter()
130cdf0e10cSrcweir             << ">";
131cdf0e10cSrcweir     }
132cdf0e10cSrcweir     aTitle.Produce_Title(slAnnotations().c_str(), rTitle().c_str());
133cdf0e10cSrcweir 
134cdf0e10cSrcweir     // Bases:
135cdf0e10cSrcweir     produce_Bases( aTitle.Add_Row(),
136cdf0e10cSrcweir                    i_ce,
137cdf0e10cSrcweir                    bIsException
138cdf0e10cSrcweir                     ?   C_sBaseException
139cdf0e10cSrcweir                     :   C_sBaseStruct );
140cdf0e10cSrcweir 
141cdf0e10cSrcweir     // Docu:
142cdf0e10cSrcweir     write_Docu(aTitle.Add_Row(), i_ce);
143cdf0e10cSrcweir     CurOut() << new Html::HorizontalLine();
144cdf0e10cSrcweir 
145cdf0e10cSrcweir     // Elements:
146cdf0e10cSrcweir     dyn_ce_list
147cdf0e10cSrcweir         dpElements;
148cdf0e10cSrcweir     if (bIsException)
149cdf0e10cSrcweir         ary::idl::ifc_exception::attr::Get_Elements(dpElements, i_ce);
150cdf0e10cSrcweir     else
151cdf0e10cSrcweir         ary::idl::ifc_struct::attr::Get_Elements(dpElements, i_ce);
152cdf0e10cSrcweir 
153cdf0e10cSrcweir     if ( (*dpElements).operator bool() )
154cdf0e10cSrcweir     {
155cdf0e10cSrcweir         produce_Members( *dpElements,
156cdf0e10cSrcweir                          C_sList_Elements,
157cdf0e10cSrcweir                          C_sList_Elements_Label,
158cdf0e10cSrcweir                          C_sList_ElementDetails,
159cdf0e10cSrcweir                          C_sList_ElementDetails_Label );
160cdf0e10cSrcweir         pNaviSubRow->SwitchOn(sli_ElementsSummary);
161cdf0e10cSrcweir         pNaviSubRow->SwitchOn(sli_ElementsDetails);
162cdf0e10cSrcweir     }
163cdf0e10cSrcweir     pNaviSubRow->Produce_Row();
164cdf0e10cSrcweir }
165cdf0e10cSrcweir 
166cdf0e10cSrcweir HtmlFactory_Idl::type_id
inq_BaseOf(const client & i_ce) const167cdf0e10cSrcweir HF_IdlStruct::inq_BaseOf( const client & i_ce ) const
168cdf0e10cSrcweir {
169cdf0e10cSrcweir     return bIsException
170cdf0e10cSrcweir                 ?   ary::idl::ifc_exception::attr::Base(i_ce)
171cdf0e10cSrcweir                 :   ary::idl::ifc_struct::attr::Base(i_ce);
172cdf0e10cSrcweir }
173cdf0e10cSrcweir 
174cdf0e10cSrcweir HF_NaviSubRow &
make_Navibar(const client & i_ce) const175cdf0e10cSrcweir HF_IdlStruct::make_Navibar( const client & i_ce ) const
176cdf0e10cSrcweir {
177cdf0e10cSrcweir     HF_IdlNavigationBar
178cdf0e10cSrcweir         aNaviBar(Env(), CurOut());
179cdf0e10cSrcweir     aNaviBar.Produce_CeMainRow(i_ce);
180cdf0e10cSrcweir 
181cdf0e10cSrcweir     DYN HF_NaviSubRow &
182cdf0e10cSrcweir         ret = aNaviBar.Add_SubRow();
183cdf0e10cSrcweir     ret.AddItem(C_sList_Elements, C_sList_Elements_Label, false);
184cdf0e10cSrcweir     ret.AddItem(C_sList_ElementDetails, C_sList_ElementDetails_Label, false);
185cdf0e10cSrcweir 
186cdf0e10cSrcweir     CurOut() << new Html::HorizontalLine();
187cdf0e10cSrcweir     return ret;
188cdf0e10cSrcweir }
189cdf0e10cSrcweir 
190cdf0e10cSrcweir void
produce_MemberDetails(HF_SubTitleTable & o_table,const client & i_ce) const191cdf0e10cSrcweir HF_IdlStruct::produce_MemberDetails( HF_SubTitleTable &  o_table,
192cdf0e10cSrcweir                                      const client &      i_ce) const
193cdf0e10cSrcweir {
194cdf0e10cSrcweir     HF_IdlStructElement
195cdf0e10cSrcweir         aElement( Env(), o_table );
196cdf0e10cSrcweir     aElement.Produce_byData(i_ce);
197cdf0e10cSrcweir }
198