1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
/*************************************************************************
*
* $RCSfile: xmltree.cxx,v $
*
* $Revision: 1.3 $
*
* last change: $Author: np $Date: $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include <xmltree.hxx>
// NOT FULLY DEFINED SERVICES
#include <cr_html.hxx>
#include <cr_index.hxx>
char C_sMODULEDESCRIPTION[] = "module-description";
char C_sCOMPONENTDESCRIPTION[] = "component-description";
char C_sAuthor[] = "author";
char C_sName[] = "name";
char C_sDescription[] = "description";
char C_sReferenceDocu[] = "reference-docu";
char C_sModuleName[] = "module-name";
char C_sLoaderName[] = "loader-name";
char C_sSupportedService[] = "supported-service";
char C_sServiceDependency[] = "service-dependency";
char C_sProjectBuildDependency[] = "project-build-dependency";
char C_sRuntimeModuleDependency[] = "runtime-module-dependency";
char C_sLanguage[] = "language";
char C_sStatus[] = "status";
char C_sType[] = "type";
char C_sAttr_value[] = "value";
char C_sAttr_xl_href[] = "xlink:href";
char C_sAttr_xl_role[] = "xlink:role";
char C_sAttr_xl_title[] = "xlink:title";
char C_sAttr_xmlns[] = "xmlns:xlink";
char C_sAttr_xl_type[] = "xlink:type";
char C_sCompDescrListTitle[] = "Component Descriptions";
FreeChoiceElement * Create_ModuleDescrOptional_Element(
MultipleTextElement * &
o_rTypes,
MultipleTextElement * &
o_rServiceDependencies );
FreeChoiceElement * Create_CompDescrOptional_Element(
MultipleTextElement * &
o_rTypes,
MultipleTextElement * &
o_rServiceDependencies );
ModuleDescription::ModuleDescription()
: SequenceElement(C_sMODULEDESCRIPTION),
pModuleName(0),
pCdList(0),
pTypes(0),
pServiceDependencies(0)
{
pModuleName = new MdName;
AddChild( *pModuleName );
pCdList = new CompDescrList;
AddChild( *pCdList );
AddChild( *Create_ModuleDescrOptional_Element( pTypes, pServiceDependencies ) );
}
const Simstr &
ModuleDescription::ModuleName() const
{
return pModuleName->Data();
}
void
ModuleDescription::Get_SupportedServices( List< const MultipleTextElement * > & o_rServices ) const
{
o_rServices.push_back(pServiceDependencies);
pCdList->Get_SupportedServices( o_rServices );
}
void
ModuleDescription::Get_Types( List< const MultipleTextElement * > & o_rTypes ) const
{
o_rTypes.push_back(pTypes);
pCdList->Get_Types( o_rTypes );
}
void
ModuleDescription::Get_ServiceDependencies( List< const MultipleTextElement * > & o_rServices ) const
{
pCdList->Get_ServiceDependencies( o_rServices );
}
ComponentDescription::ComponentDescription()
: SequenceElement(C_sCOMPONENTDESCRIPTION,1),
pComponentName(0),
pSupportedServices(0),
pTypes(0),
pServiceDependencies(0)
{
AddChild( *new SglTextElement(C_sAuthor, lt_nolink, false) );
pComponentName = new CdName;
AddChild( *pComponentName );
AddChild( *new SglTextElement(C_sDescription, lt_nolink, false) );
AddChild( *new SglTextElement(C_sLoaderName, lt_idl, true) );
AddChild( *new SglTextElement(C_sLanguage, lt_nolink, false) );
AddChild( *new SglAttrElement(C_sStatus, C_sAttr_value) );
pSupportedServices = new SupportedService;
AddChild( *pSupportedServices );
AddChild( *Create_CompDescrOptional_Element( pTypes, pServiceDependencies ) );
}
CompDescrList::CompDescrList()
: ListElement(C_sCOMPONENTDESCRIPTION, 0)
{
}
void
CompDescrList::Write2Html( HtmlCreator & io_rHC ) const
{
io_rHC.StartBigCell(C_sCompDescrListTitle);
ListElement::Write2Html(io_rHC);
io_rHC.FinishBigCell();
}
XmlElement *
CompDescrList::Create_and_Add_NewElement()
{
ComponentDescription * pCD = new ComponentDescription;
Children().push_back(pCD);
aCDs.push_back(pCD);
return pCD;
}
void
CompDescrList::Get_SupportedServices( List< const MultipleTextElement * > & o_rResult ) const
{
unsigned i_max = aCDs.size();;
for (unsigned i = 0; i < i_max; ++i)
{
o_rResult.push_back(& aCDs[i]->SupportedServices());
} // end for
}
void
CompDescrList::Get_Types( List< const MultipleTextElement * > & o_rResult ) const
{
unsigned i_max = aCDs.size();;
for (unsigned i = 0; i < i_max; ++i)
{
o_rResult.push_back(& aCDs[i]->Types());
} // end for
}
void
CompDescrList::Get_ServiceDependencies( List< const MultipleTextElement * > & o_rResult ) const
{
unsigned i_max = aCDs.size();;
for (unsigned i = 0; i < i_max; ++i)
{
o_rResult.push_back(& aCDs[i]->ServiceDependencies());
} // end for
}
MdName::MdName()
: SglTextElement(C_sModuleName, lt_html, false)
{
}
void
MdName::Write2Html( HtmlCreator & io_rHC ) const
{
io_rHC.Write_SglTextElement( *this, true );
}
CdName::CdName()
: SglTextElement(C_sName, lt_html, true)
{
}
void
CdName::Write2Html( HtmlCreator & io_rHC ) const
{
io_rHC.Write_SglTextElement( *this, true );
}
SupportedService::SupportedService()
: MultipleTextElement(C_sSupportedService, lt_idl, true)
{
}
void
SupportedService::Insert2Index( Index & o_rIndex ) const
{
for ( unsigned i = 0; i < Size(); ++i )
{
o_rIndex.InsertSupportedService( Data(i) );
}
}
FreeChoiceElement *
Create_ModuleDescrOptional_Element( MultipleTextElement * & o_rTypes,
MultipleTextElement * & o_rServiceDependencies )
{
FreeChoiceElement * ret = Create_CompDescrOptional_Element( o_rTypes, o_rServiceDependencies );
ret->AddChild( *new MultipleTextElement(C_sProjectBuildDependency, lt_nolink, false) );
ret->AddChild( *new MultipleTextElement(C_sRuntimeModuleDependency, lt_nolink, false) );
return ret;
}
FreeChoiceElement *
Create_CompDescrOptional_Element( MultipleTextElement * & o_rTypes,
MultipleTextElement * & o_rServiceDependencies )
{
FreeChoiceElement * ret = new FreeChoiceElement;
const unsigned C_sRefDocuAttrNumber = 5;
static const char * C_sRefDocuAttrNames[C_sRefDocuAttrNumber]
= { C_sAttr_xl_href, C_sAttr_xl_role, C_sAttr_xl_title, C_sAttr_xmlns, C_sAttr_xl_type };
ret->AddChild( *new MultipleAttrElement(C_sReferenceDocu, C_sRefDocuAttrNames, C_sRefDocuAttrNumber) );
o_rServiceDependencies = new MultipleTextElement(C_sServiceDependency, lt_idl, true);
ret->AddChild( *o_rServiceDependencies );
o_rTypes = new MultipleTextElement(C_sType, lt_idl, true);
ret->AddChild( *o_rTypes );
return ret;
}
#if 0
const TextElement *
ModuleDescription::ServiceDependencies() const
{
const unsigned nEarliestPossibleServiceDependenciesIndexInModules = 1;
for ( unsigned i = nEarliestPossibleServiceDependenciesIndexInModules;
i < Children().size();
++i )
{
if ( strcmp(Children()[i]->Name(), C_sServiceDependency) == 0 )
return Children()[i];
}
return 0;
}
const TextElement &
ComponentDescription::SupportedServices() const
{
return *Children()[C_nSupportedServicesIndex];
}
const TextElement *
ComponentDescription::ServiceDependencies() const
{
for ( unsigned i = C_nEarliestPossibleServiceDependenciesIndex; i < Children().size(); ++i )
{
if ( strcmp(Children()[i]->Name(),C_sServiceDependency) == 0)
return Children()[i];
}
return 0;
}
#endif
|