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 <toolkit/hf_funcdecl.hxx>
24cdf0e10cSrcweir 
25cdf0e10cSrcweir 
26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
27cdf0e10cSrcweir 
28cdf0e10cSrcweir const String C_sValignTop("top");
29cdf0e10cSrcweir const String C_sValignBottom("bottom");
30cdf0e10cSrcweir 
31cdf0e10cSrcweir 
32cdf0e10cSrcweir 
HF_FunctionDeclaration(Xml::Element & o_rParent,const String & i_sRaisesText)33cdf0e10cSrcweir HF_FunctionDeclaration::HF_FunctionDeclaration( Xml::Element & o_rParent,
34cdf0e10cSrcweir 												const String & i_sRaisesText )
35cdf0e10cSrcweir     :   HtmlMaker(o_rParent),
36cdf0e10cSrcweir         sRaisesText(i_sRaisesText),
37cdf0e10cSrcweir         pTable(0),
38cdf0e10cSrcweir         pReturnCell(0),
39cdf0e10cSrcweir         pNameCell(0),
40cdf0e10cSrcweir         pParameterLine(0),
41cdf0e10cSrcweir         pLastParameterCell(0),
42cdf0e10cSrcweir         pExceptionCell(0)
43cdf0e10cSrcweir {
44cdf0e10cSrcweir     pTable = new Html::Table;
45cdf0e10cSrcweir     CurOut()
46cdf0e10cSrcweir         >> *pTable
47cdf0e10cSrcweir             << new Html::ClassAttr("table-in-method")
48cdf0e10cSrcweir             << new Xml::AnAttribute("border","0");
49cdf0e10cSrcweir }
50cdf0e10cSrcweir 
~HF_FunctionDeclaration()51cdf0e10cSrcweir HF_FunctionDeclaration::~HF_FunctionDeclaration()
52cdf0e10cSrcweir {
53cdf0e10cSrcweir }
54cdf0e10cSrcweir 
55cdf0e10cSrcweir Xml::Element &
ReturnCell()56cdf0e10cSrcweir HF_FunctionDeclaration::ReturnCell()
57cdf0e10cSrcweir {
58cdf0e10cSrcweir     if (pReturnCell != 0)
59cdf0e10cSrcweir         return *pReturnCell;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     pReturnCell = &( *pTable
62cdf0e10cSrcweir                         >> *new Html::TableRow
63cdf0e10cSrcweir                             >> *new Html::TableCell
64cdf0e10cSrcweir                                 << new Html::VAlignAttr(C_sValignTop)
65cdf0e10cSrcweir                                 << new Xml::AnAttribute("colspan", "3")
66cdf0e10cSrcweir                     );
67cdf0e10cSrcweir     return *pReturnCell;
68cdf0e10cSrcweir }
69cdf0e10cSrcweir 
70cdf0e10cSrcweir Xml::Element &
NameCell()71cdf0e10cSrcweir HF_FunctionDeclaration::NameCell()
72cdf0e10cSrcweir {
73cdf0e10cSrcweir     if (pNameCell != 0)
74cdf0e10cSrcweir         return *pNameCell;
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     pNameCell = &( ParameterLine()
77cdf0e10cSrcweir                     >> *new Html::TableCell
78cdf0e10cSrcweir                         << new Html::VAlignAttr(C_sValignTop)
79cdf0e10cSrcweir                  );
80cdf0e10cSrcweir     pLastParameterCell = pNameCell;
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     return *pNameCell;
83cdf0e10cSrcweir }
84cdf0e10cSrcweir 
85cdf0e10cSrcweir Xml::Element &
NewParamTypeCell()86cdf0e10cSrcweir HF_FunctionDeclaration::NewParamTypeCell()
87cdf0e10cSrcweir {
88cdf0e10cSrcweir     if (pLastParameterCell != pNameCell)
89cdf0e10cSrcweir     {
90cdf0e10cSrcweir         pParameterLine = 0;
91cdf0e10cSrcweir         ParameterLine()
92cdf0e10cSrcweir             >> *new Html::TableCell;
93cdf0e10cSrcweir     }
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     Xml::Element &
96cdf0e10cSrcweir         rParamType = ParameterLine()
97cdf0e10cSrcweir                         >> *new Html::TableCell
98cdf0e10cSrcweir                             << new Html::VAlignAttr(C_sValignTop);
99cdf0e10cSrcweir     pLastParameterCell
100cdf0e10cSrcweir                    = &( ParameterLine()
101cdf0e10cSrcweir                             >> *new Html::TableCell
102cdf0e10cSrcweir                                 << new Html::VAlignAttr(C_sValignBottom)
103cdf0e10cSrcweir                                 << new Xml::XmlCode("&nbsp;")
104cdf0e10cSrcweir                       );
105cdf0e10cSrcweir     return rParamType;
106cdf0e10cSrcweir }
107cdf0e10cSrcweir 
108cdf0e10cSrcweir Xml::Element &
ParamNameCell()109cdf0e10cSrcweir HF_FunctionDeclaration::ParamNameCell()
110cdf0e10cSrcweir {
111cdf0e10cSrcweir     csv_assert(pLastParameterCell != pNameCell);
112cdf0e10cSrcweir     return *pLastParameterCell;
113cdf0e10cSrcweir }
114cdf0e10cSrcweir 
115cdf0e10cSrcweir Xml::Element &
ExceptionCell()116cdf0e10cSrcweir HF_FunctionDeclaration::ExceptionCell()
117cdf0e10cSrcweir {
118cdf0e10cSrcweir     if (pExceptionCell != 0)
119cdf0e10cSrcweir         return *pExceptionCell;
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     Xml::Element &
122cdf0e10cSrcweir         rExceptionRow = *pTable
123cdf0e10cSrcweir                             >> *new Html::TableRow;
124cdf0e10cSrcweir     rExceptionRow
125cdf0e10cSrcweir         >> *new Html::TableCell
126cdf0e10cSrcweir             << new Html::VAlignAttr(C_sValignTop)
127cdf0e10cSrcweir             << new Xml::AnAttribute("align", "right")
128cdf0e10cSrcweir             << sRaisesText
129cdf0e10cSrcweir             << "( ";
130cdf0e10cSrcweir 
131cdf0e10cSrcweir     pExceptionCell = &( rExceptionRow
132cdf0e10cSrcweir                             >> *new Html::TableCell
133cdf0e10cSrcweir                                 << new Html::VAlignAttr(C_sValignTop)
134cdf0e10cSrcweir                                 << new Xml::AnAttribute("colspan", "2")
135cdf0e10cSrcweir                       );
136cdf0e10cSrcweir     return *pExceptionCell;
137cdf0e10cSrcweir }
138cdf0e10cSrcweir 
139cdf0e10cSrcweir Html::TableRow &
ParameterLine()140cdf0e10cSrcweir HF_FunctionDeclaration::ParameterLine()
141cdf0e10cSrcweir {
142cdf0e10cSrcweir     if (pParameterLine != 0)
143cdf0e10cSrcweir         return *pParameterLine;
144cdf0e10cSrcweir 
145cdf0e10cSrcweir     pParameterLine = new Html::TableRow;
146cdf0e10cSrcweir     *pTable
147cdf0e10cSrcweir         >> *pParameterLine;
148cdf0e10cSrcweir 
149cdf0e10cSrcweir     return *pParameterLine;
150cdf0e10cSrcweir }
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 
153cdf0e10cSrcweir #if 0   // old
154cdf0e10cSrcweir HF_FunctionDeclaration::HF_FunctionDeclaration( Xml::Element & o_rParent )
155cdf0e10cSrcweir     :   HtmlMaker(o_rParent),
156cdf0e10cSrcweir         pFront(0),
157cdf0e10cSrcweir         pTypes(0),
158cdf0e10cSrcweir         pNames(0)
159cdf0e10cSrcweir {
160cdf0e10cSrcweir     Xml::Element &
161cdf0e10cSrcweir         rRow = CurOut()
162cdf0e10cSrcweir                 >> *new Html::Table
163cdf0e10cSrcweir                     << new Xml::AnAttribute("border","0")
164cdf0e10cSrcweir                     >> *new Html::TableRow;
165cdf0e10cSrcweir     pFront = &(rRow >> *new Html::TableCell << new Html::VAlignAttr(C_sValignTop));
166cdf0e10cSrcweir     pTypes = &(rRow >> *new Html::TableCell << new Html::VAlignAttr(C_sValignTop));
167cdf0e10cSrcweir     pNames = &(rRow >> *new Html::TableCell << new Html::VAlignAttr(C_sValignTop));
168cdf0e10cSrcweir }
169cdf0e10cSrcweir 
170cdf0e10cSrcweir HF_FunctionDeclaration::~HF_FunctionDeclaration()
171cdf0e10cSrcweir {
172cdf0e10cSrcweir }
173cdf0e10cSrcweir 
174cdf0e10cSrcweir Xml::Element &
175cdf0e10cSrcweir HF_FunctionDeclaration::Add_ReturnLine()
176cdf0e10cSrcweir {
177cdf0e10cSrcweir     (*pTypes) << new Xml::XmlCode("&nbsp;<br>\n");
178cdf0e10cSrcweir     (*pNames) << new Xml::XmlCode("&nbsp;<br>\n");
179cdf0e10cSrcweir     return *pFront;
180cdf0e10cSrcweir }
181cdf0e10cSrcweir 
182cdf0e10cSrcweir Xml::Element &
183cdf0e10cSrcweir HF_FunctionDeclaration::Add_RaisesLine( const char * i_sRaisesText,
184cdf0e10cSrcweir                                         bool         i_bSuppressExtraLine )
185cdf0e10cSrcweir {
186cdf0e10cSrcweir     if (NOT i_bSuppressExtraLine)
187cdf0e10cSrcweir     {
188cdf0e10cSrcweir         (*pTypes) << new Xml::XmlCode("&nbsp;<br>");
189cdf0e10cSrcweir         (*pNames) << new Xml::XmlCode("&nbsp;<br>\n");
190cdf0e10cSrcweir     }
191cdf0e10cSrcweir     (*pTypes)
192cdf0e10cSrcweir         << new Xml::XmlCode("<p class=\"raise\">")
193cdf0e10cSrcweir         << i_sRaisesText
194cdf0e10cSrcweir         << new Xml::XmlCode("( </p>\n");
195cdf0e10cSrcweir     return *pNames;
196cdf0e10cSrcweir }
197cdf0e10cSrcweir #endif // 0    old
198