VirtualBox

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

Last change on this file since 95685 was 82969, checked in by vboxsync, 5 years ago

Copyright year updates - manual ones.

  • 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-2020 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 <xsl:apply-templates select="document(@schemaLocation)/xsd:schema" mode="declare.enum"/>
124 </xsl:for-each>
125
126 <xsl:call-template name="defineEnumMember">
127 <xsl:with-param name="member" select="'MinGuestRAM'"/>
128 <xsl:with-param name="select" select="
129 xsd:complexType[@name='TMemory']/xsd:attribute[@name='RAMSize']//xsd:minInclusive/@value
130 "/>
131 </xsl:call-template>
132 <xsl:call-template name="defineEnumMember">
133 <xsl:with-param name="member" select="'MaxGuestRAM'"/>
134 <xsl:with-param name="select" select="
135 xsd:complexType[@name='TMemory']/xsd:attribute[@name='RAMSize']//xsd:maxInclusive/@value
136 "/>
137 </xsl:call-template>
138
139 <xsl:call-template name="defineEnumMember">
140 <xsl:with-param name="member" select="'MinGuestVRAM'"/>
141 <xsl:with-param name="select" select="
142 xsd:complexType[@name='TDisplay']/xsd:attribute[@name='VRAMSize']//xsd:minInclusive/@value
143 "/>
144 </xsl:call-template>
145 <xsl:call-template name="defineEnumMember">
146 <xsl:with-param name="member" select="'MaxGuestVRAM'"/>
147 <xsl:with-param name="select" select="
148 xsd:complexType[@name='TDisplay']/xsd:attribute[@name='VRAMSize']//xsd:maxInclusive/@value
149 "/>
150 </xsl:call-template>
151
152 <xsl:call-template name="defineEnumMember">
153 <xsl:with-param name="member" select="'MinCPUCount'"/>
154 <xsl:with-param name="select" select="
155 xsd:simpleType[@name='TCPUCount']//xsd:minInclusive/@value
156 "/>
157 </xsl:call-template>
158 <xsl:call-template name="defineEnumMember">
159 <xsl:with-param name="member" select="'MaxCPUCount'"/>
160 <xsl:with-param name="select" select="
161 xsd:simpleType[@name='TCPUCount']//xsd:maxInclusive/@value
162 "/>
163 </xsl:call-template>
164
165 <xsl:call-template name="defineEnumMember">
166 <xsl:with-param name="member" select="'MaxGuestMonitors'"/>
167 <xsl:with-param name="select" select="
168 xsd:simpleType[@name='TMonitorCount']//xsd:maxInclusive/@value
169 "/>
170 </xsl:call-template>
171
172 <xsl:call-template name="defineEnumMember">
173 <xsl:with-param name="member" select="'SerialPortCount'"/>
174 <xsl:with-param name="select" select="
175 xsd:complexType[@name='TUARTPort']/xsd:attribute[@name='slot']//xsd:maxExclusive/@value
176 "/>
177 </xsl:call-template>
178
179 <xsl:call-template name="defineEnumMember">
180 <xsl:with-param name="member" select="'ParallelPortCount'"/>
181 <xsl:with-param name="select" select="
182 xsd:complexType[@name='TLPTPort']/xsd:attribute[@name='slot']//xsd:maxExclusive/@value
183 "/>
184 </xsl:call-template>
185
186 <xsl:call-template name="defineEnumMember">
187 <xsl:with-param name="member" select="'MaxBootPosition'"/>
188 <xsl:with-param name="select" select="
189 xsd:complexType[@name='TBoot']//xsd:element[@name='Order']//xsd:attribute[@name='position']//xsd:maxInclusive/@value
190 "/>
191 </xsl:call-template>
192
193 <xsl:call-template name="defineEnumMember">
194 <xsl:with-param name="member" select="'DefaultHardwareVersion'"/>
195 <xsl:with-param name="select" select="
196 xsd:complexType[@name='THardware']/xsd:attribute[@name='version']/@default
197 "/>
198 </xsl:call-template>
199
200</xsl:template>
201
202<!--
203 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
204 * define mode (C++ source file)
205 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
206-->
207
208<xsl:template match="/" mode="define">
209<xsl:text>
210/*
211 * DO NOT EDIT.
212 *
213 * This source is automatically generated from the VirtualBox XML Settings
214 * Schema and contains selected schema constraints defined in C++.
215 */
216
217#include "SchemaDefs.h"
218
219namespace SchemaDefs
220{
221</xsl:text>
222
223<xsl:apply-templates select="xsd:schema" mode="define"/>
224
225<xsl:text>}
226</xsl:text>
227</xsl:template>
228
229<!--
230 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
231 * END
232 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
233-->
234
235</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