CmRTTIField.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #include "CmRTTIField.h"
  2. #include "CmException.h"
  3. namespace CamelotEngine
  4. {
  5. void RTTIField::checkIsSimple(bool array)
  6. {
  7. if(!isSimpleType())
  8. {
  9. CM_EXCEPT(InternalErrorException,
  10. "Invalid field type. Needed: Simple type. Got: " + toString(mIsVectorType) + ", " +
  11. toString(isSimpleType()) + ", " + toString(isComplexType()) + ", " + toString(isDataBlockType()) + ", " + toString(isComplexPtrType()));
  12. }
  13. checkIsArray(array);
  14. }
  15. void RTTIField::checkIsDataBlock()
  16. {
  17. if(!isDataBlockType())
  18. {
  19. CM_EXCEPT(InternalErrorException,
  20. "Invalid field type. Needed: Data block. Got: " + toString(mIsVectorType) + ", " +
  21. toString(isSimpleType()) + ", " + toString(isComplexType()) + ", " + toString(isDataBlockType()) + ", " + toString(isComplexPtrType()));
  22. }
  23. }
  24. void RTTIField::checkIsComplex(bool array)
  25. {
  26. if(!isComplexType())
  27. {
  28. CM_EXCEPT(InternalErrorException,
  29. "Invalid field type. Needed: Complex type. Got: " + toString(mIsVectorType) + ", " +
  30. toString(isSimpleType()) + ", " + toString(isComplexType()) + ", " + toString(isDataBlockType()) + ", " + toString(isComplexPtrType()));
  31. }
  32. checkIsArray(array);
  33. }
  34. void RTTIField::checkIsComplexPtr(bool array)
  35. {
  36. if(!isComplexPtrType())
  37. {
  38. CM_EXCEPT(InternalErrorException,
  39. "Invalid field type. Needed: Complex ptr type. Got: " + toString(mIsVectorType) + ", " +
  40. toString(isSimpleType()) + ", " + toString(isComplexType()) + ", " + toString(isDataBlockType()) + ", " + toString(isComplexPtrType()));
  41. }
  42. checkIsArray(array);
  43. }
  44. void RTTIField::checkIsArray(bool array)
  45. {
  46. if(array && !mIsVectorType)
  47. {
  48. CM_EXCEPT(InternalErrorException,
  49. "Invalid field type. Needed an array type but got a single type.");
  50. }
  51. if(!array && mIsVectorType)
  52. {
  53. CM_EXCEPT(InternalErrorException,
  54. "Invalid field type. Needed a single type but got an array type.");
  55. }
  56. }
  57. }