domChannel.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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/domChannel.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. domChannel::create(DAE& dae)
  24. {
  25. domChannelRef ref = new domChannel(dae);
  26. return ref;
  27. }
  28. daeMetaElement *
  29. domChannel::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( "channel" );
  36. meta->registerClass(domChannel::create);
  37. // Add attribute: source
  38. {
  39. daeMetaAttribute *ma = new daeMetaAttribute;
  40. ma->setName( "source" );
  41. ma->setType( dae.getAtomicTypes().get("URIFragmentType"));
  42. ma->setOffset( daeOffsetOf( domChannel , attrSource ));
  43. ma->setContainer( meta );
  44. ma->setIsRequired( true );
  45. meta->appendAttribute(ma);
  46. }
  47. // Add attribute: target
  48. {
  49. daeMetaAttribute *ma = new daeMetaAttribute;
  50. ma->setName( "target" );
  51. ma->setType( dae.getAtomicTypes().get("xsToken"));
  52. ma->setOffset( daeOffsetOf( domChannel , attrTarget ));
  53. ma->setContainer( meta );
  54. ma->setIsRequired( true );
  55. meta->appendAttribute(ma);
  56. }
  57. meta->setElementSize(sizeof(domChannel));
  58. meta->validate();
  59. return meta;
  60. }