VirtualBox

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

Last change on this file since 4753 was 4071, checked in by vboxsync, 17 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.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-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 as published by the Free Software Foundation,
17 in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
18 distribution. VirtualBox OSE is distributed in the hope that it will
19 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 <xsl:apply-templates select="document(@schemaLocation)/xsd:schema"/>
95 </xsl:for-each>
96
97 <xsl:call-template name="defineEnumMember">
98 <xsl:with-param name="member" select="' MinGuestRAM'"/>
99 <xsl:with-param name="select" select="
100 xsd:complexType[@name='TMemory']/xsd:attribute[@name='RAMSize']//xsd:minInclusive/@value
101 "/>
102 </xsl:call-template>
103 <xsl:call-template name="defineEnumMember">
104 <xsl:with-param name="member" select="' MaxGuestRAM'"/>
105 <xsl:with-param name="select" select="
106 xsd:complexType[@name='TMemory']/xsd:attribute[@name='RAMSize']//xsd:maxInclusive/@value
107 "/>
108 </xsl:call-template>
109
110 <xsl:call-template name="defineEnumMember">
111 <xsl:with-param name="member" select="' MinGuestVRAM'"/>
112 <xsl:with-param name="select" select="
113 xsd:complexType[@name='TDisplay']/xsd:attribute[@name='VRAMSize']//xsd:minInclusive/@value
114 "/>
115 </xsl:call-template>
116 <xsl:call-template name="defineEnumMember">
117 <xsl:with-param name="member" select="' MaxGuestVRAM'"/>
118 <xsl:with-param name="select" select="
119 xsd:complexType[@name='TDisplay']/xsd:attribute[@name='VRAMSize']//xsd:maxInclusive/@value
120 "/>
121 </xsl:call-template>
122 <xsl:call-template name="defineEnumMember">
123 <xsl:with-param name="member" select="' MaxGuestMonitors'"/>
124 <xsl:with-param name="select" select="
125 xsd:complexType[@name='TDisplay']/xsd:attribute[@name='MonitorCount']//xsd:maxInclusive/@value
126 "/>
127 </xsl:call-template>
128 <xsl:call-template name="defineEnumMember">
129 <xsl:with-param name="member" select="' NetworkAdapterCount'"/>
130 <xsl:with-param name="select" select="
131 xsd:complexType[@name='TAdapter']/xsd:attribute[@name='slot']//xsd:maxExclusive/@value
132 "/>
133 </xsl:call-template>
134 <xsl:call-template name="defineEnumMember">
135 <xsl:with-param name="member" select="' SerialPortCount'"/>
136 <xsl:with-param name="select" select="
137 xsd:complexType[@name='TUartPort']/xsd:attribute[@name='slot']//xsd:maxExclusive/@value
138 "/>
139 </xsl:call-template>
140 <xsl:call-template name="defineEnumMember">
141 <xsl:with-param name="member" select="' ParallelPortCount'"/>
142 <xsl:with-param name="select" select="
143 xsd:complexType[@name='TLptPort']/xsd:attribute[@name='slot']//xsd:maxExclusive/@value
144 "/>
145 </xsl:call-template>
146 <xsl:call-template name="defineEnumMember">
147 <xsl:with-param name="member" select="' MaxBootPosition'"/>
148 <xsl:with-param name="select" select="
149 xsd:complexType[@name='TBoot']//xsd:element[@name='Order']//xsd:attribute[@name='position']//xsd:maxInclusive/@value
150 "/>
151 </xsl:call-template>
152
153</xsl:template>
154
155</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