VirtualBox

source: vbox/trunk/src/VBox/Main/idl/comimpl.xsl@ 85315

Last change on this file since 85315 was 85315, checked in by vboxsync, 4 years ago

Main/comimpl.xsl: Use Utf8Str to store strings internally in the event objects, normally saves a bit of space and puts off the string conversion till the attributes are queried. Fixed some missing error handling in the getter methods. bugref:9790

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 43.9 KB
Line 
1<xsl:stylesheet version = '1.0'
2 xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
3 xmlns:vbox="http://www.virtualbox.org/"
4 xmlns:exsl="http://exslt.org/common"
5 extension-element-prefixes="exsl">
6
7<!--
8
9 comimpl.xsl:
10 XSLT stylesheet that generates COM C++ classes implementing
11 interfaces described in VirtualBox.xidl.
12 For now we generate implementation for events, as they are
13 rather trivial container classes for their read-only attributes.
14 Further extension to other interfaces is possible and anticipated.
15
16 Copyright (C) 2010-2020 Oracle Corporation
17
18 This file is part of VirtualBox Open Source Edition (OSE), as
19 available from http://www.virtualbox.org. This file is free software;
20 you can redistribute it and/or modify it under the terms of the GNU
21 General Public License (GPL) as published by the Free Software
22 Foundation, in version 2 as it comes in the "COPYING" file of the
23 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
24 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
25-->
26
27<xsl:output
28 method="text"
29 version="1.0"
30 encoding="utf-8"
31 indent="no"/>
32
33<xsl:include href="typemap-shared.inc.xsl" />
34
35<!-- $G_kind contains what kind of COM class implementation we generate -->
36<xsl:variable name="G_xsltFilename" select="'autogen.xsl'" />
37<xsl:variable name="G_generateBstrVariants" select="'no'" />
38
39
40<!-- - - - - - - - - - - - - - - - - - - - - - -
41 Keys for more efficiently looking up of types.
42 - - - - - - - - - - - - - - - - - - - - - - -->
43
44<xsl:key name="G_keyEnumsByName" match="//enum[@name]" use="@name"/>
45<xsl:key name="G_keyInterfacesByName" match="//interface[@name]" use="@name"/>
46
47<!-- - - - - - - - - - - - - - - - - - - - - - -
48 - - - - - - - - - - - - - - - - - - - - - - -->
49
50<xsl:template name="fileheader">
51 <xsl:param name="name" />
52 <xsl:text>/** @file </xsl:text>
53 <xsl:value-of select="$name"/>
54 <xsl:text>
55 * DO NOT EDIT! This is a generated file.
56 * Generated from: src/VBox/Main/idl/VirtualBox.xidl (VirtualBox's interface definitions in XML)
57 * Generator: src/VBox/Main/idl/comimpl.xsl
58 */
59
60/*
61 * Copyright (C) 2010-2020 Oracle Corporation
62 *
63 * This file is part of VirtualBox Open Source Edition (OSE), as
64 * available from http://www.virtualbox.org. This file is free software;
65 * you can redistribute it and/or modify it under the terms of the GNU
66 * General Public License (GPL) as published by the Free Software
67 * Foundation, in version 2 as it comes in the "COPYING" file of the
68 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
69 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
70 */
71
72</xsl:text>
73</xsl:template>
74
75<xsl:template name="genComEntry">
76 <xsl:param name="name" />
77 <xsl:variable name="extends">
78 <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
79 </xsl:variable>
80
81 <xsl:value-of select="concat(' COM_INTERFACE_ENTRY(', $name, ')&#10;')" />
82 <xsl:choose>
83 <xsl:when test="$extends='$unknown'">
84 <!-- Reached base -->
85 </xsl:when>
86 <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
87 <xsl:call-template name="genComEntry">
88 <xsl:with-param name="name" select="$extends" />
89 </xsl:call-template>
90 </xsl:when>
91 <xsl:otherwise>
92 <xsl:call-template name="fatalError">
93 <xsl:with-param name="msg" select="concat('No idea how to process it: ', $extends)" />
94 </xsl:call-template>
95 </xsl:otherwise>
96 </xsl:choose>
97</xsl:template>
98
99<xsl:template name="typeIdl2Back">
100 <xsl:param name="type" />
101 <xsl:param name="safearray" />
102 <xsl:param name="param" />
103 <xsl:param name="dir" />
104 <xsl:param name="mod" />
105 <xsl:param name="utf8str" select="'no'" />
106
107 <xsl:choose>
108 <xsl:when test="$safearray='yes'">
109 <xsl:variable name="elemtype">
110 <xsl:call-template name="typeIdl2Back">
111 <xsl:with-param name="type" select="$type" />
112 <xsl:with-param name="safearray" select="''" />
113 <xsl:with-param name="dir" select="'in'" />
114 <xsl:with-param name="utf8str" select="$utf8str" />
115 </xsl:call-template>
116 </xsl:variable>
117 <xsl:choose>
118 <xsl:when test="$param and ($dir='in')">
119 <xsl:value-of select="concat('ComSafeArrayIn(',$elemtype,',', $param,')')"/>
120 </xsl:when>
121 <xsl:when test="$param and ($dir='out')">
122 <xsl:value-of select="concat('ComSafeArrayOut(',$elemtype,', ', $param, ')')"/>
123 </xsl:when>
124 <xsl:otherwise>
125 <xsl:value-of select="concat('com::SafeArray&lt;',$elemtype,'&gt;')"/>
126 </xsl:otherwise>
127 </xsl:choose>
128 </xsl:when>
129 <xsl:otherwise>
130 <xsl:choose>
131 <xsl:when test="$mod='ptr'">
132 <xsl:value-of select="'BYTE *'" />
133 </xsl:when>
134 <xsl:when test="(($type='wstring') or ($type='uuid'))">
135 <xsl:choose>
136 <xsl:when test="$param and ($dir='in') and ($utf8str!='yes')">
137 <xsl:value-of select="'CBSTR'"/>
138 </xsl:when>
139 <xsl:when test="$param and ($dir='in') and ($utf8str='yes')">
140 <xsl:value-of select="'const Utf8Str &amp;'"/>
141 </xsl:when>
142 <xsl:when test="$param and ($dir='out')">
143 <xsl:value-of select="'BSTR'"/>
144 </xsl:when>
145 <xsl:when test="$param and ($dir='out') and ($utf8str='yes')">
146 <xsl:value-of select="'Utf8Str &amp;'"/>
147 </xsl:when>
148 <xsl:otherwise>
149 <xsl:value-of select="'Utf8Str'"/>
150 </xsl:otherwise>
151 </xsl:choose>
152 </xsl:when>
153 <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
154 <xsl:value-of select="concat($type,'_T')"/>
155 </xsl:when>
156 <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
157 <xsl:choose>
158 <xsl:when test="$param">
159 <xsl:value-of select="concat($type,' *')"/>
160 </xsl:when>
161 <xsl:otherwise>
162 <xsl:value-of select="concat('ComPtr&lt;',$type,'&gt;')"/>
163 </xsl:otherwise>
164 </xsl:choose>
165 </xsl:when>
166 <xsl:when test="$type='boolean'">
167 <xsl:value-of select="'BOOL'" />
168 </xsl:when>
169 <xsl:when test="$type='octet'">
170 <xsl:value-of select="'BYTE'" />
171 </xsl:when>
172 <xsl:when test="$type='unsigned short'">
173 <xsl:value-of select="'USHORT'" />
174 </xsl:when>
175 <xsl:when test="$type='short'">
176 <xsl:value-of select="'SHORT'" />
177 </xsl:when>
178 <xsl:when test="$type='unsigned long'">
179 <xsl:value-of select="'ULONG'" />
180 </xsl:when>
181 <xsl:when test="$type='long'">
182 <xsl:value-of select="'LONG'" />
183 </xsl:when>
184 <xsl:when test="$type='unsigned long long'">
185 <xsl:value-of select="'ULONG64'" />
186 </xsl:when>
187 <xsl:when test="$type='long long'">
188 <xsl:value-of select="'LONG64'" />
189 </xsl:when>
190 <xsl:otherwise>
191 <xsl:call-template name="fatalError">
192 <xsl:with-param name="msg" select="concat('Unhandled type: ', $type)" />
193 </xsl:call-template>
194 </xsl:otherwise>
195 </xsl:choose>
196 <xsl:if test="$dir='out'">
197 <xsl:value-of select="' *'"/>
198 </xsl:if>
199 <xsl:if test="$param and not($param='_')">
200 <xsl:value-of select="concat(' ', $param)"/>
201 </xsl:if>
202 </xsl:otherwise>
203 </xsl:choose>
204
205</xsl:template>
206
207<!-- Checks if interface $name has any string attributes, producing '1' for each string attrib.
208 No output if no string attributes -->
209<xsl:template name="hasStringAttributes">
210 <xsl:param name="name" />
211
212 <!-- Recurse into parent interfaces: -->
213 <xsl:variable name="extends">
214 <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
215 </xsl:variable>
216 <xsl:choose>
217 <xsl:when test="$extends='IEvent'">
218 </xsl:when>
219 <xsl:when test="$extends='IReusableEvent'">
220 </xsl:when>
221 <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
222 <xsl:call-template name="hasStringAttributes">
223 <xsl:with-param name="name" select="$extends" />
224 </xsl:call-template>
225 </xsl:when>
226 <xsl:otherwise>
227 <xsl:call-template name="fatalError">
228 <xsl:with-param name="msg" select="concat('No idea how to process it: ', $name)" />
229 </xsl:call-template>
230 </xsl:otherwise>
231 </xsl:choose>
232
233 <!-- Find immediate string and uuid attributes and output '1' for each one: -->
234 <xsl:for-each select="key('G_keyInterfacesByName', $name)/attribute[(@type = 'wstring' or @type = 'uuid') and (@name != 'midlDoesNotLikeEmptyInterfaces')]">
235 <xsl:text>1</xsl:text>
236 </xsl:for-each>
237</xsl:template>
238
239
240<xsl:template name="genSetParam">
241 <xsl:param name="member"/>
242 <xsl:param name="param"/>
243 <xsl:param name="type"/>
244 <xsl:param name="safearray"/>
245 <xsl:param name="internal"/>
246
247 <xsl:choose>
248 <xsl:when test="$safearray='yes'">
249 <xsl:variable name="elemtype">
250 <xsl:call-template name="typeIdl2Back">
251 <xsl:with-param name="type" select="$type" />
252 <xsl:with-param name="safearray" select="''" />
253 <xsl:with-param name="dir" select="'in'" />
254 </xsl:call-template>
255 </xsl:variable>
256 <xsl:value-of select="concat(' SafeArray&lt;', $elemtype, '&gt; aArr(ComSafeArrayInArg(',$param,'));&#10;')"/>
257 <xsl:value-of select="concat(' return ',$member, '.initFrom(aArr);&#10;')"/>
258 </xsl:when>
259 <xsl:when test="($type='wstring') or ($type='uuid')">
260 <xsl:value-of select="concat(' return ',$member, '.assignEx(', $param, ');&#10;')"/>
261 </xsl:when>
262 <xsl:otherwise>
263 <xsl:value-of select="concat(' ', $member, ' = ', $param, ';&#10;')"/>
264 <xsl:if test="$internal!='yes'">
265 <xsl:text> return S_OK;&#10;</xsl:text>
266 </xsl:if>
267 </xsl:otherwise>
268 </xsl:choose>
269</xsl:template>
270
271<xsl:template name="genRetParam">
272 <xsl:param name="member"/>
273 <xsl:param name="param"/>
274 <xsl:param name="type"/>
275 <xsl:param name="safearray"/>
276 <xsl:choose>
277 <xsl:when test="$safearray='yes'">
278 <xsl:variable name="elemtype">
279 <xsl:call-template name="typeIdl2Back">
280 <xsl:with-param name="type" select="$type" />
281 <xsl:with-param name="safearray" select="''" />
282 <xsl:with-param name="dir" select="'in'" />
283 </xsl:call-template>
284 </xsl:variable>
285<!-- @todo String arrays probably needs work, I doubt we're generating sensible code for them at the moment. -->
286 <xsl:text> SafeArray&lt;</xsl:text><xsl:value-of select="$elemtype"/><xsl:text>&gt; result;&#10;</xsl:text>
287 <xsl:text> HRESULT hrc = </xsl:text><xsl:value-of select="$member"/><xsl:text>.cloneTo(result);&#10;</xsl:text>
288 <xsl:text> if (SUCCEEDED(hrc))&#10;</xsl:text>
289 <xsl:text> result.detachTo(ComSafeArrayOutArg(</xsl:text><xsl:value-of select="$param"/><xsl:text>));&#10;</xsl:text>
290 <xsl:text> return hrc;&#10;</xsl:text>
291 </xsl:when>
292 <xsl:otherwise>
293 <xsl:choose>
294 <xsl:when test="($type='wstring') or ($type = 'uuid')">
295 <xsl:text> return </xsl:text><xsl:value-of select="$member"/><xsl:text>.cloneToEx(</xsl:text>
296 <xsl:value-of select="$param"/><xsl:text>);&#10;</xsl:text>
297 </xsl:when>
298 <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
299 <xsl:text> return </xsl:text><xsl:value-of select="$member"/><xsl:text>.queryInterfaceTo(</xsl:text>
300 <xsl:value-of select="$param"/><xsl:text>);&#10;</xsl:text>
301 </xsl:when>
302 <xsl:otherwise>
303 <xsl:text> *</xsl:text><xsl:value-of select="$param"/><xsl:text> = </xsl:text>
304 <xsl:value-of select="$member"/><xsl:text>;&#10;</xsl:text>
305 <xsl:text> return S_OK;&#10;</xsl:text>
306 </xsl:otherwise>
307 </xsl:choose>
308 </xsl:otherwise>
309 </xsl:choose>
310</xsl:template>
311
312<xsl:template name="genFormalParams">
313 <xsl:param name="name" />
314 <xsl:param name="utf8str" />
315 <xsl:variable name="extends">
316 <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
317 </xsl:variable>
318
319 <xsl:choose>
320 <xsl:when test="$extends='IEvent'">
321 </xsl:when>
322 <xsl:when test="$extends='IReusableEvent'">
323 </xsl:when>
324 <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
325 <xsl:call-template name="genFormalParams">
326 <xsl:with-param name="name" select="$extends" />
327 <xsl:with-param name="utf8str" select="$utf8str" />
328 </xsl:call-template>
329 </xsl:when>
330 <xsl:otherwise>
331 <xsl:call-template name="fatalError">
332 <xsl:with-param name="msg" select="concat('No idea how to process it: ', $name)" />
333 </xsl:call-template>
334 </xsl:otherwise>
335 </xsl:choose>
336
337 <xsl:for-each select="key('G_keyInterfacesByName', $name)/attribute[@name != 'midlDoesNotLikeEmptyInterfaces']">
338 <xsl:variable name="aName" select="concat('a_',@name)"/>
339 <xsl:variable name="aTypeName">
340 <xsl:call-template name="typeIdl2Back">
341 <xsl:with-param name="type" select="@type" />
342 <xsl:with-param name="safearray" select="@safearray" />
343 <xsl:with-param name="param" select="$aName" />
344 <xsl:with-param name="dir" select="'in'" />
345 <xsl:with-param name="mod" select="@mod" />
346 <xsl:with-param name="utf8str" select="$utf8str" />
347 </xsl:call-template>
348 </xsl:variable>
349 <xsl:value-of select="concat(', ',$aTypeName)"/>
350 </xsl:for-each>
351</xsl:template>
352
353<xsl:template name="genCallParams">
354 <xsl:param name="name" />
355 <xsl:variable name="extends">
356 <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
357 </xsl:variable>
358
359 <xsl:choose>
360 <xsl:when test="$extends='IEvent'">
361 </xsl:when>
362 <xsl:when test="$extends='IReusableEvent'">
363 </xsl:when>
364 <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
365 <xsl:call-template name="genCallParams">
366 <xsl:with-param name="name" select="$extends" />
367 </xsl:call-template>
368 </xsl:when>
369 <xsl:otherwise>
370 <xsl:call-template name="fatalError">
371 <xsl:with-param name="msg" select="concat('No idea how to process it: ', $name)" />
372 </xsl:call-template>
373 </xsl:otherwise>
374 </xsl:choose>
375
376 <xsl:for-each select="key('G_keyInterfacesByName', $name)/attribute[@name != 'midlDoesNotLikeEmptyInterfaces']">
377 <xsl:variable name="aName" select="concat('a_',@name)"/>
378 <xsl:choose>
379 <xsl:when test="@safearray='yes'">
380 <xsl:value-of select="concat(', ComSafeArrayInArg(',$aName,')')"/>
381 </xsl:when>
382 <xsl:otherwise>
383 <xsl:value-of select="concat(', ',$aName)"/>
384 </xsl:otherwise>
385 </xsl:choose>
386 </xsl:for-each>
387</xsl:template>
388
389<xsl:template name="genAttrInitCode">
390 <xsl:param name="name" />
391 <xsl:param name="obj" />
392 <xsl:variable name="extends">
393 <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
394 </xsl:variable>
395
396 <xsl:choose>
397 <xsl:when test="$extends='IEvent'">
398 </xsl:when>
399 <xsl:when test="$extends='IReusableEvent'">
400 </xsl:when>
401 <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
402 <xsl:call-template name="genAttrInitCode">
403 <xsl:with-param name="name" select="$extends" />
404 <xsl:with-param name="obj" select="$obj" />
405 </xsl:call-template>
406 </xsl:when>
407 <xsl:otherwise>
408 <xsl:call-template name="fatalError">
409 <xsl:with-param name="msg" select="concat('No idea how to process it: ', $name)" />
410 </xsl:call-template>
411 </xsl:otherwise>
412 </xsl:choose>
413
414 <xsl:for-each select="key('G_keyInterfacesByName', $name)/attribute[@name != 'midlDoesNotLikeEmptyInterfaces']">
415 <xsl:variable name="aName" select="concat('a_',@name)"/>
416 <xsl:variable name="aTypeName">
417 <xsl:call-template name="typeIdl2Back">
418 <xsl:with-param name="type" select="@type" />
419 <xsl:with-param name="safearray" select="@safearray" />
420 <xsl:with-param name="param" select="$aName" />
421 <xsl:with-param name="dir" select="'in'" />
422 <xsl:with-param name="mod" select="@mod" />
423 </xsl:call-template>
424 </xsl:variable>
425 <xsl:variable name="aType">
426 <xsl:call-template name="typeIdl2Back">
427 <xsl:with-param name="type" select="@type" />
428 <xsl:with-param name="safearray" select="@safearray" />
429 <xsl:with-param name="param" select="'_'" />
430 <xsl:with-param name="dir" select="'in'" />
431 <xsl:with-param name="mod" select="@mod" />
432 </xsl:call-template>
433 </xsl:variable>
434
435 <xsl:choose>
436 <xsl:when test="@safearray='yes'">
437 <xsl:variable name="elemtype">
438 <xsl:call-template name="typeIdl2Back">
439 <xsl:with-param name="type" select="@type" />
440 <xsl:with-param name="safearray" select="''" />
441 <xsl:with-param name="dir" select="'in'" />
442 </xsl:call-template>
443 </xsl:variable>
444 <xsl:text> if (SUCCEEDED(hrc))&#10;</xsl:text>
445 <xsl:value-of select="concat(' hrc = ',$obj, '->set_', @name, '(ComSafeArrayInArg(a_', @name, '));&#10;')"/>
446 </xsl:when>
447 <xsl:when test="(@type='wstring') or (@type = 'uuid')">
448 <xsl:text> if (SUCCEEDED(hrc))&#10;</xsl:text>
449 <xsl:value-of select="concat(' hrc = ',$obj, '->set_', @name, '(',$aName, ');&#10;')"/>
450 </xsl:when>
451 <xsl:otherwise>
452 <xsl:value-of select="concat(' ',$obj, '->set_', @name, '(',$aName, ');&#10;')"/>
453 </xsl:otherwise>
454 </xsl:choose>
455 </xsl:for-each>
456</xsl:template>
457
458<xsl:template name="genImplList">
459 <xsl:param name="impl" />
460 <xsl:param name="name" />
461 <xsl:param name="depth" />
462 <xsl:param name="parents" />
463
464 <xsl:variable name="extends">
465 <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
466 </xsl:variable>
467
468 <xsl:choose>
469 <xsl:when test="$name='IEvent'">
470 <xsl:value-of select=" '#ifdef VBOX_WITH_XPCOM&#10;'" />
471 <xsl:value-of select="concat('NS_DECL_CLASSINFO(', $impl, ')&#10;')" />
472 <xsl:value-of select="concat('NS_IMPL_THREADSAFE_ISUPPORTS',$depth,'_CI(', $impl, $parents, ', IEvent)&#10;')" />
473 <xsl:value-of select=" '#endif&#10;&#10;'"/>
474 </xsl:when>
475 <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
476 <xsl:call-template name="genImplList">
477 <xsl:with-param name="impl" select="$impl" />
478 <xsl:with-param name="name" select="$extends" />
479 <xsl:with-param name="depth" select="$depth+1" />
480 <xsl:with-param name="parents" select="concat($parents, ', ', $name)" />
481 </xsl:call-template>
482 </xsl:when>
483 <xsl:otherwise>
484 <xsl:call-template name="fatalError">
485 <xsl:with-param name="msg" select="concat('No idea how to process it: ', $name)" />
486 </xsl:call-template>
487 </xsl:otherwise>
488 </xsl:choose>
489</xsl:template>
490
491<xsl:template name="genAttrCode">
492 <xsl:param name="name" />
493 <xsl:param name="depth" />
494 <xsl:param name="parents" />
495
496 <xsl:variable name="extends">
497 <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
498 </xsl:variable>
499
500 <xsl:for-each select="key('G_keyInterfacesByName', $name)/attribute">
501 <xsl:variable name="mName">
502 <xsl:value-of select="concat('m_', @name)" />
503 </xsl:variable>
504 <xsl:variable name="mType">
505 <xsl:call-template name="typeIdl2Back">
506 <xsl:with-param name="type" select="@type" />
507 <xsl:with-param name="safearray" select="@safearray" />
508 <xsl:with-param name="dir" select="'in'" />
509 <xsl:with-param name="mod" select="@mod" />
510 </xsl:call-template>
511 </xsl:variable>
512 <xsl:variable name="pName">
513 <xsl:value-of select="concat('a_', @name)" />
514 </xsl:variable>
515 <xsl:variable name="pTypeNameOut">
516 <xsl:call-template name="typeIdl2Back">
517 <xsl:with-param name="type" select="@type" />
518 <xsl:with-param name="safearray" select="@safearray" />
519 <xsl:with-param name="param" select="$pName" />
520 <xsl:with-param name="dir" select="'out'" />
521 <xsl:with-param name="mod" select="@mod" />
522 </xsl:call-template>
523 </xsl:variable>
524
525 <xsl:variable name="pTypeNameIn">
526 <xsl:call-template name="typeIdl2Back">
527 <xsl:with-param name="type" select="@type" />
528 <xsl:with-param name="safearray" select="@safearray" />
529 <xsl:with-param name="param" select="$pName" />
530 <xsl:with-param name="dir" select="'in'" />
531 <xsl:with-param name="mod" select="@mod" />
532 </xsl:call-template>
533 </xsl:variable>
534
535 <xsl:variable name="capsName">
536 <xsl:call-template name="capitalize">
537 <xsl:with-param name="str" select="@name" />
538 </xsl:call-template>
539 </xsl:variable>
540
541 <xsl:value-of select=" '&#10;'" />
542 <xsl:value-of select="concat(' // attribute ', @name,'&#10;')" />
543 <xsl:value-of select=" 'private:&#10;'" />
544 <xsl:value-of select="concat(' ', $mType, ' ', $mName,';&#10;')" />
545 <xsl:value-of select=" 'public:&#10;'" />
546 <xsl:value-of select="concat(' STDMETHOD(COMGETTER(', $capsName,'))(',$pTypeNameOut,') RT_OVERRIDE&#10; {&#10;')" />
547 <xsl:call-template name="genRetParam">
548 <xsl:with-param name="type" select="@type" />
549 <xsl:with-param name="member" select="$mName" />
550 <xsl:with-param name="param" select="$pName" />
551 <xsl:with-param name="safearray" select="@safearray" />
552 </xsl:call-template>
553 <xsl:value-of select=" ' }&#10;'" />
554
555 <xsl:if test="not(@readonly='yes')">
556 <xsl:value-of select="concat(' STDMETHOD(COMSETTER(', $capsName,'))(',$pTypeNameIn,') RT_OVERRIDE&#10; {&#10;')" />
557 <xsl:call-template name="genSetParam">
558 <xsl:with-param name="type" select="@type" />
559 <xsl:with-param name="member" select="$mName" />
560 <xsl:with-param name="param" select="$pName" />
561 <xsl:with-param name="safearray" select="@safearray" />
562 <xsl:with-param name="internal" select="'no'" />
563 </xsl:call-template>
564 <xsl:value-of select=" ' }&#10;'" />
565 </xsl:if>
566
567 <xsl:value-of select=" ' // purely internal setter&#10;'" />
568 <xsl:text> inline </xsl:text>
569 <xsl:choose>
570 <xsl:when test="(@safearray='yes') or (@type='wstring') or (@type = 'uuid')">
571 <xsl:text>HRESULT</xsl:text>
572 </xsl:when>
573 <xsl:otherwise>
574 <xsl:text>void</xsl:text>
575 </xsl:otherwise>
576 </xsl:choose>
577 <xsl:value-of select="concat(' set_', @name,'(',$pTypeNameIn, ')&#10; {&#10;')" />
578 <xsl:call-template name="genSetParam">
579 <xsl:with-param name="type" select="@type" />
580 <xsl:with-param name="member" select="$mName" />
581 <xsl:with-param name="param" select="$pName" />
582 <xsl:with-param name="safearray" select="@safearray" />
583 <xsl:with-param name="internal" select="'yes'" />
584 </xsl:call-template>
585 <xsl:value-of select=" ' }&#10;'" />
586
587 <xsl:if test="(@type='wstring') or (@type = 'uuid')">
588 <xsl:text> inline HRESULT set_</xsl:text><xsl:value-of select="@name"/><xsl:text>(const Utf8Str &amp;a_rString)&#10;</xsl:text>
589 <xsl:text> {&#10;</xsl:text>
590 <xsl:text> return </xsl:text><xsl:value-of select="$mName"/><xsl:text>.assignEx(a_rString);&#10;</xsl:text>
591 <xsl:text> }&#10;</xsl:text>
592 </xsl:if>
593
594 </xsl:for-each>
595
596 <xsl:choose>
597 <xsl:when test="$extends='IEvent'">
598 <xsl:value-of select=" ' // skipping IEvent attributes &#10;'" />
599 </xsl:when>
600 <xsl:when test="$extends='IReusableEvent'">
601 <xsl:value-of select=" ' // skipping IReusableEvent attributes &#10;'" />
602 </xsl:when>
603 <xsl:when test="$extends='IVetoEvent'">
604 <xsl:value-of select=" ' // skipping IVetoEvent attributes &#10;'" />
605 </xsl:when>
606 <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
607 <xsl:call-template name="genAttrCode">
608 <xsl:with-param name="name" select="$extends" />
609 <xsl:with-param name="depth" select="$depth+1" />
610 <xsl:with-param name="parents" select="concat($parents, ', ', @name)" />
611 </xsl:call-template>
612 </xsl:when>
613 <xsl:otherwise>
614 <xsl:call-template name="fatalError">
615 <xsl:with-param name="msg" select="concat('No idea how to process it: ', $extends)" />
616 </xsl:call-template>
617 </xsl:otherwise>
618 </xsl:choose>
619</xsl:template>
620
621<xsl:template name="genReinitFunction">
622 <xsl:param name="name"/>
623 <xsl:param name="evname"/>
624 <xsl:param name="ifname"/>
625 <xsl:param name="implName"/>
626 <xsl:param name="utf8str"/>
627
628 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Reinit', $evname, '(IEvent *aEvent')"/>
629 <xsl:call-template name="genFormalParams">
630 <xsl:with-param name="name" select="$ifname" />
631 <xsl:with-param name="utf8str" select="'no'" />
632 </xsl:call-template>
633 <xsl:text>)&#10;</xsl:text>
634 <xsl:text>{&#10;</xsl:text>
635 <xsl:text> </xsl:text><xsl:value-of select="$implName"/><xsl:text> *pEvtImpl = dynamic_cast&lt;</xsl:text>
636 <xsl:value-of select="$implName"/><xsl:text> *&gt;(aEvent);&#10;</xsl:text>
637 <xsl:text> if (pEvtImpl)&#10;</xsl:text>
638 <xsl:text> {&#10;</xsl:text>
639 <xsl:text> pEvtImpl->Reuse();&#10;</xsl:text>
640 <xsl:text> HRESULT hrc = S_OK;&#10;</xsl:text>
641 <xsl:call-template name="genAttrInitCode">
642 <xsl:with-param name="name" select="$name" />
643 <xsl:with-param name="obj" select="'pEvtImpl'" />
644 </xsl:call-template>
645 <xsl:text> return hrc;&#10;</xsl:text>
646 <xsl:text> }&#10;</xsl:text>
647 <xsl:text> return E_INVALIDARG;&#10;</xsl:text>
648 <xsl:text>}&#10;</xsl:text>
649 <xsl:text>&#10;</xsl:text>
650</xsl:template>
651
652<xsl:template name="genCreateFunction">
653 <xsl:param name="name"/>
654 <xsl:param name="evname"/>
655 <xsl:param name="ifname"/>
656 <xsl:param name="implName"/>
657 <xsl:param name="waitable"/>
658 <xsl:param name="evid"/>
659 <xsl:param name="utf8str"/>
660
661 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Create', $evname, '(IEvent **aEvent, IEventSource *aSource')"/>
662 <xsl:call-template name="genFormalParams">
663 <xsl:with-param name="name" select="$ifname" />
664 <xsl:with-param name="utf8str" select="$utf8str" />
665 </xsl:call-template>
666 <xsl:text>)&#10;</xsl:text>
667 <xsl:text>{&#10;</xsl:text>
668 <xsl:text> ComObjPtr&lt;</xsl:text><xsl:value-of select="$implName"/><xsl:text>&gt; EvtObj;&#10;</xsl:text>
669 <xsl:text> HRESULT hrc = EvtObj.createObject();&#10;</xsl:text>
670 <xsl:text> if (SUCCEEDED(hrc))&#10;</xsl:text>
671 <xsl:text> {&#10;</xsl:text>
672 <xsl:text> hrc = EvtObj-&gt;init(aSource, VBoxEventType_</xsl:text><xsl:value-of select="$evid"/>
673 <xsl:text>, </xsl:text><xsl:value-of select="$waitable" /><xsl:text> /*waitable*/);&#10;</xsl:text>
674 <xsl:call-template name="genAttrInitCode">
675 <xsl:with-param name="name" select="$name" />
676 <xsl:with-param name="obj" select="'EvtObj'" />
677 </xsl:call-template>
678 <xsl:text> if (SUCCEEDED(hrc))&#10;</xsl:text>
679 <xsl:text> {&#10;</xsl:text>
680 <xsl:text> hrc = EvtObj.queryInterfaceTo(aEvent);&#10;</xsl:text>
681 <xsl:text> if (SUCCEEDED(hrc))&#10;</xsl:text>
682 <xsl:text> return hrc;&#10;</xsl:text>
683 <xsl:text> }&#10;</xsl:text>
684 <xsl:text> }&#10;</xsl:text>
685 <xsl:text> *aEvent = NULL;&#10;</xsl:text>
686 <xsl:text> return hrc;&#10;</xsl:text>
687 <xsl:text>}&#10;</xsl:text>
688 <xsl:text>&#10;</xsl:text>
689</xsl:template>
690
691<xsl:template name="genFireFunction">
692 <xsl:param name="evname"/>
693 <xsl:param name="ifname"/>
694 <xsl:param name="utf8str"/>
695
696 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Fire', $evname, '(IEventSource *aSource')"/>
697 <xsl:call-template name="genFormalParams">
698 <xsl:with-param name="name" select="$ifname" />
699 <xsl:with-param name="utf8str" select="$utf8str" />
700 </xsl:call-template>
701 <xsl:text>)&#10;</xsl:text>
702 <xsl:text>{&#10;</xsl:text>
703 <xsl:text> AssertReturn(aSource, E_INVALIDARG);&#10;</xsl:text>
704 <xsl:text> ComPtr&lt;IEvent&gt; ptrEvent;&#10;</xsl:text>
705 <xsl:text> HRESULT hrc = </xsl:text>
706 <xsl:value-of select="concat('Create', $evname, '(ptrEvent.asOutParam(), aSource')"/>
707 <xsl:call-template name="genCallParams">
708 <xsl:with-param name="name" select="$ifname" />
709 </xsl:call-template>
710 <xsl:text>);&#10;</xsl:text>
711 <xsl:text> if (SUCCEEDED(hrc))&#10;</xsl:text>
712 <xsl:text> {&#10;</xsl:text>
713 <xsl:text> BOOL fDeliveredIgnored = FALSE;&#10;</xsl:text>
714 <xsl:text> hrc = aSource-&gt;FireEvent(ptrEvent, /* do not wait for delivery */ 0, &amp;fDeliveredIgnored);&#10;</xsl:text>
715 <xsl:text> AssertComRC(hrc);&#10;</xsl:text>
716 <xsl:text> }&#10;</xsl:text>
717 <xsl:text> return hrc;&#10;</xsl:text>
718 <xsl:text>}&#10;</xsl:text>
719 <xsl:text>&#10;</xsl:text>
720</xsl:template>
721
722<xsl:template name="genEventImpl">
723 <xsl:param name="implName" />
724 <xsl:param name="isVeto" />
725 <xsl:param name="isReusable" />
726
727 <xsl:value-of select="concat('class ATL_NO_VTABLE ',$implName,
728 '&#10; : public VirtualBoxBase&#10; , VBOX_SCRIPTABLE_IMPL(',
729 @name, ')&#10;{&#10;')" />
730 <xsl:value-of select="'public:&#10;'" />
731 <xsl:value-of select="concat(' VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(', $implName, ', ', @name, ')&#10;')" />
732 <xsl:value-of select="concat(' DECLARE_NOT_AGGREGATABLE(', $implName, ')&#10;')" />
733 <xsl:value-of select=" ' DECLARE_PROTECT_FINAL_CONSTRUCT()&#10;'" />
734 <xsl:value-of select="concat(' BEGIN_COM_MAP(', $implName, ')&#10;')" />
735 <xsl:value-of select=" ' COM_INTERFACE_ENTRY(ISupportErrorInfo)&#10;'" />
736 <xsl:value-of select="concat(' COM_INTERFACE_ENTRY(', @name, ')&#10;')" />
737 <xsl:value-of select="concat(' COM_INTERFACE_ENTRY2(IDispatch, ', @name, ')&#10;')" />
738 <xsl:value-of select="concat(' VBOX_TWEAK_INTERFACE_ENTRY(', @name, ')&#10;')" />
739
740 <xsl:call-template name="genComEntry">
741 <xsl:with-param name="name" select="@name" />
742 </xsl:call-template>
743 <xsl:value-of select=" ' END_COM_MAP()&#10;'" />
744 <xsl:value-of select="concat(' ',$implName,'() { Log12((&quot;',$implName,' %p\n&quot;, this)); }&#10;')" />
745 <xsl:value-of select="concat(' virtual ~',$implName,'() { Log12((&quot;~',$implName,' %p\n&quot;, this)); uninit(); }&#10;')" />
746 <xsl:text><![CDATA[
747 HRESULT FinalConstruct()
748 {
749 BaseFinalConstruct();
750 return mEvent.createObject();
751 }
752 void FinalRelease()
753 {
754 uninit();
755 BaseFinalRelease();
756 }
757 STDMETHOD(COMGETTER(Type))(VBoxEventType_T *aType) RT_OVERRIDE
758 {
759 return mEvent->COMGETTER(Type)(aType);
760 }
761 STDMETHOD(COMGETTER(Source))(IEventSource * *aSource) RT_OVERRIDE
762 {
763 return mEvent->COMGETTER(Source)(aSource);
764 }
765 STDMETHOD(COMGETTER(Waitable))(BOOL *aWaitable) RT_OVERRIDE
766 {
767 return mEvent->COMGETTER(Waitable)(aWaitable);
768 }
769 STDMETHOD(SetProcessed)() RT_OVERRIDE
770 {
771 return mEvent->SetProcessed();
772 }
773 STDMETHOD(WaitProcessed)(LONG aTimeout, BOOL *aResult) RT_OVERRIDE
774 {
775 return mEvent->WaitProcessed(aTimeout, aResult);
776 }
777 void uninit()
778 {
779 if (!mEvent.isNull())
780 {
781 mEvent->uninit();
782 mEvent.setNull();
783 }
784 }
785]]></xsl:text>
786 <xsl:choose>
787 <xsl:when test="$isVeto='yes'">
788<xsl:text><![CDATA[
789 HRESULT init(IEventSource *aSource, VBoxEventType_T aType, BOOL aWaitable = TRUE)
790 {
791 NOREF(aWaitable);
792 return mEvent->init(aSource, aType);
793 }
794 STDMETHOD(AddVeto)(IN_BSTR aVeto) RT_OVERRIDE
795 {
796 return mEvent->AddVeto(aVeto);
797 }
798 STDMETHOD(IsVetoed)(BOOL *aResult) RT_OVERRIDE
799 {
800 return mEvent->IsVetoed(aResult);
801 }
802 STDMETHOD(GetVetos)(ComSafeArrayOut(BSTR, aVetos)) RT_OVERRIDE
803 {
804 return mEvent->GetVetos(ComSafeArrayOutArg(aVetos));
805 }
806 STDMETHOD(AddApproval)(IN_BSTR aReason) RT_OVERRIDE
807 {
808 return mEvent->AddApproval(aReason);
809 }
810 STDMETHOD(IsApproved)(BOOL *aResult) RT_OVERRIDE
811 {
812 return mEvent->IsApproved(aResult);
813 }
814 STDMETHOD(GetApprovals)(ComSafeArrayOut(BSTR, aReasons)) RT_OVERRIDE
815 {
816 return mEvent->GetApprovals(ComSafeArrayOutArg(aReasons));
817 }
818private:
819 ComObjPtr<VBoxVetoEvent> mEvent;
820]]></xsl:text>
821 </xsl:when>
822 <xsl:when test="$isReusable='yes'">
823 <xsl:text>
824<![CDATA[
825 HRESULT init(IEventSource *aSource, VBoxEventType_T aType, BOOL aWaitable = FALSE)
826 {
827 mGeneration = 1;
828 return mEvent->init(aSource, aType, aWaitable);
829 }
830 STDMETHOD(COMGETTER(Generation))(ULONG *aGeneration) RT_OVERRIDE
831 {
832 *aGeneration = mGeneration;
833 return S_OK;
834 }
835 STDMETHOD(Reuse)() RT_OVERRIDE
836 {
837 ASMAtomicIncU32((volatile uint32_t *)&mGeneration);
838 return S_OK;
839 }
840private:
841 volatile ULONG mGeneration;
842 ComObjPtr<VBoxEvent> mEvent;
843]]></xsl:text>
844 </xsl:when>
845 <xsl:otherwise>
846<xsl:text><![CDATA[
847 HRESULT init(IEventSource *aSource, VBoxEventType_T aType, BOOL aWaitable)
848 {
849 return mEvent->init(aSource, aType, aWaitable);
850 }
851private:
852 ComObjPtr<VBoxEvent> mEvent;
853]]></xsl:text>
854 </xsl:otherwise>
855 </xsl:choose>
856
857 <!-- Before we generate attribute code, we check and make sure there are attributes here. -->
858 <xsl:if test="count(attribute) = 0 and @name != 'INATNetworkAlterEvent'">
859 <xsl:call-template name="fatalError">
860 <xsl:with-param name="msg">error: <xsl:value-of select="@name"/> has no attributes</xsl:with-param>
861 </xsl:call-template>
862 </xsl:if>
863
864 <xsl:call-template name="genAttrCode">
865 <xsl:with-param name="name" select="@name" />
866 </xsl:call-template>
867 <xsl:value-of select="'};&#10;'" />
868
869
870 <xsl:call-template name="genImplList">
871 <xsl:with-param name="impl" select="$implName" />
872 <xsl:with-param name="name" select="@name" />
873 <xsl:with-param name="depth" select="'1'" />
874 <xsl:with-param name="parents" select="''" />
875 </xsl:call-template>
876
877 <!-- Associate public functions. -->
878 <xsl:variable name="evname">
879 <xsl:value-of select="substring(@name, 2)" />
880 </xsl:variable>
881 <xsl:variable name="evid">
882 <xsl:value-of select="concat('On', substring(@name, 2, string-length(@name)-6))" />
883 </xsl:variable>
884 <xsl:variable name="ifname">
885 <xsl:value-of select="@name" />
886 </xsl:variable>
887 <xsl:variable name="waitable">
888 <xsl:choose>
889 <xsl:when test="@waitable='yes'">
890 <xsl:value-of select="'TRUE'"/>
891 </xsl:when>
892 <xsl:otherwise>
893 <xsl:value-of select="'FALSE'"/>
894 </xsl:otherwise>
895 </xsl:choose>
896 </xsl:variable>
897 <xsl:variable name="hasStringAttribs">
898 <xsl:call-template name="hasStringAttributes">
899 <xsl:with-param name="name" select="@name"/>
900 </xsl:call-template>
901 </xsl:variable>
902
903 <!-- Generate ReinitXxxxEvent functions if reusable. -->
904 <xsl:if test="$isReusable='yes'">
905 <xsl:call-template name="genReinitFunction">
906 <xsl:with-param name="name" select="@name"/>
907 <xsl:with-param name="evname" select="$evname"/>
908 <xsl:with-param name="ifname" select="$ifname"/>
909 <xsl:with-param name="implName" select="$implName"/>
910 <xsl:with-param name="utf8str" select="'yes'"/>
911 </xsl:call-template>
912
913 <xsl:if test="($hasStringAttribs != '') and (($G_generateBstrVariants = 'yes') or (contains(@autogenflags, 'BSTR')))">
914 <xsl:call-template name="genReinitFunction">
915 <xsl:with-param name="name" select="@name"/>
916 <xsl:with-param name="evname" select="$evname"/>
917 <xsl:with-param name="ifname" select="$ifname"/>
918 <xsl:with-param name="implName" select="$implName"/>
919 <xsl:with-param name="utf8str" select="'no'"/>
920 </xsl:call-template>
921 </xsl:if>
922 </xsl:if>
923
924 <!-- Generate the CreateXxxxEvent function. -->
925 <xsl:call-template name="genCreateFunction">
926 <xsl:with-param name="name" select="@name"/>
927 <xsl:with-param name="evname" select="$evname"/>
928 <xsl:with-param name="ifname" select="$ifname"/>
929 <xsl:with-param name="implName" select="$implName"/>
930 <xsl:with-param name="waitable" select="$waitable"/>
931 <xsl:with-param name="evid" select="$evid"/>
932 <xsl:with-param name="utf8str" select="'yes'"/>
933 </xsl:call-template>
934
935 <xsl:if test="($hasStringAttribs != '') and (($G_generateBstrVariants = 'yes') or (contains(@autogenflags, 'BSTR')))">
936 <xsl:call-template name="genCreateFunction">
937 <xsl:with-param name="name" select="@name"/>
938 <xsl:with-param name="evname" select="$evname"/>
939 <xsl:with-param name="ifname" select="$ifname"/>
940 <xsl:with-param name="implName" select="$implName"/>
941 <xsl:with-param name="waitable" select="$waitable"/>
942 <xsl:with-param name="evid" select="$evid"/>
943 <xsl:with-param name="utf8str" select="'no'"/>
944 </xsl:call-template>
945 </xsl:if>
946
947 <!-- Generate the FireXxxxEvent function. -->
948 <xsl:call-template name="genFireFunction">
949 <xsl:with-param name="evname" select="$evname"/>
950 <xsl:with-param name="ifname" select="$ifname"/>
951 <xsl:with-param name="utf8str" select="'yes'"/>
952 </xsl:call-template>
953
954 <xsl:if test="($hasStringAttribs != '') and (($G_generateBstrVariants = 'yes') or (contains(@autogenflags, 'BSTR')))">
955 <xsl:call-template name="genFireFunction">
956 <xsl:with-param name="evname" select="$evname"/>
957 <xsl:with-param name="ifname" select="$ifname"/>
958 <xsl:with-param name="utf8str" select="'no'"/>
959 </xsl:call-template>
960 </xsl:if>
961
962</xsl:template>
963
964
965<!--
966 Produces VBoxEvents.cpp
967 -->
968<xsl:template name="genCommonEventCode">
969 <xsl:call-template name="fileheader">
970 <xsl:with-param name="name" select="'VBoxEvents.cpp'" />
971 </xsl:call-template>
972
973<xsl:text><![CDATA[
974#define LOG_GROUP LOG_GROUP_MAIN_EVENT
975#include <VBox/com/array.h>
976#include <VBox/log.h>
977#include <iprt/asm.h>
978#include "VBoxEvents.h"
979
980]]></xsl:text>
981
982 <!-- Interfaces -->
983 <xsl:for-each select="//interface[@autogen=$G_kind]">
984 <xsl:value-of select="concat('// ', @name, ' implementation code')" />
985 <xsl:call-template name="xsltprocNewlineOutputHack"/>
986 <xsl:variable name="implName">
987 <xsl:value-of select="substring(@name, 2)" />
988 </xsl:variable>
989
990 <xsl:choose>
991 <xsl:when test="$G_kind='VBoxEvent'">
992 <xsl:variable name="isVeto">
993 <xsl:if test="@extends='IVetoEvent'">
994 <xsl:value-of select="'yes'" />
995 </xsl:if>
996 </xsl:variable>
997 <xsl:variable name="isReusable">
998 <xsl:if test="@extends='IReusableEvent'">
999 <xsl:value-of select="'yes'" />
1000 </xsl:if>
1001 </xsl:variable>
1002 <xsl:call-template name="genEventImpl">
1003 <xsl:with-param name="implName" select="$implName" />
1004 <xsl:with-param name="isVeto" select="$isVeto" />
1005 <xsl:with-param name="isReusable" select="$isReusable" />
1006 </xsl:call-template>
1007 </xsl:when>
1008 </xsl:choose>
1009 </xsl:for-each>
1010
1011</xsl:template>
1012
1013
1014<!--
1015 Produces VBoxEvents.h
1016 -->
1017<xsl:template name="genCommonEventHeader">
1018 <xsl:call-template name="fileheader">
1019 <xsl:with-param name="name" select="'VBoxEvents.h'" />
1020 </xsl:call-template>
1021
1022 <xsl:text><![CDATA[
1023#include "EventImpl.h"
1024
1025]]></xsl:text>
1026
1027 <!-- Simple methods for firing off events. -->
1028 <xsl:text>/** @name Fire off events&#10;</xsl:text>
1029 <xsl:text> * @{ */&#10;</xsl:text>
1030 <xsl:for-each select="//interface[@autogen='VBoxEvent']">
1031 <xsl:value-of select="concat('/** Fire an ', @name, ' event. */&#10;')" />
1032 <xsl:variable name="evname">
1033 <xsl:value-of select="substring(@name, 2)" />
1034 </xsl:variable>
1035 <xsl:variable name="ifname">
1036 <xsl:value-of select="@name" />
1037 </xsl:variable>
1038 <xsl:variable name="hasStringAttribs">
1039 <xsl:call-template name="hasStringAttributes">
1040 <xsl:with-param name="name" select="@name"/>
1041 </xsl:call-template>
1042 </xsl:variable>
1043
1044 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Fire', $evname, '(IEventSource *aSource')"/>
1045 <xsl:call-template name="genFormalParams">
1046 <xsl:with-param name="name" select="$ifname" />
1047 <xsl:with-param name="utf8str" select="'yes'" />
1048 </xsl:call-template>
1049 <xsl:text>);&#10;</xsl:text>
1050
1051 <xsl:if test="($hasStringAttribs != '') and (($G_generateBstrVariants = 'yes') or (contains(@autogenflags, 'BSTR')))">
1052 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Fire', $evname, '(IEventSource *aSource')"/>
1053 <xsl:call-template name="genFormalParams">
1054 <xsl:with-param name="name" select="$ifname" />
1055 <xsl:with-param name="utf8str" select="'no'" />
1056 </xsl:call-template>
1057 <xsl:text>);&#10;</xsl:text>
1058 </xsl:if>
1059 </xsl:for-each>
1060 <xsl:text>/** @} */&#10;&#10;</xsl:text>
1061
1062 <!-- Event instantiation methods. -->
1063 <xsl:text>/** @name Instantiate events&#10;</xsl:text>
1064 <xsl:text> * @{ */&#10;</xsl:text>
1065 <xsl:for-each select="//interface[@autogen='VBoxEvent']">
1066 <xsl:value-of select="concat('/** Create an ', @name, ' event. */&#10;')" />
1067 <xsl:variable name="evname">
1068 <xsl:value-of select="substring(@name, 2)" />
1069 </xsl:variable>
1070 <xsl:variable name="ifname">
1071 <xsl:value-of select="@name" />
1072 </xsl:variable>
1073 <xsl:variable name="hasStringAttribs">
1074 <xsl:call-template name="hasStringAttributes">
1075 <xsl:with-param name="name" select="@name"/>
1076 </xsl:call-template>
1077 </xsl:variable>
1078
1079 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Create', $evname, '(IEvent **aEvent, IEventSource *aSource')"/>
1080 <xsl:call-template name="genFormalParams">
1081 <xsl:with-param name="name" select="$ifname" />
1082 <xsl:with-param name="utf8str" select="'yes'" />
1083 </xsl:call-template>
1084 <xsl:text>);&#10;</xsl:text>
1085
1086 <xsl:if test="($hasStringAttribs != '') and (($G_generateBstrVariants = 'yes') or (contains(@autogenflags, 'BSTR')))">
1087 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Create', $evname, '(IEvent **aEvent, IEventSource *aSource')"/>
1088 <xsl:call-template name="genFormalParams">
1089 <xsl:with-param name="name" select="$ifname" />
1090 <xsl:with-param name="utf8str" select="'no'" />
1091 </xsl:call-template>
1092 <xsl:text>);&#10;</xsl:text>
1093 </xsl:if>
1094 </xsl:for-each>
1095 <xsl:text>/** @} */&#10;</xsl:text>
1096 <xsl:text>&#10;</xsl:text>
1097
1098 <!-- Reinitialization methods for reusable events. -->
1099 <xsl:text>/** @name Re-init reusable events&#10;</xsl:text>
1100 <xsl:text> * @{ */&#10;</xsl:text>
1101 <xsl:for-each select="//interface[@autogen='VBoxEvent']">
1102 <xsl:if test="@extends='IReusableEvent'">
1103 <xsl:value-of select="concat('/** Re-init an ', @name, ' event. */&#10;')" />
1104 <xsl:variable name="evname">
1105 <xsl:value-of select="substring(@name, 2)" />
1106 </xsl:variable>
1107 <xsl:variable name="ifname">
1108 <xsl:value-of select="@name" />
1109 </xsl:variable>
1110 <xsl:variable name="hasStringAttribs">
1111 <xsl:call-template name="hasStringAttributes">
1112 <xsl:with-param name="name" select="@name"/>
1113 </xsl:call-template>
1114 </xsl:variable>
1115
1116 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Reinit', $evname, '(IEvent *aEvent')"/>
1117 <xsl:call-template name="genFormalParams">
1118 <xsl:with-param name="name" select="$ifname" />
1119 <xsl:with-param name="utf8str" select="'yes'" />
1120 </xsl:call-template>
1121 <xsl:text>);&#10;</xsl:text>
1122
1123 <xsl:if test="($hasStringAttribs != '') and (($G_generateBstrVariants = 'yes') or (contains(@autogenflags, 'BSTR')))">
1124 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Reinit', $evname, '(IEvent *aEvent')"/>
1125 <xsl:call-template name="genFormalParams">
1126 <xsl:with-param name="name" select="$ifname" />
1127 <xsl:with-param name="utf8str" select="'no'" />
1128 </xsl:call-template>
1129 <xsl:text>);&#10;</xsl:text>
1130 </xsl:if>
1131 </xsl:if>
1132 </xsl:for-each>
1133 <xsl:text>/** @} */&#10;</xsl:text>
1134
1135</xsl:template>
1136
1137<xsl:template match="/">
1138 <!-- Global code -->
1139 <xsl:choose>
1140 <xsl:when test="$G_kind='VBoxEvent'">
1141 <xsl:call-template name="genCommonEventCode">
1142 </xsl:call-template>
1143 </xsl:when>
1144 <xsl:when test="$G_kind='VBoxEventHeader'">
1145 <xsl:call-template name="genCommonEventHeader">
1146 </xsl:call-template>
1147 </xsl:when>
1148 <xsl:otherwise>
1149 <xsl:call-template name="fatalError">
1150 <xsl:with-param name="msg" select="concat('Request unsupported: ', $G_kind)" />
1151 </xsl:call-template>
1152 </xsl:otherwise>
1153 </xsl:choose>
1154</xsl:template>
1155
1156</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette