1 | <?xml version="1.0"?>
|
---|
2 |
|
---|
3 | <!--
|
---|
4 | * A template to generate a generic IDL file from the generic interface
|
---|
5 | * definition expressed in XML. The generated file is intended solely to
|
---|
6 | * generate the documentation using Doxygen.
|
---|
7 |
|
---|
8 | Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
9 |
|
---|
10 | This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | available from http://www.virtualbox.org. This file is free software;
|
---|
12 | you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | General Public License (GPL) as published by the Free Software
|
---|
14 | Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 |
|
---|
18 | Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | additional information or have any questions.
|
---|
21 | -->
|
---|
22 |
|
---|
23 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
---|
24 | <xsl:output method="html" indent="yes"/>
|
---|
25 |
|
---|
26 | <xsl:strip-space elements="*"/>
|
---|
27 |
|
---|
28 |
|
---|
29 | <!--
|
---|
30 | // helper definitions
|
---|
31 | /////////////////////////////////////////////////////////////////////////////
|
---|
32 | -->
|
---|
33 |
|
---|
34 | <!--
|
---|
35 | * uncapitalizes the first letter only if the second one is not capital
|
---|
36 | * otherwise leaves the string unchanged
|
---|
37 | -->
|
---|
38 | <xsl:template name="uncapitalize">
|
---|
39 | <xsl:param name="str" select="."/>
|
---|
40 | <xsl:choose>
|
---|
41 | <xsl:when test="not(contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', substring($str,2,1)))">
|
---|
42 | <xsl:value-of select="
|
---|
43 | concat(
|
---|
44 | translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),
|
---|
45 | substring($str,2)
|
---|
46 | )
|
---|
47 | "/>
|
---|
48 | </xsl:when>
|
---|
49 | <xsl:otherwise>
|
---|
50 | <xsl:value-of select="string($str)"/>
|
---|
51 | </xsl:otherwise>
|
---|
52 | </xsl:choose>
|
---|
53 | </xsl:template>
|
---|
54 |
|
---|
55 | <!--
|
---|
56 | * translates the string to uppercase
|
---|
57 | -->
|
---|
58 | <xsl:template name="uppercase">
|
---|
59 | <xsl:param name="str" select="."/>
|
---|
60 | <xsl:value-of select="
|
---|
61 | translate($str,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')
|
---|
62 | "/>
|
---|
63 | </xsl:template>
|
---|
64 |
|
---|
65 |
|
---|
66 | <!--
|
---|
67 | // Doxygen transformation rules
|
---|
68 | /////////////////////////////////////////////////////////////////////////////
|
---|
69 | -->
|
---|
70 |
|
---|
71 | <!--
|
---|
72 | * all text elements that are not explicitly matched are normalized
|
---|
73 | * (all whitespace chars are converted to single spaces)
|
---|
74 | -->
|
---|
75 | <!--xsl:template match="desc//text()">
|
---|
76 | <xsl:value-of select="concat(' ',normalize-space(.),' ')"/>
|
---|
77 | </xsl:template-->
|
---|
78 |
|
---|
79 | <!--
|
---|
80 | * all elements that are not explicitly matched are considered to be html tags
|
---|
81 | * and copied w/o modifications
|
---|
82 | -->
|
---|
83 | <xsl:template match="desc//*">
|
---|
84 | <xsl:copy>
|
---|
85 | <xsl:apply-templates/>
|
---|
86 | </xsl:copy>
|
---|
87 | </xsl:template>
|
---|
88 |
|
---|
89 | <!--
|
---|
90 | * paragraph
|
---|
91 | -->
|
---|
92 | <xsl:template match="desc//p">
|
---|
93 | <xsl:text>
</xsl:text>
|
---|
94 | <xsl:apply-templates/>
|
---|
95 | <xsl:text>
</xsl:text>
|
---|
96 | </xsl:template>
|
---|
97 |
|
---|
98 | <!--
|
---|
99 | * link
|
---|
100 | -->
|
---|
101 | <xsl:template match="desc//link">
|
---|
102 | <xsl:text>@link </xsl:text>
|
---|
103 | <!--
|
---|
104 | * sometimes Doxygen is stupid and cannot resolve global enums properly,
|
---|
105 | * thinking they are members of the current class. Fix it by adding ::
|
---|
106 | * in front of any @to value that doesn't start with #.
|
---|
107 | -->
|
---|
108 | <xsl:choose>
|
---|
109 | <xsl:when test="not(starts-with(@to, '#')) and not(contains(@to, '::'))">
|
---|
110 | <xsl:text>::</xsl:text>
|
---|
111 | </xsl:when>
|
---|
112 | </xsl:choose>
|
---|
113 | <!--
|
---|
114 | * Doxygen doesn't understand autolinks like Class::func() if Class
|
---|
115 | * doesn't actually contain a func with no arguments. Fix it.
|
---|
116 | -->
|
---|
117 | <xsl:choose>
|
---|
118 | <xsl:when test="substring(@to, string-length(@to)-1)='()'">
|
---|
119 | <xsl:value-of select="substring-before(@to, '()')"/>
|
---|
120 | </xsl:when>
|
---|
121 | <xsl:otherwise>
|
---|
122 | <xsl:value-of select="@to"/>
|
---|
123 | </xsl:otherwise>
|
---|
124 | </xsl:choose>
|
---|
125 | <xsl:text> </xsl:text>
|
---|
126 | <xsl:choose>
|
---|
127 | <xsl:when test="normalize-space(text())">
|
---|
128 | <xsl:value-of select="normalize-space(text())"/>
|
---|
129 | </xsl:when>
|
---|
130 | <xsl:otherwise>
|
---|
131 | <xsl:choose>
|
---|
132 | <xsl:when test="starts-with(@to, '#')">
|
---|
133 | <xsl:value-of select="substring-after(@to, '#')"/>
|
---|
134 | </xsl:when>
|
---|
135 | <xsl:when test="starts-with(@to, '::')">
|
---|
136 | <xsl:value-of select="substring-after(@to, '::')"/>
|
---|
137 | </xsl:when>
|
---|
138 | <xsl:otherwise>
|
---|
139 | <xsl:value-of select="@to"/>
|
---|
140 | </xsl:otherwise>
|
---|
141 | </xsl:choose>
|
---|
142 | </xsl:otherwise>
|
---|
143 | </xsl:choose>
|
---|
144 | <xsl:text>@endlink</xsl:text>
|
---|
145 | <!--
|
---|
146 | * insert a dummy empty B element to distinctly separate @endlink
|
---|
147 | * from the following text
|
---|
148 | -->
|
---|
149 | <xsl:element name="b"/>
|
---|
150 | </xsl:template>
|
---|
151 |
|
---|
152 | <!--
|
---|
153 | * note
|
---|
154 | -->
|
---|
155 | <xsl:template match="desc/note">
|
---|
156 | <xsl:text>
@note </xsl:text>
|
---|
157 | <xsl:apply-templates/>
|
---|
158 | <xsl:text>
</xsl:text>
|
---|
159 | </xsl:template>
|
---|
160 |
|
---|
161 | <!--
|
---|
162 | * see
|
---|
163 | -->
|
---|
164 | <xsl:template match="desc/see">
|
---|
165 | <xsl:text>
@see </xsl:text>
|
---|
166 | <xsl:apply-templates/>
|
---|
167 | <xsl:text>
</xsl:text>
|
---|
168 | </xsl:template>
|
---|
169 |
|
---|
170 | <!--
|
---|
171 | * comment for interfaces
|
---|
172 | -->
|
---|
173 | <xsl:template match="interface/desc">
|
---|
174 | <xsl:text>/**
</xsl:text>
|
---|
175 | <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/>
|
---|
176 | <xsl:apply-templates select="note"/>
|
---|
177 | <xsl:apply-templates select="see"/>
|
---|
178 | @par Interface ID:
|
---|
179 | <tt>{<xsl:call-template name="uppercase">
|
---|
180 | <xsl:with-param name="str" select="../@uuid"/>
|
---|
181 | </xsl:call-template>}</tt>
|
---|
182 | <xsl:text>
*/
</xsl:text>
|
---|
183 | </xsl:template>
|
---|
184 |
|
---|
185 | <!--
|
---|
186 | * comment for attributes
|
---|
187 | -->
|
---|
188 | <xsl:template match="attribute/desc">
|
---|
189 | <xsl:text>/**
</xsl:text>
|
---|
190 | <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/>
|
---|
191 | <xsl:apply-templates select="note"/>
|
---|
192 | <xsl:if test="../@mod='ptr'">
|
---|
193 | <xsl:text>
|
---|
194 |
|
---|
195 | @warning This attribute is non-scriptable. In particular, this also means that an
|
---|
196 | attempt to get or set it from a process other than the process that has created and
|
---|
197 | owns the object will most likely fail or crash your application.
|
---|
198 | </xsl:text>
|
---|
199 | </xsl:if>
|
---|
200 | <xsl:apply-templates select="see"/>
|
---|
201 | <xsl:text>
*/
</xsl:text>
|
---|
202 | </xsl:template>
|
---|
203 |
|
---|
204 | <!--
|
---|
205 | * comment for methods
|
---|
206 | -->
|
---|
207 | <xsl:template match="method/desc">
|
---|
208 | <xsl:text>/**
</xsl:text>
|
---|
209 | <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/>
|
---|
210 | <xsl:for-each select="../param">
|
---|
211 | <xsl:apply-templates select="desc"/>
|
---|
212 | </xsl:for-each>
|
---|
213 | <xsl:apply-templates select="note"/>
|
---|
214 | <xsl:apply-templates select="../param/desc/note"/>
|
---|
215 | <xsl:if test="../param/@mod='ptr'">
|
---|
216 | <xsl:text>
|
---|
217 |
|
---|
218 | @warning This method is non-scriptable. In particluar, this also means that an
|
---|
219 | attempt to call it from a process other than the process that has created and
|
---|
220 | owns the object will most likely fail or crash your application.
|
---|
221 | </xsl:text>
|
---|
222 | </xsl:if>
|
---|
223 | <xsl:apply-templates select="see"/>
|
---|
224 | <xsl:text>
*/
</xsl:text>
|
---|
225 | </xsl:template>
|
---|
226 |
|
---|
227 | <!--
|
---|
228 | * comment for method parameters
|
---|
229 | -->
|
---|
230 | <xsl:template match="method/param/desc">
|
---|
231 | <xsl:text>
@param </xsl:text>
|
---|
232 | <xsl:value-of select="../@name"/>
|
---|
233 | <xsl:text> </xsl:text>
|
---|
234 | <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/>
|
---|
235 | <xsl:text>
</xsl:text>
|
---|
236 | </xsl:template>
|
---|
237 |
|
---|
238 | <!--
|
---|
239 | * comment for interfaces
|
---|
240 | -->
|
---|
241 | <xsl:template match="enum/desc">
|
---|
242 | <xsl:text>/**
</xsl:text>
|
---|
243 | <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/>
|
---|
244 | <xsl:apply-templates select="note"/>
|
---|
245 | <xsl:apply-templates select="see"/>
|
---|
246 | @par Interface ID:
|
---|
247 | <tt>{<xsl:call-template name="uppercase">
|
---|
248 | <xsl:with-param name="str" select="../@uuid"/>
|
---|
249 | </xsl:call-template>}</tt>
|
---|
250 | <xsl:text>
*/
</xsl:text>
|
---|
251 | </xsl:template>
|
---|
252 |
|
---|
253 | <!--
|
---|
254 | * comment for enum values
|
---|
255 | -->
|
---|
256 | <xsl:template match="enum/const/desc">
|
---|
257 | <xsl:text>/** @brief </xsl:text>
|
---|
258 | <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/>
|
---|
259 | <xsl:apply-templates select="note"/>
|
---|
260 | <xsl:apply-templates select="see"/>
|
---|
261 | <xsl:text>
*/
</xsl:text>
|
---|
262 | </xsl:template>
|
---|
263 |
|
---|
264 | <!--
|
---|
265 | // templates
|
---|
266 | /////////////////////////////////////////////////////////////////////////////
|
---|
267 | -->
|
---|
268 |
|
---|
269 |
|
---|
270 | <!--
|
---|
271 | * header
|
---|
272 | -->
|
---|
273 | <xsl:template match="/idl">
|
---|
274 | /*
|
---|
275 | * DO NOT EDIT! This is a generated file.
|
---|
276 | *
|
---|
277 | * Doxygen IDL definition for VirualBox Main API (COM interfaces)
|
---|
278 | * generated from XIDL (XML interface definition).
|
---|
279 | *
|
---|
280 | * Source : src/VBox/Main/idl/VirtualBox.xidl
|
---|
281 | * Generator : src/VBox/Main/idl/doxygen.xsl
|
---|
282 | *
|
---|
283 | * This IDL is generated using some generic OMG IDL-like syntax SOLELY
|
---|
284 | * for the purpose of generating the documentation using Doxygen and
|
---|
285 | * is not syntactically valid.
|
---|
286 | *
|
---|
287 | * DO NOT USE THIS HEADER IN ANY OTHER WAY!
|
---|
288 | */
|
---|
289 |
|
---|
290 | /** @mainpage
|
---|
291 | *
|
---|
292 | * Welcome to the <b>VirtualBox Main documentation.</b> This describes the
|
---|
293 | * so-called VirtualBox "Main API", which comprises all public COM interfaces
|
---|
294 | * and components provided by the VirtualBox server and by the VirtualBox client
|
---|
295 | * library.
|
---|
296 | *
|
---|
297 | * VirtualBox employs a client-server design, meaning that whenever any part of
|
---|
298 | * VirtualBox is running -- be it the Qt GUI, the VBoxManage command-line
|
---|
299 | * interface or any virtual machine --, a background server process named
|
---|
300 | * VBoxSVC runs in the background. This allows multiple processes to cooperate
|
---|
301 | * without conflicts. Some of the COM objects described by this Main documentation
|
---|
302 | * "live" in that server process, others "live" in the local client process. In
|
---|
303 | * any case, processes that use the Main API are using inter-process communication
|
---|
304 | * to communicate with these objects, but the details of this are hidden by the COM API.
|
---|
305 | *
|
---|
306 | * On Windows platforms, the VirtualBox Main API uses Microsoft COM, a native COM
|
---|
307 | * implementation. On all other platforms, Mozilla XPCOM, an open-source COM
|
---|
308 | * implementation, is used.
|
---|
309 | *
|
---|
310 | * All the parts that a typical VirtualBox user interacts with (the Qt GUI,
|
---|
311 | * the VBoxManage command-line interface and the VBoxVRDP server) are technically
|
---|
312 | * front-ends to the Main API and only use the interfaces that are documented
|
---|
313 | * in this Main API documentation. This ensures that, with any given release
|
---|
314 | * version of VirtualBox, all capabilities of the product that could be useful
|
---|
315 | * to an external client program are always exposed by way of this API.
|
---|
316 | *
|
---|
317 | * The complete API is described in a source IDL file, called VirtualBox.idl.
|
---|
318 | * This contains all public interfaces exposed by the Main API. Two interfaces
|
---|
319 | * are of supreme importance and will be needed in order for any front-end program
|
---|
320 | * to do anything useful: these are IVirtualBox and ISession. It is recommended
|
---|
321 | * to read the documentation of these interfaces first.
|
---|
322 | *
|
---|
323 | * @note VirtualBox.idl is automatically generated from a generic internal file
|
---|
324 | * to define all interfaces in a platform-independent way for documentation
|
---|
325 | * purposes. This generated file is not a syntactically valid IDL file and
|
---|
326 | * <i>must not</i> be used for programming.
|
---|
327 | */
|
---|
328 | <xsl:text>
</xsl:text>
|
---|
329 | <xsl:apply-templates/>
|
---|
330 | </xsl:template>
|
---|
331 |
|
---|
332 |
|
---|
333 | <!--
|
---|
334 | * accept all <if>s
|
---|
335 | -->
|
---|
336 | <xsl:template match="if">
|
---|
337 | <xsl:apply-templates/>
|
---|
338 | </xsl:template>
|
---|
339 |
|
---|
340 |
|
---|
341 | <!--
|
---|
342 | * cpp_quote (ignore)
|
---|
343 | -->
|
---|
344 | <xsl:template match="cpp">
|
---|
345 | </xsl:template>
|
---|
346 |
|
---|
347 |
|
---|
348 | <!--
|
---|
349 | * #ifdef statement (@if attribute)
|
---|
350 | -->
|
---|
351 | <xsl:template match="@if" mode="begin">
|
---|
352 | <xsl:text>#if </xsl:text>
|
---|
353 | <xsl:value-of select="."/>
|
---|
354 | <xsl:text>
</xsl:text>
|
---|
355 | </xsl:template>
|
---|
356 | <xsl:template match="@if" mode="end">
|
---|
357 | <xsl:text>#endif
</xsl:text>
|
---|
358 | </xsl:template>
|
---|
359 |
|
---|
360 |
|
---|
361 | <!--
|
---|
362 | * libraries
|
---|
363 | -->
|
---|
364 | <xsl:template match="library">
|
---|
365 | <!-- all enums go first -->
|
---|
366 | <xsl:apply-templates select="enum | if/enum"/>
|
---|
367 | <!-- everything else but enums -->
|
---|
368 | <xsl:apply-templates select="*[not(self::enum) and not(self::if[enum])]"/>
|
---|
369 | </xsl:template>
|
---|
370 |
|
---|
371 |
|
---|
372 | <!--
|
---|
373 | * interfaces
|
---|
374 | -->
|
---|
375 | <xsl:template match="interface">
|
---|
376 | <xsl:apply-templates select="desc"/>
|
---|
377 | <xsl:text>interface </xsl:text>
|
---|
378 | <xsl:value-of select="@name"/>
|
---|
379 | <xsl:text> : </xsl:text>
|
---|
380 | <xsl:value-of select="@extends"/>
|
---|
381 | <xsl:text>
{
</xsl:text>
|
---|
382 | <!-- attributes (properties) -->
|
---|
383 | <xsl:apply-templates select="attribute"/>
|
---|
384 | <!-- methods -->
|
---|
385 | <xsl:apply-templates select="method"/>
|
---|
386 | <!-- 'if' enclosed elements, unsorted -->
|
---|
387 | <xsl:apply-templates select="if"/>
|
---|
388 | <!-- -->
|
---|
389 | <xsl:text>}; /* interface </xsl:text>
|
---|
390 | <xsl:value-of select="@name"/>
|
---|
391 | <xsl:text> */

</xsl:text>
|
---|
392 | </xsl:template>
|
---|
393 |
|
---|
394 |
|
---|
395 | <!--
|
---|
396 | * attributes
|
---|
397 | -->
|
---|
398 | <xsl:template match="interface//attribute | collection//attribute">
|
---|
399 | <xsl:if test="@array">
|
---|
400 | <xsl:message terminate="yes">
|
---|
401 | <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
|
---|
402 | <xsl:text>'array' attributes are not supported, use 'safearray="yes"' instead.</xsl:text>
|
---|
403 | </xsl:message>
|
---|
404 | </xsl:if>
|
---|
405 | <xsl:apply-templates select="@if" mode="begin"/>
|
---|
406 | <xsl:apply-templates select="desc"/>
|
---|
407 | <xsl:text> </xsl:text>
|
---|
408 | <xsl:if test="@readonly='yes'">
|
---|
409 | <xsl:text>readonly </xsl:text>
|
---|
410 | </xsl:if>
|
---|
411 | <xsl:text>attribute </xsl:text>
|
---|
412 | <xsl:apply-templates select="@type"/>
|
---|
413 | <xsl:text> </xsl:text>
|
---|
414 | <xsl:value-of select="@name"/>
|
---|
415 | <xsl:text>;
</xsl:text>
|
---|
416 | <xsl:apply-templates select="@if" mode="end"/>
|
---|
417 | <xsl:text>
</xsl:text>
|
---|
418 | </xsl:template>
|
---|
419 |
|
---|
420 | <!--
|
---|
421 | * methods
|
---|
422 | -->
|
---|
423 | <xsl:template match="interface//method | collection//method">
|
---|
424 | <xsl:apply-templates select="@if" mode="begin"/>
|
---|
425 | <xsl:apply-templates select="desc"/>
|
---|
426 | <xsl:text> void </xsl:text>
|
---|
427 | <xsl:value-of select="@name"/>
|
---|
428 | <xsl:if test="param">
|
---|
429 | <xsl:text> (
</xsl:text>
|
---|
430 | <xsl:for-each select="param [position() != last()]">
|
---|
431 | <xsl:text> </xsl:text>
|
---|
432 | <xsl:apply-templates select="."/>
|
---|
433 | <xsl:text>,
</xsl:text>
|
---|
434 | </xsl:for-each>
|
---|
435 | <xsl:text> </xsl:text>
|
---|
436 | <xsl:apply-templates select="param [last()]"/>
|
---|
437 | <xsl:text>
 );
</xsl:text>
|
---|
438 | </xsl:if>
|
---|
439 | <xsl:if test="not(param)">
|
---|
440 | <xsl:text>();
</xsl:text>
|
---|
441 | </xsl:if>
|
---|
442 | <xsl:apply-templates select="@if" mode="end"/>
|
---|
443 | <xsl:text>
</xsl:text>
|
---|
444 | </xsl:template>
|
---|
445 |
|
---|
446 |
|
---|
447 | <!--
|
---|
448 | * co-classes
|
---|
449 | -->
|
---|
450 | <xsl:template match="module/class">
|
---|
451 | <!-- class and contract id: later -->
|
---|
452 | <!-- CLSID_xxx declarations for XPCOM, for compatibility with Win32: later -->
|
---|
453 | </xsl:template>
|
---|
454 |
|
---|
455 |
|
---|
456 | <!--
|
---|
457 | * enumerators
|
---|
458 | -->
|
---|
459 | <xsl:template match="enumerator">
|
---|
460 | <xsl:text>interface </xsl:text>
|
---|
461 | <xsl:value-of select="@name"/>
|
---|
462 | <xsl:text> : $unknown
{
</xsl:text>
|
---|
463 | <!-- HasMore -->
|
---|
464 | <xsl:text> void hasMore ([retval] out boolean more);

</xsl:text>
|
---|
465 | <!-- GetNext -->
|
---|
466 | <xsl:text> void getNext ([retval] out </xsl:text>
|
---|
467 | <xsl:apply-templates select="@type"/>
|
---|
468 | <xsl:text> next);

</xsl:text>
|
---|
469 | <!-- -->
|
---|
470 | <xsl:text>}; /* interface </xsl:text>
|
---|
471 | <xsl:value-of select="@name"/>
|
---|
472 | <xsl:text> */

</xsl:text>
|
---|
473 | </xsl:template>
|
---|
474 |
|
---|
475 |
|
---|
476 | <!--
|
---|
477 | * collections
|
---|
478 | -->
|
---|
479 | <xsl:template match="collection">
|
---|
480 | <xsl:if test="not(@readonly='yes')">
|
---|
481 | <xsl:message terminate="yes">
|
---|
482 | <xsl:value-of select="concat(@name,': ')"/>
|
---|
483 | <xsl:text>non-readonly collections are not currently supported</xsl:text>
|
---|
484 | </xsl:message>
|
---|
485 | </xsl:if>
|
---|
486 | <xsl:text>interface </xsl:text>
|
---|
487 | <xsl:value-of select="@name"/>
|
---|
488 | <xsl:text> : $unknown
{
</xsl:text>
|
---|
489 | <!-- Count -->
|
---|
490 | <xsl:text> readonly attribute unsigned long count;

</xsl:text>
|
---|
491 | <!-- GetItemAt -->
|
---|
492 | <xsl:text> void getItemAt (in unsigned long index, [retval] out </xsl:text>
|
---|
493 | <xsl:apply-templates select="@type"/>
|
---|
494 | <xsl:text> item);

</xsl:text>
|
---|
495 | <!-- Enumerate -->
|
---|
496 | <xsl:text> void enumerate ([retval] out </xsl:text>
|
---|
497 | <xsl:apply-templates select="@enumerator"/>
|
---|
498 | <xsl:text> enumerator);

</xsl:text>
|
---|
499 | <!-- other extra attributes (properties) -->
|
---|
500 | <xsl:apply-templates select="attribute"/>
|
---|
501 | <!-- other extra methods -->
|
---|
502 | <xsl:apply-templates select="method"/>
|
---|
503 | <!-- 'if' enclosed elements, unsorted -->
|
---|
504 | <xsl:apply-templates select="if"/>
|
---|
505 | <!-- -->
|
---|
506 | <xsl:text>}; /* interface </xsl:text>
|
---|
507 | <xsl:value-of select="@name"/>
|
---|
508 | <xsl:text> */

</xsl:text>
|
---|
509 | </xsl:template>
|
---|
510 |
|
---|
511 |
|
---|
512 | <!--
|
---|
513 | * enums
|
---|
514 | -->
|
---|
515 | <xsl:template match="enum">
|
---|
516 | <xsl:apply-templates select="desc"/>
|
---|
517 | <xsl:text>enum </xsl:text>
|
---|
518 | <xsl:value-of select="@name"/>
|
---|
519 | <xsl:text>
{
</xsl:text>
|
---|
520 | <xsl:for-each select="const">
|
---|
521 | <xsl:apply-templates select="desc"/>
|
---|
522 | <xsl:text> </xsl:text>
|
---|
523 | <xsl:value-of select="@name"/> = <xsl:value-of select="@value"/>
|
---|
524 | <xsl:text>,
</xsl:text>
|
---|
525 | </xsl:for-each>
|
---|
526 | <xsl:text>};

</xsl:text>
|
---|
527 | </xsl:template>
|
---|
528 |
|
---|
529 |
|
---|
530 | <!--
|
---|
531 | * method parameters
|
---|
532 | -->
|
---|
533 | <xsl:template match="method/param">
|
---|
534 | <xsl:if test="@array">
|
---|
535 | <xsl:if test="@dir='return'">
|
---|
536 | <xsl:message terminate="yes">
|
---|
537 | <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
|
---|
538 | <xsl:text>return 'array' parameters are not supported, use 'safearray="yes"' instead.</xsl:text>
|
---|
539 | </xsl:message>
|
---|
540 | </xsl:if>
|
---|
541 | <xsl:text>[array, </xsl:text>
|
---|
542 | <xsl:choose>
|
---|
543 | <xsl:when test="../param[@name=current()/@array]">
|
---|
544 | <xsl:if test="../param[@name=current()/@array]/@dir != @dir">
|
---|
545 | <xsl:message terminate="yes">
|
---|
546 | <xsl:value-of select="concat(../../@name,'::',../@name,': ')"/>
|
---|
547 | <xsl:value-of select="concat(@name,' and ',../param[@name=current()/@array]/@name)"/>
|
---|
548 | <xsl:text> must have the same direction</xsl:text>
|
---|
549 | </xsl:message>
|
---|
550 | </xsl:if>
|
---|
551 | <xsl:text>size_is(</xsl:text>
|
---|
552 | <xsl:if test="@dir='out'">
|
---|
553 | <xsl:text>, </xsl:text>
|
---|
554 | </xsl:if>
|
---|
555 | <xsl:if test="../param[@name=current()/@array]/@dir='out'">
|
---|
556 | <xsl:text>*</xsl:text>
|
---|
557 | </xsl:if>
|
---|
558 | <xsl:value-of select="@array"/>
|
---|
559 | <xsl:text>)</xsl:text>
|
---|
560 | </xsl:when>
|
---|
561 | <xsl:otherwise>
|
---|
562 | <xsl:message terminate="yes">
|
---|
563 | <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
|
---|
564 | <xsl:text>array attribute refers to non-existent param: </xsl:text>
|
---|
565 | <xsl:value-of select="@array"/>
|
---|
566 | </xsl:message>
|
---|
567 | </xsl:otherwise>
|
---|
568 | </xsl:choose>
|
---|
569 | <xsl:text>] </xsl:text>
|
---|
570 | </xsl:if>
|
---|
571 | <xsl:choose>
|
---|
572 | <xsl:when test="@dir='in'">in </xsl:when>
|
---|
573 | <xsl:when test="@dir='out'">out </xsl:when>
|
---|
574 | <xsl:when test="@dir='return'">[retval] out </xsl:when>
|
---|
575 | <xsl:otherwise>in</xsl:otherwise>
|
---|
576 | </xsl:choose>
|
---|
577 | <xsl:apply-templates select="@type"/>
|
---|
578 | <xsl:text> </xsl:text>
|
---|
579 | <xsl:value-of select="@name"/>
|
---|
580 | </xsl:template>
|
---|
581 |
|
---|
582 |
|
---|
583 | <!--
|
---|
584 | * attribute/parameter type conversion
|
---|
585 | -->
|
---|
586 | <xsl:template match="
|
---|
587 | attribute/@type | param/@type |
|
---|
588 | enumerator/@type | collection/@type | collection/@enumerator
|
---|
589 | ">
|
---|
590 | <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
|
---|
591 |
|
---|
592 | <xsl:if test="../@array and ../@safearray='yes'">
|
---|
593 | <xsl:message terminate="yes">
|
---|
594 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
595 | <xsl:text>either 'array' or 'safearray="yes"' attribute is allowed, but not both!</xsl:text>
|
---|
596 | </xsl:message>
|
---|
597 | </xsl:if>
|
---|
598 |
|
---|
599 | <xsl:choose>
|
---|
600 | <!-- modifiers (ignored for 'enumeration' attributes)-->
|
---|
601 | <xsl:when test="name(current())='type' and ../@mod">
|
---|
602 | <xsl:choose>
|
---|
603 | <xsl:when test="../@mod='ptr'">
|
---|
604 | <xsl:choose>
|
---|
605 | <!-- standard types -->
|
---|
606 | <!--xsl:when test=".='result'">??</xsl:when-->
|
---|
607 | <xsl:when test=".='boolean'">booeanPtr</xsl:when>
|
---|
608 | <xsl:when test=".='octet'">octetPtr</xsl:when>
|
---|
609 | <xsl:when test=".='short'">shortPtr</xsl:when>
|
---|
610 | <xsl:when test=".='unsigned short'">ushortPtr</xsl:when>
|
---|
611 | <xsl:when test=".='long'">longPtr</xsl:when>
|
---|
612 | <xsl:when test=".='long long'">llongPtr</xsl:when>
|
---|
613 | <xsl:when test=".='unsigned long'">ulongPtr</xsl:when>
|
---|
614 | <xsl:when test=".='unsigned long long'">ullongPtr</xsl:when>
|
---|
615 | <xsl:when test=".='char'">charPtr</xsl:when>
|
---|
616 | <!--xsl:when test=".='string'">??</xsl:when-->
|
---|
617 | <xsl:when test=".='wchar'">wcharPtr</xsl:when>
|
---|
618 | <!--xsl:when test=".='wstring'">??</xsl:when-->
|
---|
619 | <xsl:otherwise>
|
---|
620 | <xsl:message terminate="yes">
|
---|
621 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
622 | <xsl:text>attribute 'mod=</xsl:text>
|
---|
623 | <xsl:value-of select="concat('"',../@mod,'"')"/>
|
---|
624 | <xsl:text>' cannot be used with type </xsl:text>
|
---|
625 | <xsl:value-of select="concat('"',current(),'"!')"/>
|
---|
626 | </xsl:message>
|
---|
627 | </xsl:otherwise>
|
---|
628 | </xsl:choose>
|
---|
629 | </xsl:when>
|
---|
630 | <xsl:otherwise>
|
---|
631 | <xsl:message terminate="yes">
|
---|
632 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
633 | <xsl:value-of select="concat('value "',../@mod,'" ')"/>
|
---|
634 | <xsl:text>of attibute 'mod' is invalid!</xsl:text>
|
---|
635 | </xsl:message>
|
---|
636 | </xsl:otherwise>
|
---|
637 | </xsl:choose>
|
---|
638 | </xsl:when>
|
---|
639 | <!-- no modifiers -->
|
---|
640 | <xsl:otherwise>
|
---|
641 | <xsl:choose>
|
---|
642 | <!-- standard types -->
|
---|
643 | <xsl:when test=".='result'">result</xsl:when>
|
---|
644 | <xsl:when test=".='boolean'">boolean</xsl:when>
|
---|
645 | <xsl:when test=".='octet'">octet</xsl:when>
|
---|
646 | <xsl:when test=".='short'">short</xsl:when>
|
---|
647 | <xsl:when test=".='unsigned short'">unsigned short</xsl:when>
|
---|
648 | <xsl:when test=".='long'">long</xsl:when>
|
---|
649 | <xsl:when test=".='long long'">long long</xsl:when>
|
---|
650 | <xsl:when test=".='unsigned long'">unsigned long</xsl:when>
|
---|
651 | <xsl:when test=".='unsigned long long'">unsigned long long</xsl:when>
|
---|
652 | <xsl:when test=".='char'">char</xsl:when>
|
---|
653 | <xsl:when test=".='wchar'">wchar</xsl:when>
|
---|
654 | <xsl:when test=".='string'">string</xsl:when>
|
---|
655 | <xsl:when test=".='wstring'">wstring</xsl:when>
|
---|
656 | <!-- UUID type -->
|
---|
657 | <xsl:when test=".='uuid'">uuid</xsl:when>
|
---|
658 | <!-- system interface types -->
|
---|
659 | <xsl:when test=".='$unknown'">$unknown</xsl:when>
|
---|
660 | <xsl:otherwise>
|
---|
661 | <xsl:choose>
|
---|
662 | <!-- enum types -->
|
---|
663 | <xsl:when test="
|
---|
664 | (ancestor::library/enum[@name=current()]) or
|
---|
665 | (ancestor::library/if[@target=$self_target]/enum[@name=current()])
|
---|
666 | ">
|
---|
667 | <xsl:value-of select="."/>
|
---|
668 | </xsl:when>
|
---|
669 | <!-- custom interface types -->
|
---|
670 | <xsl:when test="
|
---|
671 | (name(current())='enumerator' and
|
---|
672 | ((ancestor::library/enumerator[@name=current()]) or
|
---|
673 | (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
|
---|
674 | ) or
|
---|
675 | ((ancestor::library/interface[@name=current()]) or
|
---|
676 | (ancestor::library/if[@target=$self_target]/interface[@name=current()])
|
---|
677 | ) or
|
---|
678 | ((ancestor::library/collection[@name=current()]) or
|
---|
679 | (ancestor::library/if[@target=$self_target]/collection[@name=current()])
|
---|
680 | )
|
---|
681 | ">
|
---|
682 | <xsl:value-of select="."/>
|
---|
683 | </xsl:when>
|
---|
684 | <!-- other types -->
|
---|
685 | <xsl:otherwise>
|
---|
686 | <xsl:message terminate="yes">
|
---|
687 | <xsl:text>Unknown parameter type: </xsl:text>
|
---|
688 | <xsl:value-of select="."/>
|
---|
689 | </xsl:message>
|
---|
690 | </xsl:otherwise>
|
---|
691 | </xsl:choose>
|
---|
692 | </xsl:otherwise>
|
---|
693 | </xsl:choose>
|
---|
694 | </xsl:otherwise>
|
---|
695 | </xsl:choose>
|
---|
696 | <xsl:if test="../@safearray='yes'">
|
---|
697 | <xsl:text>[]</xsl:text>
|
---|
698 | </xsl:if>
|
---|
699 | </xsl:template>
|
---|
700 |
|
---|
701 | </xsl:stylesheet>
|
---|
702 |
|
---|