BsRTTIField.cpp 1.9 KB

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