VirtualBox

source: vbox/trunk/src/VBox/Main/xml/SchemaDefs.xsl@ 50945

Last change on this file since 50945 was 44948, checked in by vboxsync, 12 years ago

Main/SystemProperties+Machine: new config setting for default VM frontend.
Frontend/VirtualBox+VBoxManage: changes to use the default VM frontend when starting a VM, other minor cleanups
Main/xml/*.xsd: attempt to bring the XML schema close to reality
doc/manual: document the new possibilities, and fix a few long standing inaccuracies

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.0 KB
Line 
1<?xml version="1.0"?>
2
3<!--
4 * A template to generate a header that will contain some important constraints
5 * extracted from the VirtualBox XML Schema (VirtualBox-settings-*.xsd).
6 * The output file name must be SchemaDefs.h.
7 *
8 * This template depends on XML Schema structure (type names and constraints)
9 * and should be reviewed on every Schema change.
10
11 Copyright (C) 2006-2012 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:stylesheet version="1.0"
23 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
24 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
25>
26<xsl:output method="text"/>
27
28<xsl:strip-space elements="*"/>
29
30<xsl:param name="mode" expr=''/>
31
32<!--
33// helpers
34////////////////////////////////////////////////////////////////////////////////
35-->
36
37<!--
38 * Extract the specified value and assign it to an enum member with the given
39 * name
40-->
41<xsl:template name="defineEnumMember">
42 <xsl:param name="member"/>
43 <xsl:param name="select"/>
44 <xsl:if test="$select">
45 <xsl:value-of select="concat($member, ' = ', $select, ',&#x0A;')"/>
46 </xsl:if>
47</xsl:template>
48
49<!--
50// templates
51////////////////////////////////////////////////////////////////////////////////
52-->
53
54<!--
55 * shut down all implicit templates
56-->
57<xsl:template match="*"/>
58<xsl:template match="*" mode="declare"/>
59<xsl:template match="*" mode="declare.enum"/>
60<xsl:template match="*" mode="define"/>
61
62<xsl:template match="/">
63 <xsl:choose>
64 <xsl:when test="$mode='declare'">
65 <xsl:apply-templates select="/" mode="declare"/>
66 </xsl:when>
67 <xsl:when test="$mode='define'">
68 <xsl:apply-templates select="/" mode="define"/>
69 </xsl:when>
70 <xsl:otherwise>
71 <xsl:message terminate="yes">
72Value '<xsl:value-of select="$mode"/>' of parameter 'mode' is invalid!
73 </xsl:message>
74 </xsl:otherwise>
75 </xsl:choose>
76</xsl:template>
77
78<!--
79 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
80 * declare mode (C++ header file)
81 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
82-->
83
84<xsl:template match="/" mode="declare">
85<xsl:text>
86/*
87 * DO NOT EDIT.
88 *
89 * This header is automatically generated from the VirtualBox XML Settings
90 * Schema and contains selected schema constraints declared in C++.
91 */
92
93#ifndef ____H_SCHEMADEFS
94#define ____H_SCHEMADEFS
95
96namespace SchemaDefs
97{
98 enum
99 {
100</xsl:text>
101
102 <xsl:apply-templates select="xsd:schema" mode="declare.enum"/>
103
104<xsl:text> DummyTerminator
105 };
106</xsl:text>
107
108<xsl:apply-templates select="xsd:schema" mode="declare"/>
109
110<xsl:text>}
111
112#endif // !____H_SCHEMADEFS
113</xsl:text>
114</xsl:template>
115
116<!--
117 * enumeration values
118-->
119<xsl:template match="xsd:schema" mode="declare.enum">
120
121 <!-- process include statements -->
122 <xsl:for-each select="xsd:include">
123 <!-- skip VirtualBox-settings-root.xsd inclusion as it is computed at runtime -->
124 <xsl:if test="not(@schemaLocation='VirtualBox-settings-root.xsd')">
125 <xsl:apply-templates select="document(@schemaLocation)/xsd:schema" mode="declare.enum"/>
126 </xsl:if>
127 </xsl:for-each>
128
129 <xsl:call-template name="defineEnumMember">
130 <xsl:with-param name="member" select="' MinGuestRAM'"/>
131 <xsl:with-param name="select" select="
132 xsd:complexType[@name='TMemory']/xsd:attribute[@name='RAMSize']//xsd:minInclusive/@value
133 "/>
134 </xsl:call-template>
135 <xsl:call-template name="defineEnumMember">
136 <xsl:with-param name="member" select="' MaxGuestRAM'"/>
137 <xsl:with-param name="select" select="
138 xsd:complexType[@name='TMemory']/xsd:attribute[@name='RAMSize']//xsd:maxInclusive/@value
139 "/>
140 </xsl:call-template>
141
142 <xsl:call-template name="defineEnumMember">
143 <xsl:with-param name="member" select="' MinGuestVRAM'"/>
144 <xsl:with-param name="select" select="
145 xsd:complexType[@name='TDisplay']/xsd:attribute[@name='VRAMSize']//xsd:minInclusive/@value
146 "/>
147 </xsl:call-template>
148 <xsl:call-template name="defineEnumMember">
149 <xsl:with-param name="member" select="' MaxGuestVRAM'"/>
150 <xsl:with-param name="select" select="
151 xsd:complexType[@name='TDisplay']/xsd:attribute[@name='VRAMSize']//xsd:maxInclusive/@value
152 "/>
153 </xsl:call-template>
154
155 <xsl:call-template name="defineEnumMember">
156 <xsl:with-param name="member" select="' MinCPUCount'"/>
157 <xsl:with-param name="select" select="
158 xsd:simpleType[@name='TCPUCount']//xsd:minInclusive/@value
159 "/>
160 </xsl:call-template>
161 <xsl:call-template name="defineEnumMember">
162 <xsl:with-param name="member" select="' MaxCPUCount'"/>
163 <xsl:with-param name="select" select="
164 xsd:simpleType[@name='TCPUCount']//xsd:maxInclusive/@value
165 "/>
166 </xsl:call-template>
167
168 <xsl:call-template name="defineEnumMember">
169 <xsl:with-param name="member" select="' MaxGuestMonitors'"/>
170 <xsl:with-param name="select" select="
171 xsd:simpleType[@name='TMonitorCount']//xsd:maxInclusive/@value
172 "/>
173 </xsl:call-template>
174
175 <xsl:call-template name="defineEnumMember">
176 <xsl:with-param name="member" select="' SerialPortCount'"/>
177 <xsl:with-param name="select" select="
178 xsd:complexType[@name='TUARTPort']/xsd:attribute[@name='slot']//xsd:maxExclusive/@value
179 "/>
180 </xsl:call-template>
181
182 <xsl:call-template name="defineEnumMember">
183 <xsl:with-param name="member" select="' ParallelPortCount'"/>
184 <xsl:with-param name="select" select="
185 xsd:complexType[@name='TLPTPort']/xsd:attribute[@name='slot']//xsd:maxExclusive/@value
186 "/>
187 </xsl:call-template>
188
189 <xsl:call-template name="defineEnumMember">
190 <xsl:with-param name="member" select="' MaxBootPosition'"/>
191 <xsl:with-param name="select" select="
192 xsd:complexType[@name='TBoot']//xsd:element[@name='Order']//xsd:attribute[@name='position']//xsd:maxInclusive/@value
193 "/>
194 </xsl:call-template>
195
196</xsl:template>
197
198<!--
199 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
200 * define mode (C++ source file)
201 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
202-->
203
204<xsl:template match="/" mode="define">
205<xsl:text>
206/*
207 * DO NOT EDIT.
208 *
209 * This source is automatically generated from the VirtualBox XML Settings
210 * Schema and contains selected schema constraints defined in C++.
211 */
212
213#include "SchemaDefs.h"
214
215namespace SchemaDefs
216{
217</xsl:text>
218
219<xsl:apply-templates select="xsd:schema" mode="define"/>
220
221<xsl:text>}
222</xsl:text>
223</xsl:template>
224
225<!--
226 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
227 * END
228 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
229-->
230
231</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