1 | <?xml version="1.0"?>
|
---|
2 |
|
---|
3 | <!--
|
---|
4 | apiwrap-server.xsl:
|
---|
5 | XSLT stylesheet that generates C++ API wrappers (server side) from
|
---|
6 | VirtualBox.xidl.
|
---|
7 |
|
---|
8 | Copyright (C) 2010-2014 Oracle Corporation
|
---|
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 |
|
---|
19 | <xsl:stylesheet
|
---|
20 | version="1.0"
|
---|
21 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
22 | xmlns:exsl="http://exslt.org/common"
|
---|
23 | extension-element-prefixes="exsl">
|
---|
24 |
|
---|
25 | <xsl:output method="text"/>
|
---|
26 |
|
---|
27 | <xsl:strip-space elements="*"/>
|
---|
28 |
|
---|
29 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
30 | global XSLT variables
|
---|
31 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
32 |
|
---|
33 | <xsl:variable name="G_xsltFilename" select="'apiwrap-server.xsl'"/>
|
---|
34 |
|
---|
35 | <xsl:include href="typemap-shared.inc.xsl"/>
|
---|
36 |
|
---|
37 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
38 | templates for file separation
|
---|
39 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
40 |
|
---|
41 | <xsl:template match="interface" mode="listfile">
|
---|
42 | <xsl:param name="file"/>
|
---|
43 |
|
---|
44 | <xsl:value-of select="concat('	', $file, ' \ ')"/>
|
---|
45 | </xsl:template>
|
---|
46 |
|
---|
47 | <xsl:template match="interface" mode="startfile">
|
---|
48 | <xsl:param name="file"/>
|
---|
49 |
|
---|
50 | <xsl:value-of select="concat(' // ##### BEGINFILE "', $file, '" ')"/>
|
---|
51 | </xsl:template>
|
---|
52 |
|
---|
53 | <xsl:template match="interface" mode="endfile">
|
---|
54 | <xsl:param name="file"/>
|
---|
55 |
|
---|
56 | <xsl:value-of select="concat(' // ##### ENDFILE "', $file, '" ')"/>
|
---|
57 | </xsl:template>
|
---|
58 |
|
---|
59 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
60 | templates for file headers/footers
|
---|
61 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
62 |
|
---|
63 | <xsl:template name="fileheader">
|
---|
64 | <xsl:param name="class"/>
|
---|
65 | <xsl:param name="name"/>
|
---|
66 | <xsl:param name="type"/>
|
---|
67 |
|
---|
68 | <xsl:text>/** @file
|
---|
69 | *
|
---|
70 | </xsl:text>
|
---|
71 | <xsl:value-of select="concat(' * VirtualBox API class wrapper ', $type, ' for I', $class, '.')"/>
|
---|
72 | <xsl:text>
|
---|
73 | *
|
---|
74 | * DO NOT EDIT! This is a generated file.
|
---|
75 | * Generated from: src/VBox/Main/idl/VirtualBox.xidl
|
---|
76 | * Generator: src/VBox/Main/idl/apiwrap-server.xsl
|
---|
77 | */
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * Copyright (C) 2010-2014 Oracle Corporation
|
---|
81 | *
|
---|
82 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
83 | * available from http://www.virtualbox.org. This file is free software;
|
---|
84 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
85 | * General Public License (GPL) as published by the Free Software
|
---|
86 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
87 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
88 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
89 | */
|
---|
90 |
|
---|
91 | </xsl:text>
|
---|
92 | </xsl:template>
|
---|
93 |
|
---|
94 | <xsl:template name="emitCOMInterfaces">
|
---|
95 | <xsl:param name="iface"/>
|
---|
96 |
|
---|
97 | <xsl:value-of select="concat(' COM_INTERFACE_ENTRY(', $iface/@name, ') ')"/>
|
---|
98 | <!-- now recurse to emit all base interfaces -->
|
---|
99 | <xsl:variable name="extends" select="$iface/@extends"/>
|
---|
100 | <xsl:if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
|
---|
101 | <xsl:call-template name="emitCOMInterfaces">
|
---|
102 | <xsl:with-param name="iface" select="//interface[@name=$extends]"/>
|
---|
103 | </xsl:call-template>
|
---|
104 | </xsl:if>
|
---|
105 | </xsl:template>
|
---|
106 |
|
---|
107 | <xsl:template match="interface" mode="classheader">
|
---|
108 | <xsl:value-of select="concat('#ifndef ', substring(@name, 2), 'Wrap_H_ ')"/>
|
---|
109 | <xsl:value-of select="concat('#define ', substring(@name, 2), 'Wrap_H_')"/>
|
---|
110 | <xsl:text>
|
---|
111 |
|
---|
112 | #include "VirtualBoxBase.h"
|
---|
113 | #include "Wrapper.h"
|
---|
114 |
|
---|
115 | </xsl:text>
|
---|
116 | <xsl:value-of select="concat('class ATL_NO_VTABLE ', substring(@name, 2), 'Wrap:')"/>
|
---|
117 | <xsl:text>
|
---|
118 | public VirtualBoxBase,
|
---|
119 | </xsl:text>
|
---|
120 | <xsl:value-of select="concat(' VBOX_SCRIPTABLE_IMPL(', @name, ') ')"/>
|
---|
121 | <xsl:text>{
|
---|
122 | Q_OBJECT
|
---|
123 |
|
---|
124 | public:
|
---|
125 | </xsl:text>
|
---|
126 | <xsl:value-of select="concat(' VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(', substring(@name, 2), 'Wrap, ', @name, ') ')"/>
|
---|
127 | <xsl:value-of select="concat(' DECLARE_NOT_AGGREGATABLE(', substring(@name, 2), 'Wrap) ')"/>
|
---|
128 | <xsl:text> DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
129 |
|
---|
130 | </xsl:text>
|
---|
131 | <xsl:value-of select="concat(' BEGIN_COM_MAP(', substring(@name, 2), 'Wrap) ')"/>
|
---|
132 | <xsl:text> COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
---|
133 | </xsl:text>
|
---|
134 | <xsl:call-template name="emitCOMInterfaces">
|
---|
135 | <xsl:with-param name="iface" select="."/>
|
---|
136 | </xsl:call-template>
|
---|
137 | <xsl:value-of select="concat(' COM_INTERFACE_ENTRY2(IDispatch, ', @name, ') ')"/>
|
---|
138 | <xsl:text> COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
|
---|
139 | END_COM_MAP()
|
---|
140 |
|
---|
141 | </xsl:text>
|
---|
142 | <xsl:value-of select="concat(' DECLARE_EMPTY_CTOR_DTOR(', substring(@name, 2), 'Wrap) ')"/>
|
---|
143 | </xsl:template>
|
---|
144 |
|
---|
145 | <xsl:template match="interface" mode="classfooter">
|
---|
146 | <xsl:text>};
|
---|
147 |
|
---|
148 | </xsl:text>
|
---|
149 | <xsl:value-of select="concat('#endif // !', substring(@name, 2), 'Wrap_H_ ')"/>
|
---|
150 | </xsl:template>
|
---|
151 |
|
---|
152 | <xsl:template match="interface" mode="codeheader">
|
---|
153 | <xsl:value-of select="concat('#define LOG_GROUP_MAIN_OVERRIDE LOG_GROUP_MAIN_', translate(substring(@name, 2), $G_lowerCase, $G_upperCase), ' ')"/>
|
---|
154 | <xsl:value-of select="concat('#include "', substring(@name, 2), 'Wrap.h" ')"/>
|
---|
155 | <xsl:text>#include "Logging.h"
|
---|
156 |
|
---|
157 | </xsl:text>
|
---|
158 | </xsl:template>
|
---|
159 |
|
---|
160 | <xsl:template name="emitISupports">
|
---|
161 | <xsl:param name="classname"/>
|
---|
162 | <xsl:param name="extends"/>
|
---|
163 | <xsl:param name="depth"/>
|
---|
164 | <xsl:param name="interfacelist"/>
|
---|
165 |
|
---|
166 | <xsl:choose>
|
---|
167 | <xsl:when test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
|
---|
168 | <xsl:variable name="newextends" select="//interface[@name=$extends]/@extends"/>
|
---|
169 | <xsl:variable name="newiflist" select="concat($interfacelist, ', ', $extends)"/>
|
---|
170 | <xsl:call-template name="emitISupports">
|
---|
171 | <xsl:with-param name="classname" select="$classname"/>
|
---|
172 | <xsl:with-param name="extends" select="$newextends"/>
|
---|
173 | <xsl:with-param name="depth" select="$depth + 1"/>
|
---|
174 | <xsl:with-param name="interfacelist" select="$newiflist"/>
|
---|
175 | </xsl:call-template>
|
---|
176 | </xsl:when>
|
---|
177 | <xsl:otherwise>
|
---|
178 | <xsl:value-of select="concat('NS_IMPL_THREADSAFE_ISUPPORTS', $depth, '_CI(', $classname, ', ', $interfacelist, ') ')"/>
|
---|
179 | </xsl:otherwise>
|
---|
180 | </xsl:choose>
|
---|
181 | </xsl:template>
|
---|
182 |
|
---|
183 | <xsl:template match="interface" mode="codefooter">
|
---|
184 | <xsl:text>#ifdef VBOX_WITH_XPCOM
|
---|
185 | </xsl:text>
|
---|
186 | <xsl:value-of select="concat('NS_DECL_CLASSINFO(', substring(@name, 2), 'Wrap) ')"/>
|
---|
187 |
|
---|
188 | <xsl:call-template name="emitISupports">
|
---|
189 | <xsl:with-param name="classname" select="concat(substring(@name, 2), 'Wrap')"/>
|
---|
190 | <xsl:with-param name="extends" select="@extends"/>
|
---|
191 | <xsl:with-param name="depth" select="1"/>
|
---|
192 | <xsl:with-param name="interfacelist" select="@name"/>
|
---|
193 | </xsl:call-template>
|
---|
194 |
|
---|
195 | <xsl:text>#endif // VBOX_WITH_XPCOM
|
---|
196 | </xsl:text>
|
---|
197 | </xsl:template>
|
---|
198 |
|
---|
199 |
|
---|
200 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
201 | templates for dealing with names and parameters
|
---|
202 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
203 |
|
---|
204 | <xsl:template name="tospace">
|
---|
205 | <xsl:param name="str"/>
|
---|
206 | <xsl:value-of select="translate($str, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_', ' ')"/>
|
---|
207 | </xsl:template>
|
---|
208 |
|
---|
209 | <xsl:template name="checkoption">
|
---|
210 | <xsl:param name="optionlist"/>
|
---|
211 | <xsl:param name="option"/>
|
---|
212 | <xsl:value-of select="string-length($option) > 0 and contains(concat(',', translate($optionlist, ' ', ''), ','), concat(',', $option, ','))"/>
|
---|
213 | </xsl:template>
|
---|
214 |
|
---|
215 | <xsl:template name="translatepublictype">
|
---|
216 | <xsl:param name="type"/>
|
---|
217 | <xsl:param name="dir"/>
|
---|
218 | <xsl:param name="mod"/>
|
---|
219 |
|
---|
220 | <!-- get C++ glue type from IDL type from table in typemap-shared.inc.xsl -->
|
---|
221 | <xsl:variable name="gluetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename"/>
|
---|
222 | <xsl:choose>
|
---|
223 | <xsl:when test="$type='wstring' or $type='uuid'">
|
---|
224 | <xsl:choose>
|
---|
225 | <xsl:when test="$dir='in'">
|
---|
226 | <xsl:text>IN_BSTR</xsl:text>
|
---|
227 | </xsl:when>
|
---|
228 | <xsl:otherwise>
|
---|
229 | <xsl:text>BSTR</xsl:text>
|
---|
230 | </xsl:otherwise>
|
---|
231 | </xsl:choose>
|
---|
232 | </xsl:when>
|
---|
233 | <xsl:when test="string-length($gluetypefield)">
|
---|
234 | <xsl:value-of select="$gluetypefield"/>
|
---|
235 | </xsl:when>
|
---|
236 | <xsl:when test="//enum[@name=$type]">
|
---|
237 | <xsl:value-of select="concat($type, '_T')"/>
|
---|
238 | </xsl:when>
|
---|
239 | <xsl:when test="$type='$unknown'">
|
---|
240 | <xsl:text>IUnknown *</xsl:text>
|
---|
241 | </xsl:when>
|
---|
242 | <xsl:when test="//interface[@name=$type]">
|
---|
243 | <xsl:variable name="thatif" select="//interface[@name=$type]"/>
|
---|
244 | <xsl:variable name="thatifname" select="$thatif/@name"/>
|
---|
245 | <xsl:value-of select="concat($thatifname, ' *')"/>
|
---|
246 | </xsl:when>
|
---|
247 | <xsl:otherwise>
|
---|
248 | <xsl:call-template name="fatalError">
|
---|
249 | <xsl:with-param name="msg" select="concat('translatepublictype: Type "', $type, '" is not supported.')"/>
|
---|
250 | </xsl:call-template>
|
---|
251 | </xsl:otherwise>
|
---|
252 | </xsl:choose>
|
---|
253 | <xsl:if test="$mod='ptr'">
|
---|
254 | <xsl:text> *</xsl:text>
|
---|
255 | </xsl:if>
|
---|
256 | </xsl:template>
|
---|
257 |
|
---|
258 | <xsl:template name="translatewrappedtype">
|
---|
259 | <xsl:param name="type"/>
|
---|
260 | <xsl:param name="dir"/>
|
---|
261 | <xsl:param name="mod"/>
|
---|
262 | <xsl:param name="safearray"/>
|
---|
263 |
|
---|
264 | <!-- get C++ wrap type from IDL type from table in typemap-shared.inc.xsl -->
|
---|
265 | <xsl:variable name="wraptypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename"/>
|
---|
266 | <xsl:choose>
|
---|
267 | <xsl:when test="$type='wstring'">
|
---|
268 | <xsl:if test="$dir='in' and not($safearray='yes')">
|
---|
269 | <xsl:text>const </xsl:text>
|
---|
270 | </xsl:if>
|
---|
271 | <xsl:text>com::Utf8Str &</xsl:text>
|
---|
272 | </xsl:when>
|
---|
273 | <xsl:when test="$type='uuid'">
|
---|
274 | <xsl:if test="$dir='in'">
|
---|
275 | <xsl:text>const </xsl:text>
|
---|
276 | </xsl:if>
|
---|
277 | <xsl:text>com::Guid &</xsl:text>
|
---|
278 | </xsl:when>
|
---|
279 | <xsl:when test="string-length($wraptypefield)">
|
---|
280 | <xsl:value-of select="$wraptypefield"/>
|
---|
281 | </xsl:when>
|
---|
282 | <xsl:when test="//enum[@name=$type]">
|
---|
283 | <xsl:value-of select="concat($type, '_T')"/>
|
---|
284 | </xsl:when>
|
---|
285 | <xsl:when test="$type='$unknown'">
|
---|
286 | <xsl:if test="$dir='in' and not($safearray='yes')">
|
---|
287 | <xsl:text>const </xsl:text>
|
---|
288 | </xsl:if>
|
---|
289 | <xsl:text>ComPtr<IUnknown> &</xsl:text>
|
---|
290 | </xsl:when>
|
---|
291 | <xsl:when test="//interface[@name=$type]">
|
---|
292 | <xsl:variable name="thatif" select="//interface[@name=$type]"/>
|
---|
293 | <xsl:variable name="thatifname" select="$thatif/@name"/>
|
---|
294 | <xsl:if test="$dir='in' and not($safearray='yes')">
|
---|
295 | <xsl:text>const </xsl:text>
|
---|
296 | </xsl:if>
|
---|
297 | <xsl:value-of select="concat('ComPtr<', $thatifname, '> &')"/>
|
---|
298 | </xsl:when>
|
---|
299 | <xsl:otherwise>
|
---|
300 | <xsl:call-template name="fatalError">
|
---|
301 | <xsl:with-param name="msg" select="concat('translatewrappedtype: Type "', $type, '" is not supported.')"/>
|
---|
302 | </xsl:call-template>
|
---|
303 | </xsl:otherwise>
|
---|
304 | </xsl:choose>
|
---|
305 | <xsl:if test="$mod='ptr'">
|
---|
306 | <xsl:text> *</xsl:text>
|
---|
307 | </xsl:if>
|
---|
308 | </xsl:template>
|
---|
309 |
|
---|
310 | <xsl:template name="translatefmtspectype">
|
---|
311 | <xsl:param name="type"/>
|
---|
312 | <xsl:param name="dir"/>
|
---|
313 | <xsl:param name="mod"/>
|
---|
314 | <xsl:param name="safearray"/>
|
---|
315 | <xsl:param name="isref"/>
|
---|
316 |
|
---|
317 | <!-- get C format string for IDL type from table in typemap-shared.inc.xsl -->
|
---|
318 | <xsl:variable name="wrapfmt" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluefmt"/>
|
---|
319 | <xsl:choose>
|
---|
320 | <xsl:when test="$mod='ptr' or ($isref='yes' and $dir!='in')">
|
---|
321 | <xsl:text>%p</xsl:text>
|
---|
322 | </xsl:when>
|
---|
323 | <xsl:when test="$safearray='yes'">
|
---|
324 | <xsl:text>%zu</xsl:text>
|
---|
325 | </xsl:when>
|
---|
326 | <xsl:when test="string-length($wrapfmt)">
|
---|
327 | <xsl:value-of select="$wrapfmt"/>
|
---|
328 | </xsl:when>
|
---|
329 | <xsl:when test="//enum[@name=$type]">
|
---|
330 | <xsl:text>%RU32</xsl:text>
|
---|
331 | </xsl:when>
|
---|
332 | <xsl:when test="$type='$unknown'">
|
---|
333 | <xsl:text>%p</xsl:text>
|
---|
334 | </xsl:when>
|
---|
335 | <xsl:when test="//interface[@name=$type]">
|
---|
336 | <xsl:text>%p</xsl:text>
|
---|
337 | </xsl:when>
|
---|
338 | <xsl:otherwise>
|
---|
339 | <xsl:call-template name="fatalError">
|
---|
340 | <xsl:with-param name="msg" select="concat('translatefmtcpectype: Type "', $type, '" is not supported.')"/>
|
---|
341 | </xsl:call-template>
|
---|
342 | </xsl:otherwise>
|
---|
343 | </xsl:choose>
|
---|
344 | </xsl:template>
|
---|
345 |
|
---|
346 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
347 | templates for handling entire interfaces and their contents
|
---|
348 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
349 |
|
---|
350 | <xsl:template name="emitInterface">
|
---|
351 | <xsl:param name="iface"/>
|
---|
352 |
|
---|
353 | <xsl:call-template name="emitHeader">
|
---|
354 | <xsl:with-param name="iface" select="$iface"/>
|
---|
355 | </xsl:call-template>
|
---|
356 |
|
---|
357 | <xsl:call-template name="emitCode">
|
---|
358 | <xsl:with-param name="iface" select="$iface"/>
|
---|
359 | </xsl:call-template>
|
---|
360 | </xsl:template>
|
---|
361 |
|
---|
362 | <xsl:template match="attribute/@type | param/@type" mode="public">
|
---|
363 | <xsl:param name="dir"/>
|
---|
364 |
|
---|
365 | <xsl:variable name="gluetype">
|
---|
366 | <xsl:call-template name="translatepublictype">
|
---|
367 | <xsl:with-param name="type" select="."/>
|
---|
368 | <xsl:with-param name="dir" select="$dir"/>
|
---|
369 | <xsl:with-param name="mod" select="../@mod"/>
|
---|
370 | </xsl:call-template>
|
---|
371 | </xsl:variable>
|
---|
372 |
|
---|
373 | <xsl:if test="../@safearray='yes'">
|
---|
374 | <xsl:choose>
|
---|
375 | <xsl:when test="$dir='in'">
|
---|
376 | <xsl:text>ComSafeArrayIn(</xsl:text>
|
---|
377 | </xsl:when>
|
---|
378 | <xsl:otherwise>
|
---|
379 | <xsl:text>ComSafeArrayOut(</xsl:text>
|
---|
380 | </xsl:otherwise>
|
---|
381 | </xsl:choose>
|
---|
382 | </xsl:if>
|
---|
383 | <xsl:value-of select="$gluetype"/>
|
---|
384 | <xsl:choose>
|
---|
385 | <xsl:when test="../@safearray='yes'">
|
---|
386 | <xsl:text>, </xsl:text>
|
---|
387 | </xsl:when>
|
---|
388 | <xsl:otherwise>
|
---|
389 | <xsl:if test="substring($gluetype,string-length($gluetype))!='*'">
|
---|
390 | <xsl:text> </xsl:text>
|
---|
391 | </xsl:if>
|
---|
392 | <xsl:choose>
|
---|
393 | <xsl:when test="$dir='in'">
|
---|
394 | </xsl:when>
|
---|
395 | <xsl:otherwise>
|
---|
396 | <xsl:value-of select="'*'"/>
|
---|
397 | </xsl:otherwise>
|
---|
398 | </xsl:choose>
|
---|
399 | </xsl:otherwise>
|
---|
400 | </xsl:choose>
|
---|
401 | <xsl:text>a</xsl:text>
|
---|
402 | <xsl:call-template name="capitalize">
|
---|
403 | <xsl:with-param name="str" select="../@name"/>
|
---|
404 | </xsl:call-template>
|
---|
405 | <xsl:if test="../@safearray='yes'">
|
---|
406 | <xsl:value-of select="')'"/>
|
---|
407 | </xsl:if>
|
---|
408 | </xsl:template>
|
---|
409 |
|
---|
410 | <xsl:template match="attribute/@type | param/@type" mode="wrapped">
|
---|
411 | <xsl:param name="dir"/>
|
---|
412 |
|
---|
413 | <xsl:variable name="wraptype">
|
---|
414 | <xsl:call-template name="translatewrappedtype">
|
---|
415 | <xsl:with-param name="type" select="."/>
|
---|
416 | <xsl:with-param name="dir" select="$dir"/>
|
---|
417 | <xsl:with-param name="mod" select="../@mod"/>
|
---|
418 | <xsl:with-param name="safearray" select="../@safearray"/>
|
---|
419 | </xsl:call-template>
|
---|
420 | </xsl:variable>
|
---|
421 |
|
---|
422 | <xsl:choose>
|
---|
423 | <xsl:when test="../@safearray='yes'">
|
---|
424 | <xsl:if test="$dir='in'">
|
---|
425 | <xsl:text>const </xsl:text>
|
---|
426 | </xsl:if>
|
---|
427 | <xsl:text>std::vector<</xsl:text>
|
---|
428 | <xsl:choose>
|
---|
429 | <xsl:when test="substring($wraptype,string-length($wraptype))='&'">
|
---|
430 | <xsl:variable name="wraptype2">
|
---|
431 | <xsl:value-of select="substring($wraptype,1,string-length($wraptype)-2)"/>
|
---|
432 | </xsl:variable>
|
---|
433 |
|
---|
434 | <xsl:choose>
|
---|
435 | <xsl:when test="substring($wraptype2,string-length($wraptype2))='>'">
|
---|
436 | <xsl:value-of select="concat($wraptype2, ' ')"/>
|
---|
437 | </xsl:when>
|
---|
438 | <xsl:otherwise>
|
---|
439 | <xsl:value-of select="$wraptype2"/>
|
---|
440 | </xsl:otherwise>
|
---|
441 | </xsl:choose>
|
---|
442 | </xsl:when>
|
---|
443 | <xsl:when test="substring($wraptype,string-length($wraptype))='>'">
|
---|
444 | <xsl:value-of select="concat($wraptype, ' ')"/>
|
---|
445 | </xsl:when>
|
---|
446 | <xsl:otherwise>
|
---|
447 | <xsl:value-of select="$wraptype"/>
|
---|
448 | </xsl:otherwise>
|
---|
449 | </xsl:choose>
|
---|
450 | <xsl:text>> &</xsl:text>
|
---|
451 | </xsl:when>
|
---|
452 | <xsl:otherwise>
|
---|
453 | <xsl:value-of select="$wraptype"/>
|
---|
454 | <xsl:if test="substring($wraptype,string-length($wraptype))!='&'">
|
---|
455 | <xsl:if test="substring($wraptype,string-length($wraptype))!='*'">
|
---|
456 | <xsl:text> </xsl:text>
|
---|
457 | </xsl:if>
|
---|
458 | <xsl:choose>
|
---|
459 | <xsl:when test="$dir='in'">
|
---|
460 | </xsl:when>
|
---|
461 | <xsl:otherwise>
|
---|
462 | <xsl:value-of select="'*'"/>
|
---|
463 | </xsl:otherwise>
|
---|
464 | </xsl:choose>
|
---|
465 | </xsl:if>
|
---|
466 | </xsl:otherwise>
|
---|
467 | </xsl:choose>
|
---|
468 | <xsl:text>a</xsl:text>
|
---|
469 | <xsl:call-template name="capitalize">
|
---|
470 | <xsl:with-param name="str" select="../@name"/>
|
---|
471 | </xsl:call-template>
|
---|
472 | </xsl:template>
|
---|
473 |
|
---|
474 | <xsl:template match="attribute/@type | param/@type" mode="logparamtext">
|
---|
475 | <xsl:param name="dir"/>
|
---|
476 | <xsl:param name="isref"/>
|
---|
477 |
|
---|
478 | <xsl:if test="$isref!='yes' and ($dir='out' or $dir='ret')">
|
---|
479 | <xsl:text>*</xsl:text>
|
---|
480 | </xsl:if>
|
---|
481 | <xsl:text>a</xsl:text>
|
---|
482 | <xsl:call-template name="capitalize">
|
---|
483 | <xsl:with-param name="str" select="../@name"/>
|
---|
484 | </xsl:call-template>
|
---|
485 | <xsl:text>=</xsl:text>
|
---|
486 | <xsl:call-template name="translatefmtspectype">
|
---|
487 | <xsl:with-param name="type" select="."/>
|
---|
488 | <xsl:with-param name="dir" select="$dir"/>
|
---|
489 | <xsl:with-param name="mod" select="../@mod"/>
|
---|
490 | <xsl:with-param name="safearray" select="../@safearray"/>
|
---|
491 | <xsl:with-param name="isref" select="$isref"/>
|
---|
492 | </xsl:call-template>
|
---|
493 | </xsl:template>
|
---|
494 |
|
---|
495 | <xsl:template match="attribute/@type | param/@type" mode="logparamval">
|
---|
496 | <xsl:param name="dir"/>
|
---|
497 | <xsl:param name="isref"/>
|
---|
498 |
|
---|
499 | <xsl:choose>
|
---|
500 | <xsl:when test="../@safearray='yes' and $isref!='yes'">
|
---|
501 | <xsl:text>ComSafeArraySize(</xsl:text>
|
---|
502 | <xsl:if test="$isref!='yes' and $dir!='in'">
|
---|
503 | <xsl:text>*</xsl:text>
|
---|
504 | </xsl:if>
|
---|
505 | </xsl:when>
|
---|
506 | <xsl:when test="$isref!='yes' and $dir!='in'">
|
---|
507 | <xsl:text>*</xsl:text>
|
---|
508 | </xsl:when>
|
---|
509 | </xsl:choose>
|
---|
510 | <xsl:text>a</xsl:text>
|
---|
511 | <xsl:call-template name="capitalize">
|
---|
512 | <xsl:with-param name="str" select="../@name"/>
|
---|
513 | </xsl:call-template>
|
---|
514 | <xsl:choose>
|
---|
515 | <xsl:when test="../@safearray='yes' and $isref!='yes'">
|
---|
516 | <xsl:text>)</xsl:text>
|
---|
517 | </xsl:when>
|
---|
518 | </xsl:choose>
|
---|
519 | </xsl:template>
|
---|
520 |
|
---|
521 | <xsl:template match="attribute/@type | param/@type" mode="paramvalconversion">
|
---|
522 | <xsl:param name="dir"/>
|
---|
523 |
|
---|
524 | <xsl:variable name="gluetype">
|
---|
525 | <xsl:call-template name="translatepublictype">
|
---|
526 | <xsl:with-param name="type" select="."/>
|
---|
527 | <xsl:with-param name="dir" select="$dir"/>
|
---|
528 | <xsl:with-param name="mod" select="../@mod"/>
|
---|
529 | </xsl:call-template>
|
---|
530 | </xsl:variable>
|
---|
531 | <xsl:variable name="type" select="."/>
|
---|
532 | <xsl:variable name="thatif" select="../../../..//interface[@name=$type]"/>
|
---|
533 | <xsl:choose>
|
---|
534 | <xsl:when test="$type='$unknown'">
|
---|
535 | <xsl:if test="../@safearray='yes'">
|
---|
536 | <xsl:text>Array</xsl:text>
|
---|
537 | </xsl:if>
|
---|
538 | <xsl:choose>
|
---|
539 | <xsl:when test="$dir='in'">
|
---|
540 | <xsl:text>ComTypeInConverter<IUnknown>(</xsl:text>
|
---|
541 | </xsl:when>
|
---|
542 | <xsl:otherwise>
|
---|
543 | <xsl:text>ComTypeOutConverter<IUnknown>(</xsl:text>
|
---|
544 | </xsl:otherwise>
|
---|
545 | </xsl:choose>
|
---|
546 | <xsl:if test="../@safearray='yes'">
|
---|
547 | <xsl:choose>
|
---|
548 | <xsl:when test="$dir='in'">
|
---|
549 | <xsl:text>ComSafeArrayInArg(</xsl:text>
|
---|
550 | </xsl:when>
|
---|
551 | <xsl:otherwise>
|
---|
552 | <xsl:text>ComSafeArrayOutArg(</xsl:text>
|
---|
553 | </xsl:otherwise>
|
---|
554 | </xsl:choose>
|
---|
555 | </xsl:if>
|
---|
556 | </xsl:when>
|
---|
557 | <xsl:when test="$thatif">
|
---|
558 | <xsl:if test="../@safearray='yes'">
|
---|
559 | <xsl:text>Array</xsl:text>
|
---|
560 | </xsl:if>
|
---|
561 | <xsl:variable name="thatifname" select="$thatif/@name"/>
|
---|
562 | <xsl:choose>
|
---|
563 | <xsl:when test="$dir='in'">
|
---|
564 | <xsl:text>ComTypeInConverter</xsl:text>
|
---|
565 | </xsl:when>
|
---|
566 | <xsl:otherwise>
|
---|
567 | <xsl:text>ComTypeOutConverter</xsl:text>
|
---|
568 | </xsl:otherwise>
|
---|
569 | </xsl:choose>
|
---|
570 | <xsl:value-of select="concat('<', $thatifname, '>(')"/>
|
---|
571 | <xsl:if test="../@safearray='yes'">
|
---|
572 | <xsl:choose>
|
---|
573 | <xsl:when test="$dir='in'">
|
---|
574 | <xsl:text>ComSafeArrayInArg(</xsl:text>
|
---|
575 | </xsl:when>
|
---|
576 | <xsl:otherwise>
|
---|
577 | <xsl:text>ComSafeArrayOutArg(</xsl:text>
|
---|
578 | </xsl:otherwise>
|
---|
579 | </xsl:choose>
|
---|
580 | </xsl:if>
|
---|
581 | </xsl:when>
|
---|
582 | <xsl:when test="$type='wstring'">
|
---|
583 | <xsl:if test="../@safearray='yes'">
|
---|
584 | <xsl:text>Array</xsl:text>
|
---|
585 | </xsl:if>
|
---|
586 | <xsl:choose>
|
---|
587 | <xsl:when test="$dir='in'">
|
---|
588 | <xsl:text>BSTRInConverter(</xsl:text>
|
---|
589 | </xsl:when>
|
---|
590 | <xsl:otherwise>
|
---|
591 | <xsl:text>BSTROutConverter(</xsl:text>
|
---|
592 | </xsl:otherwise>
|
---|
593 | </xsl:choose>
|
---|
594 | <xsl:if test="../@safearray='yes'">
|
---|
595 | <xsl:choose>
|
---|
596 | <xsl:when test="$dir='in'">
|
---|
597 | <xsl:text>ComSafeArrayInArg(</xsl:text>
|
---|
598 | </xsl:when>
|
---|
599 | <xsl:otherwise>
|
---|
600 | <xsl:text>ComSafeArrayOutArg(</xsl:text>
|
---|
601 | </xsl:otherwise>
|
---|
602 | </xsl:choose>
|
---|
603 | </xsl:if>
|
---|
604 | </xsl:when>
|
---|
605 | <xsl:when test="$type='uuid'">
|
---|
606 | <xsl:if test="../@safearray='yes'">
|
---|
607 | <xsl:text>Array</xsl:text>
|
---|
608 | </xsl:if>
|
---|
609 | <xsl:choose>
|
---|
610 | <xsl:when test="$dir='in'">
|
---|
611 | <xsl:text>UuidInConverter(</xsl:text>
|
---|
612 | </xsl:when>
|
---|
613 | <xsl:otherwise>
|
---|
614 | <xsl:text>UuidOutConverter(</xsl:text>
|
---|
615 | </xsl:otherwise>
|
---|
616 | </xsl:choose>
|
---|
617 | <xsl:if test="../@safearray='yes'">
|
---|
618 | <xsl:choose>
|
---|
619 | <xsl:when test="$dir='in'">
|
---|
620 | <xsl:text>ComSafeArrayInArg(</xsl:text>
|
---|
621 | </xsl:when>
|
---|
622 | <xsl:otherwise>
|
---|
623 | <xsl:text>ComSafeArrayOutArg(</xsl:text>
|
---|
624 | </xsl:otherwise>
|
---|
625 | </xsl:choose>
|
---|
626 | </xsl:if>
|
---|
627 | </xsl:when>
|
---|
628 | <xsl:otherwise>
|
---|
629 | <xsl:if test="../@safearray='yes'">
|
---|
630 | <xsl:text>Array</xsl:text>
|
---|
631 | <xsl:choose>
|
---|
632 | <xsl:when test="$dir='in'">
|
---|
633 | <xsl:text>InConverter</xsl:text>
|
---|
634 | </xsl:when>
|
---|
635 | <xsl:otherwise>
|
---|
636 | <xsl:text>OutConverter</xsl:text>
|
---|
637 | </xsl:otherwise>
|
---|
638 | </xsl:choose>
|
---|
639 | <xsl:value-of select="concat('<', $gluetype, '>(')"/>
|
---|
640 | <xsl:choose>
|
---|
641 | <xsl:when test="$dir='in'">
|
---|
642 | <xsl:text>ComSafeArrayInArg(</xsl:text>
|
---|
643 | </xsl:when>
|
---|
644 | <xsl:otherwise>
|
---|
645 | <xsl:text>ComSafeArrayOutArg(</xsl:text>
|
---|
646 | </xsl:otherwise>
|
---|
647 | </xsl:choose>
|
---|
648 | </xsl:if>
|
---|
649 | </xsl:otherwise>
|
---|
650 | </xsl:choose>
|
---|
651 | <xsl:text>a</xsl:text>
|
---|
652 | <xsl:call-template name="capitalize">
|
---|
653 | <xsl:with-param name="str" select="../@name"/>
|
---|
654 | </xsl:call-template>
|
---|
655 | <xsl:choose>
|
---|
656 | <xsl:when test="$type='$unknown' or $thatif">
|
---|
657 | <xsl:choose>
|
---|
658 | <xsl:when test="../@safearray='yes'">
|
---|
659 | <xsl:text>)).array()</xsl:text>
|
---|
660 | </xsl:when>
|
---|
661 | <xsl:otherwise>
|
---|
662 | <xsl:text>).ptr()</xsl:text>
|
---|
663 | </xsl:otherwise>
|
---|
664 | </xsl:choose>
|
---|
665 | </xsl:when>
|
---|
666 | <xsl:when test="$type='wstring'">
|
---|
667 | <xsl:choose>
|
---|
668 | <xsl:when test="../@safearray='yes'">
|
---|
669 | <xsl:text>)).array()</xsl:text>
|
---|
670 | </xsl:when>
|
---|
671 | <xsl:otherwise>
|
---|
672 | <xsl:text>).str()</xsl:text>
|
---|
673 | </xsl:otherwise>
|
---|
674 | </xsl:choose>
|
---|
675 | </xsl:when>
|
---|
676 | <xsl:when test="$type='uuid'">
|
---|
677 | <xsl:choose>
|
---|
678 | <xsl:when test="../@safearray='yes'">
|
---|
679 | <xsl:text>)).array()</xsl:text>
|
---|
680 | </xsl:when>
|
---|
681 | <xsl:otherwise>
|
---|
682 | <xsl:text>).uuid()</xsl:text>
|
---|
683 | </xsl:otherwise>
|
---|
684 | </xsl:choose>
|
---|
685 | </xsl:when>
|
---|
686 | <xsl:otherwise>
|
---|
687 | <xsl:if test="../@safearray='yes'">
|
---|
688 | <xsl:text>)).array()</xsl:text>
|
---|
689 | </xsl:if>
|
---|
690 | </xsl:otherwise>
|
---|
691 | </xsl:choose>
|
---|
692 | </xsl:template>
|
---|
693 |
|
---|
694 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
695 | emit attribute
|
---|
696 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
697 |
|
---|
698 | <xsl:template match="attribute" mode="public">
|
---|
699 | <xsl:variable name="attrbasename">
|
---|
700 | <xsl:call-template name="capitalize">
|
---|
701 | <xsl:with-param name="str" select="@name"/>
|
---|
702 | </xsl:call-template>
|
---|
703 | </xsl:variable>
|
---|
704 |
|
---|
705 | <xsl:value-of select="concat(' STDMETHOD(COMGETTER(', $attrbasename, '))(')"/>
|
---|
706 | <xsl:apply-templates select="@type" mode="public">
|
---|
707 | <xsl:with-param name="dir" select="'out'"/>
|
---|
708 | </xsl:apply-templates>
|
---|
709 | <xsl:text>);
|
---|
710 | </xsl:text>
|
---|
711 |
|
---|
712 | <xsl:if test="not(@readonly) or @readonly!='yes'">
|
---|
713 | <xsl:value-of select="concat(' STDMETHOD(COMSETTER(', $attrbasename, '))(')"/>
|
---|
714 | <xsl:apply-templates select="@type" mode="public">
|
---|
715 | <xsl:with-param name="dir" select="'in'"/>
|
---|
716 | </xsl:apply-templates>
|
---|
717 | <xsl:text>);
|
---|
718 | </xsl:text>
|
---|
719 | </xsl:if>
|
---|
720 | </xsl:template>
|
---|
721 |
|
---|
722 | <xsl:template match="attribute" mode="wrapped">
|
---|
723 | <xsl:variable name="attrbasename">
|
---|
724 | <xsl:call-template name="capitalize">
|
---|
725 | <xsl:with-param name="str" select="@name"/>
|
---|
726 | </xsl:call-template>
|
---|
727 | </xsl:variable>
|
---|
728 |
|
---|
729 | <xsl:value-of select="concat(' virtual HRESULT get', $attrbasename, '(')"/>
|
---|
730 | <xsl:variable name="passAutoCaller">
|
---|
731 | <xsl:call-template name="checkoption">
|
---|
732 | <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
|
---|
733 | <xsl:with-param name="option" select="'passcaller'"/>
|
---|
734 | </xsl:call-template>
|
---|
735 | </xsl:variable>
|
---|
736 | <xsl:if test="$passAutoCaller = 'true'">
|
---|
737 | <xsl:text>AutoCaller &aAutoCaller, </xsl:text>
|
---|
738 | </xsl:if>
|
---|
739 | <xsl:apply-templates select="@type" mode="wrapped">
|
---|
740 | <xsl:with-param name="dir" select="'out'"/>
|
---|
741 | </xsl:apply-templates>
|
---|
742 | <xsl:text>) = 0;
|
---|
743 | </xsl:text>
|
---|
744 |
|
---|
745 | <xsl:if test="not(@readonly) or @readonly!='yes'">
|
---|
746 | <xsl:value-of select="concat(' virtual HRESULT set', $attrbasename, '(')"/>
|
---|
747 | <xsl:if test="$passAutoCaller = 'true'">
|
---|
748 | <xsl:text>AutoCaller &aAutoCaller, </xsl:text>
|
---|
749 | </xsl:if>
|
---|
750 | <xsl:apply-templates select="@type" mode="wrapped">
|
---|
751 | <xsl:with-param name="dir" select="'in'"/>
|
---|
752 | </xsl:apply-templates>
|
---|
753 | <xsl:text>) = 0;
|
---|
754 | </xsl:text>
|
---|
755 | </xsl:if>
|
---|
756 | </xsl:template>
|
---|
757 |
|
---|
758 | <xsl:template match="attribute" mode="code">
|
---|
759 | <xsl:param name="topclass"/>
|
---|
760 |
|
---|
761 | <xsl:variable name="attrbasename">
|
---|
762 | <xsl:call-template name="capitalize">
|
---|
763 | <xsl:with-param name="str" select="@name"/>
|
---|
764 | </xsl:call-template>
|
---|
765 | </xsl:variable>
|
---|
766 |
|
---|
767 | <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::COMGETTER(', $attrbasename, ')(')"/>
|
---|
768 | <xsl:apply-templates select="@type" mode="public">
|
---|
769 | <xsl:with-param name="dir" select="'out'"/>
|
---|
770 | </xsl:apply-templates>
|
---|
771 | <xsl:text>)
|
---|
772 | {
|
---|
773 | LogRelFlow(("{%p} %s: enter </xsl:text>
|
---|
774 | <xsl:apply-templates select="@type" mode="logparamtext">
|
---|
775 | <xsl:with-param name="dir" select="'out'"/>
|
---|
776 | <xsl:with-param name="isref" select="'yes'"/>
|
---|
777 | </xsl:apply-templates>
|
---|
778 | <xsl:text>\n", this, </xsl:text>
|
---|
779 | <xsl:value-of select="concat('"', $topclass, '::get', $attrbasename, '", ')"/>
|
---|
780 | <xsl:apply-templates select="@type" mode="logparamval">
|
---|
781 | <xsl:with-param name="dir" select="'out'"/>
|
---|
782 | <xsl:with-param name="isref" select="'yes'"/>
|
---|
783 | </xsl:apply-templates>
|
---|
784 | <xsl:text>));
|
---|
785 |
|
---|
786 | VirtualBoxBase::clearError();
|
---|
787 |
|
---|
788 | HRESULT hrc;
|
---|
789 |
|
---|
790 | try
|
---|
791 | {
|
---|
792 | CheckComArgOutPointerValidThrow(a</xsl:text>
|
---|
793 | <xsl:value-of select="$attrbasename"/>
|
---|
794 | <xsl:text>);
|
---|
795 |
|
---|
796 | AutoCaller autoCaller(this);
|
---|
797 | if (FAILED(autoCaller.rc()))
|
---|
798 | throw autoCaller.rc();
|
---|
799 |
|
---|
800 | </xsl:text>
|
---|
801 | <xsl:value-of select="concat(' hrc = get', $attrbasename, '(')"/>
|
---|
802 | <xsl:variable name="passAutoCaller">
|
---|
803 | <xsl:call-template name="checkoption">
|
---|
804 | <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
|
---|
805 | <xsl:with-param name="option" select="'passcaller'"/>
|
---|
806 | </xsl:call-template>
|
---|
807 | </xsl:variable>
|
---|
808 | <xsl:if test="$passAutoCaller = 'true'">
|
---|
809 | <xsl:text>autoCaller, </xsl:text>
|
---|
810 | </xsl:if>
|
---|
811 | <xsl:apply-templates select="@type" mode="paramvalconversion">
|
---|
812 | <xsl:with-param name="dir" select="'out'"/>
|
---|
813 | </xsl:apply-templates>
|
---|
814 | <xsl:text>);
|
---|
815 | }
|
---|
816 | catch (HRESULT hrc2)
|
---|
817 | {
|
---|
818 | hrc = hrc2;
|
---|
819 | }
|
---|
820 | catch (...)
|
---|
821 | {
|
---|
822 | hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
|
---|
823 | }
|
---|
824 |
|
---|
825 | LogRelFlow(("{%p} %s: leave </xsl:text>
|
---|
826 | <xsl:apply-templates select="@type" mode="logparamtext">
|
---|
827 | <xsl:with-param name="dir" select="'out'"/>
|
---|
828 | <xsl:with-param name="isref" select="''"/>
|
---|
829 | </xsl:apply-templates>
|
---|
830 | <xsl:text> hrc=%Rhrc\n", this, </xsl:text>
|
---|
831 | <xsl:value-of select="concat('"', $topclass, '::get', $attrbasename, '", ')"/>
|
---|
832 | <xsl:apply-templates select="@type" mode="logparamval">
|
---|
833 | <xsl:with-param name="dir" select="'out'"/>
|
---|
834 | <xsl:with-param name="isref" select="''"/>
|
---|
835 | </xsl:apply-templates>
|
---|
836 | <xsl:text>, hrc));
|
---|
837 | return hrc;
|
---|
838 | }
|
---|
839 |
|
---|
840 | </xsl:text>
|
---|
841 | <xsl:if test="not(@readonly) or @readonly!='yes'">
|
---|
842 | <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::COMSETTER(', $attrbasename, ')(')"/>
|
---|
843 | <xsl:apply-templates select="@type" mode="public">
|
---|
844 | <xsl:with-param name="dir" select="'in'"/>
|
---|
845 | </xsl:apply-templates>
|
---|
846 | <!-- @todo check in parameters if possible -->
|
---|
847 | <xsl:text>)
|
---|
848 | {
|
---|
849 | LogRelFlow(("{%p} %s: enter </xsl:text>
|
---|
850 | <xsl:apply-templates select="@type" mode="logparamtext">
|
---|
851 | <xsl:with-param name="dir" select="'in'"/>
|
---|
852 | <xsl:with-param name="isref" select="''"/>
|
---|
853 | </xsl:apply-templates>
|
---|
854 | <xsl:text>\n", this, </xsl:text>
|
---|
855 | <xsl:value-of select="concat('"', $topclass, '::set', $attrbasename, '", ')"/>
|
---|
856 | <xsl:apply-templates select="@type" mode="logparamval">
|
---|
857 | <xsl:with-param name="dir" select="'in'"/>
|
---|
858 | <xsl:with-param name="isref" select="''"/>
|
---|
859 | </xsl:apply-templates>
|
---|
860 | <xsl:text>));
|
---|
861 |
|
---|
862 | VirtualBoxBase::clearError();
|
---|
863 |
|
---|
864 | HRESULT hrc;
|
---|
865 |
|
---|
866 | try
|
---|
867 | {
|
---|
868 | AutoCaller autoCaller(this);
|
---|
869 | if (FAILED(autoCaller.rc()))
|
---|
870 | throw autoCaller.rc();
|
---|
871 |
|
---|
872 | </xsl:text>
|
---|
873 | <xsl:value-of select="concat(' hrc = set', $attrbasename, '(')"/>
|
---|
874 | <xsl:if test="$passAutoCaller = 'true'">
|
---|
875 | <xsl:text>autoCaller, </xsl:text>
|
---|
876 | </xsl:if>
|
---|
877 | <xsl:apply-templates select="@type" mode="paramvalconversion">
|
---|
878 | <xsl:with-param name="dir" select="'in'"/>
|
---|
879 | </xsl:apply-templates>
|
---|
880 | <xsl:text>);
|
---|
881 | }
|
---|
882 | catch (HRESULT hrc2)
|
---|
883 | {
|
---|
884 | hrc = hrc2;
|
---|
885 | }
|
---|
886 | catch (...)
|
---|
887 | {
|
---|
888 | hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
|
---|
889 | }
|
---|
890 |
|
---|
891 | LogRelFlow(("{%p} %s: leave hrc=%Rhrc\n", this, </xsl:text>
|
---|
892 | <xsl:value-of select="concat('"', $topclass, '::set', $attrbasename, '", ')"/>
|
---|
893 | <xsl:text>hrc));
|
---|
894 | return hrc;
|
---|
895 | }
|
---|
896 |
|
---|
897 | </xsl:text>
|
---|
898 | </xsl:if>
|
---|
899 | </xsl:template>
|
---|
900 |
|
---|
901 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
902 | emit all attributes of an interface
|
---|
903 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
904 | <xsl:template name="emitAttributes">
|
---|
905 | <xsl:param name="iface"/>
|
---|
906 | <xsl:param name="topclass"/>
|
---|
907 | <xsl:param name="pmode"/>
|
---|
908 |
|
---|
909 | <!-- first recurse to emit all base interfaces -->
|
---|
910 | <xsl:variable name="extends" select="$iface/@extends"/>
|
---|
911 | <xsl:if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
|
---|
912 | <xsl:call-template name="emitAttributes">
|
---|
913 | <xsl:with-param name="iface" select="//interface[@name=$extends]"/>
|
---|
914 | <xsl:with-param name="topclass" select="$topclass"/>
|
---|
915 | <xsl:with-param name="pmode" select="$pmode"/>
|
---|
916 | </xsl:call-template>
|
---|
917 | </xsl:if>
|
---|
918 |
|
---|
919 | <xsl:choose>
|
---|
920 | <xsl:when test="$pmode='code'">
|
---|
921 | <xsl:text>//
|
---|
922 | </xsl:text>
|
---|
923 | <xsl:value-of select="concat('// ', $iface/@name, ' properties')"/>
|
---|
924 | <xsl:text>
|
---|
925 | //
|
---|
926 |
|
---|
927 | </xsl:text>
|
---|
928 | </xsl:when>
|
---|
929 | <xsl:otherwise>
|
---|
930 | <xsl:value-of select="concat(' // ', $pmode, ' ', $iface/@name, ' properties ')"/>
|
---|
931 | </xsl:otherwise>
|
---|
932 | </xsl:choose>
|
---|
933 | <xsl:choose>
|
---|
934 | <xsl:when test="$pmode='public'">
|
---|
935 | <xsl:apply-templates select="$iface/attribute" mode="public"/>
|
---|
936 | </xsl:when>
|
---|
937 | <xsl:when test="$pmode='wrapped'">
|
---|
938 | <xsl:apply-templates select="$iface/attribute" mode="wrapped"/>
|
---|
939 | </xsl:when>
|
---|
940 | <xsl:when test="$pmode='code'">
|
---|
941 | <xsl:apply-templates select="$iface/attribute" mode="code">
|
---|
942 | <xsl:with-param name="topclass" select="$topclass"/>
|
---|
943 | </xsl:apply-templates>
|
---|
944 | </xsl:when>
|
---|
945 | <xsl:otherwise/>
|
---|
946 | </xsl:choose>
|
---|
947 | </xsl:template>
|
---|
948 |
|
---|
949 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
950 | emit method
|
---|
951 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
952 |
|
---|
953 | <xsl:template match="method" mode="public">
|
---|
954 | <xsl:variable name="methodindent">
|
---|
955 | <xsl:call-template name="tospace">
|
---|
956 | <xsl:with-param name="str" select="@name"/>
|
---|
957 | </xsl:call-template>
|
---|
958 | </xsl:variable>
|
---|
959 |
|
---|
960 | <xsl:text> STDMETHOD(</xsl:text>
|
---|
961 | <xsl:call-template name="capitalize">
|
---|
962 | <xsl:with-param name="str" select="@name"/>
|
---|
963 | </xsl:call-template>
|
---|
964 | <xsl:text>)(</xsl:text>
|
---|
965 | <xsl:for-each select="param">
|
---|
966 | <xsl:apply-templates select="@type" mode="public">
|
---|
967 | <xsl:with-param name="dir" select="@dir"/>
|
---|
968 | </xsl:apply-templates>
|
---|
969 | <xsl:if test="not(position()=last())">
|
---|
970 | <xsl:text>,
|
---|
971 | </xsl:text>
|
---|
972 | <xsl:value-of select="$methodindent"/>
|
---|
973 | </xsl:if>
|
---|
974 | </xsl:for-each>
|
---|
975 | <xsl:text>);
|
---|
976 | </xsl:text>
|
---|
977 | </xsl:template>
|
---|
978 |
|
---|
979 | <xsl:template match="method" mode="wrapped">
|
---|
980 | <xsl:variable name="methodindent">
|
---|
981 | <xsl:call-template name="tospace">
|
---|
982 | <xsl:with-param name="str" select="@name"/>
|
---|
983 | </xsl:call-template>
|
---|
984 | </xsl:variable>
|
---|
985 |
|
---|
986 | <xsl:text> virtual HRESULT </xsl:text>
|
---|
987 | <xsl:call-template name="uncapitalize">
|
---|
988 | <xsl:with-param name="str" select="@name"/>
|
---|
989 | </xsl:call-template>
|
---|
990 | <xsl:text>(</xsl:text>
|
---|
991 | <xsl:variable name="passAutoCaller">
|
---|
992 | <xsl:call-template name="checkoption">
|
---|
993 | <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
|
---|
994 | <xsl:with-param name="option" select="'passcaller'"/>
|
---|
995 | </xsl:call-template>
|
---|
996 | </xsl:variable>
|
---|
997 | <xsl:if test="$passAutoCaller = 'true'">
|
---|
998 | <xsl:text>AutoCaller &aAutoCaller</xsl:text>
|
---|
999 | <xsl:if test="count(param) > 0">
|
---|
1000 | <xsl:text>,
|
---|
1001 | </xsl:text>
|
---|
1002 | <xsl:value-of select="$methodindent"/>
|
---|
1003 | </xsl:if>
|
---|
1004 | </xsl:if>
|
---|
1005 | <xsl:for-each select="param">
|
---|
1006 | <xsl:apply-templates select="@type" mode="wrapped">
|
---|
1007 | <xsl:with-param name="dir" select="@dir"/>
|
---|
1008 | </xsl:apply-templates>
|
---|
1009 | <xsl:if test="not(position()=last())">
|
---|
1010 | <xsl:text>,
|
---|
1011 | </xsl:text>
|
---|
1012 | <xsl:value-of select="$methodindent"/>
|
---|
1013 | </xsl:if>
|
---|
1014 | </xsl:for-each>
|
---|
1015 | <xsl:text>) = 0;
|
---|
1016 | </xsl:text>
|
---|
1017 | </xsl:template>
|
---|
1018 |
|
---|
1019 | <xsl:template match="method" mode="code">
|
---|
1020 | <xsl:param name="topclass"/>
|
---|
1021 |
|
---|
1022 | <xsl:variable name="methodindent">
|
---|
1023 | <xsl:call-template name="tospace">
|
---|
1024 | <xsl:with-param name="str" select="@name"/>
|
---|
1025 | </xsl:call-template>
|
---|
1026 | </xsl:variable>
|
---|
1027 | <xsl:variable name="methodclassindent">
|
---|
1028 | <xsl:call-template name="tospace">
|
---|
1029 | <xsl:with-param name="str" select="concat($topclass, @name)"/>
|
---|
1030 | </xsl:call-template>
|
---|
1031 | </xsl:variable>
|
---|
1032 | <xsl:variable name="methodbasename">
|
---|
1033 | <xsl:call-template name="capitalize">
|
---|
1034 | <xsl:with-param name="str" select="@name"/>
|
---|
1035 | </xsl:call-template>
|
---|
1036 | </xsl:variable>
|
---|
1037 |
|
---|
1038 | <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::', $methodbasename, '(')"/>
|
---|
1039 | <xsl:for-each select="param">
|
---|
1040 | <xsl:apply-templates select="@type" mode="public">
|
---|
1041 | <xsl:with-param name="dir" select="@dir"/>
|
---|
1042 | </xsl:apply-templates>
|
---|
1043 | <xsl:if test="not(position()=last())">
|
---|
1044 | <xsl:text>,
|
---|
1045 | </xsl:text>
|
---|
1046 | <xsl:value-of select="$methodclassindent"/>
|
---|
1047 | </xsl:if>
|
---|
1048 | </xsl:for-each>
|
---|
1049 | <xsl:text>)
|
---|
1050 | {
|
---|
1051 | LogRelFlow(("{%p} %s:enter</xsl:text>
|
---|
1052 | <xsl:for-each select="param">
|
---|
1053 | <xsl:text> </xsl:text>
|
---|
1054 | <xsl:apply-templates select="@type" mode="logparamtext">
|
---|
1055 | <xsl:with-param name="dir" select="@dir"/>
|
---|
1056 | <xsl:with-param name="isref" select="'yes'"/>
|
---|
1057 | </xsl:apply-templates>
|
---|
1058 | </xsl:for-each>
|
---|
1059 | <xsl:text>\n", this</xsl:text>
|
---|
1060 | <xsl:value-of select="concat(', "', $topclass, '::', @name, '"')"/>
|
---|
1061 | <xsl:for-each select="param">
|
---|
1062 | <xsl:text>, </xsl:text>
|
---|
1063 | <xsl:apply-templates select="@type" mode="logparamval">
|
---|
1064 | <xsl:with-param name="dir" select="@dir"/>
|
---|
1065 | <xsl:with-param name="isref" select="'yes'"/>
|
---|
1066 | </xsl:apply-templates>
|
---|
1067 | </xsl:for-each>
|
---|
1068 | <xsl:text>));
|
---|
1069 |
|
---|
1070 | VirtualBoxBase::clearError();
|
---|
1071 |
|
---|
1072 | HRESULT hrc;
|
---|
1073 |
|
---|
1074 | try
|
---|
1075 | {
|
---|
1076 | </xsl:text>
|
---|
1077 | <!-- @todo check in parameters if possible -->
|
---|
1078 | <xsl:for-each select="param">
|
---|
1079 | <xsl:if test="@dir!='in'">
|
---|
1080 | <xsl:text> CheckComArgOutPointerValidThrow(a</xsl:text>
|
---|
1081 | <xsl:call-template name="capitalize">
|
---|
1082 | <xsl:with-param name="str" select="@name"/>
|
---|
1083 | </xsl:call-template>
|
---|
1084 | <xsl:text>);
|
---|
1085 | </xsl:text>
|
---|
1086 | </xsl:if>
|
---|
1087 | </xsl:for-each>
|
---|
1088 | <xsl:text>
|
---|
1089 | AutoCaller autoCaller(this);
|
---|
1090 | if (FAILED(autoCaller.rc()))
|
---|
1091 | throw autoCaller.rc();
|
---|
1092 |
|
---|
1093 | </xsl:text>
|
---|
1094 | <xsl:value-of select="concat(' hrc = ', @name, '(')"/>
|
---|
1095 | <xsl:variable name="passAutoCaller">
|
---|
1096 | <xsl:call-template name="checkoption">
|
---|
1097 | <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
|
---|
1098 | <xsl:with-param name="option" select="'passcaller'"/>
|
---|
1099 | </xsl:call-template>
|
---|
1100 | </xsl:variable>
|
---|
1101 | <xsl:if test="$passAutoCaller = 'true'">
|
---|
1102 | <xsl:text>autoCaller</xsl:text>
|
---|
1103 | <xsl:if test="count(param) > 0">
|
---|
1104 | <xsl:text>,
|
---|
1105 | </xsl:text>
|
---|
1106 | <xsl:value-of select="$methodindent"/>
|
---|
1107 | </xsl:if>
|
---|
1108 | </xsl:if>
|
---|
1109 | <xsl:for-each select="param">
|
---|
1110 | <xsl:apply-templates select="@type" mode="paramvalconversion">
|
---|
1111 | <xsl:with-param name="dir" select="@dir"/>
|
---|
1112 | </xsl:apply-templates>
|
---|
1113 | <xsl:if test="not(position()=last())">
|
---|
1114 | <xsl:text>,
|
---|
1115 | </xsl:text>
|
---|
1116 | <xsl:value-of select="$methodindent"/>
|
---|
1117 | </xsl:if>
|
---|
1118 | </xsl:for-each>
|
---|
1119 | <xsl:text>);
|
---|
1120 | }
|
---|
1121 | catch (HRESULT hrc2)
|
---|
1122 | {
|
---|
1123 | hrc = hrc2;
|
---|
1124 | }
|
---|
1125 | catch (...)
|
---|
1126 | {
|
---|
1127 | hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
|
---|
1128 | }
|
---|
1129 |
|
---|
1130 | LogRelFlow(("{%p} %s: leave</xsl:text>
|
---|
1131 | <xsl:for-each select="param">
|
---|
1132 | <xsl:if test="@dir!='in'">
|
---|
1133 | <xsl:text> </xsl:text>
|
---|
1134 | <xsl:apply-templates select="@type" mode="logparamtext">
|
---|
1135 | <xsl:with-param name="dir" select="@dir"/>
|
---|
1136 | <xsl:with-param name="isref" select="''"/>
|
---|
1137 | </xsl:apply-templates>
|
---|
1138 | </xsl:if>
|
---|
1139 | </xsl:for-each>
|
---|
1140 | <xsl:text> hrc=%Rhrc\n", this</xsl:text>
|
---|
1141 | <xsl:value-of select="concat(', "', $topclass, '::', @name, '"')"/>
|
---|
1142 | <xsl:for-each select="param">
|
---|
1143 | <xsl:if test="@dir!='in'">
|
---|
1144 | <xsl:text>, </xsl:text>
|
---|
1145 | <xsl:apply-templates select="@type" mode="logparamval">
|
---|
1146 | <xsl:with-param name="dir" select="@dir"/>
|
---|
1147 | <xsl:with-param name="isref" select="''"/>
|
---|
1148 | </xsl:apply-templates>
|
---|
1149 | </xsl:if>
|
---|
1150 | </xsl:for-each>
|
---|
1151 | <xsl:text>, hrc));
|
---|
1152 | return hrc;
|
---|
1153 | }
|
---|
1154 |
|
---|
1155 | </xsl:text>
|
---|
1156 | </xsl:template>
|
---|
1157 |
|
---|
1158 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
1159 | emit all methods of an interface
|
---|
1160 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
1161 | <xsl:template name="emitMethods">
|
---|
1162 | <xsl:param name="iface"/>
|
---|
1163 | <xsl:param name="topclass"/>
|
---|
1164 | <xsl:param name="pmode"/>
|
---|
1165 |
|
---|
1166 | <!-- first recurse to emit all base interfaces -->
|
---|
1167 | <xsl:variable name="extends" select="$iface/@extends"/>
|
---|
1168 | <xsl:if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
|
---|
1169 | <xsl:call-template name="emitMethods">
|
---|
1170 | <xsl:with-param name="iface" select="//interface[@name=$extends]"/>
|
---|
1171 | <xsl:with-param name="topclass" select="$topclass"/>
|
---|
1172 | <xsl:with-param name="pmode" select="$pmode"/>
|
---|
1173 | </xsl:call-template>
|
---|
1174 | </xsl:if>
|
---|
1175 |
|
---|
1176 | <xsl:choose>
|
---|
1177 | <xsl:when test="$pmode='code'">
|
---|
1178 | <xsl:text>//
|
---|
1179 | </xsl:text>
|
---|
1180 | <xsl:value-of select="concat('// ', $iface/@name, ' methods')"/>
|
---|
1181 | <xsl:text>
|
---|
1182 | //
|
---|
1183 |
|
---|
1184 | </xsl:text>
|
---|
1185 | </xsl:when>
|
---|
1186 | <xsl:otherwise>
|
---|
1187 | <xsl:value-of select="concat(' // ', $pmode, ' ', $iface/@name, ' methods ')"/>
|
---|
1188 | </xsl:otherwise>
|
---|
1189 | </xsl:choose>
|
---|
1190 | <xsl:choose>
|
---|
1191 | <xsl:when test="$pmode='public'">
|
---|
1192 | <xsl:apply-templates select="$iface/method" mode="public"/>
|
---|
1193 | </xsl:when>
|
---|
1194 | <xsl:when test="$pmode='wrapped'">
|
---|
1195 | <xsl:apply-templates select="$iface/method" mode="wrapped"/>
|
---|
1196 | </xsl:when>
|
---|
1197 | <xsl:when test="$pmode='code'">
|
---|
1198 | <xsl:apply-templates select="$iface/method" mode="code">
|
---|
1199 | <xsl:with-param name="topclass" select="$topclass"/>
|
---|
1200 | </xsl:apply-templates>
|
---|
1201 | </xsl:when>
|
---|
1202 | <xsl:otherwise/>
|
---|
1203 | </xsl:choose>
|
---|
1204 | </xsl:template>
|
---|
1205 |
|
---|
1206 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
1207 | emit all attributes and methods declarations of an interface
|
---|
1208 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
1209 | <xsl:template name="emitInterfaceDecls">
|
---|
1210 | <xsl:param name="iface"/>
|
---|
1211 | <xsl:param name="pmode"/>
|
---|
1212 |
|
---|
1213 | <!-- attributes -->
|
---|
1214 | <xsl:call-template name="emitAttributes">
|
---|
1215 | <xsl:with-param name="iface" select="$iface"/>
|
---|
1216 | <xsl:with-param name="pmode" select="$pmode"/>
|
---|
1217 | </xsl:call-template>
|
---|
1218 |
|
---|
1219 | <!-- methods -->
|
---|
1220 | <xsl:call-template name="emitMethods">
|
---|
1221 | <xsl:with-param name="iface" select="$iface"/>
|
---|
1222 | <xsl:with-param name="pmode" select="$pmode"/>
|
---|
1223 | </xsl:call-template>
|
---|
1224 | </xsl:template>
|
---|
1225 |
|
---|
1226 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
1227 | emit auxiliary method declarations of an interface
|
---|
1228 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
1229 | <xsl:template name="emitAuxMethodDecls">
|
---|
1230 | <xsl:param name="iface"/>
|
---|
1231 | <!-- currently nothing, maybe later some generic FinalConstruct/... helper declaration for ComObjPtr -->
|
---|
1232 | </xsl:template>
|
---|
1233 |
|
---|
1234 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
1235 | emit the header file of an interface
|
---|
1236 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
1237 | <xsl:template name="emitHeader">
|
---|
1238 | <xsl:param name="iface"/>
|
---|
1239 |
|
---|
1240 | <xsl:variable name="filename" select="concat(substring(@name, 2), 'Wrap.h')"/>
|
---|
1241 |
|
---|
1242 | <xsl:choose>
|
---|
1243 | <xsl:when test="$filelistonly=''">
|
---|
1244 | <xsl:apply-templates select="$iface" mode="startfile">
|
---|
1245 | <xsl:with-param name="file" select="$filename"/>
|
---|
1246 | </xsl:apply-templates>
|
---|
1247 | <xsl:call-template name="fileheader">
|
---|
1248 | <xsl:with-param name="name" select="$filename"/>
|
---|
1249 | <xsl:with-param name="class" select="substring(@name, 2)"/>
|
---|
1250 | <xsl:with-param name="type" select="'header'"/>
|
---|
1251 | </xsl:call-template>
|
---|
1252 | <xsl:apply-templates select="." mode="classheader"/>
|
---|
1253 |
|
---|
1254 | <!-- interface attributes/methods (public) -->
|
---|
1255 | <xsl:call-template name="emitInterfaceDecls">
|
---|
1256 | <xsl:with-param name="iface" select="$iface"/>
|
---|
1257 | <xsl:with-param name="pmode" select="'public'"/>
|
---|
1258 | </xsl:call-template>
|
---|
1259 |
|
---|
1260 | <!-- auxiliary methods (public) -->
|
---|
1261 | <xsl:call-template name="emitAuxMethodDecls">
|
---|
1262 | <xsl:with-param name="iface" select="$iface"/>
|
---|
1263 | </xsl:call-template>
|
---|
1264 |
|
---|
1265 | <!-- switch to private -->
|
---|
1266 | <xsl:text>
|
---|
1267 | private:</xsl:text>
|
---|
1268 |
|
---|
1269 | <!-- wrapped interface attributes/methods (private) -->
|
---|
1270 | <xsl:call-template name="emitInterfaceDecls">
|
---|
1271 | <xsl:with-param name="iface" select="$iface"/>
|
---|
1272 | <xsl:with-param name="pmode" select="'wrapped'"/>
|
---|
1273 | </xsl:call-template>
|
---|
1274 |
|
---|
1275 | <xsl:apply-templates select="." mode="classfooter"/>
|
---|
1276 | <xsl:apply-templates select="$iface" mode="endfile">
|
---|
1277 | <xsl:with-param name="file" select="$filename"/>
|
---|
1278 | </xsl:apply-templates>
|
---|
1279 | </xsl:when>
|
---|
1280 | <xsl:otherwise>
|
---|
1281 | <xsl:apply-templates select="$iface" mode="listfile">
|
---|
1282 | <xsl:with-param name="file" select="$filename"/>
|
---|
1283 | </xsl:apply-templates>
|
---|
1284 | </xsl:otherwise>
|
---|
1285 | </xsl:choose>
|
---|
1286 | </xsl:template>
|
---|
1287 |
|
---|
1288 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
1289 | emit all attributes and methods definitions of an interface
|
---|
1290 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
1291 | <xsl:template name="emitInterfaceDefs">
|
---|
1292 | <xsl:param name="iface"/>
|
---|
1293 |
|
---|
1294 | <xsl:value-of select="concat('DEFINE_EMPTY_CTOR_DTOR(', substring($iface/@name, 2), 'Wrap) ')"/>
|
---|
1295 |
|
---|
1296 | <!-- attributes -->
|
---|
1297 | <xsl:call-template name="emitAttributes">
|
---|
1298 | <xsl:with-param name="iface" select="$iface"/>
|
---|
1299 | <xsl:with-param name="topclass" select="substring($iface/@name, 2)"/>
|
---|
1300 | <xsl:with-param name="pmode" select="'code'"/>
|
---|
1301 | </xsl:call-template>
|
---|
1302 |
|
---|
1303 | <!-- methods -->
|
---|
1304 | <xsl:call-template name="emitMethods">
|
---|
1305 | <xsl:with-param name="iface" select="$iface"/>
|
---|
1306 | <xsl:with-param name="topclass" select="substring($iface/@name, 2)"/>
|
---|
1307 | <xsl:with-param name="pmode" select="'code'"/>
|
---|
1308 | </xsl:call-template>
|
---|
1309 | </xsl:template>
|
---|
1310 |
|
---|
1311 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
1312 | emit auxiliary method declarations of an interface
|
---|
1313 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
1314 | <xsl:template name="emitAuxMethodDefs">
|
---|
1315 | <xsl:param name="iface"/>
|
---|
1316 | <!-- currently nothing, maybe later some generic FinalConstruct/... implementation -->
|
---|
1317 | </xsl:template>
|
---|
1318 |
|
---|
1319 |
|
---|
1320 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
1321 | emit the code file of an interface
|
---|
1322 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
1323 | <xsl:template name="emitCode">
|
---|
1324 | <xsl:param name="iface"/>
|
---|
1325 |
|
---|
1326 | <xsl:variable name="filename" select="concat(substring(@name, 2), 'Wrap.cpp')"/>
|
---|
1327 |
|
---|
1328 | <xsl:choose>
|
---|
1329 | <xsl:when test="$filelistonly=''">
|
---|
1330 | <xsl:apply-templates select="$iface" mode="startfile">
|
---|
1331 | <xsl:with-param name="file" select="$filename"/>
|
---|
1332 | </xsl:apply-templates>
|
---|
1333 | <xsl:call-template name="fileheader">
|
---|
1334 | <xsl:with-param name="name" select="$filename"/>
|
---|
1335 | <xsl:with-param name="class" select="substring(@name, 2)"/>
|
---|
1336 | <xsl:with-param name="type" select="'code'"/>
|
---|
1337 | </xsl:call-template>
|
---|
1338 | <xsl:apply-templates select="." mode="codeheader"/>
|
---|
1339 |
|
---|
1340 | <!-- @todo special thread logging for API methods returning IProgress??? would be very usefulcurrently nothing, maybe later some generic FinalConstruct/... implementation -->
|
---|
1341 |
|
---|
1342 | <!-- interface attributes/methods (public) -->
|
---|
1343 | <xsl:call-template name="emitInterfaceDefs">
|
---|
1344 | <xsl:with-param name="iface" select="$iface"/>
|
---|
1345 | </xsl:call-template>
|
---|
1346 |
|
---|
1347 | <!-- auxiliary methods (public) -->
|
---|
1348 | <xsl:call-template name="emitAuxMethodDefs">
|
---|
1349 | <xsl:with-param name="iface" select="$iface"/>
|
---|
1350 | </xsl:call-template>
|
---|
1351 |
|
---|
1352 | <xsl:apply-templates select="." mode="codefooter"/>
|
---|
1353 | <xsl:apply-templates select="$iface" mode="endfile">
|
---|
1354 | <xsl:with-param name="file" select="$filename"/>
|
---|
1355 | </xsl:apply-templates>
|
---|
1356 | </xsl:when>
|
---|
1357 | <xsl:otherwise>
|
---|
1358 | <xsl:apply-templates select="$iface" mode="listfile">
|
---|
1359 | <xsl:with-param name="file" select="$filename"/>
|
---|
1360 | </xsl:apply-templates>
|
---|
1361 | </xsl:otherwise>
|
---|
1362 | </xsl:choose>
|
---|
1363 | </xsl:template>
|
---|
1364 |
|
---|
1365 |
|
---|
1366 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
1367 | wildcard match, ignore everything which has no explicit match
|
---|
1368 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
1369 |
|
---|
1370 | <xsl:template match="*"/>
|
---|
1371 |
|
---|
1372 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
1373 | ignore all if tags except those for XPIDL or MIDL target
|
---|
1374 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
1375 |
|
---|
1376 | <xsl:template match="if">
|
---|
1377 | <xsl:if test="(@target = 'xpidl') or (@target = 'midl')">
|
---|
1378 | <xsl:apply-templates/>
|
---|
1379 | </xsl:if>
|
---|
1380 | </xsl:template>
|
---|
1381 |
|
---|
1382 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
1383 | interface match
|
---|
1384 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
1385 |
|
---|
1386 | <xsl:template match="interface">
|
---|
1387 | <xsl:if test="not(@internal='yes') and not(@supportsErrorInfo='no')">
|
---|
1388 | <xsl:call-template name="emitInterface">
|
---|
1389 | <xsl:with-param name="iface" select="."/>
|
---|
1390 | </xsl:call-template>
|
---|
1391 | </xsl:if>
|
---|
1392 | </xsl:template>
|
---|
1393 |
|
---|
1394 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
1395 | library match
|
---|
1396 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
1397 |
|
---|
1398 | <xsl:template match="library">
|
---|
1399 | <xsl:apply-templates/>
|
---|
1400 | </xsl:template>
|
---|
1401 |
|
---|
1402 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
1403 | root match
|
---|
1404 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
1405 |
|
---|
1406 | <xsl:template match="/idl">
|
---|
1407 | <xsl:choose>
|
---|
1408 | <xsl:when test="$filelistonly=''">
|
---|
1409 | </xsl:when>
|
---|
1410 | <xsl:otherwise>
|
---|
1411 | <xsl:value-of select="concat($filelistonly, ' := \ ')"/>
|
---|
1412 | </xsl:otherwise>
|
---|
1413 | </xsl:choose>
|
---|
1414 | <xsl:apply-templates/>
|
---|
1415 | <xsl:choose>
|
---|
1416 | <xsl:when test="$filelistonly=''">
|
---|
1417 | </xsl:when>
|
---|
1418 | <xsl:otherwise>
|
---|
1419 | <xsl:text>
|
---|
1420 | </xsl:text>
|
---|
1421 | </xsl:otherwise>
|
---|
1422 | </xsl:choose>
|
---|
1423 | </xsl:template>
|
---|
1424 |
|
---|
1425 | </xsl:stylesheet>
|
---|
1426 | <!-- vi: set tabstop=4 shiftwidth=4 expandtab: -->
|
---|