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 |
|
---|
38 |
|
---|
39 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
40 | Keys for more efficiently looking up of types.
|
---|
41 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
42 |
|
---|
43 | <xsl:key name="G_keyEnumsByName" match="//enum[@name]" use="@name"/>
|
---|
44 | <xsl:key name="G_keyInterfacesByName" match="//interface[@name]" use="@name"/>
|
---|
45 |
|
---|
46 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
47 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
48 |
|
---|
49 | <xsl:template name="fileheader">
|
---|
50 | <xsl:param name="name" />
|
---|
51 | <xsl:text>/** @file </xsl:text>
|
---|
52 | <xsl:value-of select="$name"/>
|
---|
53 | <xsl:text>
|
---|
54 | * DO NOT EDIT! This is a generated file.
|
---|
55 | * Generated from: src/VBox/Main/idl/VirtualBox.xidl (VirtualBox's interface definitions in XML)
|
---|
56 | * Generator: src/VBox/Main/idl/comimpl.xsl
|
---|
57 | */
|
---|
58 |
|
---|
59 | /*
|
---|
60 | * Copyright (C) 2010-2020 Oracle Corporation
|
---|
61 | *
|
---|
62 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
63 | * available from http://www.virtualbox.org. This file is free software;
|
---|
64 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
65 | * General Public License (GPL) as published by the Free Software
|
---|
66 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
67 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
68 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
69 | */
|
---|
70 |
|
---|
71 | </xsl:text>
|
---|
72 | </xsl:template>
|
---|
73 |
|
---|
74 | <xsl:template name="genComEntry">
|
---|
75 | <xsl:param name="name" />
|
---|
76 | <xsl:variable name="extends">
|
---|
77 | <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
|
---|
78 | </xsl:variable>
|
---|
79 |
|
---|
80 | <xsl:value-of select="concat(' COM_INTERFACE_ENTRY(', $name, ') ')" />
|
---|
81 | <xsl:choose>
|
---|
82 | <xsl:when test="$extends='$unknown'">
|
---|
83 | <!-- Reached base -->
|
---|
84 | </xsl:when>
|
---|
85 | <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
|
---|
86 | <xsl:call-template name="genComEntry">
|
---|
87 | <xsl:with-param name="name" select="$extends" />
|
---|
88 | </xsl:call-template>
|
---|
89 | </xsl:when>
|
---|
90 | <xsl:otherwise>
|
---|
91 | <xsl:call-template name="fatalError">
|
---|
92 | <xsl:with-param name="msg" select="concat('No idea how to process it: ', $extends)" />
|
---|
93 | </xsl:call-template>
|
---|
94 | </xsl:otherwise>
|
---|
95 | </xsl:choose>
|
---|
96 | </xsl:template>
|
---|
97 |
|
---|
98 | <xsl:template name="typeIdl2Back">
|
---|
99 | <xsl:param name="type" />
|
---|
100 | <xsl:param name="safearray" />
|
---|
101 | <xsl:param name="param" />
|
---|
102 | <xsl:param name="dir" />
|
---|
103 | <xsl:param name="mod" />
|
---|
104 |
|
---|
105 | <xsl:choose>
|
---|
106 | <xsl:when test="$safearray='yes'">
|
---|
107 | <xsl:variable name="elemtype">
|
---|
108 | <xsl:call-template name="typeIdl2Back">
|
---|
109 | <xsl:with-param name="type" select="$type" />
|
---|
110 | <xsl:with-param name="safearray" select="''" />
|
---|
111 | <xsl:with-param name="dir" select="'in'" />
|
---|
112 | </xsl:call-template>
|
---|
113 | </xsl:variable>
|
---|
114 | <xsl:choose>
|
---|
115 | <xsl:when test="$param and ($dir='in')">
|
---|
116 | <xsl:value-of select="concat('ComSafeArrayIn(',$elemtype,',', $param,')')"/>
|
---|
117 | </xsl:when>
|
---|
118 | <xsl:when test="$param and ($dir='out')">
|
---|
119 | <xsl:value-of select="concat('ComSafeArrayOut(',$elemtype,', ', $param, ')')"/>
|
---|
120 | </xsl:when>
|
---|
121 | <xsl:otherwise>
|
---|
122 | <xsl:value-of select="concat('com::SafeArray<',$elemtype,'>')"/>
|
---|
123 | </xsl:otherwise>
|
---|
124 | </xsl:choose>
|
---|
125 | </xsl:when>
|
---|
126 | <xsl:otherwise>
|
---|
127 | <xsl:choose>
|
---|
128 | <xsl:when test="$mod='ptr'">
|
---|
129 | <xsl:value-of select="'BYTE*'" />
|
---|
130 | </xsl:when>
|
---|
131 | <xsl:when test="(($type='wstring') or ($type='uuid'))">
|
---|
132 | <xsl:choose>
|
---|
133 | <xsl:when test="$param and ($dir='in')">
|
---|
134 | <xsl:value-of select="'CBSTR'"/>
|
---|
135 | </xsl:when>
|
---|
136 | <xsl:when test="$param and ($dir='out')">
|
---|
137 | <xsl:value-of select="'BSTR'"/>
|
---|
138 | </xsl:when>
|
---|
139 | <xsl:otherwise>
|
---|
140 | <xsl:value-of select="'Bstr'"/>
|
---|
141 | </xsl:otherwise>
|
---|
142 | </xsl:choose>
|
---|
143 | </xsl:when>
|
---|
144 | <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
|
---|
145 | <xsl:value-of select="concat($type,'_T')"/>
|
---|
146 | </xsl:when>
|
---|
147 | <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
|
---|
148 | <xsl:choose>
|
---|
149 | <xsl:when test="$param">
|
---|
150 | <xsl:value-of select="concat($type,'*')"/>
|
---|
151 | </xsl:when>
|
---|
152 | <xsl:otherwise>
|
---|
153 | <xsl:value-of select="concat('ComPtr<',$type,'>')"/>
|
---|
154 | </xsl:otherwise>
|
---|
155 | </xsl:choose>
|
---|
156 | </xsl:when>
|
---|
157 | <xsl:when test="$type='boolean'">
|
---|
158 | <xsl:value-of select="'BOOL'" />
|
---|
159 | </xsl:when>
|
---|
160 | <xsl:when test="$type='octet'">
|
---|
161 | <xsl:value-of select="'BYTE'" />
|
---|
162 | </xsl:when>
|
---|
163 | <xsl:when test="$type='unsigned short'">
|
---|
164 | <xsl:value-of select="'USHORT'" />
|
---|
165 | </xsl:when>
|
---|
166 | <xsl:when test="$type='short'">
|
---|
167 | <xsl:value-of select="'SHORT'" />
|
---|
168 | </xsl:when>
|
---|
169 | <xsl:when test="$type='unsigned long'">
|
---|
170 | <xsl:value-of select="'ULONG'" />
|
---|
171 | </xsl:when>
|
---|
172 | <xsl:when test="$type='long'">
|
---|
173 | <xsl:value-of select="'LONG'" />
|
---|
174 | </xsl:when>
|
---|
175 | <xsl:when test="$type='unsigned long long'">
|
---|
176 | <xsl:value-of select="'ULONG64'" />
|
---|
177 | </xsl:when>
|
---|
178 | <xsl:when test="$type='long long'">
|
---|
179 | <xsl:value-of select="'LONG64'" />
|
---|
180 | </xsl:when>
|
---|
181 | <xsl:otherwise>
|
---|
182 | <xsl:call-template name="fatalError">
|
---|
183 | <xsl:with-param name="msg" select="concat('Unhandled type: ', $type)" />
|
---|
184 | </xsl:call-template>
|
---|
185 | </xsl:otherwise>
|
---|
186 | </xsl:choose>
|
---|
187 | <xsl:if test="$dir='out'">
|
---|
188 | <xsl:value-of select="'*'"/>
|
---|
189 | </xsl:if>
|
---|
190 | <xsl:if test="$param and not($param='_')">
|
---|
191 | <xsl:value-of select="concat(' ', $param)"/>
|
---|
192 | </xsl:if>
|
---|
193 | </xsl:otherwise>
|
---|
194 | </xsl:choose>
|
---|
195 |
|
---|
196 | </xsl:template>
|
---|
197 |
|
---|
198 |
|
---|
199 | <xsl:template name="genSetParam">
|
---|
200 | <xsl:param name="member"/>
|
---|
201 | <xsl:param name="param"/>
|
---|
202 | <xsl:param name="type"/>
|
---|
203 | <xsl:param name="safearray"/>
|
---|
204 |
|
---|
205 | <xsl:choose>
|
---|
206 | <xsl:when test="$safearray='yes'">
|
---|
207 | <xsl:variable name="elemtype">
|
---|
208 | <xsl:call-template name="typeIdl2Back">
|
---|
209 | <xsl:with-param name="type" select="$type" />
|
---|
210 | <xsl:with-param name="safearray" select="''" />
|
---|
211 | <xsl:with-param name="dir" select="'in'" />
|
---|
212 | </xsl:call-template>
|
---|
213 | </xsl:variable>
|
---|
214 | <xsl:value-of select="concat(' SafeArray<', $elemtype, '> aArr(ComSafeArrayInArg(',$param,')); ')"/>
|
---|
215 | <xsl:value-of select="concat(' ',$member, '.initFrom(aArr); ')"/>
|
---|
216 | </xsl:when>
|
---|
217 | <xsl:otherwise>
|
---|
218 | <xsl:value-of select="concat(' ', $member, ' = ', $param, '; ')"/>
|
---|
219 | </xsl:otherwise>
|
---|
220 | </xsl:choose>
|
---|
221 | </xsl:template>
|
---|
222 |
|
---|
223 | <xsl:template name="genRetParam">
|
---|
224 | <xsl:param name="member"/>
|
---|
225 | <xsl:param name="param"/>
|
---|
226 | <xsl:param name="type"/>
|
---|
227 | <xsl:param name="safearray"/>
|
---|
228 | <xsl:choose>
|
---|
229 | <xsl:when test="$safearray='yes'">
|
---|
230 | <xsl:variable name="elemtype">
|
---|
231 | <xsl:call-template name="typeIdl2Back">
|
---|
232 | <xsl:with-param name="type" select="$type" />
|
---|
233 | <xsl:with-param name="safearray" select="''" />
|
---|
234 | <xsl:with-param name="dir" select="'in'" />
|
---|
235 | </xsl:call-template>
|
---|
236 | </xsl:variable>
|
---|
237 | <xsl:value-of select="concat(' SafeArray<', $elemtype,'> result; ')"/>
|
---|
238 | <xsl:value-of select="concat(' ', $member, '.cloneTo(result); ')"/>
|
---|
239 | <xsl:value-of select="concat(' result.detachTo(ComSafeArrayOutArg(', $param, ')); ')"/>
|
---|
240 | </xsl:when>
|
---|
241 | <xsl:otherwise>
|
---|
242 | <xsl:choose>
|
---|
243 | <xsl:when test="($type='wstring') or ($type = 'uuid')">
|
---|
244 | <xsl:value-of select="concat(' ', $member, '.cloneTo(', $param, '); ')"/>
|
---|
245 | </xsl:when>
|
---|
246 | <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
|
---|
247 | <xsl:value-of select="concat(' ', $member, '.queryInterfaceTo(', $param, '); ')"/>
|
---|
248 | </xsl:when>
|
---|
249 | <xsl:otherwise>
|
---|
250 | <xsl:value-of select="concat(' *', $param, ' = ', $member, '; ')"/>
|
---|
251 | </xsl:otherwise>
|
---|
252 | </xsl:choose>
|
---|
253 | </xsl:otherwise>
|
---|
254 | </xsl:choose>
|
---|
255 | </xsl:template>
|
---|
256 |
|
---|
257 | <xsl:template name="genAttrInitCode">
|
---|
258 | <xsl:param name="name" />
|
---|
259 | <xsl:param name="obj" />
|
---|
260 | <xsl:variable name="extends">
|
---|
261 | <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
|
---|
262 | </xsl:variable>
|
---|
263 |
|
---|
264 | <xsl:choose>
|
---|
265 | <xsl:when test="$extends='IEvent'">
|
---|
266 | </xsl:when>
|
---|
267 | <xsl:when test="$extends='IReusableEvent'">
|
---|
268 | </xsl:when>
|
---|
269 | <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
|
---|
270 | <xsl:call-template name="genAttrInitCode">
|
---|
271 | <xsl:with-param name="name" select="$extends" />
|
---|
272 | <xsl:with-param name="obj" select="$obj" />
|
---|
273 | </xsl:call-template>
|
---|
274 | </xsl:when>
|
---|
275 | <xsl:otherwise>
|
---|
276 | <xsl:call-template name="fatalError">
|
---|
277 | <xsl:with-param name="msg" select="concat('No idea how to process it: ', $name)" />
|
---|
278 | </xsl:call-template>
|
---|
279 | </xsl:otherwise>
|
---|
280 | </xsl:choose>
|
---|
281 |
|
---|
282 | <xsl:for-each select="key('G_keyInterfacesByName', $name)/attribute[@name != 'midlDoesNotLikeEmptyInterfaces']">
|
---|
283 | <xsl:variable name="aName" select="concat('a_',@name)"/>
|
---|
284 | <xsl:variable name="aTypeName">
|
---|
285 | <xsl:call-template name="typeIdl2Back">
|
---|
286 | <xsl:with-param name="type" select="@type" />
|
---|
287 | <xsl:with-param name="safearray" select="@safearray" />
|
---|
288 | <xsl:with-param name="param" select="$aName" />
|
---|
289 | <xsl:with-param name="dir" select="'in'" />
|
---|
290 | <xsl:with-param name="mod" select="@mod" />
|
---|
291 | </xsl:call-template>
|
---|
292 | </xsl:variable>
|
---|
293 | <xsl:variable name="aType">
|
---|
294 | <xsl:call-template name="typeIdl2Back">
|
---|
295 | <xsl:with-param name="type" select="@type" />
|
---|
296 | <xsl:with-param name="safearray" select="@safearray" />
|
---|
297 | <xsl:with-param name="param" select="'_'" />
|
---|
298 | <xsl:with-param name="dir" select="'in'" />
|
---|
299 | <xsl:with-param name="mod" select="@mod" />
|
---|
300 | </xsl:call-template>
|
---|
301 | </xsl:variable>
|
---|
302 |
|
---|
303 | <xsl:choose>
|
---|
304 | <xsl:when test="@safearray='yes'">
|
---|
305 | <xsl:variable name="elemtype">
|
---|
306 | <xsl:call-template name="typeIdl2Back">
|
---|
307 | <xsl:with-param name="type" select="@type" />
|
---|
308 | <xsl:with-param name="safearray" select="''" />
|
---|
309 | <xsl:with-param name="dir" select="'in'" />
|
---|
310 | </xsl:call-template>
|
---|
311 | </xsl:variable>
|
---|
312 | <xsl:value-of select=" '#ifdef RT_OS_WINDOWS '"/>
|
---|
313 | <xsl:value-of select="concat(' SAFEARRAY *aPtr_', @name, ' = va_arg(args, SAFEARRAY *); ')"/>
|
---|
314 | <xsl:value-of select="concat(' com::SafeArray<', $elemtype,'> aArr_', @name, '(aPtr_', @name, '); ')"/>
|
---|
315 | <xsl:value-of select=" '#else '"/>
|
---|
316 | <xsl:value-of select="concat(' PRUint32 aArrSize_', @name, ' = va_arg(args, PRUint32); ')"/>
|
---|
317 | <xsl:value-of select="concat(' void* aPtr_', @name, ' = va_arg(args, void*); ')"/>
|
---|
318 | <xsl:value-of select="concat(' com::SafeArray<', $elemtype,'> aArr_', @name, '(aArrSize_', @name, ', (', $elemtype,'*)aPtr_', @name, '); ')"/>
|
---|
319 | <xsl:value-of select=" '#endif '"/>
|
---|
320 | <xsl:value-of select="concat(' ',$obj, '->set_', @name, '(ComSafeArrayAsInParam(aArr_', @name, ')); ')"/>
|
---|
321 | </xsl:when>
|
---|
322 | <xsl:when test="substring($aType, string-length($aType) - 1) = '_T'"> <!-- To avoid pedantic gcc warnings/errors. -->
|
---|
323 | <xsl:value-of select=" '#ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK '"/>
|
---|
324 | <xsl:value-of select="concat(' ',$aTypeName, ' = (',$aType,')va_arg(args, int); ')"/>
|
---|
325 | <xsl:value-of select=" '#else '"/>
|
---|
326 | <xsl:value-of select="concat(' ',$aTypeName, ' = va_arg(args, ',$aType,'); ')"/>
|
---|
327 | <xsl:value-of select=" '#endif '"/>
|
---|
328 | <xsl:value-of select="concat(' ',$obj, '->set_', @name, '(',$aName, '); ')"/>
|
---|
329 | </xsl:when>
|
---|
330 | <xsl:otherwise>
|
---|
331 | <xsl:value-of select="concat(' ',$aTypeName, ' = va_arg(args, ',$aType,'); ')"/>
|
---|
332 | <xsl:value-of select="concat(' ',$obj, '->set_', @name, '(',$aName, '); ')"/>
|
---|
333 | </xsl:otherwise>
|
---|
334 | </xsl:choose>
|
---|
335 | </xsl:for-each>
|
---|
336 | </xsl:template>
|
---|
337 |
|
---|
338 | <xsl:template name="genImplList">
|
---|
339 | <xsl:param name="impl" />
|
---|
340 | <xsl:param name="name" />
|
---|
341 | <xsl:param name="depth" />
|
---|
342 | <xsl:param name="parents" />
|
---|
343 |
|
---|
344 | <xsl:variable name="extends">
|
---|
345 | <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
|
---|
346 | </xsl:variable>
|
---|
347 |
|
---|
348 | <xsl:choose>
|
---|
349 | <xsl:when test="$name='IEvent'">
|
---|
350 | <xsl:value-of select=" '#ifdef VBOX_WITH_XPCOM '" />
|
---|
351 | <xsl:value-of select="concat('NS_DECL_CLASSINFO(', $impl, ') ')" />
|
---|
352 | <xsl:value-of select="concat('NS_IMPL_THREADSAFE_ISUPPORTS',$depth,'_CI(', $impl, $parents, ', IEvent) ')" />
|
---|
353 | <xsl:value-of select=" '#endif '"/>
|
---|
354 | </xsl:when>
|
---|
355 | <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
|
---|
356 | <xsl:call-template name="genImplList">
|
---|
357 | <xsl:with-param name="impl" select="$impl" />
|
---|
358 | <xsl:with-param name="name" select="$extends" />
|
---|
359 | <xsl:with-param name="depth" select="$depth+1" />
|
---|
360 | <xsl:with-param name="parents" select="concat($parents, ', ', $name)" />
|
---|
361 | </xsl:call-template>
|
---|
362 | </xsl:when>
|
---|
363 | <xsl:otherwise>
|
---|
364 | <xsl:call-template name="fatalError">
|
---|
365 | <xsl:with-param name="msg" select="concat('No idea how to process it: ', $name)" />
|
---|
366 | </xsl:call-template>
|
---|
367 | </xsl:otherwise>
|
---|
368 | </xsl:choose>
|
---|
369 | </xsl:template>
|
---|
370 |
|
---|
371 | <xsl:template name="genAttrCode">
|
---|
372 | <xsl:param name="name" />
|
---|
373 | <xsl:param name="depth" />
|
---|
374 | <xsl:param name="parents" />
|
---|
375 |
|
---|
376 | <xsl:variable name="extends">
|
---|
377 | <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
|
---|
378 | </xsl:variable>
|
---|
379 |
|
---|
380 | <xsl:for-each select="key('G_keyInterfacesByName', $name)/attribute">
|
---|
381 | <xsl:variable name="mName">
|
---|
382 | <xsl:value-of select="concat('m_', @name)" />
|
---|
383 | </xsl:variable>
|
---|
384 | <xsl:variable name="mType">
|
---|
385 | <xsl:call-template name="typeIdl2Back">
|
---|
386 | <xsl:with-param name="type" select="@type" />
|
---|
387 | <xsl:with-param name="safearray" select="@safearray" />
|
---|
388 | <xsl:with-param name="dir" select="'in'" />
|
---|
389 | <xsl:with-param name="mod" select="@mod" />
|
---|
390 | </xsl:call-template>
|
---|
391 | </xsl:variable>
|
---|
392 | <xsl:variable name="pName">
|
---|
393 | <xsl:value-of select="concat('a_', @name)" />
|
---|
394 | </xsl:variable>
|
---|
395 | <xsl:variable name="pTypeNameOut">
|
---|
396 | <xsl:call-template name="typeIdl2Back">
|
---|
397 | <xsl:with-param name="type" select="@type" />
|
---|
398 | <xsl:with-param name="safearray" select="@safearray" />
|
---|
399 | <xsl:with-param name="param" select="$pName" />
|
---|
400 | <xsl:with-param name="dir" select="'out'" />
|
---|
401 | <xsl:with-param name="mod" select="@mod" />
|
---|
402 | </xsl:call-template>
|
---|
403 | </xsl:variable>
|
---|
404 |
|
---|
405 | <xsl:variable name="pTypeNameIn">
|
---|
406 | <xsl:call-template name="typeIdl2Back">
|
---|
407 | <xsl:with-param name="type" select="@type" />
|
---|
408 | <xsl:with-param name="safearray" select="@safearray" />
|
---|
409 | <xsl:with-param name="param" select="$pName" />
|
---|
410 | <xsl:with-param name="dir" select="'in'" />
|
---|
411 | <xsl:with-param name="mod" select="@mod" />
|
---|
412 | </xsl:call-template>
|
---|
413 | </xsl:variable>
|
---|
414 |
|
---|
415 | <xsl:variable name="capsName">
|
---|
416 | <xsl:call-template name="capitalize">
|
---|
417 | <xsl:with-param name="str" select="@name" />
|
---|
418 | </xsl:call-template>
|
---|
419 | </xsl:variable>
|
---|
420 |
|
---|
421 | <xsl:value-of select=" ' '" />
|
---|
422 | <xsl:value-of select="concat(' // attribute ', @name,' ')" />
|
---|
423 | <xsl:value-of select=" 'private: '" />
|
---|
424 | <xsl:value-of select="concat(' ', $mType, ' ', $mName,'; ')" />
|
---|
425 | <xsl:value-of select=" 'public: '" />
|
---|
426 | <xsl:value-of select="concat(' STDMETHOD(COMGETTER(', $capsName,'))(',$pTypeNameOut,') { ')" />
|
---|
427 | <xsl:call-template name="genRetParam">
|
---|
428 | <xsl:with-param name="type" select="@type" />
|
---|
429 | <xsl:with-param name="member" select="$mName" />
|
---|
430 | <xsl:with-param name="param" select="$pName" />
|
---|
431 | <xsl:with-param name="safearray" select="@safearray" />
|
---|
432 | </xsl:call-template>
|
---|
433 | <xsl:value-of select=" ' return S_OK; '" />
|
---|
434 | <xsl:value-of select=" ' } '" />
|
---|
435 |
|
---|
436 | <xsl:if test="not(@readonly='yes')">
|
---|
437 | <xsl:value-of select="concat(' STDMETHOD(COMSETTER(', $capsName,'))(',$pTypeNameIn,') { ')" />
|
---|
438 | <xsl:call-template name="genSetParam">
|
---|
439 | <xsl:with-param name="type" select="@type" />
|
---|
440 | <xsl:with-param name="member" select="$mName" />
|
---|
441 | <xsl:with-param name="param" select="$pName" />
|
---|
442 | <xsl:with-param name="safearray" select="@safearray" />
|
---|
443 | </xsl:call-template>
|
---|
444 | <xsl:value-of select=" ' return S_OK; '" />
|
---|
445 | <xsl:value-of select=" ' } '" />
|
---|
446 | </xsl:if>
|
---|
447 |
|
---|
448 | <xsl:value-of select=" ' // purely internal setter '" />
|
---|
449 | <xsl:value-of select="concat(' HRESULT set_', @name,'(',$pTypeNameIn, ') { ')" />
|
---|
450 | <xsl:call-template name="genSetParam">
|
---|
451 | <xsl:with-param name="type" select="@type" />
|
---|
452 | <xsl:with-param name="member" select="$mName" />
|
---|
453 | <xsl:with-param name="param" select="$pName" />
|
---|
454 | <xsl:with-param name="safearray" select="@safearray" />
|
---|
455 | </xsl:call-template>
|
---|
456 | <xsl:value-of select=" ' return S_OK; '" />
|
---|
457 | <xsl:value-of select=" ' } '" />
|
---|
458 | </xsl:for-each>
|
---|
459 |
|
---|
460 | <xsl:choose>
|
---|
461 | <xsl:when test="$extends='IEvent'">
|
---|
462 | <xsl:value-of select=" ' // skipping IEvent attributes '" />
|
---|
463 | </xsl:when>
|
---|
464 | <xsl:when test="$extends='IReusableEvent'">
|
---|
465 | <xsl:value-of select=" ' // skipping IReusableEvent attributes '" />
|
---|
466 | </xsl:when>
|
---|
467 | <xsl:when test="$extends='IVetoEvent'">
|
---|
468 | <xsl:value-of select=" ' // skipping IVetoEvent attributes '" />
|
---|
469 | </xsl:when>
|
---|
470 | <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
|
---|
471 | <xsl:call-template name="genAttrCode">
|
---|
472 | <xsl:with-param name="name" select="$extends" />
|
---|
473 | <xsl:with-param name="depth" select="$depth+1" />
|
---|
474 | <xsl:with-param name="parents" select="concat($parents, ', ', @name)" />
|
---|
475 | </xsl:call-template>
|
---|
476 | </xsl:when>
|
---|
477 | <xsl:otherwise>
|
---|
478 | <xsl:call-template name="fatalError">
|
---|
479 | <xsl:with-param name="msg" select="concat('No idea how to process it: ', $extends)" />
|
---|
480 | </xsl:call-template>
|
---|
481 | </xsl:otherwise>
|
---|
482 | </xsl:choose>
|
---|
483 | </xsl:template>
|
---|
484 |
|
---|
485 | <xsl:template name="genEventImpl">
|
---|
486 | <xsl:param name="implName" />
|
---|
487 | <xsl:param name="isVeto" />
|
---|
488 | <xsl:param name="isReusable" />
|
---|
489 |
|
---|
490 | <xsl:value-of select="concat('class ATL_NO_VTABLE ',$implName,
|
---|
491 | ' : public VirtualBoxBase, VBOX_SCRIPTABLE_IMPL(',
|
---|
492 | @name, ') { ')" />
|
---|
493 | <xsl:value-of select="'public: '" />
|
---|
494 | <xsl:value-of select="concat(' VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(', $implName, ', ', @name, ') ')" />
|
---|
495 | <xsl:value-of select="concat(' DECLARE_NOT_AGGREGATABLE(', $implName, ') ')" />
|
---|
496 | <xsl:value-of select=" ' DECLARE_PROTECT_FINAL_CONSTRUCT() '" />
|
---|
497 | <xsl:value-of select="concat(' BEGIN_COM_MAP(', $implName, ') ')" />
|
---|
498 | <xsl:value-of select=" ' COM_INTERFACE_ENTRY(ISupportErrorInfo) '" />
|
---|
499 | <xsl:value-of select="concat(' COM_INTERFACE_ENTRY(', @name, ') ')" />
|
---|
500 | <xsl:value-of select="concat(' COM_INTERFACE_ENTRY2(IDispatch, ', @name, ') ')" />
|
---|
501 | <xsl:value-of select="concat(' VBOX_TWEAK_INTERFACE_ENTRY(', @name, ') ')" />
|
---|
502 |
|
---|
503 | <xsl:call-template name="genComEntry">
|
---|
504 | <xsl:with-param name="name" select="@name" />
|
---|
505 | </xsl:call-template>
|
---|
506 | <xsl:value-of select=" ' END_COM_MAP() '" />
|
---|
507 | <xsl:value-of select="concat(' ',$implName,'() { /*printf("',$implName,'\n")*/;} ')" />
|
---|
508 | <xsl:value-of select="concat(' virtual ~',$implName,'() { /*printf("~',$implName,'\n")*/; uninit(); } ')" />
|
---|
509 | <xsl:text><![CDATA[
|
---|
510 | HRESULT FinalConstruct()
|
---|
511 | {
|
---|
512 | BaseFinalConstruct();
|
---|
513 | return mEvent.createObject();
|
---|
514 | }
|
---|
515 | void FinalRelease()
|
---|
516 | {
|
---|
517 | uninit();
|
---|
518 | BaseFinalRelease();
|
---|
519 | }
|
---|
520 | STDMETHOD(COMGETTER(Type))(VBoxEventType_T *aType)
|
---|
521 | {
|
---|
522 | return mEvent->COMGETTER(Type)(aType);
|
---|
523 | }
|
---|
524 | STDMETHOD(COMGETTER(Source))(IEventSource * *aSource)
|
---|
525 | {
|
---|
526 | return mEvent->COMGETTER(Source)(aSource);
|
---|
527 | }
|
---|
528 | STDMETHOD(COMGETTER(Waitable))(BOOL *aWaitable)
|
---|
529 | {
|
---|
530 | return mEvent->COMGETTER(Waitable)(aWaitable);
|
---|
531 | }
|
---|
532 | STDMETHOD(SetProcessed)()
|
---|
533 | {
|
---|
534 | return mEvent->SetProcessed();
|
---|
535 | }
|
---|
536 | STDMETHOD(WaitProcessed)(LONG aTimeout, BOOL *aResult)
|
---|
537 | {
|
---|
538 | return mEvent->WaitProcessed(aTimeout, aResult);
|
---|
539 | }
|
---|
540 | void uninit()
|
---|
541 | {
|
---|
542 | if (!mEvent.isNull())
|
---|
543 | {
|
---|
544 | mEvent->uninit();
|
---|
545 | mEvent.setNull();
|
---|
546 | }
|
---|
547 | }
|
---|
548 | ]]></xsl:text>
|
---|
549 | <xsl:choose>
|
---|
550 | <xsl:when test="$isVeto='yes'">
|
---|
551 | <xsl:text><![CDATA[
|
---|
552 | HRESULT init(IEventSource* aSource, VBoxEventType_T aType, BOOL aWaitable = TRUE)
|
---|
553 | {
|
---|
554 | NOREF(aWaitable);
|
---|
555 | return mEvent->init(aSource, aType);
|
---|
556 | }
|
---|
557 | STDMETHOD(AddVeto)(IN_BSTR aVeto)
|
---|
558 | {
|
---|
559 | return mEvent->AddVeto(aVeto);
|
---|
560 | }
|
---|
561 | STDMETHOD(IsVetoed)(BOOL *aResult)
|
---|
562 | {
|
---|
563 | return mEvent->IsVetoed(aResult);
|
---|
564 | }
|
---|
565 | STDMETHOD(GetVetos)(ComSafeArrayOut(BSTR, aVetos))
|
---|
566 | {
|
---|
567 | return mEvent->GetVetos(ComSafeArrayOutArg(aVetos));
|
---|
568 | }
|
---|
569 | STDMETHOD(AddApproval)(IN_BSTR aReason)
|
---|
570 | {
|
---|
571 | return mEvent->AddApproval(aReason);
|
---|
572 | }
|
---|
573 | STDMETHOD(IsApproved)(BOOL *aResult)
|
---|
574 | {
|
---|
575 | return mEvent->IsApproved(aResult);
|
---|
576 | }
|
---|
577 | STDMETHOD(GetApprovals)(ComSafeArrayOut(BSTR, aReasons))
|
---|
578 | {
|
---|
579 | return mEvent->GetApprovals(ComSafeArrayOutArg(aReasons));
|
---|
580 | }
|
---|
581 | private:
|
---|
582 | ComObjPtr<VBoxVetoEvent> mEvent;
|
---|
583 | ]]></xsl:text>
|
---|
584 | </xsl:when>
|
---|
585 | <xsl:when test="$isReusable='yes'">
|
---|
586 | <xsl:text>
|
---|
587 | <![CDATA[
|
---|
588 | HRESULT init(IEventSource* aSource, VBoxEventType_T aType, BOOL aWaitable = FALSE)
|
---|
589 | {
|
---|
590 | mGeneration = 1;
|
---|
591 | return mEvent->init(aSource, aType, aWaitable);
|
---|
592 | }
|
---|
593 | STDMETHOD(COMGETTER(Generation))(ULONG *aGeneration)
|
---|
594 | {
|
---|
595 | *aGeneration = mGeneration;
|
---|
596 | return S_OK;
|
---|
597 | }
|
---|
598 | STDMETHOD(Reuse)()
|
---|
599 | {
|
---|
600 | ASMAtomicIncU32((volatile uint32_t*)&mGeneration);
|
---|
601 | return S_OK;
|
---|
602 | }
|
---|
603 | private:
|
---|
604 | volatile ULONG mGeneration;
|
---|
605 | ComObjPtr<VBoxEvent> mEvent;
|
---|
606 | ]]></xsl:text>
|
---|
607 | </xsl:when>
|
---|
608 | <xsl:otherwise>
|
---|
609 | <xsl:text><![CDATA[
|
---|
610 | HRESULT init(IEventSource* aSource, VBoxEventType_T aType, BOOL aWaitable)
|
---|
611 | {
|
---|
612 | return mEvent->init(aSource, aType, aWaitable);
|
---|
613 | }
|
---|
614 | private:
|
---|
615 | ComObjPtr<VBoxEvent> mEvent;
|
---|
616 | ]]></xsl:text>
|
---|
617 | </xsl:otherwise>
|
---|
618 | </xsl:choose>
|
---|
619 |
|
---|
620 | <!-- Before we generate attribute code, we check and make sure there are attributes here. -->
|
---|
621 | <xsl:if test="count(attribute) = 0 and @name != 'INATNetworkAlterEvent'">
|
---|
622 | <xsl:call-template name="fatalError">
|
---|
623 | <xsl:with-param name="msg">error: <xsl:value-of select="@name"/> has no attributes</xsl:with-param>
|
---|
624 | </xsl:call-template>
|
---|
625 | </xsl:if>
|
---|
626 |
|
---|
627 | <xsl:call-template name="genAttrCode">
|
---|
628 | <xsl:with-param name="name" select="@name" />
|
---|
629 | </xsl:call-template>
|
---|
630 | <xsl:value-of select="'}; '" />
|
---|
631 |
|
---|
632 |
|
---|
633 | <xsl:call-template name="genImplList">
|
---|
634 | <xsl:with-param name="impl" select="$implName" />
|
---|
635 | <xsl:with-param name="name" select="@name" />
|
---|
636 | <xsl:with-param name="depth" select="'1'" />
|
---|
637 | <xsl:with-param name="parents" select="''" />
|
---|
638 | </xsl:call-template>
|
---|
639 |
|
---|
640 | </xsl:template>
|
---|
641 |
|
---|
642 |
|
---|
643 | <xsl:template name="genSwitchCase">
|
---|
644 | <xsl:param name="ifaceName" />
|
---|
645 | <xsl:param name="implName" />
|
---|
646 | <xsl:param name="reinit" />
|
---|
647 | <xsl:variable name="waitable">
|
---|
648 | <xsl:choose>
|
---|
649 | <xsl:when test="@waitable='yes'">
|
---|
650 | <xsl:value-of select="'TRUE'"/>
|
---|
651 | </xsl:when>
|
---|
652 | <xsl:otherwise>
|
---|
653 | <xsl:value-of select="'FALSE'"/>
|
---|
654 | </xsl:otherwise>
|
---|
655 | </xsl:choose>
|
---|
656 | </xsl:variable>
|
---|
657 | <xsl:value-of select="concat(' case VBoxEventType_', @id, ': ')"/>
|
---|
658 | <xsl:value-of select=" ' { '"/>
|
---|
659 | <xsl:choose>
|
---|
660 | <xsl:when test="$reinit='yes'">
|
---|
661 | <xsl:value-of select="concat(' ComPtr<', $ifaceName, '> iobj; ')"/>
|
---|
662 | <xsl:value-of select=" ' iobj = mEvent; '"/>
|
---|
663 | <xsl:value-of select=" ' Assert(!iobj.isNull()); '"/>
|
---|
664 | <xsl:value-of select="concat(' ',$implName, '* obj = (', $implName, '*)(', $ifaceName, '*)iobj; ')"/>
|
---|
665 | <xsl:value-of select=" ' obj->Reuse(); '"/>
|
---|
666 | </xsl:when>
|
---|
667 | <xsl:otherwise>
|
---|
668 | <xsl:value-of select="concat(' ComObjPtr<', $implName, '> obj; ')"/>
|
---|
669 | <xsl:value-of select=" ' obj.createObject(); '"/>
|
---|
670 | <xsl:value-of select="concat(' obj->init(aSource, aType, ', $waitable, '); ')"/>
|
---|
671 | </xsl:otherwise>
|
---|
672 | </xsl:choose>
|
---|
673 | <xsl:call-template name="genAttrInitCode">
|
---|
674 | <xsl:with-param name="name" select="@name" />
|
---|
675 | <xsl:with-param name="obj" select="'obj'" />
|
---|
676 | </xsl:call-template>
|
---|
677 | <xsl:if test="not($reinit='yes')">
|
---|
678 | <xsl:value-of select=" ' obj.queryInterfaceTo(mEvent.asOutParam()); '"/>
|
---|
679 | </xsl:if>
|
---|
680 | <xsl:value-of select=" ' break; '"/>
|
---|
681 | <xsl:value-of select=" ' } '"/>
|
---|
682 | </xsl:template>
|
---|
683 |
|
---|
684 | <xsl:template name="genCommonEventCode">
|
---|
685 | <xsl:call-template name="fileheader">
|
---|
686 | <xsl:with-param name="name" select="'VBoxEvents.cpp'" />
|
---|
687 | </xsl:call-template>
|
---|
688 |
|
---|
689 | <xsl:text><![CDATA[
|
---|
690 | #include <VBox/com/array.h>
|
---|
691 | #include <iprt/asm.h>
|
---|
692 | #include "EventImpl.h"
|
---|
693 | ]]></xsl:text>
|
---|
694 |
|
---|
695 | <!-- Interfaces -->
|
---|
696 | <xsl:for-each select="//interface[@autogen=$G_kind]">
|
---|
697 | <xsl:value-of select="concat('// ', @name, ' implementation code')" />
|
---|
698 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
699 | <xsl:variable name="implName">
|
---|
700 | <xsl:value-of select="substring(@name, 2)" />
|
---|
701 | </xsl:variable>
|
---|
702 |
|
---|
703 | <xsl:choose>
|
---|
704 | <xsl:when test="$G_kind='VBoxEvent'">
|
---|
705 | <xsl:variable name="isVeto">
|
---|
706 | <xsl:if test="@extends='IVetoEvent'">
|
---|
707 | <xsl:value-of select="'yes'" />
|
---|
708 | </xsl:if>
|
---|
709 | </xsl:variable>
|
---|
710 | <xsl:variable name="isReusable">
|
---|
711 | <xsl:if test="@extends='IReusableEvent'">
|
---|
712 | <xsl:value-of select="'yes'" />
|
---|
713 | </xsl:if>
|
---|
714 | </xsl:variable>
|
---|
715 | <xsl:call-template name="genEventImpl">
|
---|
716 | <xsl:with-param name="implName" select="$implName" />
|
---|
717 | <xsl:with-param name="isVeto" select="$isVeto" />
|
---|
718 | <xsl:with-param name="isReusable" select="$isReusable" />
|
---|
719 | </xsl:call-template>
|
---|
720 | </xsl:when>
|
---|
721 | </xsl:choose>
|
---|
722 | </xsl:for-each>
|
---|
723 |
|
---|
724 | <xsl:text><![CDATA[
|
---|
725 | HRESULT VBoxEventDesc::init(IEventSource *aSource, VBoxEventType_T aType, ...)
|
---|
726 | {
|
---|
727 | va_list args;
|
---|
728 |
|
---|
729 | mEventSource = aSource;
|
---|
730 | va_start(args, aType);
|
---|
731 | switch (aType)
|
---|
732 | {
|
---|
733 | ]]></xsl:text>
|
---|
734 |
|
---|
735 | <xsl:for-each select="//interface[@autogen=$G_kind]">
|
---|
736 | <xsl:variable name="implName">
|
---|
737 | <xsl:value-of select="substring(@name, 2)" />
|
---|
738 | </xsl:variable>
|
---|
739 | <xsl:call-template name="genSwitchCase">
|
---|
740 | <xsl:with-param name="ifaceName" select="@name" />
|
---|
741 | <xsl:with-param name="implName" select="$implName" />
|
---|
742 | <xsl:with-param name="reinit" select="'no'" />
|
---|
743 | </xsl:call-template>
|
---|
744 | </xsl:for-each>
|
---|
745 |
|
---|
746 | <xsl:text><![CDATA[
|
---|
747 | default:
|
---|
748 | AssertFailed();
|
---|
749 | }
|
---|
750 | va_end(args);
|
---|
751 |
|
---|
752 | return S_OK;
|
---|
753 | }
|
---|
754 | ]]></xsl:text>
|
---|
755 |
|
---|
756 | <xsl:text><![CDATA[
|
---|
757 | HRESULT VBoxEventDesc::reinit(VBoxEventType_T aType, ...)
|
---|
758 | {
|
---|
759 | va_list args;
|
---|
760 |
|
---|
761 | va_start(args, aType);
|
---|
762 | switch (aType)
|
---|
763 | {
|
---|
764 | ]]></xsl:text>
|
---|
765 |
|
---|
766 | <xsl:for-each select="//interface[@autogen=$G_kind and @extends='IReusableEvent']">
|
---|
767 | <xsl:variable name="implName">
|
---|
768 | <xsl:value-of select="substring(@name, 2)" />
|
---|
769 | </xsl:variable>
|
---|
770 | <xsl:call-template name="genSwitchCase">
|
---|
771 | <xsl:with-param name="ifaceName" select="@name" />
|
---|
772 | <xsl:with-param name="implName" select="$implName" />
|
---|
773 | <xsl:with-param name="reinit" select="'yes'" />
|
---|
774 | </xsl:call-template>
|
---|
775 | </xsl:for-each>
|
---|
776 |
|
---|
777 | <xsl:text><![CDATA[
|
---|
778 | default:
|
---|
779 | AssertFailed();
|
---|
780 | }
|
---|
781 | va_end(args);
|
---|
782 |
|
---|
783 | return S_OK;
|
---|
784 | }
|
---|
785 | ]]></xsl:text>
|
---|
786 |
|
---|
787 | </xsl:template>
|
---|
788 |
|
---|
789 | <xsl:template name="genFormalParams">
|
---|
790 | <xsl:param name="name" />
|
---|
791 | <xsl:variable name="extends">
|
---|
792 | <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
|
---|
793 | </xsl:variable>
|
---|
794 |
|
---|
795 | <xsl:choose>
|
---|
796 | <xsl:when test="$extends='IEvent'">
|
---|
797 | </xsl:when>
|
---|
798 | <xsl:when test="$extends='IReusableEvent'">
|
---|
799 | </xsl:when>
|
---|
800 | <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
|
---|
801 | <xsl:call-template name="genFormalParams">
|
---|
802 | <xsl:with-param name="name" select="$extends" />
|
---|
803 | </xsl:call-template>
|
---|
804 | </xsl:when>
|
---|
805 | <xsl:otherwise>
|
---|
806 | <xsl:call-template name="fatalError">
|
---|
807 | <xsl:with-param name="msg" select="concat('No idea how to process it: ', $name)" />
|
---|
808 | </xsl:call-template>
|
---|
809 | </xsl:otherwise>
|
---|
810 | </xsl:choose>
|
---|
811 |
|
---|
812 | <xsl:for-each select="key('G_keyInterfacesByName', $name)/attribute[@name != 'midlDoesNotLikeEmptyInterfaces']">
|
---|
813 | <xsl:variable name="aName" select="concat('a_',@name)"/>
|
---|
814 | <xsl:variable name="aTypeName">
|
---|
815 | <xsl:call-template name="typeIdl2Back">
|
---|
816 | <xsl:with-param name="type" select="@type" />
|
---|
817 | <xsl:with-param name="safearray" select="@safearray" />
|
---|
818 | <xsl:with-param name="param" select="$aName" />
|
---|
819 | <xsl:with-param name="dir" select="'in'" />
|
---|
820 | <xsl:with-param name="mod" select="@mod" />
|
---|
821 | </xsl:call-template>
|
---|
822 | </xsl:variable>
|
---|
823 | <xsl:value-of select="concat(', ',$aTypeName)"/>
|
---|
824 | </xsl:for-each>
|
---|
825 | </xsl:template>
|
---|
826 |
|
---|
827 | <xsl:template name="genFactParams">
|
---|
828 | <xsl:param name="name" />
|
---|
829 | <xsl:variable name="extends">
|
---|
830 | <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
|
---|
831 | </xsl:variable>
|
---|
832 |
|
---|
833 | <xsl:choose>
|
---|
834 | <xsl:when test="$extends='IEvent'">
|
---|
835 | </xsl:when>
|
---|
836 | <xsl:when test="$extends='IReusableEvent'">
|
---|
837 | </xsl:when>
|
---|
838 | <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
|
---|
839 | <xsl:call-template name="genFactParams">
|
---|
840 | <xsl:with-param name="name" select="$extends" />
|
---|
841 | </xsl:call-template>
|
---|
842 | </xsl:when>
|
---|
843 | <xsl:otherwise>
|
---|
844 | <xsl:call-template name="fatalError">
|
---|
845 | <xsl:with-param name="msg" select="concat('No idea how to process it: ', $name)" />
|
---|
846 | </xsl:call-template>
|
---|
847 | </xsl:otherwise>
|
---|
848 | </xsl:choose>
|
---|
849 |
|
---|
850 | <xsl:for-each select="key('G_keyInterfacesByName', $name)/attribute[@name != 'midlDoesNotLikeEmptyInterfaces']">
|
---|
851 | <xsl:variable name="aName" select="concat('a_',@name)"/>
|
---|
852 | <xsl:choose>
|
---|
853 | <xsl:when test="@safearray='yes'">
|
---|
854 | <xsl:value-of select="concat(', ComSafeArrayInArg(',$aName,')')"/>
|
---|
855 | </xsl:when>
|
---|
856 | <xsl:otherwise>
|
---|
857 | <xsl:value-of select="concat(', ',$aName)"/>
|
---|
858 | </xsl:otherwise>
|
---|
859 | </xsl:choose>
|
---|
860 | </xsl:for-each>
|
---|
861 | </xsl:template>
|
---|
862 |
|
---|
863 | <xsl:template name="genCommonEventHeader">
|
---|
864 | <xsl:call-template name="fileheader">
|
---|
865 | <xsl:with-param name="name" select="'VBoxEvents.h'" />
|
---|
866 | </xsl:call-template>
|
---|
867 |
|
---|
868 | <xsl:text><![CDATA[
|
---|
869 | #include "EventImpl.h"
|
---|
870 | ]]></xsl:text>
|
---|
871 |
|
---|
872 | <!-- Interfaces -->
|
---|
873 | <xsl:for-each select="//interface[@autogen='VBoxEvent']">
|
---|
874 | <xsl:value-of select="concat('// ', @name, ' generation routine ')" />
|
---|
875 | <xsl:variable name="evname">
|
---|
876 | <xsl:value-of select="substring(@name, 2)" />
|
---|
877 | </xsl:variable>
|
---|
878 | <xsl:variable name="evid">
|
---|
879 | <xsl:value-of select="concat('On', substring(@name, 2, string-length(@name)-6))" />
|
---|
880 | </xsl:variable>
|
---|
881 |
|
---|
882 | <xsl:variable name="ifname">
|
---|
883 | <xsl:value-of select="@name" />
|
---|
884 | </xsl:variable>
|
---|
885 |
|
---|
886 | <xsl:value-of select="concat('DECLINLINE(void) fire', $evname, '(IEventSource* aSource')"/>
|
---|
887 | <xsl:call-template name="genFormalParams">
|
---|
888 | <xsl:with-param name="name" select="$ifname" />
|
---|
889 | </xsl:call-template>
|
---|
890 | <xsl:value-of select=" ') { '"/>
|
---|
891 |
|
---|
892 | <xsl:value-of select=" ' VBoxEventDesc evDesc; '"/>
|
---|
893 | <xsl:value-of select="concat(' evDesc.init(aSource, VBoxEventType_',$evid)"/>
|
---|
894 | <xsl:call-template name="genFactParams">
|
---|
895 | <xsl:with-param name="name" select="$ifname" />
|
---|
896 | </xsl:call-template>
|
---|
897 | <xsl:value-of select="'); '"/>
|
---|
898 | <xsl:value-of select=" ' evDesc.fire(/* do not wait for delivery */ 0); '"/>
|
---|
899 | <xsl:value-of select=" '} '"/>
|
---|
900 | </xsl:for-each>
|
---|
901 | </xsl:template>
|
---|
902 |
|
---|
903 | <xsl:template match="/">
|
---|
904 | <!-- Global code -->
|
---|
905 | <xsl:choose>
|
---|
906 | <xsl:when test="$G_kind='VBoxEvent'">
|
---|
907 | <xsl:call-template name="genCommonEventCode">
|
---|
908 | </xsl:call-template>
|
---|
909 | </xsl:when>
|
---|
910 | <xsl:when test="$G_kind='VBoxEventHeader'">
|
---|
911 | <xsl:call-template name="genCommonEventHeader">
|
---|
912 | </xsl:call-template>
|
---|
913 | </xsl:when>
|
---|
914 | <xsl:otherwise>
|
---|
915 | <xsl:call-template name="fatalError">
|
---|
916 | <xsl:with-param name="msg" select="concat('Request unsupported: ', $G_kind)" />
|
---|
917 | </xsl:call-template>
|
---|
918 | </xsl:otherwise>
|
---|
919 | </xsl:choose>
|
---|
920 | </xsl:template>
|
---|
921 |
|
---|
922 | </xsl:stylesheet>
|
---|