VirtualBox

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

Last change on this file since 7449 was 7442, checked in by vboxsync, 17 years ago

Main: Applied SATA changes from #2406. Increased XML settings version format from 1.2 to 1.3.pre.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 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-2007 innotek GmbH
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<!--
31// helpers
32////////////////////////////////////////////////////////////////////////////////
33-->
34
35<!--
36 * Extract the specified value and assign it to an enum member with the given
37 * name
38-->
39<xsl:template name="defineEnumMember">
40 <xsl:param name="member"/>
41 <xsl:param name="select"/>
42 <xsl:if test="$select">
43 <xsl:value-of select="concat($member, ' = ', $select, ',&#x0A;')"/>
44 </xsl:if>
45</xsl:template>
46
47<!--
48// templates
49////////////////////////////////////////////////////////////////////////////////
50-->
51
52<!--
53 * shut down all implicit templates
54-->
55<xsl:template match="*"/>
56
57<!--
58 * header
59-->
60<xsl:template match="/">
61<xsl:text>
62/*
63 * DO NOT EDIT.
64 *
65 * This header is automatically generated from the VirtualBox XML Schema
66 * and contains selected schema constraints defined in C.
67 */
68
69#ifndef ____H_SCHEMADEFS
70#define ____H_SCHEMADEFS
71
72struct SchemaDefs
73{
74 enum
75 {
76</xsl:text>
77
78 <xsl:apply-templates select="xsd:schema"/>
79
80<xsl:text> };
81};
82
83#endif // ____H_SCHEMADEFS
84</xsl:text>
85</xsl:template>
86
87<!--
88 * extract schema definitions
89-->
90<xsl:template match="xsd:schema">
91
92 <!-- process include statements -->
93 <xsl:for-each select="xsd:include">
94 <!-- skip VirtualBox-settings-root.xsd inclusion as it is computed at runtime -->
95 <xsl:if test="not(@schemaLocation='VirtualBox-settings-root.xsd')">
96 <xsl:apply-templates select="document(@schemaLocation)/xsd:schema"/>
97 </xsl:if>
98 </xsl:for-each>
99
100 <xsl:call-template name="defineEnumMember">
101 <xsl:with-param name="member" select="' MinGuestRAM'"/>
102 <xsl:with-param name="select" select="
103 xsd:complexType[@name='TMemory']/xsd:attribute[@name='RAMSize']//xsd:minInclusive/@value
104 "/>
105 </xsl:call-template>
106 <xsl:call-template name="defineEnumMember">
107 <xsl:with-param name="member" select="' MaxGuestRAM'"/>
108 <xsl:with-param name="select" select="
109 xsd:complexType[@name='TMemory']/xsd:attribute[@name='RAMSize']//xsd:maxInclusive/@value
110 "/>
111 </xsl:call-template>
112
113 <xsl:call-template name="defineEnumMember">
114 <xsl:with-param name="member" select="' MinGuestVRAM'"/>
115 <xsl:with-param name="select" select="
116 xsd:complexType[@name='TDisplay']/xsd:attribute[@name='VRAMSize']//xsd:minInclusive/@value
117 "/>
118 </xsl:call-template>
119 <xsl:call-template name="defineEnumMember">
120 <xsl:with-param name="member" select="' MaxGuestVRAM'"/>
121 <xsl:with-param name="select" select="
122 xsd:complexType[@name='TDisplay']/xsd:attribute[@name='VRAMSize']//xsd:maxInclusive/@value
123 "/>
124 </xsl:call-template>
125 <xsl:call-template name="defineEnumMember">
126 <xsl:with-param name="member" select="' MaxGuestMonitors'"/>
127 <xsl:with-param name="select" select="
128 xsd:complexType[@name='TDisplay']/xsd:attribute[@name='MonitorCount']//xsd:maxInclusive/@value
129 "/>
130 </xsl:call-template>
131 <xsl:call-template name="defineEnumMember">
132 <xsl:with-param name="member" select="' NetworkAdapterCount'"/>
133 <xsl:with-param name="select" select="
134 xsd:complexType[@name='TNetworkAdapter']/xsd:attribute[@name='slot']//xsd:maxExclusive/@value
135 "/>
136 </xsl:call-template>
137 <xsl:call-template name="defineEnumMember">
138 <xsl:with-param name="member" select="' SerialPortCount'"/>
139 <xsl:with-param name="select" select="
140 xsd:complexType[@name='TUartPort']/xsd:attribute[@name='slot']//xsd:maxExclusive/@value
141 "/>
142 </xsl:call-template>
143 <xsl:call-template name="defineEnumMember">
144 <xsl:with-param name="member" select="' ParallelPortCount'"/>
145 <xsl:with-param name="select" select="
146 xsd:complexType[@name='TLptPort']/xsd:attribute[@name='slot']//xsd:maxExclusive/@value
147 "/>
148 </xsl:call-template>
149 <xsl:call-template name="defineEnumMember">
150 <xsl:with-param name="member" select="' MaxBootPosition'"/>
151 <xsl:with-param name="select" select="
152 xsd:complexType[@name='TBoot']//xsd:element[@name='Order']//xsd:attribute[@name='position']//xsd:maxInclusive/@value
153 "/>
154 </xsl:call-template>
155
156</xsl:template>
157
158</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