blob: 4c72ea247d7b20bb8936a5637736b611cf2e9cb7 [file] [log] [blame]
/*
* 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
*
*/
#include <dae.h>
#include <dae/daeDom.h>
#include <dom/domLibrary_nodes.h>
#include <dae/daeMetaCMPolicy.h>
#include <dae/daeMetaSequence.h>
#include <dae/daeMetaChoice.h>
#include <dae/daeMetaGroup.h>
#include <dae/daeMetaAny.h>
#include <dae/daeMetaElementAttribute.h>
daeElementRef
domLibrary_nodes::create(DAE& dae)
{
domLibrary_nodesRef ref = new domLibrary_nodes(dae);
return ref;
}
daeMetaElement *
domLibrary_nodes::registerElement(DAE& dae)
{
daeMetaElement* meta = dae.getMeta(ID());
if ( meta != NULL ) return meta;
meta = new daeMetaElement(dae);
dae.setMeta(ID(), *meta);
meta->setName( "library_nodes" );
meta->registerClass(domLibrary_nodes::create);
daeMetaCMPolicy *cm = NULL;
daeMetaElementAttribute *mea = NULL;
cm = new daeMetaSequence( meta, cm, 0, 1, 1 );
mea = new daeMetaElementAttribute( meta, cm, 0, 0, 1 );
mea->setName( "asset" );
mea->setOffset( daeOffsetOf(domLibrary_nodes,elemAsset) );
mea->setElementType( domAsset::registerElement(dae) );
cm->appendChild( mea );
mea = new daeMetaElementArrayAttribute( meta, cm, 1, 1, -1 );
mea->setName( "node" );
mea->setOffset( daeOffsetOf(domLibrary_nodes,elemNode_array) );
mea->setElementType( domNode::registerElement(dae) );
cm->appendChild( mea );
mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 );
mea->setName( "extra" );
mea->setOffset( daeOffsetOf(domLibrary_nodes,elemExtra_array) );
mea->setElementType( domExtra::registerElement(dae) );
cm->appendChild( mea );
cm->setMaxOrdinal( 2 );
meta->setCMRoot( cm );
// Add attribute: id
{
daeMetaAttribute *ma = new daeMetaAttribute;
ma->setName( "id" );
ma->setType( dae.getAtomicTypes().get("xsID"));
ma->setOffset( daeOffsetOf( domLibrary_nodes , attrId ));
ma->setContainer( meta );
meta->appendAttribute(ma);
}
// Add attribute: name
{
daeMetaAttribute *ma = new daeMetaAttribute;
ma->setName( "name" );
ma->setType( dae.getAtomicTypes().get("xsNCName"));
ma->setOffset( daeOffsetOf( domLibrary_nodes , attrName ));
ma->setContainer( meta );
meta->appendAttribute(ma);
}
meta->setElementSize(sizeof(domLibrary_nodes));
meta->validate();
return meta;
}