CmResourceRTTI.h 793 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include "CmPrerequisites.h"
  3. #include "CmRTTIType.h"
  4. #include "CmResource.h"
  5. namespace CamelotFramework
  6. {
  7. class CM_EXPORT ResourceRTTI : public RTTIType<Resource, IReflectable, ResourceRTTI>
  8. {
  9. private:
  10. UINT32& getSize(Resource* obj) { return obj->mSize; }
  11. void setSize(Resource* obj, UINT32& size) { obj->mSize = size; }
  12. public:
  13. ResourceRTTI()
  14. {
  15. addPlainField("Size", 0, &ResourceRTTI::getSize, &ResourceRTTI::setSize);
  16. }
  17. virtual const String& getRTTIName()
  18. {
  19. static String name = "Resource";
  20. return name;
  21. }
  22. virtual UINT32 getRTTIId()
  23. {
  24. return 100;
  25. }
  26. virtual std::shared_ptr<IReflectable> newRTTIObject()
  27. {
  28. CM_EXCEPT(InternalErrorException, "Cannot instantiate an abstract class.");
  29. }
  30. };
  31. }