24 static_assert(!
sizeof(T*),
"Invalid target type for GetRawType.");
66 requires((is_array_v<T> || is_reference_wrapper_v<T>)&&(is_builtin_convertible_v<typename T::value_type> || is_form_pointer_v<typename T::value_type> ||
67 is_alias_pointer_v<typename T::value_type> || is_active_effect_pointer_v<typename T::value_type>))
struct GetRawType<T>
71 using value_type =
typename T::value_type;
72 if constexpr (is_builtin_convertible_v<value_type>) {
74 }
else if constexpr (is_form_pointer_v<value_type>) {
76 }
else if constexpr (is_alias_pointer_v<value_type> || is_active_effect_pointer_v<value_type>) {
79 static_assert(
sizeof(T) &&
false);
86 class U = std::decay_t<T>,
88 is_string_convertible_v<U>,
97 class U = std::decay_t<T>,
99 is_signed_integral_convertible_v<U>,
101 inline void PackValue(Variable* a_dst, T&& a_src)
104 a_dst->SetSInt(
static_cast<std::int32_t
>(std::forward<T>(a_src)));
108 class U = std::decay_t<T>,
110 is_unsigned_integral_convertible_v<U>,
112 inline void PackValue(Variable* a_dst, T&& a_src)
115 a_dst->SetUInt(
static_cast<std::uint32_t
>(std::forward<T>(a_src)));
120 class U = std::decay_t<T>,
122 is_floating_point_convertible_v<U>,
124 inline void PackValue(Variable* a_dst, T&& a_src)
127 a_dst->SetFloat(
static_cast<float>(std::forward<T>(a_src)));
132 class U = std::decay_t<T>,
136 inline void PackValue(Variable* a_dst, T&& a_src)
139 a_dst->SetBool(
static_cast<bool>(std::forward<T>(a_src)));
144 class U = std::decay_t<T>,
146 is_form_pointer_v<U>,
148 inline void PackValue(Variable* a_dst, T&& a_src)
150 PackHandle(a_dst, std::forward<T>(a_src),
static_cast<VMTypeID>(decay_pointer_t<U>::FORMTYPE));
155 class U = std::decay_t<T>,
157 is_alias_pointer_v<U>,
159 inline void PackValue(Variable* a_dst, T&& a_src)
161 PackHandle(a_dst, std::forward<T>(a_src), decay_pointer_t<U>::VMTYPEID);
166 class U = std::decay_t<T>,
168 is_active_effect_pointer_v<U>,
170 inline void PackValue(Variable* a_dst, T&& a_src)
172 PackHandle(a_dst, std::forward<T>(a_src), decay_pointer_t<U>::VMTYPEID);
177 class U = std::decay_t<T>,
181 void PackValue(Variable* a_dst, T&& a_src);
186 is_static_base_pointer_v<T>,
190 return static_cast<T
>(
nullptr);
196 is_string_convertible_v<T>,
207 is_signed_integral_convertible_v<T>,
209 [[nodiscard]]
inline T
UnpackValue(
const Variable* a_src)
212 return static_cast<T
>(a_src->GetSInt());
218 is_unsigned_integral_convertible_v<T>,
220 [[nodiscard]]
inline T
UnpackValue(
const Variable* a_src)
223 return static_cast<T
>(a_src->GetUInt());
229 is_floating_point_convertible_v<T>,
231 [[nodiscard]]
inline T
UnpackValue(
const Variable* a_src)
234 return static_cast<T
>(a_src->GetFloat());
242 [[nodiscard]]
inline T
UnpackValue(
const Variable* a_src)
245 return static_cast<T
>(a_src->GetBool());
251 is_form_pointer_v<T>,
253 [[nodiscard]]
inline T
UnpackValue(
const Variable* a_src)
255 return static_cast<T
>(
UnpackHandle(a_src,
static_cast<VMTypeID>(decay_pointer_t<T>::FORMTYPE)));
261 is_alias_pointer_v<T>,
263 [[nodiscard]]
inline T
UnpackValue(
const Variable* a_src)
265 return static_cast<T
>(
UnpackHandle(a_src, decay_pointer_t<T>::VMTYPEID));
271 is_active_effect_pointer_v<T>,
273 [[nodiscard]]
inline T
UnpackValue(
const Variable* a_src)
275 return static_cast<T
>(
UnpackHandle(a_src, decay_pointer_t<T>::VMTYPEID));
283 [[nodiscard]] T
UnpackValue(
const Variable* a_src);
288 is_reference_wrapper_v<T>,
298 PackValue<T>(
this, std::forward<T>(a_src));
304 return UnpackValue<T>(
this);
RawType
Definition: TypeInfo.h:13
Definition: Variable.h:15
void SetString(std::string_view a_val)
void Pack(T &&a_src)
Definition: PackUnpack.h:296
T Unpack() const
Definition: PackUnpack.h:302
std::string_view GetString() const
Definition: BSTSmartPointer.h:36
T UnpackValue([[maybe_unused]] const Variable *a_src)
Definition: PackUnpack.h:188
requires(is_builtin_convertible_v< T >) struct GetRawType< T >
Definition: PackUnpack.h:30
typename decay_pointer< T >::type decay_pointer_t
Definition: CommonTypeTraits.h:200
typename unwrapped_type< T >::type unwrapped_type_t
Definition: TypeTraits.h:67
TypeInfo::RawType GetRawTypeFromVMType(VMTypeID a_typeID)
void PackHandle(Variable *a_dst, const void *a_src, VMTypeID a_typeID)
void * UnpackHandle(const Variable *a_src, VMTypeID a_typeID)
void PackValue(Variable *a_dst, T &&a_src)
Definition: PackUnpack.h:90
void BindID(BSTSmartPointer< Object > &a_object, const void *a_src, VMTypeID a_typeID)
Definition: AbsorbEffect.h:6
std::uint32_t VMTypeID
Definition: BSCoreTypes.h:9
Definition: PackUnpack.h:21
constexpr TypeInfo::RawType operator()() const noexcept
Definition: PackUnpack.h:22