Merge branch 'fixes' into main/rendor-staging
[ryzomcore.git] / ryzom / common / src / game_share / generate_client_db.xslt
blob699630569865220dac103bf394f09c0dafc0906f
1 <?xml version="1.0"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4 <xsl:output method="text" indent="no"/>
6 <!-- Output : can be 'header', 'cpp' or 'php' -->
7 <xsl:param name="output"/> <!-- select="'header' -->
8 <xsl:param name="side"/> <!-- The generation side (my be 'server' or 'client' -->
9 <xsl:param name="filename"/>
10 <xsl:param name="bank"/> <!-- The database bank to generate (must meet an entry in <bank_superclass> banks) -->
12 <!-- A special template applyer that is mode aware -->
13 <xsl:template name="myApplyTemplate">
14 <xsl:choose>
15 <xsl:when test="$output = 'header'">
16 <xsl:if test="$side = 'server'">
17 <xsl:apply-templates mode="header-server"/>
18 </xsl:if>
19 <xsl:if test="$side = 'client'">
20 <xsl:apply-templates mode="header-client"/>
21 </xsl:if>
22 </xsl:when>
23 <xsl:when test="$output = 'cpp'">
24 <xsl:if test="$side = 'server'">
25 <xsl:apply-templates mode="cpp-server"/>
26 </xsl:if>
27 <xsl:if test="$side = 'client'">
28 <xsl:apply-templates mode="cpp-client"/>
29 </xsl:if>
30 </xsl:when>
31 </xsl:choose>
32 </xsl:template>
34 <!-- some stupide template to remove unwanted text from output -->
35 <xsl:template match="text()" mode="cpp-server"/>
36 <xsl:template match="text()" mode="header-server"/>
37 <xsl:template match="text()" mode="cpp-client"/>
38 <xsl:template match="text()" mode="header-client"/>
40 <xsl:template match="/"><xsl:call-template name="myApplyTemplate"/></xsl:template>
42 <!-- ######################################################### -->
43 <!-- ##### Recursive build of full class name ####### -->
44 <!-- ######################################################### -->
45 <xsl:template name="makeFullClassName">
46 <xsl:if test="name() = 'branch'">
47 <xsl:for-each select="..">
48 <xsl:call-template name="makeFullClassName"/>
49 </xsl:for-each>
50 <xsl:text>::</xsl:text><xsl:call-template name="makeBranchType"/>
51 </xsl:if>
52 <xsl:if test="name() = 'database_description'">
53 <xsl:text>CBankAccessor_</xsl:text><xsl:value-of select="$bank"/>
54 </xsl:if>
55 </xsl:template>
57 <!-- ######################################################### -->
58 <!-- ##### Root template matcher (cpp-server) ####### -->
59 <!-- ######################################################### -->
60 <xsl:template match="database_description" mode="cpp-server">
61 // Ryzom - MMORPG Framework &lt;http://dev.ryzom.com/projects/ryzom/&gt;
62 // Copyright (C) 2010 Winch Gate Property Limited
64 // This program is free software: you can redistribute it and/or modify
65 // it under the terms of the GNU Affero General Public License as
66 // published by the Free Software Foundation, either version 3 of the
67 // License, or (at your option) any later version.
69 // This program is distributed in the hope that it will be useful,
70 // but WITHOUT ANY WARRANTY; without even the implied warranty of
71 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
72 // GNU Affero General Public License for more details.
74 // You should have received a copy of the GNU Affero General Public License
75 // along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.
77 /////////////////////////////////////////////////////////////////
83 // WARNING : this is a generated file, don't change it !
90 /////////////////////////////////////////////////////////////////
92 #include "stdpch.h"
93 #include "database_<xsl:value-of select="translate($bank, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>.h"
95 <xsl:for-each select="bank_superclass/bank[@name = $bank]">
96 <xsl:variable name="bankName" select="@name"/>
98 TCDBBank CBankAccessor_<xsl:value-of select="@name"/>::BankTag;
100 <!-- generate root class members-->
101 <xsl:for-each select="/*/branch[@bank = $bankName and not(@clientonly)]">
102 <xsl:call-template name="makeFullClassName"/><xsl:text> </xsl:text><xsl:for-each select=".."><xsl:call-template name="makeFullClassName"/></xsl:for-each>::_<xsl:call-template name="makeBranchName"/><xsl:if test="@count">[<xsl:value-of select="@count"/>]</xsl:if><xsl:text>;
103 </xsl:text>
104 </xsl:for-each>
106 <!-- generate init method -->
107 void CBankAccessor_<xsl:value-of select="@name"/>::init()
109 static bool inited = false;
110 if (!inited)
112 // retreive the bank structure
113 CCDBStructBanks *bank = CCDBStructBanks::instance();
114 BankTag = CCDBStructBanks::readBankName("<xsl:value-of select="$bankName"/>");
116 ICDBStructNode *node;
118 // branch init
119 <xsl:for-each select="/*/branch[@bank = $bankName and not(@clientonly)]">
120 <xsl:if test="not(@count)">
121 node = bank->getICDBStructNodeFromName( BankTag, "<xsl:value-of select="@name"/>" );
122 nlassert(node != NULL);
123 // call sub branch init
124 _<xsl:call-template name="makeBranchName"/>.init(node);
125 </xsl:if>
126 <xsl:if test="@count">
127 for (uint i=0; i&lt;<xsl:value-of select="@count"/>; ++i)
129 node = bank->getICDBStructNodeFromName( BankTag, NLMISC::toString("<xsl:value-of select="@name"/>%u", i) );
130 nlassert(node != NULL);
131 // call sub branch init
132 _<xsl:call-template name="makeBranchName"/>[i].init(node, i);
134 </xsl:if>
135 </xsl:for-each>
137 inited = true;
140 <!-- generate inner classes methods -->
141 <xsl:for-each select="/*/branch[@bank = $bankName and not(@clientonly)]">
142 <xsl:call-template name="branch_cpp"/>
143 </xsl:for-each>
145 </xsl:for-each>
146 </xsl:template>
149 <!-- ######################################################### -->
150 <!-- ##### Root template matcher ####### -->
151 <!-- ######################################################### -->
152 <xsl:template match="database_description" mode="header-server">
154 #ifndef INCLUDED_<xsl:value-of select="concat($filename, '_', $bank)"/>_H
155 #define INCLUDED_<xsl:value-of select="concat($filename, '_', $bank)"/>_H
156 // Ryzom - MMORPG Framework &lt;http://dev.ryzom.com/projects/ryzom/&gt;
157 // Copyright (C) 2010 Winch Gate Property Limited
159 // This program is free software: you can redistribute it and/or modify
160 // it under the terms of the GNU Affero General Public License as
161 // published by the Free Software Foundation, either version 3 of the
162 // License, or (at your option) any later version.
164 // This program is distributed in the hope that it will be useful,
165 // but WITHOUT ANY WARRANTY; without even the implied warranty of
166 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
167 // GNU Affero General Public License for more details.
169 // You should have received a copy of the GNU Affero General Public License
170 // along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.
172 /////////////////////////////////////////////////////////////////
178 // WARNING : this is a generated file, don't change it !
185 /////////////////////////////////////////////////////////////////
187 #include "nel/misc/string_common.h"
188 #include "cdb_group.h"
189 #include "player_manager/cdb.h"
190 #include "player_manager/cdb_synchronised.h"
192 <xsl:for-each select="bank_superclass/bank[@name = $bank]">
193 <xsl:for-each select="include">
194 #include "<xsl:value-of select="@file"/>"
195 </xsl:for-each>
196 <!-- copy any verbatime code -->
197 <xsl:value-of select="verbatime"/>
198 </xsl:for-each>
200 <![CDATA[
201 #ifndef _SET_PROP_ACCESSOR_
202 #define _SET_PROP_ACCESSOR_
203 inline void _setProp(CCDBSynchronised &db, ICDBStructNode *node, bool value, bool forceSending = false)
205 db.x_setProp(node, uint64(value), forceSending);
207 inline void _setProp(CCDBSynchronised &db, ICDBStructNode *node, uint8 value, bool forceSending = false)
209 db.x_setProp(node, uint64(value), forceSending);
211 inline void _setProp(CCDBSynchronised &db, ICDBStructNode *node, uint16 value, bool forceSending = false)
213 db.x_setProp(node, uint64(value), forceSending);
215 inline void _setProp(CCDBSynchronised &db, ICDBStructNode *node, uint32 value, bool forceSending = false)
217 db.x_setProp(node, uint64(value), forceSending);
219 inline void _setProp(CCDBSynchronised &db, ICDBStructNode *node, uint64 value, bool forceSending = false)
221 db.x_setProp(node, uint64(value), forceSending);
223 inline void _setProp(CCDBSynchronised &db, ICDBStructNode *node, sint8 value, bool forceSending = false)
225 db.x_setProp(node, uint64(value), forceSending);
227 inline void _setProp(CCDBSynchronised &db, ICDBStructNode *node, sint16 value, bool forceSending = false)
229 db.x_setProp(node, uint64(value), forceSending);
231 inline void _setProp(CCDBSynchronised &db, ICDBStructNode *node, sint32 value, bool forceSending = false)
233 db.x_setProp(node, uint64(value), forceSending);
235 inline void _setProp(CCDBSynchronised &db, ICDBStructNode *node, sint64 value, bool forceSending = false)
237 db.x_setProp(node, uint64(value), forceSending);
239 inline void _setProp(CCDBSynchronised &db, ICDBStructNode *node, const std::string &value, bool forceSending = false)
241 db.x_setPropString(node, value, forceSending);
243 inline void _setProp(CCDBSynchronised &db, ICDBStructNode *node, const ucstring &value, bool forceSending = false)
245 db.x_setPropString(node, value, forceSending);
247 inline void _setProp(CCDBSynchronised &db, ICDBStructNode *node, const NLMISC::CSheetId &value, bool forceSending = false)
249 db.x_setProp(node, uint64(value.asInt()), forceSending);
253 inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, bool &value)
255 value = db.x_getProp(node) != 0;
257 inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, uint8 &value)
259 value = uint8(db.x_getProp(node));
261 inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, uint16 &value)
263 value = uint16(db.x_getProp(node));
265 inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, uint32 &value)
267 value = uint32(db.x_getProp(node));
269 inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, uint64 &value)
271 value = db.x_getProp(node);
273 inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, sint8 &value)
275 value = uint8(db.x_getProp(node));
277 inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, sint16 &value)
279 value = uint16(db.x_getProp(node));
281 inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, sint32 &value)
283 value = uint32(db.x_getProp(node));
285 inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, sint64 &value)
287 value = db.x_getProp(node);
289 inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, std::string &value)
291 value = db.x_getPropString(node);
293 inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, ucstring &value)
295 value = db.x_getPropUcstring(node);
297 inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::CSheetId &value)
299 value = uint32(db.x_getProp(node));
301 #endif // _SET_PROP_ACCESSOR_
304 <xsl:for-each select="bank_superclass/bank[@name = $bank]">
305 <xsl:variable name="bankName" select="@name"/>
306 class CBankAccessor_<xsl:value-of select="@name"/> : public <xsl:value-of select="@class"/>
308 public:
309 static TCDBBank BankTag;
311 <!-- generate inner classes -->
312 <xsl:for-each select="/*/branch[@bank = $bankName and not(@clientonly)]">
313 <xsl:call-template name="branch_header"/>
314 </xsl:for-each>
316 <!-- generate branch class instance -->
317 <xsl:for-each select="/*/branch[@bank = $bankName and not(@clientonly)]">
318 static <xsl:call-template name="makeBranchType"/> _<xsl:call-template name="makeBranchName"/><xsl:if test="@count">[<xsl:value-of select="@count"/>]</xsl:if><xsl:text>;
319 </xsl:text>
320 </xsl:for-each>
322 public:
324 // Constructor
325 CBankAccessor_<xsl:value-of select="@name"/>()
327 // make sure the static tree is initialised (some kind of lazy initialisation)
328 init();
330 // init the base class
331 <xsl:value-of select="@class"/>::init(BankTag);
334 <!-- generate init method -->
335 static void init();
337 <!-- generate branch accessors -->
338 <xsl:for-each select="/*/branch[@bank = $bankName and not(@clientonly)]">
339 <xsl:call-template name="branchAccess"/>
340 </xsl:for-each>
343 </xsl:for-each>
344 <xsl:call-template name="myApplyTemplate"/>
346 #endif // INCLUDED_<xsl:value-of select="concat($filename, '_', $bank)"/><xsl:text>_H
347 </xsl:text>
349 </xsl:template>
352 <!-- ######################################################### -->
353 <!-- ##### branch template (header) ####### -->
354 <!-- ######################################################### -->
355 <xsl:template name="branch_header" match="IDONTKNOWWHATSHOULDGOHERE" mode="header-server">
356 <xsl:if test="not(@clientonly='1')">
357 class <xsl:call-template name="makeBranchType"/>
359 public:
360 <!-- generate sub class member -->
361 <xsl:for-each select="branch[not(@clientonly)]"><xsl:call-template name="branch_header" /></xsl:for-each>
363 private:
364 ICDBStructNode *_BranchNode;
366 <!-- generate leaf -->
367 <xsl:for-each select="leaf[not(@clientonly)]">
368 <xsl:call-template name="leaf"/>
369 </xsl:for-each>
371 <!-- generate branch -->
372 <xsl:for-each select="branch[not(@clientonly)]">
373 <xsl:call-template name="branchInstance"/>
374 </xsl:for-each>
376 public:
377 void init(ICDBStructNode *parent<xsl:if test="@count">, uint index</xsl:if>);
379 // accessor to branch node
380 ICDBStructNode *getCDBNode()
382 return _BranchNode;
385 <!-- generate accessors -->
386 <xsl:for-each select="leaf[not(@clientonly)]">
387 <xsl:call-template name="leafAccess"/>
388 </xsl:for-each>
389 <xsl:for-each select="branch[not(@clientonly)]">
390 <xsl:call-template name="branchAccess"/>
391 </xsl:for-each>
393 </xsl:if>
394 </xsl:template>
396 <!-- ######################################################### -->
397 <!-- ##### branch template (cpp) ####### -->
398 <!-- ######################################################### -->
399 <xsl:template name="branch_cpp">
400 <xsl:if test="not(@clientonly='1')">
403 <!--ICDBStructNode *<xsl:call-template name="makeFullClassName"/>::_BranchNode;-->
405 <!-- generate class members-->
406 <!--
407 <xsl:for-each select="branch[not(@clientonly)]">
408 <xsl:call-template name="makeFullClassName"/><xsl:text> </xsl:text><xsl:for-each select=".."><xsl:call-template name="makeFullClassName"/></xsl:for-each>::_<xsl:call-template name="makeBranchName"/><xsl:if test="@count">[<xsl:value-of select="@count"/>]</xsl:if><xsl:text>;
409 </xsl:text>
410 </xsl:for-each>
411 <xsl:for-each select="leaf[not(@clientonly)]">
412 ICDBStructNode *<xsl:for-each select=".."><xsl:call-template name="makeFullClassName"/>::</xsl:for-each>_<xsl:value-of select="@name"/><xsl:if test="@count">[<xsl:value-of select="@count"/>]</xsl:if><xsl:text>;
413 </xsl:text>
414 </xsl:for-each>
417 <!-- generate init method -->
418 void <xsl:call-template name="makeFullClassName"/>::init(ICDBStructNode *parent<xsl:if test="@count">, uint index</xsl:if>)
420 ICDBStructNode *node = parent;
422 _BranchNode = node;
424 // leaf init
425 <xsl:for-each select="leaf[not(@clientonly)]">
426 <xsl:if test="not(@count)">
427 node = parent->getNode( ICDBStructNode::CTextId("<xsl:value-of select="@name"/>"), false );
428 nlassert(node != NULL);
429 _<xsl:value-of select="@name"/> = node;
430 </xsl:if>
431 <xsl:if test="@count">
432 for (uint i=0; i&lt;<xsl:value-of select="@count"/>; ++i)
434 node = parent->getNode( ICDBStructNode::CTextId(NLMISC::toString("<xsl:value-of select="@name"/>%u", i)), false );
435 nlassert(node != NULL);
436 _<xsl:value-of select="@name"/>[i] = node;
438 </xsl:if>
439 </xsl:for-each>
441 // branch init
442 <xsl:for-each select="branch[not(@clientonly)]">
443 <xsl:if test="not(@count)">
444 node = parent->getNode( ICDBStructNode::CTextId("<xsl:value-of select="@name"/>"), false );
445 nlassert(node != NULL);
446 _<xsl:call-template name="makeBranchName"/>.init(node);
447 </xsl:if>
448 <xsl:if test="@count">
449 for (uint i=0; i&lt;<xsl:value-of select="@count"/>; ++i)
451 node = parent->getNode( ICDBStructNode::CTextId(NLMISC::toString("<xsl:value-of select="@name"/>%u", i)), false );
452 nlassert(node != NULL);
453 _<xsl:call-template name="makeBranchName"/>[i].init(node, i);
455 </xsl:if>
456 </xsl:for-each>
459 <!-- generate inner classes methods -->
460 <xsl:for-each select="branch[not(@clientonly)]">
461 <xsl:call-template name="branch_cpp"/>
462 </xsl:for-each>
464 </xsl:if>
465 </xsl:template>
468 <!-- ######################################################### -->
469 <!-- ##### generate branch accessor ###### -->
470 <!-- ######################################################### -->
471 <xsl:template name="branchAccess">
472 <xsl:if test="not(@count)">
473 <xsl:if test="name(..) = 'database_description'">static </xsl:if><xsl:call-template name="makeBranchType"/> &amp;get<xsl:call-template name="makeBranchName"/>()
475 return _<xsl:call-template name="makeBranchName"/>;
477 </xsl:if>
478 <xsl:if test="@count">
479 <xsl:if test="name(..) = 'database_description'">static </xsl:if><xsl:call-template name="makeBranchType"/> &amp;get<xsl:call-template name="makeBranchName"/>(uint32 index)
481 nlassert(index &lt; <xsl:value-of select="@count"/>);
482 return _<xsl:call-template name="makeBranchName"/>[index];
484 </xsl:if>
485 </xsl:template>
487 <!-- ######################################################### -->
488 <!-- ##### generate leaf accessor ###### -->
489 <!-- ######################################################### -->
490 <xsl:template name="leafAccess">
491 <xsl:variable name="bankName" select="ancestor::*/@bank"/>
492 void set<xsl:value-of select="@name"/>(<xsl:value-of select="/*/bank_superclass/bank[@name = $bankName]/@class"/> &amp;dbGroup, <xsl:call-template name="makeLeafParamType"><xsl:with-param name="leafType" select="@type"/><xsl:with-param name="cppType" select="@cppType"/></xsl:call-template> value, bool forceSending = false)
494 <xsl:if test="not(@cppType) and not(substring(@type, 2) = '1' or substring(@type, 2) = '8' or substring(@type, 2) = '16' or substring(@type, 2) = '32' or substring(@type, 2) = '64')">
495 <!-- we can only test validity on simple types that are not of standard bit size-->
496 <xsl:if test="(substring(@type, 1, 1) = 'I' or substring(@type, 1, 1) = 'U')">
497 <!-- unsigned value -->
498 // Check that the value is not out of database precision
499 STOP_IF(value &gt; (1&lt;&lt;<xsl:value-of select="substring(@type, 2)"/>)-1, "set<xsl:value-of select="@name"/> : Value out of bound : trying to store "&lt;&lt;value&lt;&lt;" in a unsigned field limited to <xsl:value-of select="substring(@type, 2)"/> bits");
500 </xsl:if>
501 <xsl:if test="substring(@type, 1, 1) = 'S'">
502 <!-- signed value -->
503 // Check that the value is not out of database precision
504 if (value > 0)
505 STOP_IF(value &gt; (1&lt;&lt;(<xsl:value-of select="substring(@type, 2)"/>-1))-1, "set<xsl:value-of select="@name"/> : Value out of bound : trying to store "&lt;&lt;value&lt;&lt;" in a signed field limited to <xsl:value-of select="substring(@type, 2)"/> bits");
506 else
507 STOP_IF(value &lt; -(1&lt;&lt;(<xsl:value-of select="substring(@type, 2)"/>-1)), "set<xsl:value-of select="@name"/> : Value out of bound : trying to store "&lt;&lt;value&lt;&lt;" in a signed field limited to <xsl:value-of select="substring(@type, 2)"/> bits");
508 </xsl:if>
509 </xsl:if>
511 _setProp(dbGroup<xsl:value-of select="/*/bank_superclass/bank[@name = $bankName]/@dbAccessor"/>, _<xsl:value-of select="@name"/>, value, forceSending);
514 <xsl:call-template name="makeLeafParamType"><xsl:with-param name="leafType" select="@type"/><xsl:with-param name="cppType" select="@cppType"/></xsl:call-template> get<xsl:value-of select="@name"/>(const <xsl:value-of select="/*/bank_superclass/bank[@name = $bankName]/@class"/> &amp;dbGroup)
516 <xsl:call-template name="makeLeafType"><xsl:with-param name="leafType" select="@type"/><xsl:with-param name="cppType" select="@cppType"/></xsl:call-template> value;
517 _getProp(dbGroup<xsl:value-of select="/*/bank_superclass/bank[@name = $bankName]/@dbAccessor"/>, _<xsl:value-of select="@name"/>, value);
519 return value;
521 <xsl:if test="@type = 'TEXT'">
522 <!-- generate int accessor for text type -->
523 void set<xsl:value-of select="@name"/>(<xsl:value-of select="/*/bank_superclass/bank[@name = $bankName]/@class"/> &amp;dbGroup, uint32 stringId, bool forceSending = false)
525 _setProp(dbGroup<xsl:value-of select="/*/bank_superclass/bank[@name = $bankName]/@dbAccessor"/>, _<xsl:value-of select="@name"/>, stringId, forceSending);
527 uint32 get<xsl:value-of select="@name"/>_id(const <xsl:value-of select="/*/bank_superclass/bank[@name = $bankName]/@class"/> &amp;dbGroup)
529 uint32 value;
530 _getProp(dbGroup<xsl:value-of select="/*/bank_superclass/bank[@name = $bankName]/@dbAccessor"/>, _<xsl:value-of select="@name"/>, value);
532 return value;
534 </xsl:if>
535 ICDBStructNode *get<xsl:value-of select="@name"/>CDBNode()
537 return _<xsl:value-of select="@name"/>;
539 </xsl:template>
541 <!-- ######################################################### -->
542 <!-- ##### generate leaf declaration ###### -->
543 <!-- ######################################################### -->
544 <xsl:template name="leaf">
545 <xsl:if test="@count">
546 <xsl:text>ICDBStructNode *_</xsl:text><xsl:value-of select="@name"/>[<xsl:value-of select="@count"/>];
547 </xsl:if>
548 <xsl:if test="not(@count)">
549 <xsl:text>ICDBStructNode *_</xsl:text><xsl:value-of select="@name"/>;
550 </xsl:if>
551 </xsl:template>
553 <!-- ######################################################### -->
554 <!-- ##### generate branch declaration ###### -->
555 <!-- ######################################################### -->
556 <xsl:template name="branchInstance">
557 <xsl:if test="@count">
558 <xsl:text></xsl:text><xsl:call-template name="makeBranchType"/> _<xsl:call-template name="makeBranchName"/>[<xsl:value-of select="@count"/>];
559 </xsl:if>
560 <xsl:if test="not(@count)">
561 <xsl:text></xsl:text><xsl:call-template name="makeBranchType"/> _<xsl:call-template name="makeBranchName"/>;
562 </xsl:if>
563 </xsl:template>
565 <!-- ################################################################## -->
566 <!-- ##### generate leaf C++ group name (mainly for anonimous group ## -->
567 <!-- ################################################################## -->
568 <xsl:template name="makeBranchName">
569 <xsl:if test="@name = ''"><xsl:text>Array</xsl:text></xsl:if>
570 <xsl:if test="@name != ''"><xsl:value-of select="@name"/></xsl:if>
571 </xsl:template>
573 <xsl:template name="makeBranchType">
574 <xsl:if test="@name = ''"><xsl:text>TArray</xsl:text></xsl:if>
575 <xsl:if test="@name != ''">T<xsl:value-of select="@name"/></xsl:if>
576 </xsl:template>
579 <!-- ######################################################### -->
580 <!-- ##### generate leaf C++ convertion ###### -->
581 <!-- ######################################################### -->
583 <xsl:template name="convToUint64">
584 <xsl:choose>
585 <xsl:when test="@type = 'TEXT'"> <xsl:text>std::string</xsl:text></xsl:when>
587 </xsl:choose>
589 </xsl:template>
592 <!-- ######################################################### -->
593 <!-- ##### generate C++ param type ###### -->
594 <!-- ######################################################### -->
595 <xsl:template name="makeLeafParamType">
596 <xsl:param name="leafType"/>
597 <xsl:param name="cppType"/>
599 <xsl:if test="$cppType = 'TEXT'"><xsl:text>const </xsl:text></xsl:if>
600 <xsl:call-template name="makeLeafType"><xsl:with-param name="leafType" select="$leafType"/><xsl:with-param name="cppType" select="$cppType"/></xsl:call-template>
601 <xsl:if test="$cppType = 'TEXT'"><xsl:text> &amp;</xsl:text></xsl:if>
602 </xsl:template>
605 <!-- ######################################################### -->
606 <!-- ##### generate leaf C++ type ###### -->
607 <!-- ######################################################### -->
608 <xsl:template name="makeLeafType">
609 <xsl:param name="leafType"/>
610 <xsl:param name="cppType"/>
612 <xsl:if test="$cppType"><xsl:value-of select="$cppType"/></xsl:if>
613 <xsl:if test="not($cppType)">
614 <xsl:choose>
615 <xsl:when test="$leafType = 'I1'"> <xsl:text>bool</xsl:text> </xsl:when>
616 <xsl:when test="$leafType = 'I2'"> <xsl:text>uint8</xsl:text> </xsl:when>
617 <xsl:when test="$leafType = 'I3'"> <xsl:text>uint8</xsl:text> </xsl:when>
618 <xsl:when test="$leafType = 'I4'"> <xsl:text>uint8</xsl:text> </xsl:when>
619 <xsl:when test="$leafType = 'I5'"> <xsl:text>uint8</xsl:text> </xsl:when>
620 <xsl:when test="$leafType = 'I6'"> <xsl:text>uint8</xsl:text> </xsl:when>
621 <xsl:when test="$leafType = 'I7'"> <xsl:text>uint8</xsl:text> </xsl:when>
622 <xsl:when test="$leafType = 'I8'"> <xsl:text>uint8</xsl:text> </xsl:when>
623 <xsl:when test="$leafType = 'I9'"> <xsl:text>uint16</xsl:text> </xsl:when>
624 <xsl:when test="$leafType = 'I10'"> <xsl:text>uint16</xsl:text> </xsl:when>
625 <xsl:when test="$leafType = 'I11'"> <xsl:text>uint16</xsl:text> </xsl:when>
626 <xsl:when test="$leafType = 'I12'"> <xsl:text>uint16</xsl:text> </xsl:when>
627 <xsl:when test="$leafType = 'I13'"> <xsl:text>uint16</xsl:text> </xsl:when>
628 <xsl:when test="$leafType = 'I14'"> <xsl:text>uint16</xsl:text> </xsl:when>
629 <xsl:when test="$leafType = 'I15'"> <xsl:text>uint16</xsl:text> </xsl:when>
630 <xsl:when test="$leafType = 'I16'"> <xsl:text>uint16</xsl:text> </xsl:when>
631 <xsl:when test="$leafType = 'I17'"> <xsl:text>uint32</xsl:text> </xsl:when>
632 <xsl:when test="$leafType = 'I18'"> <xsl:text>uint32</xsl:text> </xsl:when>
633 <xsl:when test="$leafType = 'I19'"> <xsl:text>uint32</xsl:text> </xsl:when>
634 <xsl:when test="$leafType = 'I20'"> <xsl:text>uint32</xsl:text> </xsl:when>
635 <xsl:when test="$leafType = 'I21'"> <xsl:text>uint32</xsl:text> </xsl:when>
636 <xsl:when test="$leafType = 'I22'"> <xsl:text>uint32</xsl:text> </xsl:when>
637 <xsl:when test="$leafType = 'I23'"> <xsl:text>uint32</xsl:text> </xsl:when>
638 <xsl:when test="$leafType = 'I24'"> <xsl:text>uint32</xsl:text> </xsl:when>
639 <xsl:when test="$leafType = 'I25'"> <xsl:text>uint32</xsl:text> </xsl:when>
640 <xsl:when test="$leafType = 'I26'"> <xsl:text>uint32</xsl:text> </xsl:when>
641 <xsl:when test="$leafType = 'I27'"> <xsl:text>uint32</xsl:text> </xsl:when>
642 <xsl:when test="$leafType = 'I28'"> <xsl:text>uint32</xsl:text> </xsl:when>
643 <xsl:when test="$leafType = 'I29'"> <xsl:text>uint32</xsl:text> </xsl:when>
644 <xsl:when test="$leafType = 'I30'"> <xsl:text>uint32</xsl:text> </xsl:when>
645 <xsl:when test="$leafType = 'I31'"> <xsl:text>uint32</xsl:text> </xsl:when>
646 <xsl:when test="$leafType = 'I32'"> <xsl:text>uint32</xsl:text> </xsl:when>
647 <xsl:when test="$leafType = 'I33'"> <xsl:text>uint64</xsl:text> </xsl:when>
648 <xsl:when test="$leafType = 'I34'"> <xsl:text>uint64</xsl:text> </xsl:when>
649 <xsl:when test="$leafType = 'I35'"> <xsl:text>uint64</xsl:text> </xsl:when>
650 <xsl:when test="$leafType = 'I36'"> <xsl:text>uint64</xsl:text> </xsl:when>
651 <xsl:when test="$leafType = 'I37'"> <xsl:text>uint64</xsl:text> </xsl:when>
652 <xsl:when test="$leafType = 'I38'"> <xsl:text>uint64</xsl:text> </xsl:when>
653 <xsl:when test="$leafType = 'I39'"> <xsl:text>uint64</xsl:text> </xsl:when>
654 <xsl:when test="$leafType = 'I40'"> <xsl:text>uint64</xsl:text> </xsl:when>
655 <xsl:when test="$leafType = 'I41'"> <xsl:text>uint64</xsl:text> </xsl:when>
656 <xsl:when test="$leafType = 'I42'"> <xsl:text>uint64</xsl:text> </xsl:when>
657 <xsl:when test="$leafType = 'I43'"> <xsl:text>uint64</xsl:text> </xsl:when>
658 <xsl:when test="$leafType = 'I44'"> <xsl:text>uint64</xsl:text> </xsl:when>
659 <xsl:when test="$leafType = 'I45'"> <xsl:text>uint64</xsl:text> </xsl:when>
660 <xsl:when test="$leafType = 'I46'"> <xsl:text>uint64</xsl:text> </xsl:when>
661 <xsl:when test="$leafType = 'I47'"> <xsl:text>uint64</xsl:text> </xsl:when>
662 <xsl:when test="$leafType = 'I48'"> <xsl:text>uint64</xsl:text> </xsl:when>
663 <xsl:when test="$leafType = 'I49'"> <xsl:text>uint64</xsl:text> </xsl:when>
664 <xsl:when test="$leafType = 'I50'"> <xsl:text>uint64</xsl:text> </xsl:when>
665 <xsl:when test="$leafType = 'I51'"> <xsl:text>uint64</xsl:text> </xsl:when>
666 <xsl:when test="$leafType = 'I52'"> <xsl:text>uint64</xsl:text> </xsl:when>
667 <xsl:when test="$leafType = 'I53'"> <xsl:text>uint64</xsl:text> </xsl:when>
668 <xsl:when test="$leafType = 'I54'"> <xsl:text>uint64</xsl:text> </xsl:when>
669 <xsl:when test="$leafType = 'I55'"> <xsl:text>uint64</xsl:text> </xsl:when>
670 <xsl:when test="$leafType = 'I56'"> <xsl:text>uint64</xsl:text> </xsl:when>
671 <xsl:when test="$leafType = 'I57'"> <xsl:text>uint64</xsl:text> </xsl:when>
672 <xsl:when test="$leafType = 'I58'"> <xsl:text>uint64</xsl:text> </xsl:when>
673 <xsl:when test="$leafType = 'I59'"> <xsl:text>uint64</xsl:text> </xsl:when>
674 <xsl:when test="$leafType = 'I59'"> <xsl:text>uint64</xsl:text> </xsl:when>
675 <xsl:when test="$leafType = 'I60'"> <xsl:text>uint64</xsl:text> </xsl:when>
676 <xsl:when test="$leafType = 'I61'"> <xsl:text>uint64</xsl:text> </xsl:when>
677 <xsl:when test="$leafType = 'I62'"> <xsl:text>uint64</xsl:text> </xsl:when>
678 <xsl:when test="$leafType = 'I63'"> <xsl:text>uint64</xsl:text> </xsl:when>
679 <xsl:when test="$leafType = 'I64'"> <xsl:text>uint64</xsl:text> </xsl:when>
680 <xsl:when test="$leafType = 'S1'"> <xsl:text>sint8</xsl:text> </xsl:when>
681 <xsl:when test="$leafType = 'S2'"> <xsl:text>sint8</xsl:text> </xsl:when>
682 <xsl:when test="$leafType = 'S3'"> <xsl:text>sint8</xsl:text> </xsl:when>
683 <xsl:when test="$leafType = 'S4'"> <xsl:text>sint8</xsl:text> </xsl:when>
684 <xsl:when test="$leafType = 'S5'"> <xsl:text>sint8</xsl:text> </xsl:when>
685 <xsl:when test="$leafType = 'S6'"> <xsl:text>sint8</xsl:text> </xsl:when>
686 <xsl:when test="$leafType = 'S7'"> <xsl:text>sint8</xsl:text> </xsl:when>
687 <xsl:when test="$leafType = 'S8'"> <xsl:text>sint8</xsl:text> </xsl:when>
688 <xsl:when test="$leafType = 'S9'"> <xsl:text>sint16</xsl:text> </xsl:when>
689 <xsl:when test="$leafType = 'S10'"> <xsl:text>sint16</xsl:text> </xsl:when>
690 <xsl:when test="$leafType = 'S11'"> <xsl:text>sint16</xsl:text> </xsl:when>
691 <xsl:when test="$leafType = 'S12'"> <xsl:text>sint16</xsl:text> </xsl:when>
692 <xsl:when test="$leafType = 'S13'"> <xsl:text>sint16</xsl:text> </xsl:when>
693 <xsl:when test="$leafType = 'S14'"> <xsl:text>sint16</xsl:text> </xsl:when>
694 <xsl:when test="$leafType = 'S15'"> <xsl:text>sint16</xsl:text> </xsl:when>
695 <xsl:when test="$leafType = 'S16'"> <xsl:text>sint16</xsl:text> </xsl:when>
696 <xsl:when test="$leafType = 'S17'"> <xsl:text>sint32</xsl:text> </xsl:when>
697 <xsl:when test="$leafType = 'S18'"> <xsl:text>sint32</xsl:text> </xsl:when>
698 <xsl:when test="$leafType = 'S19'"> <xsl:text>sint32</xsl:text> </xsl:when>
699 <xsl:when test="$leafType = 'S20'"> <xsl:text>sint32</xsl:text> </xsl:when>
700 <xsl:when test="$leafType = 'S21'"> <xsl:text>sint32</xsl:text> </xsl:when>
701 <xsl:when test="$leafType = 'S22'"> <xsl:text>sint32</xsl:text> </xsl:when>
702 <xsl:when test="$leafType = 'S23'"> <xsl:text>sint32</xsl:text> </xsl:when>
703 <xsl:when test="$leafType = 'S24'"> <xsl:text>sint32</xsl:text> </xsl:when>
704 <xsl:when test="$leafType = 'S25'"> <xsl:text>sint32</xsl:text> </xsl:when>
705 <xsl:when test="$leafType = 'S26'"> <xsl:text>sint32</xsl:text> </xsl:when>
706 <xsl:when test="$leafType = 'S27'"> <xsl:text>sint32</xsl:text> </xsl:when>
707 <xsl:when test="$leafType = 'S28'"> <xsl:text>sint32</xsl:text> </xsl:when>
708 <xsl:when test="$leafType = 'S29'"> <xsl:text>sint32</xsl:text> </xsl:when>
709 <xsl:when test="$leafType = 'S30'"> <xsl:text>sint32</xsl:text> </xsl:when>
710 <xsl:when test="$leafType = 'S31'"> <xsl:text>sint32</xsl:text> </xsl:when>
711 <xsl:when test="$leafType = 'S32'"> <xsl:text>sint32</xsl:text> </xsl:when>
712 <xsl:when test="$leafType = 'S33'"> <xsl:text>sint64</xsl:text> </xsl:when>
713 <xsl:when test="$leafType = 'S34'"> <xsl:text>sint64</xsl:text> </xsl:when>
714 <xsl:when test="$leafType = 'S35'"> <xsl:text>sint64</xsl:text> </xsl:when>
715 <xsl:when test="$leafType = 'S36'"> <xsl:text>sint64</xsl:text> </xsl:when>
716 <xsl:when test="$leafType = 'S37'"> <xsl:text>sint64</xsl:text> </xsl:when>
717 <xsl:when test="$leafType = 'S38'"> <xsl:text>sint64</xsl:text> </xsl:when>
718 <xsl:when test="$leafType = 'S39'"> <xsl:text>sint64</xsl:text> </xsl:when>
719 <xsl:when test="$leafType = 'S40'"> <xsl:text>sint64</xsl:text> </xsl:when>
720 <xsl:when test="$leafType = 'S41'"> <xsl:text>sint64</xsl:text> </xsl:when>
721 <xsl:when test="$leafType = 'S42'"> <xsl:text>sint64</xsl:text> </xsl:when>
722 <xsl:when test="$leafType = 'S43'"> <xsl:text>sint64</xsl:text> </xsl:when>
723 <xsl:when test="$leafType = 'S44'"> <xsl:text>sint64</xsl:text> </xsl:when>
724 <xsl:when test="$leafType = 'S45'"> <xsl:text>sint64</xsl:text> </xsl:when>
725 <xsl:when test="$leafType = 'S46'"> <xsl:text>sint64</xsl:text> </xsl:when>
726 <xsl:when test="$leafType = 'S47'"> <xsl:text>sint64</xsl:text> </xsl:when>
727 <xsl:when test="$leafType = 'S48'"> <xsl:text>sint64</xsl:text> </xsl:when>
728 <xsl:when test="$leafType = 'S49'"> <xsl:text>sint64</xsl:text> </xsl:when>
729 <xsl:when test="$leafType = 'S50'"> <xsl:text>sint64</xsl:text> </xsl:when>
730 <xsl:when test="$leafType = 'S51'"> <xsl:text>sint64</xsl:text> </xsl:when>
731 <xsl:when test="$leafType = 'S52'"> <xsl:text>sint64</xsl:text> </xsl:when>
732 <xsl:when test="$leafType = 'S53'"> <xsl:text>sint64</xsl:text> </xsl:when>
733 <xsl:when test="$leafType = 'S54'"> <xsl:text>sint64</xsl:text> </xsl:when>
734 <xsl:when test="$leafType = 'S55'"> <xsl:text>sint64</xsl:text> </xsl:when>
735 <xsl:when test="$leafType = 'S56'"> <xsl:text>sint64</xsl:text> </xsl:when>
736 <xsl:when test="$leafType = 'S57'"> <xsl:text>sint64</xsl:text> </xsl:when>
737 <xsl:when test="$leafType = 'S58'"> <xsl:text>sint64</xsl:text> </xsl:when>
738 <xsl:when test="$leafType = 'S59'"> <xsl:text>sint64</xsl:text> </xsl:when>
739 <xsl:when test="$leafType = 'S59'"> <xsl:text>sint64</xsl:text> </xsl:when>
740 <xsl:when test="$leafType = 'S60'"> <xsl:text>sint64</xsl:text> </xsl:when>
741 <xsl:when test="$leafType = 'S61'"> <xsl:text>sint64</xsl:text> </xsl:when>
742 <xsl:when test="$leafType = 'S62'"> <xsl:text>sint64</xsl:text> </xsl:when>
743 <xsl:when test="$leafType = 'S63'"> <xsl:text>sint64</xsl:text> </xsl:when>
744 <xsl:when test="$leafType = 'S64'"> <xsl:text>sint64</xsl:text> </xsl:when>
746 <xsl:when test="$leafType = 'TEXT'"> <xsl:text>ucstring</xsl:text> </xsl:when>
747 <xsl:otherwise> <xsl:message terminate="yes">Unsupported leaf type <xsl:value-of select="$leafType"/></xsl:message></xsl:otherwise>
748 </xsl:choose>
749 </xsl:if>
750 </xsl:template>
751 </xsl:stylesheet>