DAEChannelTarget.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #ifndef DAECHANNELTARGET_H_
  2. #define DAECHANNELTARGET_H_
  3. namespace gameplay
  4. {
  5. /**
  6. * DAEChannelTarget represents the target attribute of the COLLADA dom element "channel".
  7. * The syntax for the channel target is in the COLLADA spec under "COLLADA Target Addressing".
  8. */
  9. class DAEChannelTarget
  10. {
  11. public:
  12. /**
  13. * Constructs the DAEChannelTarget from the given channel element.
  14. */
  15. DAEChannelTarget(const domChannelRef channelRef);
  16. /**
  17. * Destructor.
  18. */
  19. virtual ~DAEChannelTarget(void);
  20. /**
  21. * Returns a pointer to the dom element that this targeted.
  22. *
  23. * @return Pointer to the dom element or NULL if not found.
  24. */
  25. daeElement* getTargetElement();
  26. /**
  27. * Returns the target ID string.
  28. */
  29. const std::string& getTargetId() const;
  30. /**
  31. * Returns the number of target attributes for this channel target.
  32. */
  33. size_t getTargetAttributeCount() const;
  34. /**
  35. * Returns the attribute element at the given index.
  36. */
  37. daeElement* getTargetAttribute(size_t index);
  38. /**
  39. * Returns property name of the attribute at the given index.
  40. * The property name is copied to str.
  41. * If the attribute is not found or it doesn't have a property, str is cleared.
  42. *
  43. * @param index Index of the attribute.
  44. * @param str Destination string to copy the property name to.
  45. */
  46. void getPropertyName(size_t index, std::string* str);
  47. private:
  48. /**
  49. * The channel element.
  50. */
  51. const domChannelRef _channel;
  52. domElement* _targetElement;
  53. /**
  54. * The first part is the id attribute of an element in the instance document
  55. * or a dot segment (".") indicating that this is a relative address.
  56. */
  57. std::string _targetId;
  58. /**
  59. * A channel target can have zero or more target attributes.
  60. * Each target attribute my have a property.
  61. * Example: "cube/Translate.X/Translate.Y"
  62. * Result: attributeIds will contain 2 elements. "Translate.X" and "Translate.Y"
  63. * Refer to the COLLADA spec "COLLADA Target Addressing".
  64. */
  65. std::vector<std::string> _attributeIds;
  66. };
  67. }
  68. #endif