BsRTTIField.cpp 2.2 KB

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