domParam.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. #include <dae.h>
  14. #include <dae/daeDom.h>
  15. #include <dom/domParam.h>
  16. #include <dae/daeMetaCMPolicy.h>
  17. #include <dae/daeMetaSequence.h>
  18. #include <dae/daeMetaChoice.h>
  19. #include <dae/daeMetaGroup.h>
  20. #include <dae/daeMetaAny.h>
  21. #include <dae/daeMetaElementAttribute.h>
  22. daeElementRef
  23. domParam::create(DAE& dae)
  24. {
  25. domParamRef ref = new domParam(dae);
  26. return ref;
  27. }
  28. daeMetaElement *
  29. domParam::registerElement(DAE& dae)
  30. {
  31. daeMetaElement* meta = dae.getMeta(ID());
  32. if ( meta != NULL ) return meta;
  33. meta = new daeMetaElement(dae);
  34. dae.setMeta(ID(), *meta);
  35. meta->setName( "param" );
  36. meta->registerClass(domParam::create);
  37. // Add attribute: _value
  38. {
  39. daeMetaAttribute *ma = new daeMetaAttribute;
  40. ma->setName( "_value" );
  41. ma->setType( dae.getAtomicTypes().get("xsString"));
  42. ma->setOffset( daeOffsetOf( domParam , _value ));
  43. ma->setContainer( meta );
  44. meta->appendAttribute(ma);
  45. }
  46. // Add attribute: name
  47. {
  48. daeMetaAttribute *ma = new daeMetaAttribute;
  49. ma->setName( "name" );
  50. ma->setType( dae.getAtomicTypes().get("xsNCName"));
  51. ma->setOffset( daeOffsetOf( domParam , attrName ));
  52. ma->setContainer( meta );
  53. meta->appendAttribute(ma);
  54. }
  55. // Add attribute: sid
  56. {
  57. daeMetaAttribute *ma = new daeMetaAttribute;
  58. ma->setName( "sid" );
  59. ma->setType( dae.getAtomicTypes().get("xsNCName"));
  60. ma->setOffset( daeOffsetOf( domParam , attrSid ));
  61. ma->setContainer( meta );
  62. meta->appendAttribute(ma);
  63. }
  64. // Add attribute: semantic
  65. {
  66. daeMetaAttribute *ma = new daeMetaAttribute;
  67. ma->setName( "semantic" );
  68. ma->setType( dae.getAtomicTypes().get("xsNMTOKEN"));
  69. ma->setOffset( daeOffsetOf( domParam , attrSemantic ));
  70. ma->setContainer( meta );
  71. meta->appendAttribute(ma);
  72. }
  73. // Add attribute: type
  74. {
  75. daeMetaAttribute *ma = new daeMetaAttribute;
  76. ma->setName( "type" );
  77. ma->setType( dae.getAtomicTypes().get("xsNMTOKEN"));
  78. ma->setOffset( daeOffsetOf( domParam , attrType ));
  79. ma->setContainer( meta );
  80. ma->setIsRequired( true );
  81. meta->appendAttribute(ma);
  82. }
  83. meta->setElementSize(sizeof(domParam));
  84. meta->validate();
  85. return meta;
  86. }