BsRTTIField.cpp 2.2 KB

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