domInstanceWithExtra.h 6.3 KB

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