VirtualBox

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

Last change on this file since 96311 was 96308, checked in by vboxsync, 2 years ago

src/VBox/Main: XML/XSL comment fixes

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