domExtra.h 4.3 KB

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