CommonLibVR
TypeInfo.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace RE
4 {
5  namespace BSScript
6  {
7  class ObjectTypeInfo;
8 
9  class TypeInfo
10  {
11  public:
12  enum class RawType : std::size_t
13  {
14  kNone = 0,
15  kObject = 1,
16  kString = 2,
17  kInt = 3,
18  kFloat = 4,
19  kBool = 5,
20 
21  kNoneArray = 10,
22  kObjectArray = 11,
23  kStringArray = 12,
24  kIntArray = 13,
25  kFloatArray = 14,
26  kBoolArray = 15,
27 
29 
30  // the type id for classes IS their class ptr
31  // an object is an array if its first bit is set
32  };
33 
35  explicit TypeInfo(RawType a_type);
36  TypeInfo(const TypeInfo& a_rhs);
37  TypeInfo(TypeInfo&& a_rhs);
38 
39  TypeInfo& operator=(const TypeInfo& a_rhs);
42 
43  friend bool operator==(const TypeInfo& a_lhs, const TypeInfo& a_rhs);
44  friend bool operator!=(const TypeInfo& a_lhs, const TypeInfo& a_rhs);
45  friend bool operator<(const TypeInfo& a_lhs, const TypeInfo& a_rhs);
46  friend bool operator<=(const TypeInfo& a_lhs, const TypeInfo& a_rhs);
47  friend bool operator>(const TypeInfo& a_lhs, const TypeInfo& a_rhs);
48  friend bool operator>=(const TypeInfo& a_lhs, const TypeInfo& a_rhs);
49 
50  [[nodiscard]] RawType GetRawType() const;
51  [[nodiscard]] ObjectTypeInfo* GetTypeInfo() const;
52  [[nodiscard]] RawType GetUnmangledRawType() const;
53  [[nodiscard]] bool IsArray() const;
54  [[nodiscard]] bool IsBool() const;
55  [[nodiscard]] bool IsFloat() const;
56  [[nodiscard]] bool IsInt() const;
57  [[nodiscard]] bool IsLiteralArray() const;
58  [[nodiscard]] bool IsNoneArray() const;
59  [[nodiscard]] bool IsNoneObject() const;
60  [[nodiscard]] bool IsObject() const;
61  [[nodiscard]] bool IsObjectArray() const;
62  [[nodiscard]] bool IsString() const;
63  [[nodiscard]] std::string TypeAsString() const;
64  void SetType(RawType a_type);
65 
66  protected:
67  // members
69  };
70  static_assert(sizeof(TypeInfo) == 0x8);
71  }
72 }
Definition: ObjectTypeInfo.h:17
Definition: TypeInfo.h:10
friend bool operator>(const TypeInfo &a_lhs, const TypeInfo &a_rhs)
RawType
Definition: TypeInfo.h:13
TypeInfo(TypeInfo &&a_rhs)
friend bool operator>=(const TypeInfo &a_lhs, const TypeInfo &a_rhs)
RawType GetRawType() const
friend bool operator<=(const TypeInfo &a_lhs, const TypeInfo &a_rhs)
void SetType(RawType a_type)
TypeInfo & operator=(RawType a_rhs)
TypeInfo & operator=(const TypeInfo &a_rhs)
TypeInfo(const TypeInfo &a_rhs)
bool IsObjectArray() const
RawType GetUnmangledRawType() const
std::string TypeAsString() const
TypeInfo(RawType a_type)
TypeInfo & operator=(TypeInfo &&a_rhs)
ObjectTypeInfo * GetTypeInfo() const
bool IsLiteralArray() const
bool IsNoneArray() const
friend bool operator==(const TypeInfo &a_lhs, const TypeInfo &a_rhs)
stl::enumeration< RawType, std::size_t > _rawType
Definition: TypeInfo.h:68
friend bool operator<(const TypeInfo &a_lhs, const TypeInfo &a_rhs)
friend bool operator!=(const TypeInfo &a_lhs, const TypeInfo &a_rhs)
bool IsNoneObject() const
Definition: AbsorbEffect.h:6
string(const CharT(&)[N]) -> string< CharT, N - 1 >