1/*
2* Copyright 2006 Sony Computer Entertainment Inc.
3*
4* Licensed under the MIT Open Source License, for details please see license.txt or the website
5* http://www.opensource.org/licenses/mit-license.php
6*
7*/
8
9#include <dae.h>
10#include <dae/daeDom.h>
11#include <dom/domTechnique.h>
12#include <dae/daeMetaCMPolicy.h>
13#include <dae/daeMetaSequence.h>
14#include <dae/daeMetaChoice.h>
15#include <dae/daeMetaGroup.h>
16#include <dae/daeMetaAny.h>
17#include <dae/daeMetaElementAttribute.h>
18
19daeElementRef
20domTechnique::create(DAE& dae)
21{
22	domTechniqueRef ref = new domTechnique(dae);
23	return ref;
24}
25
26
27daeMetaElement *
28domTechnique::registerElement(DAE& dae)
29{
30	daeMetaElement* meta = dae.getMeta(ID());
31	if ( meta != NULL ) return meta;
32
33	meta = new daeMetaElement(dae);
34	dae.setMeta(ID(), *meta);
35	meta->setName( "technique" );
36	meta->registerClass(domTechnique::create);
37
38	daeMetaCMPolicy *cm = NULL;
39	cm = new daeMetaSequence( meta, cm, 0, 1, 1 );
40
41	cm = new daeMetaAny( meta, cm, 0, 0, -1 );
42
43	cm->setMaxOrdinal( 0 );
44	cm->getParent()->appendChild( cm );
45	cm = cm->getParent();
46
47	cm->setMaxOrdinal( 0 );
48	meta->setCMRoot( cm );
49	meta->setAllowsAny( true );
50	// Ordered list of sub-elements
51	meta->addContents(daeOffsetOf(domTechnique,_contents));
52	meta->addContentsOrder(daeOffsetOf(domTechnique,_contentsOrder));
53
54	//	Add attribute: xmlns
55	{
56		daeMetaAttribute* ma = new daeMetaAttribute;
57		ma->setName( "xmlns" );
58		ma->setType( dae.getAtomicTypes().get("xsAnyURI"));
59		ma->setOffset( daeOffsetOf( domTechnique , attrXmlns ));
60		ma->setContainer( meta );
61		//ma->setIsRequired( true );
62		meta->appendAttribute(ma);
63	}
64
65	//	Add attribute: profile
66	{
67		daeMetaAttribute *ma = new daeMetaAttribute;
68		ma->setName( "profile" );
69		ma->setType( dae.getAtomicTypes().get("xsNMTOKEN"));
70		ma->setOffset( daeOffsetOf( domTechnique , attrProfile ));
71		ma->setContainer( meta );
72		ma->setIsRequired( true );
73
74		meta->appendAttribute(ma);
75	}
76
77	meta->setElementSize(sizeof(domTechnique));
78	meta->validate();
79
80	return meta;
81}
82
83