VirtualBox

source: vbox/trunk/src/VBox/Main/webservice/websrv-python.xsl@ 16560

Last change on this file since 16560 was 16124, checked in by vboxsync, 15 years ago

fixed webservice copyright

  • Property svn:eol-style set to native
File size: 23.3 KB
Line 
1<xsl:stylesheet version = '1.0'
2 xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
3 xmlns:vbox="http://www.virtualbox.org/">
4
5<!--
6
7 websrv-python.xsl:
8 XSLT stylesheet that generates VirtualBox_services.py from
9 VirtualBox.xidl. This Python file represents our
10 web service API. Depends on WSDL file for actual SOAP bindings.
11
12 Copyright (C) 2008 Sun Microsystems, Inc.
13
14 This file is part of VirtualBox Open Source Edition (OSE), as
15 available from http://www.virtualbox.org. This file is free software;
16 you can redistribute it and/or modify it under the terms of the GNU
17 General Public License (GPL) as published by the Free Software
18 Foundation, in version 2 as it comes in the "COPYING" file of the
19 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
20 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
21
22 Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23 Clara, CA 95054 USA or visit http://www.sun.com if you need
24 additional information or have any questions.
25-->
26
27
28<xsl:output
29 method="text"
30 version="1.0"
31 encoding="utf-8"
32 indent="no"/>
33
34<xsl:include href="websrv-shared.inc.xsl" />
35
36<xsl:variable name="G_setSuppressedInterfaces"
37 select="//interface[@wsmap='suppress']" />
38
39<xsl:template name="emitConvertedType">
40 <xsl:param name="ifname" />
41 <xsl:param name="methodname" />
42 <xsl:param name="type" />
43 <xsl:choose>
44 <xsl:when test="$type='wstring'">String</xsl:when>
45 <xsl:when test="$type='boolean'">Boolean</xsl:when>
46 <xsl:when test="$type='unsigned long'">UnsignedInt</xsl:when>
47 <xsl:when test="$type='double'">Double</xsl:when>
48 <xsl:when test="$type='float'">Float</xsl:when>
49 <xsl:when test="$type='long'">Int</xsl:when>
50 <xsl:when test="$type='long long'">Long</xsl:when>
51 <xsl:when test="$type='short'">Short</xsl:when>
52 <xsl:when test="$type='unsigned short'">UnsignedShort</xsl:when>
53 <xsl:when test="$type='unsigned long long'">UnsignedLong</xsl:when>
54 <xsl:when test="$type='result'">UnsignedInt</xsl:when>
55 <xsl:when test="$type='uuid'">UUID</xsl:when>
56 <xsl:when test="$type='$unknown'">IUnknown</xsl:when>
57 <xsl:otherwise><xsl:value-of select="$type" /></xsl:otherwise>
58 </xsl:choose>
59</xsl:template>
60
61<xsl:template name="emitOutParam">
62 <xsl:param name="ifname" />
63 <xsl:param name="methodname" />
64 <xsl:param name="type" />
65 <xsl:param name="value" />
66 <xsl:param name="safearray" />
67
68 <xsl:call-template name="emitConvertedType">
69 <xsl:with-param name="ifname" select="$ifname" />
70 <xsl:with-param name="methodname" select="$methodname" />
71 <xsl:with-param name="type" select="$type" />
72 </xsl:call-template>
73 <xsl:text>(</xsl:text>
74 <xsl:value-of select="$value"/>
75 <xsl:if test="$safearray='yes'">
76 <xsl:value-of select="', True'"/>
77 </xsl:if>
78 <xsl:text>)</xsl:text>
79</xsl:template>
80
81
82<xsl:template name="emitGetAttribute">
83 <xsl:param name="ifname" />
84 <xsl:param name="attrname" />
85 <xsl:param name="attrtype" />
86 <xsl:param name="attrsafearray" />
87 <xsl:variable name="fname"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname"/></xsl:call-template> </xsl:variable>
88 def <xsl:value-of select="$fname"/>(self):
89 req=<xsl:value-of select="$ifname"/>_<xsl:value-of select="$fname"/>RequestMsg()
90 req._this=self.handle
91 val=g_port.<xsl:value-of select="$ifname"/>_<xsl:value-of select="$fname"/>(req)
92 <xsl:text>return </xsl:text>
93 <xsl:call-template name="emitOutParam">
94 <xsl:with-param name="ifname" select="$ifname" />
95 <xsl:with-param name="methodname" select="@name" />
96 <xsl:with-param name="type" select="$attrtype" />
97 <xsl:with-param name="value" select="concat('val.','_returnval')" />
98 <xsl:with-param name="safearray" select="@safearray"/>
99 </xsl:call-template>
100</xsl:template>
101
102<xsl:template name="emitSetAttribute">
103 <xsl:param name="ifname" />
104 <xsl:param name="attrname" />
105 <xsl:param name="attrtype" />
106 <xsl:param name="attrsafearray" />
107 <xsl:variable name="fname"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname"/></xsl:call-template> </xsl:variable>
108 def <xsl:value-of select="$fname"/>(self, value):
109 req=<xsl:value-of select="$ifname"/>_<xsl:value-of select="$fname"/>RequestMsg()
110 req._this=self.handle
111 if type(value) in [int, bool, basestring]:
112 req._<xsl:value-of select="$attrname"/> = value
113 else:
114 req._<xsl:value-of select="$attrname"/> = value.handle
115 g_port.<xsl:value-of select="$ifname"/>_<xsl:value-of select="$fname"/>(req)
116</xsl:template>
117
118<xsl:template name="collection">
119 <xsl:variable name="cname"><xsl:value-of select="@name" /></xsl:variable>
120 <xsl:variable name="ename"><xsl:value-of select="@type" /></xsl:variable>
121class <xsl:value-of select="$cname"/>:
122 def __init__(self, array):
123 self.array = array
124
125 def __next(self):
126 return self.array.__next()
127
128 def __size(self):
129 return self.array._array.__size()
130
131 def __len__(self):
132 return self.array._array.__len__()
133
134 def __getitem__(self, index):
135 return <xsl:value-of select="$ename"/>(self.array._array[index])
136
137</xsl:template>
138
139<xsl:template name="interface">
140 <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
141class <xsl:value-of select="$ifname"/>:
142 def __init__(self, handle = None,isarray = False):
143 self.handle = handle
144 self.isarray = isarray
145<!--
146 This doesn't work now
147 g_manMgr.register(handle)
148
149 def __del__(self):
150 g_manMgr.unregister(self.handle)
151-->
152 def releaseRemote(self):
153 try:
154 req=IManagedObjectRef_releaseRequestMsg()
155 req._this=handle
156 g_port.IManagedObjectRef_release(req)
157 except:
158 pass
159
160 def __next(self):
161 if self.isarray:
162 return self.handle.__next()
163 raise TypeError, "iteration over non-sequence"
164
165 def __size(self):
166 if self.isarray:
167 return self.handle.__size()
168 raise TypeError, "iteration over non-sequence"
169
170 def __len__(self):
171 if self.isarray:
172 return self.handle.__len__()
173 raise TypeError, "iteration over non-sequence"
174
175 def __getitem__(self, index):
176 if self.isarray:
177 return <xsl:value-of select="$ifname" />(self.handle[index])
178 raise TypeError, "iteration over non-sequence"
179
180 def __str__(self):
181 return self.handle
182
183 def isValid(self):
184 return self.handle != None and self.handle != ''
185
186 def __getattr__(self,name):
187 hndl = <xsl:value-of select="$ifname" />._Attrs_.get(name, None)
188 if (hndl != None and hndl[0] != None):
189 return hndl[0](self)
190 else:
191 raise AttributeError
192
193 def __setattr__(self, name, val):
194 hndl = <xsl:value-of select="$ifname" />._Attrs_.get(name, None)
195 if (hndl != None and hndl[1] != None):
196 hndl[1](self,val)
197 else:
198 self.__dict__[name] = val
199
200 <xsl:for-each select="method">
201 <xsl:call-template name="method"/>
202 </xsl:for-each>
203
204 <xsl:for-each select="attribute">
205 <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
206 <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
207 <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
208 <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" -->
209 <xsl:choose>
210 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
211 <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrtype, ' for it is of a suppressed type')" /></xsl:comment>
212 </xsl:when>
213 <xsl:otherwise>
214 <xsl:choose>
215 <xsl:when test="@readonly='yes'">
216 <xsl:comment> readonly attribute <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$attrname" /> </xsl:comment>
217 </xsl:when>
218 <xsl:otherwise>
219 <xsl:comment> read/write attribute <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$attrname" /> </xsl:comment>
220 </xsl:otherwise>
221 </xsl:choose>
222 <!-- aa) get method: emit request and result -->
223 <xsl:call-template name="emitGetAttribute">
224 <xsl:with-param name="ifname" select="$ifname" />
225 <xsl:with-param name="attrname" select="$attrname" />
226 <xsl:with-param name="attrtype" select="$attrtype" />
227 </xsl:call-template>
228 <!-- bb) emit a set method if the attribute is read/write -->
229 <xsl:if test="not($attrreadonly='yes')">
230 <xsl:call-template name="emitSetAttribute">
231 <xsl:with-param name="ifname" select="$ifname" />
232 <xsl:with-param name="attrname" select="$attrname" />
233 <xsl:with-param name="attrtype" select="$attrtype" />
234 </xsl:call-template>
235 </xsl:if>
236 </xsl:otherwise>
237 </xsl:choose>
238 </xsl:for-each>
239
240
241 _Attrs_=<xsl:text>{</xsl:text>
242 <xsl:for-each select="attribute">
243 <xsl:if test="not( @type=($G_setSuppressedInterfaces/@name) )">
244 <xsl:text> </xsl:text>'<xsl:value-of select="@name"/>'<xsl:text>:[</xsl:text>
245 <xsl:call-template name="makeGetterName">
246 <xsl:with-param name="attrname" select="@name"/>
247 </xsl:call-template>
248 <xsl:text>,</xsl:text>
249 <xsl:choose>
250 <xsl:when test="@readonly='yes'">
251 <xsl:text>None</xsl:text>
252 </xsl:when>
253 <xsl:otherwise>
254 <xsl:call-template name="makeSetterName">
255 <xsl:with-param name="attrname" select="@name"/>
256 </xsl:call-template>,
257 </xsl:otherwise>
258 </xsl:choose>
259 <xsl:text>]</xsl:text>
260 <xsl:if test="not(position()=last())"><xsl:text>,&#10;</xsl:text></xsl:if>
261 </xsl:if>
262 </xsl:for-each>
263 <xsl:text>}</xsl:text>
264</xsl:template>
265
266<xsl:template name="interfacestruct">
267 <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
268class <xsl:value-of select="$ifname"/>:
269 def __init__(self, handle):<xsl:for-each select="attribute">
270 self.<xsl:value-of select="@name"/> = handle._<xsl:value-of select="@name"/>
271 </xsl:for-each>
272
273 <!-- also do getters/setters -->
274 <xsl:for-each select="attribute">
275 def <xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="@name"/></xsl:call-template>(self):
276 return self.<xsl:value-of select="@name"/>
277
278 def <xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="@name"/></xsl:call-template>(self):
279 raise Error, 'setters not supported'
280 </xsl:for-each>
281</xsl:template>
282
283<xsl:template name="genreq">
284 <xsl:text>req=</xsl:text><xsl:value-of select="../@name"/>_<xsl:value-of select="@name"/>RequestMsg()
285 req._this=self.handle
286 <xsl:for-each select="param[@dir='in']">
287 req._<xsl:value-of select="@name" />=_arg_<xsl:value-of select="@name" />
288 </xsl:for-each>
289 val=g_port.<xsl:value-of select="../@name"/>_<xsl:value-of select="@name"/>(req)
290 <!-- return needs to be the first one -->
291 return <xsl:for-each select="param[@dir='return']">
292 <xsl:call-template name="emitOutParam">
293 <xsl:with-param name="ifname" select="../@name" />
294 <xsl:with-param name="methodname" select="@name" />
295 <xsl:with-param name="type" select="@type" />
296 <xsl:with-param name="value" select="concat('val.','_returnval')" />
297 <xsl:with-param name="safearray" select="@safearray"/>
298 </xsl:call-template>
299 <xsl:if test="../param[@dir='out']">
300 <xsl:text>, </xsl:text>
301 </xsl:if>
302 </xsl:for-each>
303 <xsl:for-each select="param[@dir='out']">
304 <xsl:if test="not(position()=1)">
305 <xsl:text>, </xsl:text>
306 </xsl:if>
307 <xsl:call-template name="emitOutParam">
308 <xsl:with-param name="ifname" select="../@name" />
309 <xsl:with-param name="methodname" select="@name" />
310 <xsl:with-param name="type" select="@type" />
311 <xsl:with-param name="value" select="concat('val._',@name)" />
312 <xsl:with-param name="safearray" select="@safearray"/>
313 </xsl:call-template>
314 </xsl:for-each>
315 <xsl:text>&#10;&#10;</xsl:text>
316</xsl:template>
317
318<xsl:template name="method" >
319 def <xsl:value-of select="@name"/><xsl:text>(self</xsl:text>
320 <xsl:for-each select="param[@dir='in']">
321 <xsl:text>, </xsl:text>
322 <xsl:value-of select="concat('_arg_',@name)"/>
323 </xsl:for-each><xsl:text>):&#10; </xsl:text>
324 <xsl:call-template name="genreq"/>
325</xsl:template>
326
327<xsl:template name="enum">
328class <xsl:value-of select="@name"/>:
329 def __init__(self,handle):
330 if isinstance(handle,basestring):
331 self.handle=<xsl:value-of select="@name"/>._ValueMap[handle]
332 else:
333 self.handle=handle
334
335 def __eq__(self,other):
336 if isinstance(other,<xsl:value-of select="@name"/>):
337 return self.handle == other.handle
338 if isinstance(other,int):
339 return self.handle == other
340 return False
341
342 def __ne__(self,other):
343 if isinstance(other,<xsl:value-of select="@name"/>):
344 return self.handle != other.handle
345 if isinstance(other,int):
346 return self.handle != other
347 return True
348
349 def __str__(self):
350 return <xsl:value-of select="@name"/>._NameMap[self.handle]
351
352 def __int__(self):
353 return self.handle
354
355 _NameMap={<xsl:for-each select="const">
356 <xsl:value-of select="@value"/>:'<xsl:value-of select="@name"/>'<xsl:if test="not(position()=last())">,</xsl:if>
357 </xsl:for-each>}
358 _ValueMap={<xsl:for-each select="const">
359 '<xsl:value-of select="@name"/>':<xsl:value-of select="@value"/><xsl:if test="not(position()=last())">,</xsl:if>
360 </xsl:for-each>}
361
362<xsl:for-each select="const"><xsl:text> </xsl:text><xsl:value-of select="@name"/>=<xsl:value-of select="@value"/><xsl:text>&#xa;</xsl:text>
363</xsl:for-each>
364</xsl:template>
365
366<xsl:template match="/">
367<xsl:text># Copyright (C) 2008 Sun Microsystems, Inc.
368#
369# This file is part of VirtualBox Open Source Edition (OSE), as
370# available from http://www.virtualbox.org. This file is free software;
371# you can redistribute it and/or modify it under the terms of the GNU
372# General Public License (GPL) as published by the Free Software
373# Foundation, in version 2 as it comes in the "COPYING" file of the
374# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
375# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
376#
377# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
378# Clara, CA 95054 USA or visit http://www.sun.com if you need
379# additional information or have any questions.
380#
381# This file is autogenerated from VirtualBox.xidl, DO NOT EDIT!
382#
383from VirtualBox_services import *
384
385g_port = vboxServiceLocator().getvboxPortType()
386
387class ManagedManager:
388 def __init__(self):
389 self.map = {}
390
391 def register(self,handle):
392 if handle == None:
393 return
394 c = self.map.get(handle,0)
395 c = c + 1
396 self.map[handle]=c
397
398 def unregister(self,handle):
399 if handle == None:
400 return
401 c = self.map.get(handle,-1)
402 if c == -1:
403 raise Error, 'wrong refcount'
404 c = c - 1
405 if c == 0:
406 try:
407 req=IManagedObjectRef_releaseRequestMsg()
408 req._this=handle
409 g_port.IManagedObjectRef_release(req)
410 except:
411 pass
412 finally:
413 self.map[handle] = -1
414 else:
415 self.map[handle] = c
416
417g_manMgr = ManagedManager()
418
419class String:
420 def __init__(self, handle = None, isarray = False):
421 self.handle = handle
422 self.isarray = isarray
423
424 def __next(self):
425 if self.isarray:
426 return self.handle.__next()
427 raise TypeError, "iteration over non-sequence"
428
429 def __size(self):
430 if self.isarray:
431 return self.handle.__size()
432 raise TypeError, "iteration over non-sequence"
433
434 def __len__(self):
435 if self.isarray:
436 return self.handle.__len__()
437 raise TypeError, "iteration over non-sequence"
438
439 def __getitem__(self, index):
440 if self.isarray:
441 return String(self.handle[index])
442 raise TypeError, "iteration over non-sequence"
443
444 def __str__(self):
445 return self.handle
446
447 def __eq__(self,other):
448 if self.isarray:
449 return isinstance(other,String) and self.handle == other.handle
450 if isinstance(other,String):
451 return self.handle == other.handle
452 if isinstance(other,basestring):
453 return self.handle == other
454 return False
455
456 def __ne__(self,other):
457 if self.isarray:
458 return not isinstance(other,String) or self.handle == other.handle
459 if isinstance(other,String):
460 return self.handle != other.handle
461 if isinstance(other,basestring):
462 return self.handle != other
463 return True
464
465
466class UUID:
467 def __init__(self, handle = None, isarray = False):
468 self.handle = handle
469 self.isarray = isarray
470
471 def __next(self):
472 if self.isarray:
473 return self.handle.__next()
474 raise TypeError, "iteration over non-sequence"
475
476 def __size(self):
477 if self.isarray:
478 return self.handle.__size()
479 raise TypeError, "iteration over non-sequence"
480
481 def __len__(self):
482 if self.isarray:
483 return self.handle.__len__()
484 raise TypeError, "iteration over non-sequence"
485
486 def __getitem__(self, index):
487 if self.isarray:
488 return UUID(self.handle[index])
489 raise TypeError, "iteration over non-sequence"
490
491 def __str__(self):
492 return self.handle
493
494 def __eq__(self,other):
495 if self.isarray:
496 return isinstance(other,UUID) and self.handle == other.handle
497 if isinstance(other,UUID):
498 return self.handle == other.handle
499 if isinstance(other,basestring):
500 return self.handle == other
501 return False
502
503 def __ne__(self,other):
504 if self.isarray:
505 return not isinstance(other,UUID) or self.handle == other.handle
506 if isinstance(other,UUID):
507 return self.handle != other.handle
508 if isinstance(other,basestring):
509 return self.handle != other
510 return True
511
512class Boolean:
513 def __init__(self, handle = None, isarray = False):
514 self.handle = handle
515 self.isarray = isarray
516
517 def __str__(self):
518 return "true" if self.handle else "false"
519
520 def __eq__(self,other):
521 if isinstance(other,Bool):
522 return self.handle == other.value
523 if isinstance(other,bool):
524 return self.handle == other
525 return False
526
527 def __ne__(self,other):
528 if isinstance(other,Bool):
529 return self.handle != other.handle
530 if isinstance(other,bool):
531 return self.handle != other
532 return True
533
534class UnsignedInt:
535 def __init__(self, handle = None, isarray = False):
536 self.handle = handle
537 self.isarray = isarray
538
539 def __str__(self):
540 return str(self.handle)
541
542 def __int__(self):
543 return int(self.handle)
544
545 def __next(self):
546 if self.isarray:
547 return self.handle.__next()
548 raise TypeError, "iteration over non-sequence"
549
550 def __size(self):
551 if self.isarray:
552 return self.handle.__size()
553 raise TypeError, "iteration over non-sequence"
554
555 def __len__(self):
556 if self.isarray:
557 return self.handle.__len__()
558 raise TypeError, "iteration over non-sequence"
559
560 def __getitem__(self, index):
561 if self.isarray:
562 return UnsignedInt(self.handle[index])
563 raise TypeError, "iteration over non-sequence"
564
565
566class Int:
567 def __init__(self, handle = None, isarray = False):
568 self.handle = handle
569 self.isarray = isarray
570
571 def __next(self):
572 if self.isarray:
573 return self.handle.__next()
574 raise TypeError, "iteration over non-sequence"
575
576 def __size(self):
577 if self.isarray:
578 return self.handle.__size()
579 raise TypeError, "iteration over non-sequence"
580
581 def __len__(self):
582 if self.isarray:
583 return self.handle.__len__()
584 raise TypeError, "iteration over non-sequence"
585
586 def __getitem__(self, index):
587 if self.isarray:
588 return Int(self.handle[index])
589 raise TypeError, "iteration over non-sequence"
590
591 def __str__(self):
592 return str(self.handle)
593
594 def __int__(self):
595 return int(self.handle)
596
597class UnsignedShort:
598 def __init__(self, handle = None, isarray = False):
599 self.handle = handle
600 self.isarray = isarray
601
602 def __str__(self):
603 return str(self.handle)
604
605 def __int__(self):
606 return int(self.handle)
607
608class Short:
609 def __init__(self, handle = None, isarray = False):
610 self.handle = handle
611
612 def __str__(self):
613 return str(self.handle)
614
615 def __int__(self):
616 return int(self.handle)
617
618class UnsignedLong:
619 def __init__(self, handle = None, isarray = False):
620 self.handle = handle
621
622 def __str__(self):
623 return str(self.handle)
624
625 def __int__(self):
626 return int(self.handle)
627
628class Long:
629 def __init__(self, handle = None, isarray = False):
630 self.handle = handle
631
632 def __str__(self):
633 return str(self.handle)
634
635 def __int__(self):
636 return int(self.handle)
637
638class Double:
639 def __init__(self, handle = None, isarray = False):
640 self.handle = handle
641
642 def __str__(self):
643 return str(self.handle)
644
645 def __int__(self):
646 return int(self.handle)
647
648class Float:
649 def __init__(self, handle = None, isarray = False):
650 self.handle = handle
651
652 def __str__(self):
653 return str(self.handle)
654
655 def __int__(self):
656 return int(self.handle)
657
658
659class IUnknown:
660 def __init__(self, handle = None, isarray = False):
661 self.handle = handle
662 self.isarray = isarray
663
664 def __next(self):
665 if self.isarray:
666 return self.handle.__next()
667 raise TypeError, "iteration over non-sequence"
668
669 def __size(self):
670 if self.isarray:
671 return self.handle.__size()
672 raise TypeError, "iteration over non-sequence"
673
674 def __len__(self):
675 if self.isarray:
676 return self.handle.__len__()
677 raise TypeError, "iteration over non-sequence"
678
679 def __getitem__(self, index):
680 if self.isarray:
681 return IUnknown(self.handle[index])
682 raise TypeError, "iteration over non-sequence"
683
684 def __str__(self):
685 return str(self.handle)
686
687</xsl:text>
688 <xsl:for-each select="//interface[@wsmap='managed' or @wsmap='global']">
689 <xsl:call-template name="interface"/>
690 </xsl:for-each>
691 <xsl:for-each select="//interface[@wsmap='struct']">
692 <xsl:call-template name="interfacestruct"/>
693 </xsl:for-each>
694 <xsl:for-each select="//collection">
695 <xsl:call-template name="collection"/>
696 </xsl:for-each>
697 <xsl:for-each select="//enum">
698 <xsl:call-template name="enum"/>
699 </xsl:for-each>
700
701class VirtualBoxReflectionInfo:
702 def __init__(self):
703 self.map = {}
704
705 def add(self,name,ref):
706 self.map[name] = ref
707
708 def __getattr__(self,name):
709 ref = self.map.get(name,None)
710 if ref == None:
711 return self.__dict__[name]
712 return ref
713
714g_reflectionInfo = VirtualBoxReflectionInfo()
715<xsl:for-each select="//enum">
716 <xsl:variable name="ename">
717 <xsl:value-of select="@name"/>
718 </xsl:variable>
719 <xsl:value-of select="concat('g_reflectionInfo.add(&#34;',$ename,'&#34;,',$ename,')&#10;')"/>
720</xsl:for-each>
721
722</xsl:template>
723
724</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use