1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#include "Reflection/BsRTTIField.h"
4#include "Error/BsException.h"
5
6namespace bs
7{
8 RTTIFieldInfo RTTIFieldInfo::DEFAULT;
9
10 void RTTIField::checkIsPlain(bool array)
11 {
12 if(!isPlainType())
13 {
14 BS_EXCEPT(InternalErrorException,
15 "Invalid field type. Needed: Plain type. Got: " + toString(mIsVectorType) + ", " +
16 toString(isPlainType()) + ", " + toString(isReflectableType()) + ", " + toString(isDataBlockType()) + ", " + toString(isReflectablePtrType()));
17 }
18
19 checkIsArray(array);
20 }
21
22 void RTTIField::checkIsDataBlock()
23 {
24 if(!isDataBlockType())
25 {
26 BS_EXCEPT(InternalErrorException,
27 "Invalid field type. Needed: Data block. Got: " + toString(mIsVectorType) + ", " +
28 toString(isPlainType()) + ", " + toString(isReflectableType()) + ", " + toString(isDataBlockType()) + ", " + toString(isReflectablePtrType()));
29 }
30 }
31
32 void RTTIField::checkIsComplex(bool array)
33 {
34 if(!isReflectableType())
35 {
36 BS_EXCEPT(InternalErrorException,
37 "Invalid field type. Needed: Complex type. Got: " + toString(mIsVectorType) + ", " +
38 toString(isPlainType()) + ", " + toString(isReflectableType()) + ", " + toString(isDataBlockType()) + ", " + toString(isReflectablePtrType()));
39 }
40
41 checkIsArray(array);
42 }
43
44 void RTTIField::checkIsComplexPtr(bool array)
45 {
46 if(!isReflectablePtrType())
47 {
48 BS_EXCEPT(InternalErrorException,
49 "Invalid field type. Needed: Complex ptr type. Got: " + toString(mIsVectorType) + ", " +
50 toString(isPlainType()) + ", " + toString(isReflectableType()) + ", " + toString(isDataBlockType()) + ", " + toString(isReflectablePtrType()));
51 }
52
53 checkIsArray(array);
54 }
55
56 void RTTIField::checkIsArray(bool array)
57 {
58 if(array && !mIsVectorType)
59 {
60 BS_EXCEPT(InternalErrorException,
61 "Invalid field type. Needed an array type but got a single type.");
62 }
63
64 if(!array && mIsVectorType)
65 {
66 BS_EXCEPT(InternalErrorException,
67 "Invalid field type. Needed a single type but got an array type.");
68 }
69 }
70}