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 __domInstanceWithExtra_h__ 10 #define __domInstanceWithExtra_h__ 11 12 #include <dae/daeDocument.h> 13 #include <dom/domTypes.h> 14 #include <dom/domElements.h> 15 16 #include <dom/domExtra.h> 17 class DAE; 18 19 /** 20 * The InstanceWithExtra type is used for all generic instance elements. A 21 * generic instance element is one which does not have any specific child 22 * elements declared. 23 */ 24 class domInstanceWithExtra_complexType 25 { 26 protected: // Attributes 27 /** 28 * The url attribute refers to resource to instantiate. This may refer to 29 * a local resource using a relative URL fragment identifier that begins 30 * with the # character. The url attribute may refer to an external 31 * resource using an absolute or relative URL. 32 */ 33 xsAnyURI attrUrl; 34 /** 35 * The sid attribute is a text string value containing the sub-identifier 36 * of this element. This value must be unique within the scope of the parent 37 * element. Optional attribute. 38 */ 39 xsNCName attrSid; 40 /** 41 * The name attribute is the text string name of this element. Optional attribute. 42 */ 43 xsNCName attrName; 44 45 protected: // Element 46 /** 47 * The extra element may occur any number of times. @see domExtra 48 */ 49 domExtra_Array elemExtra_array; 50 51 public: //Accessors and Mutators 52 /** 53 * Gets the url attribute. 54 * @return Returns a xsAnyURI reference of the url attribute. 55 */ 56 xsAnyURI &getUrl() { return attrUrl; } 57 /** 58 * Gets the url attribute. 59 * @return Returns a constant xsAnyURI reference of the url attribute. 60 */ 61 const xsAnyURI &getUrl() const { return attrUrl; } 62 /** 63 * Sets the url attribute. 64 * @param atUrl The new value for the url attribute. 65 */ 66 void setUrl( const xsAnyURI &atUrl ) { attrUrl = atUrl; } 67 /** 68 * Sets the url attribute. 69 * @param atUrl The new value for the url attribute. 70 */ 71 void setUrl( xsString atUrl ) { attrUrl = atUrl; } 72 73 /** 74 * Gets the sid attribute. 75 * @return Returns a xsNCName of the sid attribute. 76 */ 77 xsNCName getSid() const { return attrSid; } 78 /** 79 * Sets the sid attribute. 80 * @param atSid The new value for the sid attribute. 81 */ 82 void setSid( xsNCName atSid ) { *(daeStringRef*)&attrSid = atSid;} 83 84 /** 85 * Gets the name attribute. 86 * @return Returns a xsNCName of the name attribute. 87 */ 88 xsNCName getName() const { return attrName; } 89 /** 90 * Sets the name attribute. 91 * @param atName The new value for the name attribute. 92 */ 93 void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName;} 94 95 /** 96 * Gets the extra element array. 97 * @return Returns a reference to the array of extra elements. 98 */ 99 domExtra_Array &getExtra_array() { return elemExtra_array; } 100 /** 101 * Gets the extra element array. 102 * @return Returns a constant reference to the array of extra elements. 103 */ 104 const domExtra_Array &getExtra_array() const { return elemExtra_array; } 105 protected: 106 /** 107 * Constructor 108 */ 109 domInstanceWithExtra_complexType(DAE& dae, daeElement* elt) : attrUrl(dae, *elt), attrSid(), attrName(), elemExtra_array() {} 110 /** 111 * Destructor 112 */ 113 virtual ~domInstanceWithExtra_complexType() {} 114 /** 115 * Overloaded assignment operator 116 */ 117 virtual domInstanceWithExtra_complexType &operator=( const domInstanceWithExtra_complexType &cpy ) { (void)cpy; return *this; } 118 }; 119 120 /** 121 * An element of type domInstanceWithExtra_complexType. 122 */ 123 class domInstanceWithExtra : public daeElement, public domInstanceWithExtra_complexType 124 { 125 public: 126 virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::INSTANCEWITHEXTRA; } 127 static daeInt ID() { return 3; } 128 virtual daeInt typeID() const { return ID(); } 129 130 public: //Accessors and Mutators 131 /** 132 * Gets the url attribute. 133 * @return Returns a xsAnyURI reference of the url attribute. 134 */ 135 xsAnyURI &getUrl() { return attrUrl; } 136 /** 137 * Gets the url attribute. 138 * @return Returns a constant xsAnyURI reference of the url attribute. 139 */ 140 const xsAnyURI &getUrl() const { return attrUrl; } 141 /** 142 * Sets the url attribute. 143 * @param atUrl The new value for the url attribute. 144 */ 145 void setUrl( const xsAnyURI &atUrl ) { attrUrl = atUrl; _validAttributeArray[0] = true; } 146 /** 147 * Sets the url attribute. 148 * @param atUrl The new value for the url attribute. 149 */ 150 void setUrl( xsString atUrl ) { attrUrl = atUrl; _validAttributeArray[0] = true; } 151 152 /** 153 * Gets the sid attribute. 154 * @return Returns a xsNCName of the sid attribute. 155 */ 156 xsNCName getSid() const { return attrSid; } 157 /** 158 * Sets the sid attribute. 159 * @param atSid The new value for the sid attribute. 160 */ 161 void setSid( xsNCName atSid ) { *(daeStringRef*)&attrSid = atSid; _validAttributeArray[1] = true; } 162 163 /** 164 * Gets the name attribute. 165 * @return Returns a xsNCName of the name attribute. 166 */ 167 xsNCName getName() const { return attrName; } 168 /** 169 * Sets the name attribute. 170 * @param atName The new value for the name attribute. 171 */ 172 void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[2] = true; } 173 174 protected: 175 /** 176 * Constructor 177 */ 178 domInstanceWithExtra(DAE& dae) : daeElement(dae), domInstanceWithExtra_complexType(dae, this) {} 179 /** 180 * Destructor 181 */ 182 virtual ~domInstanceWithExtra() {} 183 /** 184 * Overloaded assignment operator 185 */ 186 virtual domInstanceWithExtra &operator=( const domInstanceWithExtra &cpy ) { (void)cpy; return *this; } 187 188 public: // STATIC METHODS 189 /** 190 * Creates an instance of this class and returns a daeElementRef referencing it. 191 * @return a daeElementRef referencing an instance of this object. 192 */ 193 static DLLSPEC daeElementRef create(DAE& dae); 194 /** 195 * Creates a daeMetaElement object that describes this element in the meta object reflection framework. 196 * If a daeMetaElement already exists it will return that instead of creating a new one. 197 * @return A daeMetaElement describing this COLLADA element. 198 */ 199 static DLLSPEC daeMetaElement* registerElement(DAE& dae); 200 }; 201 202 203 #endif 204