VirtualBox

source: vbox/trunk/src/VBox/Main/glue/constants-python.xsl@ 30396

Last change on this file since 30396 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 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 constants-python.xsl:
8 XSLT stylesheet that generates VirtualBox_constants.py from
9 VirtualBox.xidl.
10
11 Copyright (C) 2009 Oracle Corporation
12
13 This file is part of VirtualBox Open Source Edition (OSE), as
14 available from http://www.virtualbox.org. This file is free software;
15 you can redistribute it and/or modify it under the terms of the GNU
16 General Public License (GPL) as published by the Free Software
17 Foundation, in version 2 as it comes in the "COPYING" file of the
18 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
19 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
20-->
21
22<xsl:output
23 method="text"
24 version="1.0"
25 encoding="utf-8"
26 indent="no"/>
27
28<xsl:template match="/">
29<xsl:text># Copyright (C) 2009 Sun Microsystems, Inc.
30#
31# This file is part of VirtualBox Open Source Edition (OSE), as
32# available from http://www.virtualbox.org. This file is free software;
33# you can redistribute it and/or modify it under the terms of the GNU
34# General Public License (GPL) as published by the Free Software
35# Foundation, in version 2 as it comes in the "COPYING" file of the
36# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
37# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
38#
39# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
40# Clara, CA 95054 USA or visit http://www.sun.com if you need
41# additional information or have any questions.
42#
43# This file is autogenerated from VirtualBox.xidl, DO NOT EDIT!
44#
45</xsl:text>
46class VirtualBoxReflectionInfo:
47 def __init__(self, isSym):
48 self.isSym = isSym
49
50 _Values = {<xsl:for-each select="//enum">
51 '<xsl:value-of select="@name"/>':{
52 <xsl:for-each select="const">'<xsl:value-of select="@name"/>':<xsl:value-of select="@value"/><xsl:if test="not(position()=last())">,</xsl:if>
53 </xsl:for-each>}<xsl:if test="not(position()=last())">,</xsl:if>
54
55 </xsl:for-each>}
56
57 _ValuesSym = {<xsl:for-each select="//enum">
58 '<xsl:value-of select="@name"/>':{
59 <xsl:for-each select="const">'<xsl:value-of select="@name"/>': '<xsl:value-of select="@name"/>'<xsl:if test="not(position()=last())">,</xsl:if>
60 </xsl:for-each>}<xsl:if test="not(position()=last())">,</xsl:if>
61
62 </xsl:for-each>}
63
64 _ValuesFlat = {<xsl:for-each select="//enum">
65 <xsl:variable name="ename">
66 <xsl:value-of select="@name"/>
67 </xsl:variable>
68 <xsl:for-each select="const">
69 '<xsl:value-of select="$ename"/>_<xsl:value-of select="@name"/>':<xsl:value-of select="@value"/><xsl:if test="not(position()=last())">,</xsl:if>
70 </xsl:for-each>
71 <xsl:if test="not(position()=last())">,</xsl:if>
72 </xsl:for-each>}
73
74 _ValuesFlatSym = {<xsl:for-each select="//enum">
75 <xsl:variable name="ename">
76 <xsl:value-of select="@name"/>
77 </xsl:variable>
78 <xsl:for-each select="const">
79 <xsl:variable name="eval">
80 <xsl:value-of select="concat($ename, '_', @name)"/>
81 </xsl:variable>
82 '<xsl:value-of select="$eval"/>': '<xsl:value-of select="@name"/>'<xsl:if test="not(position()=last())">,</xsl:if>
83 </xsl:for-each>
84 <xsl:if test="not(position()=last())">,</xsl:if>
85 </xsl:for-each>}
86
87 def __getattr__(self,attr):
88 if self.isSym:
89 v = self._ValuesFlatSym.get(attr)
90 else:
91 v = self._ValuesFlat.get(attr)
92 if v is not None:
93 return v
94 else:
95 raise AttributeError
96
97 def all_values(self,enum_name):
98 if self.isSym:
99 vals = self._ValuesSym.get(enum_name)
100 else:
101 vals = self._Values.get(enum_name)
102 if vals is not None:
103 return vals
104 else:
105 return {}
106
107</xsl:template>
108</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.

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