summaryrefslogtreecommitdiffstats
path: root/1.4.0/dom/codeGen/1.4/tpl
diff options
context:
space:
mode:
Diffstat (limited to '1.4.0/dom/codeGen/1.4/tpl')
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/template-engine.php469
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-class-def.php475
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-constants-cpp-file.php16
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-constants-cpp.php36
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-constants-file.php16
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-constants.php42
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-cpp-body.php25
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-cpp-methods.php462
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-cpp-static.php29
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-cpp.php16
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-dot-h.php28
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-doxygen.php38
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-elements-file.php16
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-elements.php31
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-header.php16
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-include-list.php13
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-includes.php32
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-types-cpp-file.php16
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-types-cpp.php136
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-types-header-file.php16
-rw-r--r--1.4.0/dom/codeGen/1.4/tpl/tpl-types-header.php172
21 files changed, 2100 insertions, 0 deletions
diff --git a/1.4.0/dom/codeGen/1.4/tpl/template-engine.php b/1.4.0/dom/codeGen/1.4/tpl/template-engine.php
new file mode 100644
index 0000000..d0160c1
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/template-engine.php
@@ -0,0 +1,469 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+$_globals = array();
+// FLAG: Full Code - set true to output verbose mode, minimal otherwise (does not include// inline elements in minimal)
+$_globals['full_code'] = true;
+$_globals['copyright'] = false;
+$_globals['copyright_text'] = "/*\n" .
+" * Copyright 2006 Sony Computer Entertainment Inc.\n" .
+" *\n" .
+" * Licensed under the SCEA Shared Source License, Version 1.0 (the \"License\"); you may not use this\n" .
+" * file except in compliance with the License. You may obtain a copy of the License at:\n" .
+" * http://research.scea.com/scea_shared_source_license.html\n" .
+" *\n" .
+" * Unless required by applicable law or agreed to in writing, software distributed under the License\n" .
+" * is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n" .
+" * implied. See the License for the specific language governing permissions and limitations under the\n" .
+" * License.\n" .
+" */\n\n";
+
+$_globals['depth'] = 0;
+$_globals['meta_prefix'] = 'dae';
+$_globals['prefix'] = 'dom';
+$_globals['language'] = 'en';
+$_globals['dom_dir'] = 'gen/dom/';
+$_globals['tmp_dir'] = 'tmp/';
+$_globals['log_file'] = 'gen/gen.log';
+
+$_globals['register_list'] = array();
+$_globals['include_list'] = array();
+$_globals['complex_types'] = array();
+$_globals['groups'] = array();
+$_globals['constStrings'] = array(); //used to store all the constant strings needed to be put in the file.
+$_globals['elementTypes'] = array();
+$_globals['elementNames'] = array();
+$_globals['elementNames'][] = "COLLADA"; //needed because no elements have this as a child.
+$_globals['typeID'] = 0;
+
+$_globals['target_dir'] = '';
+
+$_globals['global_elements'] = array();
+
+$_globals['templates'] = array(
+ 'DOXYGEN' => 'tpl/tpl-doxygen.php',
+ 'TYPES_HEADER_FILE' => 'tpl/tpl-types-header-file.php',
+ 'TYPES_HEADER' => 'tpl/tpl-types-header.php',
+ 'TYPES_CPP_FILE' => 'tpl/tpl-types-cpp-file.php',
+ 'TYPES_CPP' => 'tpl/tpl-types-cpp.php',
+ 'INCLUDES' => 'tpl/tpl-includes.php',
+ 'HEADER' => 'tpl/tpl-dot-h.php',
+ 'HEADER_FILE' => 'tpl/tpl-header.php',
+ 'INCLUDE_LIST' => 'tpl/tpl-include-list.php',
+ 'CPP_FILE' => 'tpl/tpl-cpp.php',
+ 'CPP' => 'tpl/tpl-cpp-body.php',
+ 'CPP_STATIC' => 'tpl/tpl-cpp-static.php',
+ 'CPP_METHODS' => 'tpl/tpl-cpp-methods.php',
+ 'CLASS' => 'tpl/tpl-class-def.php',
+ 'ELEMENTS_FILE' => 'tpl/tpl-elements-file.php',
+ 'ELEMENTS' => 'tpl/tpl-elements.php',
+ 'CONSTANTS_FILE' => 'tpl/tpl-constants-file.php',
+ 'CONSTANTS' => 'tpl/tpl-constants.php',
+ 'CONSTANTS_CPP_FILE' => 'tpl/tpl-constants-cpp-file.php',
+ 'CONSTANTS_CPP' => 'tpl/tpl-constants-cpp.php'
+);
+
+function applyTemplate( $template, & $bag )
+{
+ global $_globals;
+
+ $_result = '';
+ if ( array_key_exists( $template, $_globals['templates'] ) )
+ {
+ ob_start();
+ include( $_globals['templates'][ $template ] );
+
+ $_result = ob_get_contents();
+ ob_end_clean();
+ }
+ return $_result;
+}
+
+function initGen( $file )
+{
+ global $_globals;
+
+ // A few defns
+ $_globals['gen_start_time'] = date( "M d Y H:i:s" );
+ $_globals['file_name'] = $file;
+
+ // Verify target dirs exist, create if not
+ makeGenDir( getcwd() . "/gen" );
+ makeGenDir( getcwd() . "/" . $_globals['dom_dir'] );
+ makeGenDir( getcwd() . "/" . $_globals['dom_dir'] . 'include/' );
+ makeGenDir( getcwd() . "/" . $_globals['dom_dir'] . 'src/' );
+
+ // Start buffering output
+ ob_start();
+}
+
+function makeGenDir( $dir )
+{
+ if ( !is_dir( $dir ) )
+ {
+ if ( !mkdir( $dir ) )
+ {
+ die( "Could not create directory $dir\n" );
+ }
+ }
+}
+
+function cleanupGen()
+{
+ global $_globals;
+
+ // Get output buffer
+ $_result = ob_get_contents();
+ ob_end_clean();
+ // Assemble report
+ ob_start();
+ print "========================================\n\n";
+ print " Code Generation\n\n";
+ print "----------------------------------------\n";
+ print "COLLADA File: " . $_globals['file_name'] . "\n";
+ print "Start time: " . $_globals['gen_start_time'] . "\n";
+ print "End time: " . date( "M d Y H:i:s" ) . "\n";
+ print "----------------------------------------\n\n";
+ print $_result;
+ print "\r\n\r\nend\r\n";
+ file_put_contents( $_globals['log_file'], ob_get_contents() );
+ ob_end_clean();
+ print "Generation complete\n";
+}
+
+function saveTemplate( $file, $template, & $bag )
+{
+ $bytes = file_put_contents( $file, applyTemplate( $template, $bag ) );
+}
+
+function printAllSubChildren( & $elem, $prefix, $suffix ) {
+ //print "subchild test count = ". count( $elem['elements'] ) ."\n";
+ //print "subchild test name = ". $elem['element_name'] ."\n";
+ global $_globals;
+ global $meta;
+ for ( $i = 0; $i < count( $elem['elements'] ); $i++ ) {
+ if ( isset( $meta[$elem['elements'][$i]] ) ) {
+ if ( $meta[$elem['elements'][$i]]['isAGroup'] ) {
+
+ printAllSubChildren( $meta[$elem['elements'][$i]], $prefix, $suffix );
+ }
+ else if ( !$meta[$elem['elements'][$i]]['abstract'] ) {
+ print $prefix ."_Meta->children.append(\"". $elem['elements'][$i] ."\");". $suffix;
+ print ");\n";
+ }
+ for( $c = 0; $c < count( $meta[$elem['elements'][$i]]['substitutableWith']); $c++ ) {
+ $subwith = $meta[$elem['elements'][$i]]['substitutableWith'][$c];
+ print $prefix ."_Meta->children.append(\"". $subwith ."\");". $suffix;
+ print ");\n";
+ }
+ }
+ else {
+ print $prefix . $elem['elements'][$i] . $suffix;
+ if ( isset($meta[$elem['element_attrs'][ $elem['elements'][$i] ]['type']]) &&
+ $meta[$elem['element_attrs'][ $elem['elements'][$i] ]['type']]['isAComplexType'] ) {
+ print ", \"". $elem['element_attrs'][ $elem['elements'][$i] ]['type'] ."\"";
+ }
+ print ");\n";
+ }
+ }
+}
+
+function getInheritanceStatement($baseClasses) {
+ if (count($baseClasses) == 0)
+ return "";
+ $statement = " : public " . $baseClasses[0];
+ for ($i = 1; $i < count($baseClasses); $i++)
+ $statement .= ", public " . $baseClasses[$i];
+ return $statement;
+}
+
+function beginConstructorInitializer(& $initializerListStarted) {
+ print $initializerListStarted ? ", " : " : ";
+ $initializerListStarted = true;
+}
+
+function printBaseClassInitializers($elemName, $baseClasses, & $initializerListStarted) {
+ $elt = strpos($elemName, "_complexType") === false ? "this" : "elt";
+ for ($i = 0; $i < count($baseClasses); $i++) {
+ beginConstructorInitializer($initializerListStarted);
+ print $baseClasses[$i] .
+ (strpos($baseClasses[$i], "_complexType") !== false ? "(dae, " . $elt . ")" : "(dae)");
+ }
+}
+
+function printConstructors( $elemName, & $bag, $baseClasses, $indent ) {
+ //print the protected ctor and copy stuff
+ print $indent ."protected:\n";
+ print $indent ."\t/**\n". $indent ."\t * Constructor\n". $indent ."\t */\n";
+ print $indent ."\t". $elemName ."(DAE& dae";
+ if ($bag['isAComplexType'])
+ print ", daeElement* elt";
+ print ")";
+ $initializerListStarted = false;
+ $eltVar = $bag['isAComplexType'] ? "*elt" : "*this";
+
+ printBaseClassInitializers($elemName, $baseClasses, $initializerListStarted);
+
+ if ($bag['useXMLNS']) {
+ beginConstructorInitializer($initializerListStarted);
+ print "attrXmlns(dae, " . $eltVar . ")";
+ }
+
+ // Constructor initialization of attributes
+ if (count($bag['attributes']) > 0) {
+ foreach( $bag['attributes'] as $attr_name => & $a_list ) {
+ beginConstructorInitializer($initializerListStarted);
+
+ $attr_name = ucfirst($attr_name);
+ $type = $a_list['type'];
+ print "attr" . $attr_name . "(";
+ if ($type == 'xs:anyURI' || $type == 'URIFragmentType')
+ print "dae, " . $eltVar;
+ else if ($type == 'xs:IDREF')
+ print $eltVar;
+ else if ($type == 'xs:IDREFS')
+ print "new xsIDREF(" . $eltVar . ")";
+ print ")";
+ }
+ }
+
+ // Constructor initialization of elements
+ for( $i=0; $i<count( $bag['elements'] ); $i++ ) {
+ $maxOccurs = $bag['element_attrs'][ $bag['elements'][$i] ]['maxOccurs'];
+ $maxOccurs = ($maxOccurs == 'unbounded' || $maxOccurs > 1);
+ beginConstructorInitializer($initializerListStarted);
+ print "elem" . ucfirst($bag['elements'][$i]) . ($maxOccurs ? "_array" : "") . "()";
+ }
+
+ if ( ($bag['content_type'] != '' || $bag['mixed']) && !$bag['abstract'] ) {
+ beginConstructorInitializer($initializerListStarted);
+ if ($bag['content_type'] == 'xs:anyURI' || $bag['content_type'] == 'URIFragmentType')
+ print "_value(dae, " . $eltVar . ")";
+ else if ($bag['content_type'] == 'xs:IDREF')
+ print "_value(" . $eltVar . ")";
+ else if ($bag['content_type'] == 'xs:IDREFS')
+ print "_value(new xsIDREF(" . $eltVar . "))";
+ else
+ print "_value()";
+ }
+ print " {}\n";
+
+ print $indent ."\t/**\n". $indent ."\t * Destructor\n". $indent ."\t */\n";
+ print $indent ."\tvirtual ~". $elemName ."() {";
+ if ( $bag['hasChoice'] ) {
+ print " daeElement::deleteCMDataArray(_CMData); ";
+ }
+ print "}\n";
+
+ print $indent ."\t/**\n". $indent ."\t * Overloaded assignment operator\n". $indent ."\t */\n";
+ print $indent ."\tvirtual ".$elemName ." &operator=( const ".$elemName ." &cpy ) { (void)cpy; return *this; }\n";
+}
+
+function printAttributes( & $bag, & $typemeta, & $indent, $vaa ) {
+ global $_globals;
+
+ $attrCnt = 0;
+ if ( $bag['useXMLNS'] ) {
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the xmlns attribute.\n";
+ print $indent ."\t * @return Returns a xsAnyURI reference of the xmlns attribute.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\txsAnyURI &getXmlns() { return attrXmlns; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the xmlns attribute.\n";
+ print $indent ."\t * @return Returns a constant xsAnyURI reference of the xmlns attribute.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tconst xsAnyURI &getXmlns() const { return attrXmlns; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Sets the xmlns attribute.\n";
+ print $indent ."\t * @param xmlns The new value for the xmlns attribute.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tvoid setXmlns( const xsAnyURI &xmlns ) { attrXmlns = xmlns;";
+ if ( $vaa ) {
+ print $indent ."\n\t _validAttributeArray[". $attrCnt ."] = true;";
+ }
+ print " }\n\n";
+
+ $attrCnt++;
+ }
+
+ foreach( $bag['attributes'] as $attr_name => & $a_list ) {
+ $type = $a_list['type'];
+ if ( preg_match( "/xs\:/", $type ) ) {
+ $type = substr( $type, 3 );
+ $pre = "xs";
+ }
+ else {
+ $pre = $_globals['prefix'];
+ }
+ if ( $type == '' )
+ {
+ $type = "String";
+ }
+ $baseStringTypes = "xsDateTime xsID xsNCName xsNMTOKEN xsName xsToken xsString";
+ $baseType = $pre . ucfirst( $type );
+ if ( isset( $typemeta[$type] ) ) {
+ $typeInfo = $typemeta[$type];
+ while ( $typeInfo['base'] != '' && isset( $typemeta[$typeInfo['base']] ) ) {
+ $typeInfo = $typemeta[$typeInfo['base']];
+ if ( preg_match( "/xs\:/", $typeInfo['type'] ) ) {
+ $baseType = "xs" . ucfirst( substr( $typeInfo['type'], 3 ) );
+ }
+ else {
+ $baseType = $_globals['prefix'] . ucfirst( $typeInfo['type'] );
+ }
+ }
+ }
+
+ if ( (isset( $typemeta[$type] ) && $typemeta[$type]['isArray']) || $type == 'IDREFS' ) {
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the ". $attr_name ." array attribute.\n";
+ print $indent ."\t * @return Returns a ". $pre . ucfirst( $type ) ." reference of the ". $attr_name ." array attribute.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\t" . $pre . ucfirst( $type ) . " &get" . ucfirst($attr_name) ."() { ";
+ print "return attr". ucfirst($attr_name) ."; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the ". $attr_name ." array attribute.\n";
+ print $indent ."\t * @return Returns a constant ". $pre . ucfirst( $type ) ." reference of the ". $attr_name ." array attribute.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tconst " . $pre . ucfirst( $type ) . " &get" . ucfirst($attr_name) ."() const { ";
+ print "return attr". ucfirst($attr_name) ."; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Sets the ". $attr_name ." array attribute.\n";
+ print $indent ."\t * @param at". ucfirst($attr_name)." The new value for the ". $attr_name ." array attribute.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tvoid set". ucfirst( $attr_name ) ."( const ". $pre . ucfirst( $type ) ." &at";
+ print ucfirst($attr_name) ." ) { attr". ucfirst($attr_name) ." = at". ucfirst($attr_name) .";";
+ if ( $vaa ) {
+ print " _validAttributeArray[". $attrCnt ."] = true;";
+ }
+ print " }\n\n";
+ }
+ else if ( ucfirst($type) == 'AnyURI' || ucfirst($type) == 'URIFragmentType' ) {
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the ". $attr_name ." attribute.\n";
+ print $indent ."\t * @return Returns a ". $pre . ucfirst( $type ) ." reference of the ". $attr_name ." attribute.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\t" . $pre . ucfirst( $type ) . " &get" . ucfirst($attr_name) ."() { ";
+ print "return attr". ucfirst($attr_name) ."; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the ". $attr_name ." attribute.\n";
+ print $indent ."\t * @return Returns a constant ". $pre . ucfirst( $type ) ." reference of the ". $attr_name ." attribute.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tconst " . $pre . ucfirst( $type ) . " &get" . ucfirst($attr_name) ."() const { ";
+ print "return attr". ucfirst($attr_name) ."; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Sets the ". $attr_name ." attribute.\n";
+ print $indent ."\t * @param at". ucfirst($attr_name)." The new value for the ". $attr_name ." attribute.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tvoid set". ucfirst( $attr_name ) ."( const ". $pre . ucfirst( $type ) ." &at";
+ print ucfirst($attr_name) ." ) { attr". ucfirst($attr_name) ." = at". ucfirst($attr_name) .";";
+ if ( $vaa ) {
+ print " _validAttributeArray[". $attrCnt ."] = true;";
+ }
+ print " }\n";
+ // We add a setter that takes a plain string to help with backward compatibility
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Sets the ". $attr_name ." attribute.\n";
+ print $indent ."\t * @param at". ucfirst($attr_name)." The new value for the ". $attr_name ." attribute.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tvoid set". ucfirst( $attr_name ) ."( xsString at";
+ print ucfirst($attr_name) ." ) { attr". ucfirst($attr_name) ." = at" . ucfirst($attr_name) . ";";
+ if ( $vaa ) {
+ print " _validAttributeArray[". $attrCnt ."] = true;";
+ }
+ print " }\n\n";
+ }
+ else if( ucfirst($type) == 'IDREF' ) {
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the ". $attr_name ." attribute.\n";
+ print $indent ."\t * @return Returns a ". $pre . ucfirst( $type ) ." reference of the ". $attr_name ." attribute.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\t" . $pre . ucfirst( $type ) . " &get" . ucfirst($attr_name) ."() { ";
+ print "return attr". ucfirst($attr_name) ."; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the ". $attr_name ." attribute.\n";
+ print $indent ."\t * @return Returns a constant ". $pre . ucfirst( $type ) ." reference of the ". $attr_name ." attribute.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tconst " . $pre . ucfirst( $type ) . " &get" . ucfirst($attr_name) ."() const{ ";
+ print "return attr". ucfirst($attr_name) ."; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Sets the ". $attr_name ." attribute.\n";
+ print $indent ."\t * @param at". ucfirst($attr_name)." The new value for the ". $attr_name ." attribute.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tvoid set". ucfirst( $attr_name ) ."( const ". $pre . ucfirst( $type ) ." &at";
+ print ucfirst($attr_name) ." ) { attr". ucfirst($attr_name) ." = at". ucfirst($attr_name) .";";
+ if ( $vaa ) {
+ print " _validAttributeArray[". $attrCnt ."] = true;";
+ }
+ print " }\n\n";
+ }
+ else if ( strstr( $baseStringTypes, $baseType ) !== FALSE && count( $a_list['enum'] ) == 0 ) {
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the ". $attr_name ." attribute.\n";
+ print $indent ."\t * @return Returns a ". $pre . ucfirst( $type ) ." of the ". $attr_name ." attribute.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\t" . $pre . ucfirst( $type ) . " get" . ucfirst($attr_name) ."() const { ";
+ print "return attr". ucfirst($attr_name) ."; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Sets the ". $attr_name ." attribute.\n";
+ print $indent ."\t * @param at". ucfirst($attr_name)." The new value for the ". $attr_name ." attribute.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tvoid set". ucfirst( $attr_name ) ."( ". $pre . ucfirst( $type ) ." at";
+ print ucfirst($attr_name) ." ) { *(daeStringRef*)&attr". ucfirst($attr_name) ." = at". ucfirst($attr_name) .";";
+ if ( $vaa ) {
+ print " _validAttributeArray[". $attrCnt ."] = true; ";
+ }
+ if ( $attr_name == "id" )
+ {
+ print "\n". $indent ."\t\tif( _document != NULL ) _document->changeElementID( this, attrId );\n". $indent ."\t";
+ }
+
+ print "}\n\n";
+ }
+ else {
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the ". $attr_name ." attribute.\n";
+ print $indent ."\t * @return Returns a ". $pre . ucfirst( $type ) ." of the ". $attr_name ." attribute.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\t" . $pre . ucfirst( $type ) . " get" . ucfirst($attr_name) ."() const { ";
+ print "return attr". ucfirst($attr_name) ."; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Sets the ". $attr_name ." attribute.\n";
+ print $indent ."\t * @param at". ucfirst($attr_name)." The new value for the ". $attr_name ." attribute.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tvoid set". ucfirst( $attr_name ) ."( ". $pre . ucfirst( $type ) ." at";
+ print ucfirst($attr_name) ." ) { attr". ucfirst($attr_name) ." = at". ucfirst($attr_name) .";";
+ if ( $vaa ) {
+ print " _validAttributeArray[". $attrCnt ."] = true;";
+ }
+ print " }\n\n";
+ }
+ $attrCnt++;
+ }
+}
+
+?> \ No newline at end of file
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-class-def.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-class-def.php
new file mode 100644
index 0000000..700106e
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-class-def.php
@@ -0,0 +1,475 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+ global $meta;
+ global $typemeta;
+
+ // shorthand:
+ $full_element_name = $_globals['prefix'] . ucfirst( $bag['element_name'] );
+ //COLLADA TYPE list
+ if ( array_search( $bag['element_name'], $_globals['elementTypes'] ) === FALSE )
+ {
+ $_globals['elementTypes'][] = $bag['element_name'];
+ }
+ //COLLADA ELEMENT list
+ for( $i=0; $i<count( $bag['elements'] ); $i++ )
+ {
+ if ( array_search( $bag['elements'][$i], $_globals['elementNames'] ) === FALSE )
+ {
+ $_globals['elementNames'][] = $bag['elements'][$i];
+ }
+ }
+ if ( $bag['substitution_group'] != '' )
+ {
+ //also add this element to the list of elements.
+ if ( array_search( $bag['element_name'], $_globals['elementNames'] ) === FALSE )
+ {
+ $_globals['elementNames'][] = $bag['element_name'];
+ }
+ }
+
+ $indent = "";
+ for ($i = 0; $i < $GLOBALS['indentNum']; $i++ ) {
+ $indent .= "\t";
+ }
+ if ( $GLOBALS['indentNum'] > 0 ) { //only print these for the inner classes.. the main classes will have
+ //them defined in a seperate file to avoid circular includes.
+ print $indent."class " . $full_element_name . ";\n\n";
+ print $indent ."typedef daeSmartRef<". $full_element_name ."> ". $full_element_name ."Ref;\n";
+ print $indent ."typedef daeTArray<". $full_element_name ."Ref> ". $full_element_name ."_Array;\n\n";
+ }
+
+ // DOCUMENTATION
+ if ( isset( $bag['documentation'][ $_globals['language'] ] ) )
+ {
+ print applyTemplate( 'DOXYGEN', $bag['documentation'][ $_globals['language'] ] );
+ }
+
+ // SUBSTITION GROUP/INHERITANCE
+ $baseClasses = array();
+ if ( $bag['isAComplexType'] ) {
+ if ( $bag['complex_type'] )
+ $baseClasses[] = $_globals['prefix'] . ucfirst( $bag['base_type'] ) . "_complexType";
+ print $indent ."class ". $full_element_name ."_complexType ".
+ getInheritanceStatement($baseClasses) ."\n".$indent."{\n";
+ }
+ else {
+ $baseClasses[] = ($bag['substitution_group'] != '' ? $_globals['prefix'] . ucfirst($bag['substitution_group']) : 'daeElement');
+ if ( $bag['complex_type'] )
+ $baseClasses[] = $_globals['prefix'] . ucfirst( $bag['base_type'] ) . "_complexType";
+ print $indent ."class ". $full_element_name . getInheritanceStatement($baseClasses) . "\n".$indent."{\n";
+ print $indent ."public:\n";
+ print $indent ."\tvirtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::". strtoupper($bag['element_name']) ."; }\n";
+ print $indent ."\tstatic daeInt ID() { return ". $_globals['typeID']++ ."; }\n";
+ print $indent ."\tvirtual daeInt typeID() const { return ID(); }\n";
+ }
+
+ // INTERNAL CLASSES
+ $result = '';
+ $inlines = array_keys( $bag['inline_elements'] );
+ for( $i=0; $i<count( $inlines ); $i++ )
+ {
+ $inner = $bag['inline_elements'][ $inlines[$i] ];
+ if ( !$inner['complex_type'] || $inner['isRestriction'] || $inner['isExtension'] ) {
+ $GLOBALS['indentNum']++;
+ $result .= applyTemplate( 'CLASS', $inner );
+ $GLOBALS['indentNum']--;
+ }
+ }
+ if ( strlen( $result ) > 0 ) { print $indent ."public:\n$result\n"; }
+
+ //ENUM
+ if ( $bag['simple_type'] != NULL ) {
+ $typeMeta = $bag['simple_type']->getMeta();
+ //print $typeMeta['type'];
+ if ( count( $typeMeta['enum'] ) > 0 )
+ {
+ //print "has enums";
+ print $indent ."public: //ENUM\n";
+ if ( !$typeMeta['useConstStrings'] ) {
+ //Decided to name mangle the enum constants so they are more descriptive and avoid collisions
+ if ( isset( $typeMeta['documentation']['en'] ) ) {
+ print applyTemplate( 'DOXYGEN', $typeMeta['documentation']['en'] );
+ }
+ print "enum " . $_globals['prefix'] . ucfirst( $typeMeta['type'] ) . "_type {\n";
+ //print "\t" . strtoupper( $typeMeta['type'] ) . "_" . $typeMeta['enum'][0] ." = 1";
+ for( $i = 0; $i < count( $typeMeta['enum'] ); $i++ ) {
+ //print ",";
+ print "\t" . strtoupper( $typeMeta['type'] ) . "_" . $typeMeta['enum'][$i] .",";
+ if ( isset( $typeMeta['enum_documentation'][$i] ) ) {
+ print "\t\t/**< ". $typeMeta['enum_documentation'][$i] ." */";
+ }
+ //print "\n\t" . strtoupper( $typeMeta['type'] ) . "_" . $typeMeta['enum'][$i];
+ print "\n";
+ }
+ //if ( isset( $typeMeta['enum_documentation'][count( $typeMeta['enum'] )-1] ) ) {
+ // print "\t\t/**< ". $typeMeta['enum_documentation'][count( $typeMeta['enum'] )-1] ." */";
+ //}
+ print "\t". strtoupper( $typeMeta['type'] ) . "_COUNT";
+ print "\n};\n\n";
+ }
+ else {
+ //if ( isset( $typeMeta['documentation']['en'] ) ) {
+ // $_globals['constStrings'][] = applyTemplate( 'DOXYGEN', $typeMeta['documentation']['en'] );
+ //}
+ for( $i = 0; $i < count( $typeMeta['enum'] ); $i++ ) {
+ //print "static const daeString ". strtoupper( $typeMeta['type'] ) . "_" . $typeMeta['enum'][$i];
+ //print " = \"". $typeMeta['enum'][$i] ."\";\n";
+ if ( isset( $typeMeta['enum_documentation'][$i] ) ) {
+ $_globals['constStrings'][] = "/**\n * ". $typeMeta['enum_documentation'][$i] ."\n */\n";
+ }
+ $conststrnm = strtoupper( $typeMeta['type'] ) . "_" . $typeMeta['enum'][$i];
+ $conststr = "\"". $typeMeta['enum'][$i] ."\";\n";
+ $_globals['constStrings'][$conststrnm] = $conststr;
+ }
+ $_globals['constStrings'][] = "\n";
+ }
+ }
+ }
+
+ // ATTRIBUTES
+ if ( count( $bag['attributes'] ) > 0 || $bag['useXMLNS'] )
+ {
+ print $indent ."protected: // Attribute". (count( $bag['attributes'] ) > 1 ? 's' : '') ."\n";
+
+ if ( $bag['useXMLNS'] ) {
+ print $indent ."\t/**\n". $indent ."\t * This element may specify its own xmlns.\n". $indent ."\t */\n";
+ print $indent ."\txsAnyURI attrXmlns;\n";
+ }
+ foreach( $bag['attributes'] as $attr_name => & $a_list )
+ {
+ $type = $a_list['type'];
+ if ( preg_match( "/xs\:/", $type ) ) {
+ $type = substr( $type, 3 );
+ $pre = "xs";
+ }
+ else {
+ $pre = $_globals['prefix'];
+ }
+ if ( $type == '' )
+ {
+ $type = "String";
+ }
+ if ( isset( $a_list['documentation'] ) ) {
+ print applyTemplate( 'DOXYGEN', $a_list['documentation'] );
+ }
+ print $indent ."\t" . $pre . ucfirst( $type ) . " attr" . ucfirst($attr_name) .";\n";
+ }
+ }
+
+ // ELEMENTS
+ if ( count( $bag['attributes'] > 0 ) ) { print "\n"; }
+
+ if ( (count( $bag['elements'] ) > 0 && !$bag['isRestriction']) || $bag['has_any'] )
+ {
+
+ print $indent ."protected: // Element". (count( $bag['elements'] ) > 1 ? 's' : '') ."\n";
+ $needsContents = false;
+ for( $i=0; $i<count( $bag['elements'] ); $i++ )
+ {
+ $maxOccurs = $bag['element_attrs'][ $bag['elements'][$i] ]['maxOccurs'];
+// $minOccurs = $bag['element_attrs'][ $bag['elements'][$i] ]['minOccurs'];
+// print " // minOccurs=$minOccurs, maxOccurs=$maxOccurs\n";
+ $maxOccurs = ($maxOccurs == 'unbounded' || $maxOccurs > 1);
+ if ( isset( $bag['element_documentation'][ $bag['elements'][$i] ] ) ) {
+ $bag['element_documentation'][ $bag['elements'][$i] ] .= " @see " . $_globals['prefix'] . ucfirst( $bag['elements'][$i] );
+ print applyTemplate( 'DOXYGEN', $bag['element_documentation'][ $bag['elements'][$i] ] );
+ }
+ if ( isset( $bag['element_attrs'][ $bag['elements'][$i] ]['type'] ) &&
+ isset( $meta[$bag['element_attrs'][ $bag['elements'][$i] ]['type']] ) ){
+ print $indent ."\t" . $_globals['prefix'] . ucfirst( $bag['element_attrs'][ $bag['elements'][$i] ]['type'] ) . ($maxOccurs ? "_Array" : "Ref") . " elem" . ucfirst($bag['elements'][$i]) . ($maxOccurs ? "_array" : "") . ";\n";
+ }
+ else {
+ print $indent ."\t" . $_globals['prefix'] . ucfirst( $bag['elements'][$i] ) . ($maxOccurs ? "_Array" : "Ref") . " elem" . ucfirst($bag['elements'][$i]) . ($maxOccurs ? "_array" : "") . ";\n";
+ }
+ if ( isset( $meta[$bag['elements'][$i]] ) ) {
+ if( count( $meta[$bag['elements'][$i]]['substitutableWith']) > 0 ) {
+ $needsContents = true;
+ }
+ }
+ }
+ if ( $bag['hasChoice'] || $needsContents || $bag['has_any'] )
+ {
+ print $indent ."\t/**\n". $indent ."\t * Used to preserve order in elements that do not specify strict sequencing of sub-elements.";
+ print "\n". $indent ."\t */\n";
+ print $indent ."\tdaeElementRefArray _contents;\n";
+ print $indent ."\t/**\n". $indent ."\t * Used to preserve order in elements that have a complex content model.";
+ print "\n". $indent ."\t */\n";
+ print $indent ."\tdaeUIntArray _contentsOrder;\n\n";
+ }
+ if ( $bag['hasChoice'] )
+ {
+ print $indent ."\t/**\n". $indent ."\t * Used to store information needed for some content model objects.\n";
+ print $indent ."\t */\n". $indent ."\tdaeTArray< daeCharArray * > _CMData;\n\n";
+ }
+ }
+
+ //VALUE
+ // NOTE: special casing any element with 'mixed' content model to ListOfInts type _value
+ if ( ($bag['content_type'] != '' || $bag['mixed']) && !$bag['abstract'] )
+ {
+ print $indent ."protected: // Value\n";
+
+ $content_type = $bag['content_type'];
+ if ( preg_match( "/xs\:/", $content_type ) ) {
+ $content_type = substr( $content_type, 3 );
+ $pre = "xs";
+ }
+ else {
+ $pre = $_globals['prefix'];
+ }
+ //if ( !strcmp( $pre . ucfirst( $content_type ), $full_element_name ) ) {
+ if ( $bag['parent_meta']['inline_elements'] != NULL && array_key_exists( $content_type, $bag['parent_meta']['inline_elements'] ) ) {
+ $pre = '::' . $pre;
+ }
+ print $indent ."\t/**\n". $indent ."\t * The " . $pre . ucfirst( $content_type ) ." value of the text data of this element. ";
+ print "\n". $indent ."\t */\n";
+ print $indent ."\t".$pre . ucfirst( $content_type ) ." _value;\n";
+ }
+
+ if ( $bag['complex_type'] && !$bag['isAComplexType'] )
+ {
+ $bag2 = $bag;
+ $bag2['attributes'] = array_merge( $meta[$bag['base_type']]['attributes'], $bag['attributes'] );
+ printAttributes( $bag2, $typemeta, $indent, true );
+ }
+
+ if ( $_globals['accessorsAndMutators'] && ( $bag['useXMLNS'] || count($bag['attributes'])>0 ||
+ count($bag['elements'])>0 ||( ($bag['content_type'] != '' || $bag['mixed']) && !$bag['abstract'] ) ) ) {
+
+ //generate accessors and mutators for everything
+ print "\n". $indent ."public:\t//Accessors and Mutators\n";
+ printAttributes( $bag, $typemeta, $indent, !$bag['isAComplexType'] );
+
+ $needsContents = false;
+ for( $i=0; $i<count( $bag['elements'] ); $i++ ) {
+ $maxOccurs = $bag['element_attrs'][ $bag['elements'][$i] ]['maxOccurs'];
+ $maxOccurs = ($maxOccurs == 'unbounded' || $maxOccurs > 1);
+ $type = '';
+ if ( isset( $bag['element_attrs'][ $bag['elements'][$i] ]['type'] ) &&
+ isset( $meta[$bag['element_attrs'][ $bag['elements'][$i] ]['type']] ) ){
+
+ $type = $_globals['prefix'] . ucfirst( $bag['element_attrs'][ $bag['elements'][$i] ]['type'] ) . ($maxOccurs ? "_Array" : "Ref");
+ }
+ else {
+ $type = $_globals['prefix'] . ucfirst( $bag['elements'][$i] ) . ($maxOccurs ? "_Array" : "Ref");
+ }
+ $name = ucfirst($bag['elements'][$i]) . ($maxOccurs ? "_array" : "");
+ if ( $maxOccurs ) {
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the ". $bag['elements'][$i] ." element array.\n";
+ print $indent ."\t * @return Returns a reference to the array of ". $bag['elements'][$i] ." elements.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\t". $type ." &get". $name ."() { return elem". $name ."; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the ". $bag['elements'][$i] ." element array.\n";
+ print $indent ."\t * @return Returns a constant reference to the array of ". $bag['elements'][$i] ." elements.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tconst ". $type ." &get". $name ."() const { return elem". $name ."; }\n";
+ //print $indent ."\tvoid set". $name ."( ". $type ." *e". $name ." ) { elem". $name ." = *e". $name ."; }\n\n";
+ }
+ else {
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the ". $bag['elements'][$i] ." element.\n";
+ print $indent ."\t * @return a daeSmartRef to the ". $bag['elements'][$i] ." element.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tconst ". $type ." get". $name ."() const { return elem". $name ."; }\n";
+ //print $indent ."\tvoid set". $name ."( ". $type ." &e". $name ." ) { elem". $name ." = e". $name ."; }\n\n";
+ }
+
+ if ( isset( $meta[$bag['elements'][$i]] ) ) {
+ if( count( $meta[$bag['elements'][$i]]['substitutableWith']) > 0 ) {
+ $needsContents = true;
+ }
+ }
+ }
+
+ if ( $bag['hasChoice'] || $needsContents || $bag['has_any'] )
+ {
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the _contents array.\n";
+ print $indent ."\t * @return Returns a reference to the _contents element array.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tdaeElementRefArray &getContents() { return _contents; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the _contents array.\n";
+ print $indent ."\t * @return Returns a constant reference to the _contents element array.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tconst daeElementRefArray &getContents() const { return _contents; }\n\n";
+ }
+
+ if ( ($bag['content_type'] != '' || $bag['mixed']) && !$bag['abstract'] )
+ {
+ $type = $bag['content_type'];
+ if ( preg_match( "/xs\:/", $type ) ) {
+ $type = substr( $type, 3 );
+ $pre = "xs";
+ }
+ else {
+ $pre = $_globals['prefix'];
+ }
+ $baseStringTypes = "xsDateTime xsID xsNCName xsNMTOKEN xsName xsToken xsString";
+ $baseType = $pre . ucfirst( $type );
+ if ( isset( $typemeta[$type] ) ) {
+ $typeInfo = $typemeta[$type];
+ while ( $typeInfo['base'] != '' && isset( $typemeta[$typeInfo['base']] ) ) {
+ $typeInfo = $typemeta[$typeInfo['base']];
+ if ( preg_match( "/xs\:/", $typeInfo['type'] ) ) {
+ $baseType = "xs" . ucfirst( substr( $typeInfo['type'], 3 ) );
+ }
+ else {
+ $baseType = $_globals['prefix'] . ucfirst( $typeInfo['type'] );
+ }
+ }
+ }
+ //if ( !strcmp( $pre . ucfirst( $type ), $full_element_name ) ) {
+ if ( $bag['parent_meta']['inline_elements'] != NULL && array_key_exists( $type, $bag['parent_meta']['inline_elements'] ) ) {
+ $pre = '::' . $pre;
+ }
+ if ( (isset( $typemeta[$content_type] ) && $typemeta[$content_type]['isArray']) || $content_type == 'IDREFS' ) {
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the _value array.\n";
+ print $indent ."\t * @return Returns a ". $pre . ucfirst( $type ) ." reference of the _value array.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\t".$pre . ucfirst( $type ) ." &getValue() { return _value; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the _value array.\n";
+ print $indent ."\t * @return Returns a constant ". $pre . ucfirst( $type ) ." reference of the _value array.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tconst ".$pre . ucfirst( $type ) ." &getValue() const { return _value; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Sets the _value array.\n";
+ print $indent ."\t * @param val The new value for the _value array.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tvoid setValue( const ". $pre . ucfirst( $type ) ." &val ) { _value = val; }\n\n";
+ //print $indent ."\t _meta->getValueAttribute()->setIsValid(true); }\n\n";
+ }
+ else if ( ucfirst($type) == 'AnyURI' ) {
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the value of this element.\n";
+ print $indent ."\t * @return Returns a ". $pre . ucfirst( $type ) ." of the value.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\t".$pre . ucfirst( $type ) ." &getValue() { return _value; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the value of this element.\n";
+ print $indent ."\t * @return Returns a constant ". $pre . ucfirst( $type ) ." of the value.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tconst ".$pre . ucfirst( $type ) ." &getValue() const { return _value; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Sets the _value of this element.\n";
+ print $indent ."\t * @param val The new value for this element.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tvoid setValue( const ". $pre . ucfirst( $type ) ." &val ) { _value = val; }\n";
+ // We add a setter that takes a plain string to help with backward compatibility
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Sets the _value of this element.\n";
+ print $indent ."\t * @param val The new value for this element.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tvoid setValue( xsString val ) { _value = val; }\n\n";
+ }
+ else if( ucfirst($type) == 'IDREF' ) {
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the value of this element.\n";
+ print $indent ."\t * @return Returns a ". $pre . ucfirst( $type ) ." of the value.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\t".$pre . ucfirst( $type ) ." &getValue() { return _value; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the value of this element.\n";
+ print $indent ."\t * @return Returns a constant ". $pre . ucfirst( $type ) ." of the value.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tconst ".$pre . ucfirst( $type ) ." &getValue() const { return _value; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Sets the _value of this element.\n";
+ print $indent ."\t * @param val The new value for this element.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tvoid setValue( const ". $pre . ucfirst( $type ) ." &val ) { _value = val; }\n\n";
+ //print $indent ."\t _meta->getValueAttribute()->setIsValid(true); }\n\n";
+ }
+ else if ( strstr( $baseStringTypes, $baseType ) !== FALSE && count( $typemeta[$type]['enum'] ) == 0 ) {
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the value of this element.\n";
+ print $indent ."\t * @return Returns a ". $pre . ucfirst( $type ) ." of the value.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\t".$pre . ucfirst( $type ) ." getValue() const { return _value; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Sets the _value of this element.\n";
+ print $indent ."\t * @param val The new value for this element.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tvoid setValue( ". $pre . ucfirst( $type ) ." val ) { *(daeStringRef*)&_value = val; }\n\n";
+ }
+ else {
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Gets the value of this element.\n";
+ print $indent ."\t * @return a ". $pre . ucfirst( $type ) ." of the value.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\t".$pre . ucfirst( $type ) ." getValue() const { return _value; }\n";
+ //comment
+ print $indent ."\t/**\n". $indent ."\t * Sets the _value of this element.\n";
+ print $indent ."\t * @param val The new value for this element.\n";
+ print $indent ."\t */\n";
+ //code
+ print $indent ."\tvoid setValue( ". $pre . ucfirst( $type ) ." val ) { _value = val; }\n\n";
+ //print $indent ."\t _meta->getValueAttribute()->setIsValid(true); }\n\n";
+ }
+ }
+ }
+
+ //CONSTRUCTORS
+ if ( !$bag['isAComplexType'] ) {
+ printConstructors( $full_element_name, $bag, $baseClasses, $indent );
+ }
+ else {
+ printConstructors( $full_element_name ."_complexType", $bag, $baseClasses, $indent );
+
+ print $indent ."};\n\n";
+ print $indent ."/**\n". $indent ." * An element of type ". $full_element_name ."_complexType.\n". $indent ." */\n";
+ print $indent ."class ". $full_element_name ." : public daeElement, public ". $full_element_name ."_complexType\n";
+ print $indent ."{\n";
+ print $indent ."public:\n";
+ print $indent ."\tvirtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::". strtoupper($bag['element_name']) ."; }\n";
+ print $indent ."\tstatic daeInt ID() { return ". $_globals['typeID']++ ."; }\n";
+ print $indent ."\tvirtual daeInt typeID() const { return ID(); }\n";
+
+ if ( $_globals['accessorsAndMutators'] && ( $bag['useXMLNS'] || count($bag['attributes'])>0 ) ) {
+ //generate accessors and mutators for everything
+ print "\n". $indent ."public:\t//Accessors and Mutators\n";
+ printAttributes( $bag, $typemeta, $indent, true );
+ }
+
+ $dummy = array();
+ printConstructors( $full_element_name, $dummy, array("daeElement", $full_element_name . "_complexType"), $indent );
+ }
+
+ print "\n".$indent ."public: // STATIC METHODS\n";
+ print $indent ."\t/**\n". $indent ."\t * Creates an instance of this class and returns a daeElementRef referencing it.\n";
+ print $indent ."\t * @return a daeElementRef referencing an instance of this object.\n". $indent ."\t */\n";
+ print $indent ."\tstatic DLLSPEC ". $_globals['meta_prefix'] ."ElementRef create(DAE& dae);\n";
+ print $indent ."\t/**\n". $indent ."\t * Creates a daeMetaElement object that describes this element in the meta object reflection framework.";
+ print "\n". $indent ."\t * If a daeMetaElement already exists it will return that instead of creating a new one. \n";
+ print $indent ."\t * @return A daeMetaElement describing this COLLADA element.\n". $indent ."\t */\n";
+ print $indent ."\tstatic DLLSPEC ". $_globals['meta_prefix'] ."MetaElement* registerElement(DAE& dae);\n";
+ print $indent ."};\n\n";
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-constants-cpp-file.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-constants-cpp-file.php
new file mode 100644
index 0000000..c6141e2
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-constants-cpp-file.php
@@ -0,0 +1,16 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+// Grab the file name and save the output
+$_file = $_globals['prefix'] . "Constants.cpp";
+$_bytes = file_put_contents( ($_globals['target_dir'] . $_globals['dom_dir'] . 'src/' . $_file), applyTemplate( 'CONSTANTS_CPP', $bag ) );
+
+//if ( $_bytes > 0 ) { print "Wrote $_bytes bytes to file '$_file'\n"; }
+
+?> \ No newline at end of file
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-constants-cpp.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-constants-cpp.php
new file mode 100644
index 0000000..30d113d
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-constants-cpp.php
@@ -0,0 +1,36 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+if ( $_globals['copyright'] ) {
+print $_globals['copyright_text'];
+}
+?>
+#include <dom/domConstants.h>
+
+<?php
+ foreach ($bag as $name => $val ) {
+ if ( is_int($name) ) {
+ print $val;
+ continue;
+ }
+ print "DLLSPEC daeString ". $name ." = ". $val;
+ }
+ print "\n";
+
+ foreach ($_globals['elementTypes'] as $num => $val )
+ {
+ print "DLLSPEC daeString COLLADA_TYPE_". getUniqueName($val, $_globals['elementTypes']) ." = \"". $val ."\";\n";
+ }
+ print "\n";
+
+ foreach ($_globals['elementNames'] as $num => $val )
+ {
+ print "DLLSPEC daeString COLLADA_ELEMENT_". getUniqueName($val, $_globals['elementNames']) ." = \"". $val ."\";\n";
+ }
+?>
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-constants-file.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-constants-file.php
new file mode 100644
index 0000000..8bfc456
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-constants-file.php
@@ -0,0 +1,16 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+// Grab the file name and save the output
+$_file = $_globals['prefix'] . "Constants.h";
+$_bytes = file_put_contents( ($_globals['target_dir'] . $_globals['dom_dir']. 'include/' . $_file), applyTemplate( 'CONSTANTS', $bag ) );
+
+//if ( $_bytes > 0 ) { print "Wrote $_bytes bytes to file '$_file'\n"; }
+
+?> \ No newline at end of file
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-constants.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-constants.php
new file mode 100644
index 0000000..199e849
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-constants.php
@@ -0,0 +1,42 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+if ( $_globals['copyright'] ) {
+print $_globals['copyright_text'];
+}
+?>
+#ifndef __DOM_CONSTANTS_H__
+#define __DOM_CONSTANTS_H__
+
+#include <dae/daeDomTypes.h>
+
+<?php
+ foreach ($bag as $name => $val ) {
+ if ( is_int($name) ) {
+ print $val;
+ continue;
+ }
+ print "extern DLLSPEC daeString ". $name .";\n";
+ }
+ print "\n";
+
+ foreach ($_globals['elementTypes'] as $num => $val )
+ {
+ print "extern DLLSPEC daeString COLLADA_TYPE_". getUniqueName($val, $_globals['elementTypes']) .";\n";
+ }
+ print "\n";
+
+ foreach ($_globals['elementNames'] as $num => $val )
+ {
+ print "extern DLLSPEC daeString COLLADA_ELEMENT_". getUniqueName($val, $_globals['elementNames']) .";\n";
+ }
+?>
+
+#endif //__DOM_CONSTANTS_H__
+
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-cpp-body.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-cpp-body.php
new file mode 100644
index 0000000..757e953
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-cpp-body.php
@@ -0,0 +1,25 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+if ( $_globals['copyright'] ) {
+print $_globals['copyright_text'];
+}
+?>
+#include <dae.h>
+#include <<?= $_globals['meta_prefix'] ?>/daeDom.h>
+#include <<?= $_globals['prefix'] ?>/<?= $_globals['prefix'] . ucfirst( $bag['element_name'] ) . ".h" ?>>
+#include <<?= $_globals['meta_prefix'] ?>/daeMetaCMPolicy.h>
+#include <<?= $_globals['meta_prefix'] ?>/daeMetaSequence.h>
+#include <<?= $_globals['meta_prefix'] ?>/daeMetaChoice.h>
+#include <<?= $_globals['meta_prefix'] ?>/daeMetaGroup.h>
+#include <<?= $_globals['meta_prefix'] ?>/daeMetaAny.h>
+#include <<?= $_globals['meta_prefix'] ?>/daeMetaElementAttribute.h>
+
+<?= applyTemplate( 'CPP_METHODS', $bag ) ?>
+<?= applyTemplate( 'CPP_STATIC', $bag ) ?> \ No newline at end of file
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-cpp-methods.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-cpp-methods.php
new file mode 100644
index 0000000..754df8c
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-cpp-methods.php
@@ -0,0 +1,462 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+ global $meta;
+ global $typemeta;
+
+ $_context = $bag['context'];
+ for( $i=0; $i<count( $_context ); $i++ )
+ {
+ $_context[$i] = $_globals['prefix'] . ucfirst( $_context[$i] );
+ }
+ $scoped_element = implode( '::', $_context );
+
+ /*if ( $bag['has_any'] ) {
+ foreach ( $meta as $nm => $lm ) {
+ if ( !$lm['isAGroup'] && !$lm['isAComplexType'] && !$lm['abstract'] ) {
+ print "#include <". $_globals['prefix'] ."/". $_globals['prefix'] . ucfirst($nm).".h>\n";
+ }
+ }
+ print "\n";
+ }*/
+
+ if ( $scoped_element == "domCOLLADA" ) {
+ print "extern daeString COLLADA_VERSION;\n";
+ print "extern daeString COLLADA_NAMESPACE;\n\n";
+ }
+?><?= $_globals['meta_prefix'] ?>ElementRef
+<?= $scoped_element ?>::create(DAE& dae)
+{
+ <?= $scoped_element ?>Ref ref = new <?= $scoped_element ?>(dae);
+<?php
+ if ( $bag['useXMLNS'] ) {
+ print "\tref->attrXmlns.setContainer( (". $scoped_element ."*)ref );\n";
+ }
+ foreach( $bag['attributes'] as $attr_name => & $a_list ) {
+ if ( $a_list['type'] == 'xs:anyURI' || $a_list['type'] == 'URIFragmentType' ) {
+ print "\tref->attr". ucfirst($attr_name) .".setContainer( (". $scoped_element ."*)ref );\n";
+ }
+ }
+ if ( $bag['content_type'] == 'xs:anyURI' || $bag['content_type'] == 'URIFragmentType' ) {
+ print "\tref->_value.setContainer( (". $scoped_element ."*)ref );\n";
+ }
+ if ( $scoped_element == "domCOLLADA" ) {
+ print "\tref->_meta = dae.getMeta(domCOLLADA::ID());\n";
+ print "\tref->setAttribute(\"version\", COLLADA_VERSION );\n";
+ print "\tref->setAttribute(\"xmlns\", COLLADA_NAMESPACE );\n";
+ print "\tref->_meta = NULL;\n";
+ }
+?>
+ return ref;
+}
+
+<?php
+ if( $bag['complex_type'] && !$bag['isRestriction'] ) {
+ //print "element ". $bag['element_name'] ." is of base ". $bag['base_type'] ."\n";
+ //import content model from type
+ $bag['elements'] = array_merge( $meta[$bag['base_type']]['elements'], $bag['elements'] );
+ $bag['element_attrs'] = array_merge( $meta[$bag['base_type']]['element_attrs'], $bag['element_attrs'] );
+ $bag['content_type'] = $meta[$bag['base_type']]['content_type'];
+ $bag['attributes'] = array_merge( $meta[$bag['base_type']]['attributes'], $bag['attributes'] );
+ $tempArray = array();
+ if ( count( $bag['content_model'] ) > 0 ) {
+ //we have an addition to the content model - need to add a starting sequence
+ $tempArray[] = array( 'name' => 0, 'minOccurs' => 1, 'maxOccurs' => 1 );
+ }
+ $tempArray = array_merge( $tempArray, $meta[$bag['base_type']]['content_model'] );
+ array_pop( $tempArray ); //remove the last END token
+ $tempArray = array_merge( $tempArray, $bag['content_model'] );
+ if ( count( $bag['content_model'] ) > 0 ) {
+ //we have an addition to the content model - need to add a starting sequence
+ $tempArray[] = array( 'name' => 5, 'minOccurs' => 1, 'maxOccurs' => 1 );
+ }
+ $bag['content_model'] = $tempArray;
+ }
+
+ for( $i=0; $i<count( $bag['elements'] ); $i++ ) {
+ if ( isset( $meta[$bag['elements'][$i]] ) ) {
+ $cnt = count( $meta[$bag['elements'][$i]]['substitutableWith']);
+ for ( $c = 0; $c < $cnt; $c++ ) {
+ $subwith = $meta[$bag['elements'][$i]]['substitutableWith'][$c];
+ print $prefix ."#include <". $_globals['prefix'] ."/". $_globals['prefix'] . ucfirst( $subwith ) .".h>\n";
+ }
+ }
+ }
+?>
+
+<?= $_globals['meta_prefix'] ?>MetaElement *
+<?= $scoped_element ?>::registerElement(DAE& dae)
+{
+ <?= $_globals['meta_prefix'] ?>MetaElement* meta = dae.getMeta(ID());
+ if ( meta != NULL ) return meta;
+
+ meta = new daeMetaElement(dae);
+ dae.setMeta(ID(), *meta);
+ meta->setName( "<?= $bag['element_name'] ?>" );
+ meta->registerClass(<?= $scoped_element ?>::create);
+
+<?php
+ if ( $bag['isAGroup'] ) {
+ print "\tmeta->setIsTransparent( true );\n";
+ }
+ if ( $bag['abstract'] ) {
+ print "\tmeta->setIsAbstract( true );\n";
+ }
+ if ( isset( $bag['parent_meta'] ) ) {
+ print "\tmeta->setIsInnerClass( true );\n";
+ }
+
+ if ( count( $bag['elements'] ) > 0 || $bag['has_any'] )
+ {
+ print "\tdaeMetaCMPolicy *cm = NULL;\n";
+ if ( !$bag['has_any'] ) {
+ print "\tdaeMetaElementAttribute *mea = NULL;\n";
+ }
+
+ $needsContents = false;
+ $cmTree = array();
+ $currentCM = NULL;
+ $currentOrd = 0;
+ $level = 0;
+ $choiceNum = 0;
+ for( $i=0; $i<count( $bag['content_model'] ) - 1; $i++ )
+ {
+ $cm = $bag['content_model'][$i];
+ if ( $cm['maxOccurs'] == "unbounded" )
+ {
+ $cm['maxOccurs'] = -1;
+ }
+ if ( is_int( $cm['name'] ) )
+ {
+ if ( $cm['name'] == 0 ) //sequence
+ {
+ //if ( $level > 0 ) {
+ // $needsContents = true;
+ //}
+
+ // !!!steveT Horrible hack here. For some reason the wrong value gets generated for
+ // the third parameter
+ if (strcmp($scoped_element, "domCamera::domOptics::domTechnique_common::domPerspective") == 0)
+ print "\tcm = new daeMetaSequence( meta, cm, 0, ". $cm['minOccurs'] .", ". $cm['maxOccurs'] ." );\n\n";
+ else
+ print "\tcm = new daeMetaSequence( meta, cm, ". $currentOrd .", ". $cm['minOccurs'] .", ". $cm['maxOccurs'] ." );\n\n";
+
+ $level++;
+ $currentCM = array( 'cm' => $currentCM['cm'], 'ord' => $currentOrd );
+ array_push( $cmTree, $currentCM );
+ $currentCM = array( 'cm' => $cm, 'ord' => $currentOrd );
+ $currentOrd = 0;
+ }
+ else if ( $cm['name'] == 1 ) //choice
+ {
+ print "\tcm = new daeMetaChoice( meta, cm, ". $choiceNum .", ". $currentOrd .", ". $cm['minOccurs'] .", ". $cm['maxOccurs'] ." );\n\n";
+ $level++;
+ $needsContents = true;
+ $currentCM = array( 'cm' => $currentCM['cm'], 'ord' => $currentOrd );
+ array_push( $cmTree, $currentCM );
+ $currentCM = array( 'cm' => $cm, 'ord' => $currentOrd );
+ $currentOrd = 0;
+ $choiceNum++;
+ }
+ else if ( $cm['name'] == 2 ) //group
+ {
+ $i++; //groups actually add two parts to the content model. The first is the group the second an element
+ $groupName = $bag['content_model'][$i]['name'];
+ $arrayOrNot = $bag['element_attrs'][ $groupName ]['maxOccurs'];
+ if ( $arrayOrNot == 'unbounded' || $arrayOrNot > 1 ) {
+ $arrayOrNot = true;
+ }
+ else {
+ $arrayOrNot = false;
+ }
+?>
+ mea = new daeMetaElement<?= $arrayOrNot ? 'Array' : '' ?>Attribute( meta, cm, <?= $currentOrd ?>, <?= $cm['minOccurs'] ?>, <?= $cm['maxOccurs'] ?> );
+ mea->setName( "<?= $groupName ?>" );
+ mea->setOffset( daeOffsetOf(<?= $scoped_element ?>,elem<?= ucfirst( $groupName ) ?><?= $arrayOrNot ? '_array' : '' ?>) );
+ mea->setElementType( <?= $_globals['prefix'] . ucfirst( $groupName ) ?>::registerElement(dae) );
+ cm->appendChild( new daeMetaGroup( mea, meta, cm, <?= $currentOrd ?>, <?= $cm['minOccurs'] ?>, <?= $cm['maxOccurs'] ?> ) );
+
+<?php
+ if ( $currentCM['cm']['name'] == 0 ) {
+ $currentOrd++;
+ }
+ }
+ else if ( $cm['name'] == 3 ) //all
+ {
+ //print "\tcm = new daeMetaAll( meta, cm, ". $cm['minOccurs'] .", ". $cm['maxOccurs'] ." );\n";
+ $level++;
+ $needsContents = true;
+ $currentCM = array( 'cm' => $currentCM['cm'], 'ord' => $currentOrd );
+ array_push( $cmTree, $currentCM );
+ $currentCM = array( 'cm' => $cm, 'ord' => $currentOrd );
+ $currentOrd = 0;
+ }
+ else if ( $cm['name'] == 4 ) //any
+ {
+ $level++;
+ print "\tcm = new daeMetaAny( meta, cm, ". $currentOrd .", ". $cm['minOccurs'] .", ". $cm['maxOccurs'] ." );\n\n";
+ if ( $currentCM['cm']['name'] == 0 ) {
+ $currentOrd++;
+ }
+ }
+ else if ( $cm['name'] == 5 ) //end
+ {
+ $level--;
+ if ( $level > 0 )
+ {
+?>
+ cm->setMaxOrdinal( <?= ($currentOrd-1 >= 0)? $currentOrd-1 : 0 ?> );
+ cm->getParent()->appendChild( cm );
+ cm = cm->getParent();
+
+<?php
+ }
+ //----------------------
+ if ( $currentCM['cm']['name'] == 0 ) {
+ $tempMaxO = $currentCM['cm']['maxOccurs'];
+ $currentCM = array_pop( $cmTree );
+ if ( $tempMaxO == -1 ) {
+ $currentOrd = $currentCM['ord'] + 3000;
+ }
+ else {
+ $currentOrd = $currentCM['ord'] + $tempMaxO*$currentOrd;
+ }
+ }
+ else {
+ $tempMaxO = $currentCM['cm']['maxOccurs'];
+ if ( $tempMaxO == -1 ) $tempMaxO = 3001;
+ $currentCM = array_pop( $cmTree );
+ $currentOrd = $currentCM['ord'] + $tempMaxO;
+ }
+ }
+ }
+ else //got an element name
+ {
+ $arrayOrNot = $bag['element_attrs'][ $cm['name'] ]['maxOccurs'];
+ if ( $arrayOrNot == 'unbounded' || $arrayOrNot > 1 ) {
+ $arrayOrNot = true;
+ }
+ else {
+ $arrayOrNot = false;
+ }
+ $typeClass = $_globals['prefix'] . ucfirst( $cm['name'] );
+
+ if ( !in_array( $cm['name'], $bag['ref_elements'] ) && !$bag['complex_type'] ) {
+ $typeClass = $scoped_element ."::". $typeClass;
+ }
+ if ( isset( $bag['element_attrs'][ $cm['name'] ]['type'] ) &&
+ isset( $meta[$bag['element_attrs'][ $cm['name'] ]['type']] ) ){
+
+ $typeClass = $_globals['prefix'] . ucfirst( $bag['element_attrs'][ $cm['name'] ]['type'] );
+ }
+?>
+ mea = new daeMetaElement<?= $arrayOrNot ? 'Array' : '' ?>Attribute( meta, cm, <?= $currentOrd ?>, <?= $cm['minOccurs'] ?>, <?= $cm['maxOccurs'] ?> );
+ mea->setName( "<?= $cm['name'] ?>" );
+ mea->setOffset( daeOffsetOf(<?= $scoped_element ?>,elem<?= ucfirst( $cm['name'] ) ?><?= $arrayOrNot ? '_array' : '' ?>) );
+ mea->setElementType( <?= $typeClass ?>::registerElement(dae) );
+ cm->appendChild( mea );
+
+<?php
+ if ( isset( $meta[$cm['name']] ) ) {
+ $cnt = count( $meta[$cm['name']]['substitutableWith']);
+ for ( $c = 0; $c < $cnt; $c++ ) {
+ $subwith = $meta[$cm['name']]['substitutableWith'][$c];
+?>
+ mea = new daeMetaElement<?= $arrayOrNot ? 'Array' : '' ?>Attribute( meta, cm, <?= $currentOrd ?>, <?= $cm['minOccurs'] ?>, <?= $cm['maxOccurs'] ?> );
+ mea->setName( "<?= $subwith ?>" );
+ mea->setOffset( daeOffsetOf(<?= $scoped_element ?>,elem<?= ucfirst( $cm['name'] ) ?><?= $arrayOrNot ? '_array' : '' ?>) );
+ mea->setElementType( <?= $_globals['prefix'] . ucfirst( $subwith ) ?>::registerElement(dae) );
+ cm->appendChild( mea );
+
+<?php
+ $needsContents = true;
+ }
+ }
+ if ( $currentCM['cm']['name'] == 0 ) {
+ $currentOrd++;
+ }
+ }
+ }
+?>
+ cm->setMaxOrdinal( <?= ($currentOrd-1 >= 0)? $currentOrd-1 : 0 ?> );
+ meta->setCMRoot( cm );
+<?php
+
+ if ( $bag['has_any'] ) {
+ $needsContents = true;
+ print "\tmeta->setAllowsAny( true );\n";
+ }
+
+ // For elements that allow more than one type of sub-element, _contents keeps an order for those sub-elements
+ if ( $bag['hasChoice'] || $needsContents ) {
+?>
+ // Ordered list of sub-elements
+ meta->addContents(daeOffsetOf(<?= $scoped_element ?>,_contents));
+ meta->addContentsOrder(daeOffsetOf(<?= $scoped_element ?>,_contentsOrder));
+
+<?php
+ if ( $choiceNum > 0 )
+ {
+?>
+ meta->addCMDataArray(daeOffsetOf(<?= $scoped_element ?>,_CMData), <?= $choiceNum ?>);<?php
+ }
+ }
+ }
+
+ // TAKE CARE OF THE ENUM IF IT HAS ONE!!
+ if ( $bag['simple_type'] != NULL ) {
+ $typeMeta = $bag['simple_type']->getMeta();
+
+ if ( count( $typeMeta['enum'] ) > 0 && !$typeMeta['useConstStrings'] )
+ {
+?>
+ // ENUM: <?= ucfirst( $typeMeta['type'] ) ?>_type
+ daeAtomicType *type;
+ type = new daeEnumType;
+ type->_nameBindings.append("<?= ucfirst( $typeMeta['type'] ) ?>_type");
+ ((daeEnumType*)type)->_strings = new daeStringRefArray;
+ ((daeEnumType*)type)->_values = new daeEnumArray;
+<?php
+ foreach( $typeMeta['enum'] as $val )
+ {
+?>
+ ((daeEnumType*)type)->_strings->append("<?= $val ?>");
+ ((daeEnumType*)type)->_values->append(<?= strtoupper($typeMeta['type']) . "_" . $val ?>);
+<?php
+ }
+ print "\tdaeAtomicType::append( type );\n\n";
+ }
+ }
+
+ // NOTE: special casing any element with 'mixed' content model to ListOfInts type _value
+ $pre = '';
+ if (($bag['content_type'] != '' || $bag['mixed']) && !$bag['abstract'] ) {
+?>
+ // Add attribute: _value
+ {
+<?php
+ $content_type = ( $bag['mixed'] ? 'ListOfInts' : $bag['content_type'] );
+ if ( preg_match( "/xs\:/", $content_type ) ) {
+ $content_type = substr( $content_type, 3 );
+ $pre = 'xs';
+ }
+ //print "\t\tdaeMetaAttribute* ma = daeMetaAttribute::makeAttrForType(\"". ucfirst($content_type) ."\");\n";
+ if ( (isset( $typemeta[$content_type] ) && $typemeta[$content_type]['isArray']) || $content_type == 'IDREFS' ) {
+ print "\t\tdaeMetaAttribute *ma = new daeMetaArrayAttribute;\n";
+ }
+ else {
+ print "\t\tdaeMetaAttribute *ma = new daeMetaAttribute;\n";
+ }
+?>
+ ma->setName( "_value" );
+<?php
+ //if ( $bag['mixed'] ) {
+ // print "#ifdef POLYGONS_MIXED_CONTENT_MODEL_HOLES\n\t\tma->setType( daeAtomicType::get(\"ListOfStrings\"));\n";
+ // print "#else\n\t\tma->setType( daeAtomicType::get(\"ListOfInts\"));\n#endif\n";
+ //}
+ //else {
+ print "\t\tma->setType( dae.getAtomicTypes().get(\"". $pre. ucfirst($content_type) ."\"));\n";
+ //}
+?>
+ ma->setOffset( daeOffsetOf( <?= $scoped_element ?> , _value ));
+ ma->setContainer( meta );
+ meta->appendAttribute(ma);
+ }
+<?php
+ }
+
+ if ( $bag['useXMLNS'] ) {
+ ?>
+ // Add attribute: xmlns
+ {
+ daeMetaAttribute* ma = new daeMetaAttribute;
+ ma->setName( "xmlns" );
+ ma->setType( dae.getAtomicTypes().get("xsAnyURI"));
+ ma->setOffset( daeOffsetOf( <?= $scoped_element ?> , attrXmlns ));
+ ma->setContainer( meta );
+ //ma->setIsRequired( true );
+ meta->appendAttribute(ma);
+ }
+ <?php
+ }
+
+ foreach( $bag['attributes'] as $attr_name => $attr_attrs )
+ {
+ $_type = $attr_attrs['type'];
+ $printType;
+ if ( preg_match( "/xs\:/", $_type ) ) {
+ $_type = 'xs' . ucfirst( substr( $_type, 3 ) );
+ $printType = $_type;
+ }
+ else {
+ $printType = ucfirst( $_type );
+ }
+?>
+
+ // Add attribute: <?= $attr_name . "\n" ?>
+ {
+<?php
+ /*print "\t//". $_type ." is set ";
+ if ( isset( $typemeta[$_type] ) ) print "true\n";
+ else print "false\n";
+
+ print "\t//is array ";
+ if ( $typemeta[$_type]['isArray'] ) print "true\n";
+ else print "false\n";*/
+
+ if ( isset( $typemeta[$_type] ) && $typemeta[$_type]['isArray'] ) {
+ print "\t\tdaeMetaAttribute *ma = new daeMetaArrayAttribute;\n";
+ }
+ else {
+ print "\t\tdaeMetaAttribute *ma = new daeMetaAttribute;\n";
+ }
+?>
+ ma->setName( "<?= $attr_name ?>" );
+ ma->setType( dae.getAtomicTypes().get("<?= $printType ?>"));
+ ma->setOffset( daeOffsetOf( <?= $scoped_element ?> , attr<?= ucfirst($attr_name) ?> ));
+ ma->setContainer( meta );
+<?php
+ if ( isset( $attr_attrs['default'] ) )
+ {
+?> ma->setDefaultString( "<?= $attr_attrs['default'] ?>");
+<?php
+ }
+
+ if ( isset( $attr_attrs['use'] ) ) {
+ $required = $attr_attrs['use'] == 'required' ? 'true' : 'false';
+
+?> ma->setIsRequired( <?= $required ?> );
+<?php
+ }
+?>
+ meta->appendAttribute(ma);
+ }
+<?php
+ }
+?>
+
+ meta->setElementSize(sizeof(<?= $scoped_element ?>));
+ meta->validate();
+
+ return meta;
+}
+
+<?php
+ $_keys = array_keys( $bag['inline_elements'] );
+ if ( count( $_keys ) > 0 )
+ {
+ foreach( $_keys as $_k )
+ {
+ $inner = $bag['inline_elements'][ $_k ];
+ if ( !$inner['complex_type'] || $inner['isRestriction'] || $inner['isExtension'] ) {
+ print applyTemplate( 'CPP_METHODS', $inner );
+ }
+ }
+ }
+?> \ No newline at end of file
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-cpp-static.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-cpp-static.php
new file mode 100644
index 0000000..80508b1
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-cpp-static.php
@@ -0,0 +1,29 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+ $_context = $bag['context'];
+ for( $i=0; $i<count( $_context ); $i++ )
+ {
+ $_context[$i] = $_globals['prefix'] . ucfirst( $_context[$i] );//. "_element";
+ }
+?>
+<?php
+//}
+ $keys = array_keys( $bag['inline_elements'] );
+ if ( count( $keys ) > 0 )
+ {
+ foreach( $keys as $k )
+ {
+ $inner = $bag['inline_elements'][ $k ];
+ if ( !$inner['complex_type'] || $inner['isRestriction'] || $inner['isExtension'] ) {
+ print applyTemplate( 'CPP_STATIC', $inner );
+ }
+ }
+ }
+?> \ No newline at end of file
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-cpp.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-cpp.php
new file mode 100644
index 0000000..49c3b42
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-cpp.php
@@ -0,0 +1,16 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+// Grab the file name and save the output
+$_file = $_globals['prefix'] . ucfirst( $bag['element_name'] ) . ".cpp";
+$_bytes = file_put_contents( ($_globals['target_dir'] . $_globals['dom_dir'] . 'src/' . $_file), applyTemplate( 'CPP', $bag ) );
+
+//if ( $_bytes > 0 ) { print "Wrote $_bytes bytes to file '$_file'\n"; }
+
+?> \ No newline at end of file
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-dot-h.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-dot-h.php
new file mode 100644
index 0000000..6d14e57
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-dot-h.php
@@ -0,0 +1,28 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+if ( $_globals['copyright'] ) {
+print $_globals['copyright_text'];
+}
+?>#ifndef __<?= $_globals['prefix'] . ucfirst( $bag['element_name'] ) ?>_h__
+#define __<?= $_globals['prefix'] . ucfirst( $bag['element_name'] ) ?>_h__
+
+#include <dae/daeDocument.h>
+#include <<?= $_globals['prefix'] . '/' . $_globals['prefix'] ?>Types.h>
+#include <<?= $_globals['prefix'] . '/' . $_globals['prefix'] ?>Elements.h>
+
+<?php
+global $includeList;
+$includeList = array();
+print applyTemplate( 'INCLUDES', $bag ) ?>
+class DAE;
+
+<?= applyTemplate( 'CLASS', $bag ) ?>
+
+#endif
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-doxygen.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-doxygen.php
new file mode 100644
index 0000000..30a6d6d
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-doxygen.php
@@ -0,0 +1,38 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+global $indent;
+// Add doxygen formatted comments
+
+print $indent ."/**\n";
+
+//$_local_doc = $bag['documentation'][ $_globals['language'] ];
+$_local_doc = str_replace( "\n", " ", $bag );
+$_local_doc = str_replace( "\t", "", $_local_doc );
+while( strlen( $_local_doc ) > 0 )
+{
+ if ( preg_match( "/(.{0,70}[^\s]*)(\s*)/", $_local_doc, $matches ) )
+ {
+ // Print blocks of 70 chars thru the next word
+ print $indent ." * " . $matches[1] . "\n";
+
+ // Account for any newlines
+ /*$n_newlines = preg_match_all( "/\n/", $matches[2], $buf );
+ if ( $n_newlines > 0 )
+ {
+ for( $i=0; $i<$n_newlines; $i++ ) { print " * \n"; }
+ }*/
+
+ // Find more lines...
+ $_local_doc = substr( $_local_doc, strlen( $matches[0] ) );
+ }
+}
+
+print $indent ." */\n";
+?> \ No newline at end of file
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-elements-file.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-elements-file.php
new file mode 100644
index 0000000..4e5694d
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-elements-file.php
@@ -0,0 +1,16 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+// Grab the file name and save the output
+$_file = $_globals['prefix'] . "Elements.h";
+$_bytes = file_put_contents( ($_globals['target_dir'] . $_globals['dom_dir'] . 'include/' . $_file), applyTemplate( 'ELEMENTS', $bag ) );
+
+//if ( $_bytes > 0 ) { print "Wrote $_bytes bytes to file '$_file'\n"; }
+
+?> \ No newline at end of file
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-elements.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-elements.php
new file mode 100644
index 0000000..f16d2af
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-elements.php
@@ -0,0 +1,31 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+if ( $_globals['copyright'] ) {
+print $_globals['copyright_text'];
+}
+?>
+#ifndef __DOM_ELEMENTS_H__
+#define __DOM_ELEMENTS_H__
+
+#include <<?= $_globals['prefix'] ?>/<?= $_globals['prefix'] ?>Types.h>
+
+<?php
+//Base elements
+foreach( $bag as $name => $meta ) {
+ $full_element_name = $_globals['prefix'] . ucfirst( $name );
+ print "class " . $full_element_name . ";\n\n";
+ print "typedef daeSmartRef<". $full_element_name ."> ". $full_element_name ."Ref;\n";
+ print "typedef daeTArray<". $full_element_name ."Ref> ". $full_element_name ."_Array;\n\n";
+}
+
+?>
+
+#endif //__DOM_ELEMENTS_H__
+
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-header.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-header.php
new file mode 100644
index 0000000..07dad80
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-header.php
@@ -0,0 +1,16 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+// Grab the file name and save the output
+$_file = $_globals['prefix'] . ucfirst( $bag['element_name'] ) . ".h";
+$_bytes = file_put_contents( ($_globals['target_dir'] . $_globals['dom_dir'] . 'include/' . $_file), applyTemplate( 'HEADER', $bag ) );
+
+//if ( $_bytes > 0 ) { print "dom/" . $_globals['prefix'] . ucfirst( $bag['element_name'] ) . ".obj "; }
+
+?> \ No newline at end of file
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-include-list.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-include-list.php
new file mode 100644
index 0000000..f09c278
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-include-list.php
@@ -0,0 +1,13 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+?>/* --- DO NOT REMOVE THIS LINE --- SNIP_SDK_COPYRIGHT_C_BEGIN
+ * --- DO NOT REMOVE THIS LINE --- SNIP_SDK_COPYRIGHT_C_END */
+
+<?= implode( "\n", $_globals['include_list'] ) ?>
+
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-includes.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-includes.php
new file mode 100644
index 0000000..be4be90
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-includes.php
@@ -0,0 +1,32 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+ // INCLUDES
+ $inc = array();
+ global $includeList;
+ for( $i=0; $i<count( $bag['ref_elements'] ); $i++ )
+ {
+ if ( !in_array( $_globals['prefix'] . ucfirst( $bag['ref_elements'][$i] ), $includeList ) ) {
+ $inc[] = "#include <" . $_globals['prefix'] . "/" . $_globals['prefix'] . ucfirst( $bag['ref_elements'][$i] ) . ".h>";
+ $includeList[] = $_globals['prefix'] . ucfirst( $bag['ref_elements'][$i] );
+ }
+ }
+ if ( count( $inc ) ) { //only print if you have to include something
+ print implode( "\n", $inc ) . "\n";
+ }
+
+ $keys = array_keys( $bag['inline_elements'] );
+ if ( count( $keys ) > 0 )
+ {
+ foreach( $keys as $k )
+ {
+ print applyTemplate( 'INCLUDES', $bag['inline_elements'][ $k ] );
+ }
+ }
+?> \ No newline at end of file
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-types-cpp-file.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-types-cpp-file.php
new file mode 100644
index 0000000..16f15c6
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-types-cpp-file.php
@@ -0,0 +1,16 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+// Grab the file name and save the output
+$_file = $_globals['prefix'] . "Types.cpp";
+$_bytes = file_put_contents( ($_globals['target_dir'] . $_globals['dom_dir'] . 'src/' . $_file), applyTemplate( 'TYPES_CPP', $bag ) );
+
+//if ( $_bytes > 0 ) { print "Wrote $_bytes bytes to file '$_file'\n"; }
+
+?> \ No newline at end of file
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-types-cpp.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-types-cpp.php
new file mode 100644
index 0000000..b6199d2
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-types-cpp.php
@@ -0,0 +1,136 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+if ( $_globals['copyright'] ) {
+print $_globals['copyright_text'];
+}
+?>
+#include <dae.h>
+#include <<?= $_globals['prefix'] . '/' . $_globals['prefix'] ?>Types.h>
+#include <dae/daeDom.h>
+#include <dom/domCOLLADA.h>
+
+<?php
+
+foreach( $bag as $type => $meta )
+{
+ if ( $meta['isComplex'] ) {
+ ?>#include <<?= $_globals['prefix'] . '/' . $_globals['prefix'] . ucfirst( $type ) ?>.h>
+<?php
+ }
+}
+
+?>
+
+void registerDomTypes(DAE& dae)
+{
+ daeAtomicType* type = NULL;
+ daeAtomicTypeList& atomicTypes = dae.getAtomicTypes();
+
+<?php
+
+foreach( $bag as $type => $meta )
+{
+ if ( count( $meta['enum'] ) > 0 && !$meta['useConstStrings'] )
+ {?>
+ // ENUM: <?= ucfirst( $type ) ?>
+
+ type = new daeEnumType(dae);
+ type->_nameBindings.append("<?= ucfirst( $type ) ?>");
+ ((daeEnumType*)type)->_strings = new daeStringRefArray;
+ ((daeEnumType*)type)->_values = new daeEnumArray;
+<?php
+ foreach( $meta['enum'] as $val )
+ {?>
+ ((daeEnumType*)type)->_strings->append("<?= $val ?>");
+<?php $val = str_replace( '.', '_', $val ); ?>
+ ((daeEnumType*)type)->_values->append(<?= strtoupper($type) . "_" . $val ?>);
+<?php
+ }
+ print "\tatomicTypes.append( type );\n\n";
+ }
+ elseif ( $meta['isComplex'] ) {
+ ?>
+ // COMPLEX TYPE: <?= ucfirst( $type ) ?>
+
+ type = new daeElementRefType(dae);
+ type->_nameBindings.append("<?= ucfirst( $type ) ?>");
+ atomicTypes.append( type );
+
+<?php
+ }
+ /*else if ( $meta['union_type'] ) { //union type
+ ?>
+ // ENUM: <?= ucfirst( $type ) ?>
+
+ type = new daeEnumType;
+ type->_nameBindings.append("<?= ucfirst( $type ) ?>");
+ ((daeEnumType*)type)->_strings = new daeStringRefArray;
+ ((daeEnumType*)type)->_values = new daeEnumArray;
+<?php
+ $types = explode( ' ', $meta['union_members'] );
+ foreach ( $types as $typeName ) {
+ if ( isset( $bag[$typeName] ) && count($bag[$typeName]['enum']) > 0 ) {
+ foreach( $bag[$typeName]['enum'] as $val )
+ {?>
+ ((daeEnumType*)type)->_strings->append("<?= $val ?>");
+<?php $val = str_replace( '.', '_', $val ); ?>
+ ((daeEnumType*)type)->_values->append(<?= strtoupper($type) . "_" . $val ?>);
+<?php
+ }
+ }
+ }
+ print "\tatomicTypes.append( type );\n\n";
+ } */
+ else if ( !$meta['useConstStrings'] ) { //standard typedef
+ $base = strlen( $meta['base'] ) > 0 ? $meta['base'] : $meta['listType'];
+ if ( preg_match( "/xs\:/", $base ) ) {
+ $base = 'xs' . ucfirst( substr( $base, 3 ) );
+ }
+ else {
+ $base = ucfirst( $base );
+ }
+ ?>
+ // TYPEDEF: <?= ucfirst( $type ) ?>
+ //check if this type has an existing base
+<?php
+ //special casing URIFragmentType to be a xsURI for automatic resolution
+ if ( $type == 'URIFragmentType' ) {
+ print "\ttype = atomicTypes.get(\"xsAnyURI\");\n";
+ }
+ else {
+ print "\ttype = atomicTypes.get(\"". $base ."\");\n";
+ }
+?>
+ if ( type == NULL ) { //register as a raw type
+ type = new daeRawRefType(dae);
+ type->_nameBindings.append("<?= ucfirst( $type ) ?>");
+ atomicTypes.append( type );
+ }
+ else { //add binding to existing type
+ type->_nameBindings.append("<?= ucfirst( $type ) ?>");
+ }
+
+<?php
+ }
+}
+?>
+}
+
+daeMetaElement* registerDomElements(DAE& dae)
+{
+ daeMetaElement* meta = domCOLLADA::registerElement(dae);
+ // Enable tracking of top level object by default
+ meta->setIsTrackableForQueries(true);
+ return meta;
+}
+
+daeInt DLLSPEC colladaTypeCount() {
+ return <?php /* +1 for <any> */ print ($_globals['typeID']+1); ?>;
+}
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-types-header-file.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-types-header-file.php
new file mode 100644
index 0000000..e635bae
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-types-header-file.php
@@ -0,0 +1,16 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+// Grab the file name and save the output
+$_file = $_globals['prefix'] . "Types.h";
+$_bytes = file_put_contents( ($_globals['target_dir'] . $_globals['dom_dir'] . 'include/' . $_file), applyTemplate( 'TYPES_HEADER', $bag ) );
+
+//if ( $_bytes > 0 ) { print "Wrote $_bytes bytes to file '$_file'\n"; }
+
+?> \ No newline at end of file
diff --git a/1.4.0/dom/codeGen/1.4/tpl/tpl-types-header.php b/1.4.0/dom/codeGen/1.4/tpl/tpl-types-header.php
new file mode 100644
index 0000000..52c7e57
--- /dev/null
+++ b/1.4.0/dom/codeGen/1.4/tpl/tpl-types-header.php
@@ -0,0 +1,172 @@
+<?php
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+if ( $_globals['copyright'] ) {
+print $_globals['copyright_text'];
+}
+?>
+#ifndef __DOM_TYPES_H__
+#define __DOM_TYPES_H__
+
+#include <dae/daeDomTypes.h>
+
+<?php
+//BASIC TYPES
+foreach( $bag as $type => $meta )
+{
+ if ( count( $meta['enum'] ) == 0 && !$meta['isComplex'] ) {
+ if ( strlen( $meta['base'] ) > 0 ) { //has a base type
+ if ( preg_match( "/xs\:/", $meta['base'] ) ) {
+ $base = substr( $meta['base'], 3 );
+ $pre = 'xs';
+ }
+ else {
+ $base = $meta['base'];
+ $pre = $_globals['prefix'];
+ }
+ if ( isset( $meta['documentation']['en'] ) ) {
+ print applyTemplate( 'DOXYGEN', $meta['documentation']['en'] );
+ }
+ //special casing URIFragmentType to be a xsURI for automatic resolution
+ if ( $type == 'URIFragmentType' ) {
+ print "typedef xsAnyURI\t\tdomURIFragmentType;\n";
+ }
+ else {
+ print "typedef " . $pre . ucfirst($base) . "\t\t" . $_globals['prefix'] . ucfirst( $type ) . ";\n";
+ }
+ }
+ elseif ( strlen( $meta['listType'] ) > 0 ) { //is a list type
+ if ( isset( $meta['documentation']['en'] ) ) {
+ print applyTemplate( 'DOXYGEN', $meta['documentation']['en'] );
+ }
+ if ( preg_match( "/xs\:/", $meta['listType'] ) ) {
+ $lt = substr( $meta['listType'], 3 );
+ print "typedef xs" . ucfirst($lt) . "Array\t\t" . $_globals['prefix'] . ucfirst( $type ) . ";\n";
+ }
+ else {
+ $lt = $meta['listType'];
+ print "typedef daeTArray<" . $_globals['prefix'] . ucfirst($lt) . ">\t\t" . $_globals['prefix'] . ucfirst( $type ) . ";\n";
+ }
+ }
+ }
+}
+
+print "\n";
+
+//ENUMS
+foreach( $bag as $type => $meta )
+{
+ if ( count( $meta['enum'] ) > 0 )
+ {
+ if ( !$meta['useConstStrings'] ) {
+ //Decided to name mangle the enum constants so they are more descriptive and avoid collisions
+ if ( isset( $meta['documentation']['en'] ) ) {
+ print applyTemplate( 'DOXYGEN', $meta['documentation']['en'] );
+ }
+ print "enum " . $_globals['prefix'] . ucfirst( $type ) . " {\n";
+ for( $i = 0; $i < count( $meta['enum'] ); $i++ ) {
+ $val = $meta['enum'][$i];
+ $val = str_replace( '.', '_', $val );
+ print "\t" . strtoupper( $type ) . "_" . $val;
+ if ( isset( $meta['enum_value'][$i] ) ) {
+ print " = ". $meta['enum_value'][$i];
+ }
+ //else if ($i==0) {
+ // print " = 1";
+ //}
+ print ",";
+ if ( isset( $meta['enum_documentation'][$i] ) ) {
+ print "\t\t/**< ". $meta['enum_documentation'][$i] ." */";
+ }
+ print "\n";
+ }
+ $cnt = count($meta['enum']);
+ //if ( !isset($meta['enum_value'][0]) ) {
+ // $cnt++;
+ //}
+ print "\t". strtoupper( $type ) . "_COUNT = ". $cnt;
+ print "\n};\n\n";
+ }
+ else {
+ for( $i = 0; $i < count( $meta['enum'] ); $i++ ) {
+ if ( isset( $meta['enum_documentation'][$i] ) ) {
+ $_globals['constStrings'][] = "/**\n * ". $meta['enum_documentation'][$i] ."\n */\n";
+ }
+ $conststrnm = strtoupper( $type ) . "_" . $meta['enum'][$i];
+ $conststr = "\"". $meta['enum'][$i] ."\";\n";
+ $_globals['constStrings'][$conststrnm] = $conststr;
+ }
+ $_globals['constStrings'][] = "\n";
+ }
+ }
+}
+
+//UNIONS
+foreach( $bag as $type => & $meta )
+{
+ if ( $meta['union_type'] )
+ {
+ if ( isset( $meta['documentation']['en'] ) ) {
+ print applyTemplate( 'DOXYGEN', $meta['documentation']['en'] );
+ }
+ print "enum " . $_globals['prefix'] . ucfirst( $type ) . " {\n";
+
+ //tokenize memberTypes string
+ $types = explode( ' ', $meta['union_members'] );
+ //look up the members
+ $cnt = 1;
+ foreach ( $types as $typeName ) {
+ if ( isset( $bag[$typeName] ) && count($bag[$typeName]['enum']) > 0 ) {
+ //print all of their enum children
+ for( $i = 0; $i < count( $bag[$typeName]['enum'] ); $i++ ) {
+ $val = $bag[$typeName]['enum'][$i];
+ $val = str_replace( '.', '_', $val );
+ if ( in_array( $val, $meta['enum'] ) ) {
+ continue;
+ }
+ $meta['enum'][] = $val;
+ print "\t" . strtoupper( $type ) . "_" . $val;
+ if ( isset( $bag[$typeName]['enum_value'][$i] ) ) {
+ print " = ". $bag[$typeName]['enum_value'][$i];
+ }
+ else if ($i==0) {
+ print " = 1";
+ }
+ print ",";
+ if ( isset( $bag[$typeName]['enum_documentation'][$i] ) ) {
+ print "\t\t/**< ". $bag[$typeName]['enum_documentation'][$i] ." */";
+ }
+ print "\n";
+ $cnt++;
+ }
+ }
+ }
+ print "\t". strtoupper( $type ) . "_COUNT = ". $cnt;
+ print "\n};\n\n";
+ }
+}
+
+?>
+//Element Type Enum
+namespace COLLADA_TYPE
+{
+ const int
+ NO_TYPE = 0,
+ ANY = 1<?php
+ foreach( $_globals['elementTypes'] as $num => $val )
+ print ",\n\t\t". getUniqueName($val, $_globals['elementTypes']) ." = ". ($num+2);
+ print ";"
+?>
+
+}
+
+// Returns the total number of schema types/dom* classes
+daeInt DLLSPEC colladaTypeCount();
+
+#endif