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 #ifndef __domExtra_h__ 10 #define __domExtra_h__ 11 12 #include <dae/daeDocument.h> 13 #include <dom/domTypes.h> 14 #include <dom/domElements.h> 15 16 #include <dom/domAsset.h> 17 #include <dom/domTechnique.h> 18 class DAE; 19 20 /** 21 * The extra element declares additional information regarding its parent 22 * element. 23 */ 24 class domExtra : public daeElement 25 { 26 public: getElementType()27 virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::EXTRA; } ID()28 static daeInt ID() { return 679; } typeID()29 virtual daeInt typeID() const { return ID(); } 30 protected: // Attributes 31 /** 32 * The id attribute is a text string containing the unique identifier of 33 * this element. This value must be unique within the instance document. 34 * Optional attribute. 35 */ 36 xsID attrId; 37 /** 38 * The name attribute is the text string name of this element. Optional attribute. 39 */ 40 xsNCName attrName; 41 /** 42 * The type attribute indicates the type of the value data. This text string 43 * must be understood by the application. Optional attribute. 44 */ 45 xsNMTOKEN attrType; 46 47 protected: // Elements 48 /** 49 * The extra element may contain an asset element. @see domAsset 50 */ 51 domAssetRef elemAsset; 52 /** 53 * This element must contain at least one non-common profile technique. 54 * @see domTechnique 55 */ 56 domTechnique_Array elemTechnique_array; 57 58 public: //Accessors and Mutators 59 /** 60 * Gets the id attribute. 61 * @return Returns a xsID of the id attribute. 62 */ getId()63 xsID getId() const { return attrId; } 64 /** 65 * Sets the id attribute. 66 * @param atId The new value for the id attribute. 67 */ setId(xsID atId)68 void setId( xsID atId ) { *(daeStringRef*)&attrId = atId; _validAttributeArray[0] = true; 69 if( _document != NULL ) _document->changeElementID( this, attrId ); 70 } 71 72 /** 73 * Gets the name attribute. 74 * @return Returns a xsNCName of the name attribute. 75 */ getName()76 xsNCName getName() const { return attrName; } 77 /** 78 * Sets the name attribute. 79 * @param atName The new value for the name attribute. 80 */ setName(xsNCName atName)81 void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[1] = true; } 82 83 /** 84 * Gets the type attribute. 85 * @return Returns a xsNMTOKEN of the type attribute. 86 */ getType()87 xsNMTOKEN getType() const { return attrType; } 88 /** 89 * Sets the type attribute. 90 * @param atType The new value for the type attribute. 91 */ setType(xsNMTOKEN atType)92 void setType( xsNMTOKEN atType ) { *(daeStringRef*)&attrType = atType; _validAttributeArray[2] = true; } 93 94 /** 95 * Gets the asset element. 96 * @return a daeSmartRef to the asset element. 97 */ getAsset()98 const domAssetRef getAsset() const { return elemAsset; } 99 /** 100 * Gets the technique element array. 101 * @return Returns a reference to the array of technique elements. 102 */ getTechnique_array()103 domTechnique_Array &getTechnique_array() { return elemTechnique_array; } 104 /** 105 * Gets the technique element array. 106 * @return Returns a constant reference to the array of technique elements. 107 */ getTechnique_array()108 const domTechnique_Array &getTechnique_array() const { return elemTechnique_array; } 109 protected: 110 /** 111 * Constructor 112 */ domExtra(DAE & dae)113 domExtra(DAE& dae) : daeElement(dae), attrId(), attrName(), attrType(), elemAsset(), elemTechnique_array() {} 114 /** 115 * Destructor 116 */ ~domExtra()117 virtual ~domExtra() {} 118 /** 119 * Overloaded assignment operator 120 */ 121 virtual domExtra &operator=( const domExtra &cpy ) { (void)cpy; return *this; } 122 123 public: // STATIC METHODS 124 /** 125 * Creates an instance of this class and returns a daeElementRef referencing it. 126 * @return a daeElementRef referencing an instance of this object. 127 */ 128 static DLLSPEC daeElementRef create(DAE& dae); 129 /** 130 * Creates a daeMetaElement object that describes this element in the meta object reflection framework. 131 * If a daeMetaElement already exists it will return that instead of creating a new one. 132 * @return A daeMetaElement describing this COLLADA element. 133 */ 134 static DLLSPEC daeMetaElement* registerElement(DAE& dae); 135 }; 136 137 138 #endif 139