1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22 #include <precomp.h>
23 #include <toolkit/hf_funcdecl.hxx>
24
25
26 // NOT FULLY DEFINED SERVICES
27
28 const String C_sValignTop("top");
29 const String C_sValignBottom("bottom");
30
31
32
HF_FunctionDeclaration(Xml::Element & o_rParent,const String & i_sRaisesText)33 HF_FunctionDeclaration::HF_FunctionDeclaration( Xml::Element & o_rParent,
34 const String & i_sRaisesText )
35 : HtmlMaker(o_rParent),
36 sRaisesText(i_sRaisesText),
37 pTable(0),
38 pReturnCell(0),
39 pNameCell(0),
40 pParameterLine(0),
41 pLastParameterCell(0),
42 pExceptionCell(0)
43 {
44 pTable = new Html::Table;
45 CurOut()
46 >> *pTable
47 << new Html::ClassAttr("table-in-method")
48 << new Xml::AnAttribute("border","0");
49 }
50
~HF_FunctionDeclaration()51 HF_FunctionDeclaration::~HF_FunctionDeclaration()
52 {
53 }
54
55 Xml::Element &
ReturnCell()56 HF_FunctionDeclaration::ReturnCell()
57 {
58 if (pReturnCell != 0)
59 return *pReturnCell;
60
61 pReturnCell = &( *pTable
62 >> *new Html::TableRow
63 >> *new Html::TableCell
64 << new Html::VAlignAttr(C_sValignTop)
65 << new Xml::AnAttribute("colspan", "3")
66 );
67 return *pReturnCell;
68 }
69
70 Xml::Element &
NameCell()71 HF_FunctionDeclaration::NameCell()
72 {
73 if (pNameCell != 0)
74 return *pNameCell;
75
76 pNameCell = &( ParameterLine()
77 >> *new Html::TableCell
78 << new Html::VAlignAttr(C_sValignTop)
79 );
80 pLastParameterCell = pNameCell;
81
82 return *pNameCell;
83 }
84
85 Xml::Element &
NewParamTypeCell()86 HF_FunctionDeclaration::NewParamTypeCell()
87 {
88 if (pLastParameterCell != pNameCell)
89 {
90 pParameterLine = 0;
91 ParameterLine()
92 >> *new Html::TableCell;
93 }
94
95 Xml::Element &
96 rParamType = ParameterLine()
97 >> *new Html::TableCell
98 << new Html::VAlignAttr(C_sValignTop);
99 pLastParameterCell
100 = &( ParameterLine()
101 >> *new Html::TableCell
102 << new Html::VAlignAttr(C_sValignBottom)
103 << new Xml::XmlCode(" ")
104 );
105 return rParamType;
106 }
107
108 Xml::Element &
ParamNameCell()109 HF_FunctionDeclaration::ParamNameCell()
110 {
111 csv_assert(pLastParameterCell != pNameCell);
112 return *pLastParameterCell;
113 }
114
115 Xml::Element &
ExceptionCell()116 HF_FunctionDeclaration::ExceptionCell()
117 {
118 if (pExceptionCell != 0)
119 return *pExceptionCell;
120
121 Xml::Element &
122 rExceptionRow = *pTable
123 >> *new Html::TableRow;
124 rExceptionRow
125 >> *new Html::TableCell
126 << new Html::VAlignAttr(C_sValignTop)
127 << new Xml::AnAttribute("align", "right")
128 << sRaisesText
129 << "( ";
130
131 pExceptionCell = &( rExceptionRow
132 >> *new Html::TableCell
133 << new Html::VAlignAttr(C_sValignTop)
134 << new Xml::AnAttribute("colspan", "2")
135 );
136 return *pExceptionCell;
137 }
138
139 Html::TableRow &
ParameterLine()140 HF_FunctionDeclaration::ParameterLine()
141 {
142 if (pParameterLine != 0)
143 return *pParameterLine;
144
145 pParameterLine = new Html::TableRow;
146 *pTable
147 >> *pParameterLine;
148
149 return *pParameterLine;
150 }
151
152
153 #if 0 // old
154 HF_FunctionDeclaration::HF_FunctionDeclaration( Xml::Element & o_rParent )
155 : HtmlMaker(o_rParent),
156 pFront(0),
157 pTypes(0),
158 pNames(0)
159 {
160 Xml::Element &
161 rRow = CurOut()
162 >> *new Html::Table
163 << new Xml::AnAttribute("border","0")
164 >> *new Html::TableRow;
165 pFront = &(rRow >> *new Html::TableCell << new Html::VAlignAttr(C_sValignTop));
166 pTypes = &(rRow >> *new Html::TableCell << new Html::VAlignAttr(C_sValignTop));
167 pNames = &(rRow >> *new Html::TableCell << new Html::VAlignAttr(C_sValignTop));
168 }
169
170 HF_FunctionDeclaration::~HF_FunctionDeclaration()
171 {
172 }
173
174 Xml::Element &
175 HF_FunctionDeclaration::Add_ReturnLine()
176 {
177 (*pTypes) << new Xml::XmlCode(" <br>\n");
178 (*pNames) << new Xml::XmlCode(" <br>\n");
179 return *pFront;
180 }
181
182 Xml::Element &
183 HF_FunctionDeclaration::Add_RaisesLine( const char * i_sRaisesText,
184 bool i_bSuppressExtraLine )
185 {
186 if (NOT i_bSuppressExtraLine)
187 {
188 (*pTypes) << new Xml::XmlCode(" <br>");
189 (*pNames) << new Xml::XmlCode(" <br>\n");
190 }
191 (*pTypes)
192 << new Xml::XmlCode("<p class=\"raise\">")
193 << i_sRaisesText
194 << new Xml::XmlCode("( </p>\n");
195 return *pNames;
196 }
197 #endif // 0 old
198