VirtualBox

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

Last change on this file since 1217 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 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 InnoTek Systemberatung 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 * If you received this file as part of a commercial VirtualBox
22 * distribution, then only the terms of your commercial VirtualBox
23 * license agreement apply instead of the previous paragraph.
24-->
25
26<xsl:stylesheet version="1.0"
27 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
28 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
29>
30<xsl:output method="text"/>
31
32<xsl:strip-space elements="*"/>
33
34<!--
35// helpers
36////////////////////////////////////////////////////////////////////////////////
37-->
38
39<!--
40 * Extract the specified value and assign it to an enum member with the given
41 * name
42-->
43<xsl:template name="defineEnumMember">
44 <xsl:param name="member"/>
45 <xsl:param name="select"/>
46 <xsl:if test="$select">
47 <xsl:value-of select="concat($member, ' = ', $select, ',&#x0A;')"/>
48 </xsl:if>
49</xsl:template>
50
51<!--
52// templates
53////////////////////////////////////////////////////////////////////////////////
54-->
55
56<!--
57 * shut down all implicit templates
58-->
59<xsl:template match="*"/>
60
61<!--
62 * header
63-->
64<xsl:template match="/">
65<xsl:text>
66/*
67 * DO NOT EDIT.
68 *
69 * This header is automatically generated from the VirtualBox XML Schema
70 * and contains selected schema constraints defined in C.
71 */
72
73#ifndef ____H_SCHEMADEFS
74#define ____H_SCHEMADEFS
75
76struct SchemaDefs
77{
78 enum
79 {
80</xsl:text>
81
82 <xsl:apply-templates select="xsd:schema"/>
83
84<xsl:text> };
85};
86
87#endif // ____H_SCHEMADEFS
88</xsl:text>
89</xsl:template>
90
91<!--
92 * extract schema definitions
93-->
94<xsl:template match="xsd:schema">
95
96 <!-- process include statements -->
97 <xsl:for-each select="xsd:include">
98 <xsl:apply-templates select="document(@schemaLocation)/xsd:schema"/>
99 </xsl:for-each>
100
101 <xsl:call-template name="defineEnumMember">
102 <xsl:with-param name="member" select="' MinGuestRAM'"/>
103 <xsl:with-param name="select" select="
104 xsd:complexType[@name='TMemory']/xsd:attribute[@name='RAMSize']//xsd:minInclusive/@value
105 "/>
106 </xsl:call-template>
107 <xsl:call-template name="defineEnumMember">
108 <xsl:with-param name="member" select="' MaxGuestRAM'"/>
109 <xsl:with-param name="select" select="
110 xsd:complexType[@name='TMemory']/xsd:attribute[@name='RAMSize']//xsd:maxInclusive/@value
111 "/>
112 </xsl:call-template>
113
114 <xsl:call-template name="defineEnumMember">
115 <xsl:with-param name="member" select="' MinGuestVRAM'"/>
116 <xsl:with-param name="select" select="
117 xsd:complexType[@name='TDisplay']/xsd:attribute[@name='VRAMSize']//xsd:minInclusive/@value
118 "/>
119 </xsl:call-template>
120 <xsl:call-template name="defineEnumMember">
121 <xsl:with-param name="member" select="' MaxGuestVRAM'"/>
122 <xsl:with-param name="select" select="
123 xsd:complexType[@name='TDisplay']/xsd:attribute[@name='VRAMSize']//xsd:maxInclusive/@value
124 "/>
125 </xsl:call-template>
126 <xsl:call-template name="defineEnumMember">
127 <xsl:with-param name="member" select="' NetworkAdapterCount'"/>
128 <xsl:with-param name="select" select="
129 xsd:complexType[@name='TAdapter']/xsd:attribute[@name='slot']//xsd:maxExclusive/@value
130 "/>
131 </xsl:call-template>
132 <xsl:call-template name="defineEnumMember">
133 <xsl:with-param name="member" select="' MaxBootPosition'"/>
134 <xsl:with-param name="select" select="
135 xsd:complexType[@name='TBoot']//xsd:element[@name='Order']//xsd:attribute[@name='position']//xsd:maxInclusive/@value
136 "/>
137 </xsl:call-template>
138
139</xsl:template>
140
141</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