/tools/EffectGenerator/ParentXMLTypes.h

http://rgdengine.googlecode.com/ · C Header · 57 lines · 35 code · 14 blank · 8 comment · 2 complexity · 6c8820684fafcc6333b0e427fa8e39d7 MD5 · raw file

  1. //////////////////////////////////////////////////////////////////////////
  2. // @author Sidorenko "PC" Alexander
  3. // @date 02.07.2006
  4. // email: sidorenko.alexander@gmail.com
  5. // project: RGDE
  6. // description:
  7. // example of use:
  8. //////////////////////////////////////////////////////////////////////////
  9. #pragma once
  10. #include "BaseXMLTypes.h"
  11. template <class TLeafType>
  12. class TParentElement : public IBaseElement
  13. {
  14. public:
  15. typedef std::vector<TLeafType> LeafElements;
  16. public:
  17. TParentElement(const TiXmlElement* elem)
  18. : IBaseElement(elem)
  19. {
  20. const TiXmlElement* first = elem->FirstChildElement();
  21. const TiXmlElement* current = first;
  22. while(current != NULL)
  23. {
  24. m_children.push_back(TLeafType(current));
  25. current = current->NextSiblingElement();
  26. }
  27. }
  28. const LeafElements& getChildren() const
  29. {
  30. return m_children;
  31. }
  32. private:
  33. LeafElements m_children;
  34. };
  35. template <class TLeafType>
  36. class TAttributedParentElement : public TParentElement<TLeafType>, public IHasAttributes
  37. {
  38. public:
  39. TAttributedParentElement(const TiXmlElement* elem)
  40. : TParentElement(elem), IHasAttributes(elem)
  41. {
  42. }
  43. };