14 enum class ValueType : uint8_t {
84 _ObjectStart = String,
85 _ObjectEnd = ArrayMatrix4x4,
87 _ArrayStart = ArrayBool,
88 _ArrayEnd = ArrayMatrix4x4,
90 _StructStart = Vector2,
91 _StructEnd = Matrix4x4,
94 #if _WIN32 && !_M_ARM64
95 _HiddenParamStart = Vector3,
97 _HiddenParamStart = Matrix4x4,
99 _LastAssigned = Matrix4x4,
105 namespace ValueName {
106 static constexpr std::string_view Void =
"void";
107 static constexpr std::string_view Bool =
"bool";
108 static constexpr std::string_view Char8 =
"char8";
109 static constexpr std::string_view Char16 =
"char16";
110 static constexpr std::string_view Int8 =
"int8";
111 static constexpr std::string_view Int16 =
"int16";
112 static constexpr std::string_view Int32 =
"int32";
113 static constexpr std::string_view Int64 =
"int64";
114 static constexpr std::string_view UInt8 =
"uint8";
115 static constexpr std::string_view UInt16 =
"uint16";
116 static constexpr std::string_view UInt32 =
"uint32";
117 static constexpr std::string_view UInt64 =
"uint64";
118 static constexpr std::string_view Float =
"float";
119 static constexpr std::string_view Double =
"double";
120 static constexpr std::string_view Function =
"function";
121 static constexpr std::string_view String =
"string";
122 static constexpr std::string_view Any =
"any";
123 static constexpr std::string_view ArrayBool =
"bool[]";
124 static constexpr std::string_view ArrayChar8 =
"char8[]";
125 static constexpr std::string_view ArrayChar16 =
"char16[]";
126 static constexpr std::string_view ArrayInt8 =
"int8[]";
127 static constexpr std::string_view ArrayInt16 =
"int16[]";
128 static constexpr std::string_view ArrayInt32 =
"int32[]";
129 static constexpr std::string_view ArrayInt64 =
"int64[]";
130 static constexpr std::string_view ArrayUInt8 =
"uint8[]";
131 static constexpr std::string_view ArrayUInt16 =
"uint16[]";
132 static constexpr std::string_view ArrayUInt32 =
"uint32[]";
133 static constexpr std::string_view ArrayUInt64 =
"uint64[]";
134 static constexpr std::string_view ArrayFloat =
"float[]";
135 static constexpr std::string_view ArrayDouble =
"double[]";
136 static constexpr std::string_view ArrayString =
"string[]";
137 static constexpr std::string_view ArrayAny =
"any[]";
138 static constexpr std::string_view ArrayVector2 =
"vec2[]";
139 static constexpr std::string_view ArrayVector3 =
"vec3[]";
140 static constexpr std::string_view ArrayVector4 =
"vec4[]";
141 static constexpr std::string_view ArrayMatrix4x4 =
"mat4x4[]";
142 static constexpr std::string_view Vector2 =
"vec2";
143 static constexpr std::string_view Vector3 =
"vec3";
144 static constexpr std::string_view Vector4 =
"vec4";
145 static constexpr std::string_view Matrix4x4 =
"mat4x4";
146 static constexpr std::string_view Invalid =
"invalid";
147 #if INTPTR_MAX == INT32_MAX
148 static constexpr std::string_view Pointer =
"ptr32";
149 static constexpr std::string_view ArrayPointer =
"ptr32[]";
150 #elif INTPTR_MAX == INT64_MAX
151 static constexpr std::string_view Pointer =
"ptr64";
152 static constexpr std::string_view ArrayPointer =
"ptr64[]";
154 #error "Environment not 32 or 64-bit."
161 namespace ValueUtils {
173 return x >= a && x <= b;
182 constexpr
bool IsVoid(ValueType type) noexcept {
return type == ValueType::Void; }
190 constexpr
bool IsValid(ValueType type) noexcept {
return IsBetween(type, ValueType::Void, ValueType::_LastAssigned); }
198 constexpr
bool IsScalar(ValueType type) noexcept {
return IsBetween(type, ValueType::_BaseStart, ValueType::_BaseEnd); }
206 constexpr
bool IsFloating(ValueType type) noexcept {
return IsBetween(type, ValueType::_FloatStart, ValueType::_FloatEnd); }
214 constexpr
bool IsBool(ValueType type) noexcept {
return type == ValueType::Bool; }
222 constexpr
bool IsChar8(ValueType type) noexcept {
return type == ValueType::Char8; }
230 constexpr
bool IsChar16(ValueType type) noexcept {
return type == ValueType::Char16; }
238 constexpr
bool IsInt8(ValueType type) noexcept {
return type == ValueType::Int8; }
246 constexpr
bool IsUInt8(ValueType type) noexcept {
return type == ValueType::UInt8; }
254 constexpr
bool IsInt16(ValueType type) noexcept {
return type == ValueType::Int16; }
262 constexpr
bool IsUInt16(ValueType type) noexcept {
return type == ValueType::UInt16; }
270 constexpr
bool IsInt32(ValueType type) noexcept {
return type == ValueType::Int32; }
278 constexpr
bool IsUInt32(ValueType type) noexcept {
return type == ValueType::UInt32; }
286 constexpr
bool IsInt64(ValueType type) noexcept {
return type == ValueType::Int64; }
294 constexpr
bool IsUInt64(ValueType type) noexcept {
return type == ValueType::UInt64; }
302 constexpr
bool IsPointer(ValueType type) noexcept {
return type == ValueType::Pointer; }
310 constexpr
bool IsFloat(ValueType type) noexcept {
return type == ValueType::Float; }
318 constexpr
bool IsDouble(ValueType type) noexcept {
return type == ValueType::Double; }
326 constexpr
bool IsFunction(ValueType type) noexcept {
return type == ValueType::Function; }
334 constexpr
bool IsString(ValueType type) noexcept {
return type == ValueType::String; }
342 constexpr
bool IsAny(ValueType type) noexcept {
return type == ValueType::Any; }
350 constexpr
bool IsObject(ValueType type) noexcept {
return IsBetween(type, ValueType::_ObjectStart, ValueType::_ObjectEnd); }
358 constexpr
bool IsArray(ValueType type) noexcept {
return IsBetween(type, ValueType::_ArrayStart, ValueType::_ArrayEnd); }
366 constexpr
bool IsStruct(ValueType type) noexcept {
return IsBetween(type, ValueType::_StructStart, ValueType::_StructEnd); }
380 return IsObject(type) ||
IsBetween(type, ValueType::_HiddenParamStart, ValueType::_StructEnd);
388 constexpr std::string_view
ToString(ValueType value) noexcept {
390 case ValueType::Void:
return ValueName::Void;
391 case ValueType::Bool:
return ValueName::Bool;
392 case ValueType::Char8:
return ValueName::Char8;
393 case ValueType::Char16:
return ValueName::Char16;
394 case ValueType::Int8:
return ValueName::Int8;
395 case ValueType::Int16:
return ValueName::Int16;
396 case ValueType::Int32:
return ValueName::Int32;
397 case ValueType::Int64:
return ValueName::Int64;
398 case ValueType::UInt8:
return ValueName::UInt8;
399 case ValueType::UInt16:
return ValueName::UInt16;
400 case ValueType::UInt32:
return ValueName::UInt32;
401 case ValueType::UInt64:
return ValueName::UInt64;
402 case ValueType::Pointer:
return ValueName::Pointer;
403 case ValueType::Float:
return ValueName::Float;
404 case ValueType::Double:
return ValueName::Double;
405 case ValueType::Function:
return ValueName::Function;
406 case ValueType::String:
return ValueName::String;
407 case ValueType::Any:
return ValueName::Any;
408 case ValueType::ArrayBool:
return ValueName::ArrayBool;
409 case ValueType::ArrayChar8:
return ValueName::ArrayChar8;
410 case ValueType::ArrayChar16:
return ValueName::ArrayChar16;
411 case ValueType::ArrayInt8:
return ValueName::ArrayInt8;
412 case ValueType::ArrayInt16:
return ValueName::ArrayInt16;
413 case ValueType::ArrayInt32:
return ValueName::ArrayInt32;
414 case ValueType::ArrayInt64:
return ValueName::ArrayInt64;
415 case ValueType::ArrayUInt8:
return ValueName::ArrayUInt8;
416 case ValueType::ArrayUInt16:
return ValueName::ArrayUInt16;
417 case ValueType::ArrayUInt32:
return ValueName::ArrayUInt32;
418 case ValueType::ArrayUInt64:
return ValueName::ArrayUInt64;
419 case ValueType::ArrayPointer:
return ValueName::ArrayPointer;
420 case ValueType::ArrayFloat:
return ValueName::ArrayFloat;
421 case ValueType::ArrayDouble:
return ValueName::ArrayDouble;
422 case ValueType::ArrayString:
return ValueName::ArrayString;
423 case ValueType::ArrayAny:
return ValueName::ArrayAny;
424 case ValueType::ArrayVector2:
return ValueName::ArrayVector2;
425 case ValueType::ArrayVector3:
return ValueName::ArrayVector3;
426 case ValueType::ArrayVector4:
return ValueName::ArrayVector4;
427 case ValueType::ArrayMatrix4x4:
return ValueName::ArrayMatrix4x4;
428 case ValueType::Vector2:
return ValueName::Vector2;
429 case ValueType::Vector3:
return ValueName::Vector3;
430 case ValueType::Vector4:
return ValueName::Vector4;
431 case ValueType::Matrix4x4:
return ValueName::Matrix4x4;
432 default:
return ValueName::Invalid;
441 constexpr ValueType
FromString(std::string_view value) noexcept {
442 if (value == ValueName::Void) {
443 return ValueType::Void;
444 }
else if (value == ValueName::Bool) {
445 return ValueType::Bool;
446 }
else if (value == ValueName::Char8) {
447 return ValueType::Char8;
448 }
else if (value == ValueName::Char16) {
449 return ValueType::Char16;
450 }
else if (value == ValueName::Int8) {
451 return ValueType::Int8;
452 }
else if (value == ValueName::Int16) {
453 return ValueType::Int16;
454 }
else if (value == ValueName::Int32) {
455 return ValueType::Int32;
456 }
else if (value == ValueName::Int64) {
457 return ValueType::Int64;
458 }
else if (value == ValueName::UInt8) {
459 return ValueType::UInt8;
460 }
else if (value == ValueName::UInt16) {
461 return ValueType::UInt16;
462 }
else if (value == ValueName::UInt32) {
463 return ValueType::UInt32;
464 }
else if (value == ValueName::UInt64) {
465 return ValueType::UInt64;
466 }
else if (value == ValueName::Pointer) {
467 return ValueType::Pointer;
468 }
else if (value == ValueName::Float) {
469 return ValueType::Float;
470 }
else if (value == ValueName::Double) {
471 return ValueType::Double;
472 }
else if (value == ValueName::Function) {
473 return ValueType::Function;
474 }
else if (value == ValueName::String) {
475 return ValueType::String;
476 }
else if (value == ValueName::Any) {
477 return ValueType::Any;
478 }
else if (value == ValueName::ArrayBool) {
479 return ValueType::ArrayBool;
480 }
else if (value == ValueName::ArrayChar8) {
481 return ValueType::ArrayChar8;
482 }
else if (value == ValueName::ArrayChar16) {
483 return ValueType::ArrayChar16;
484 }
else if (value == ValueName::ArrayInt8) {
485 return ValueType::ArrayInt8;
486 }
else if (value == ValueName::ArrayInt16) {
487 return ValueType::ArrayInt16;
488 }
else if (value == ValueName::ArrayInt32) {
489 return ValueType::ArrayInt32;
490 }
else if (value == ValueName::ArrayInt64) {
491 return ValueType::ArrayInt64;
492 }
else if (value == ValueName::ArrayUInt8) {
493 return ValueType::ArrayUInt8;
494 }
else if (value == ValueName::ArrayUInt16) {
495 return ValueType::ArrayUInt16;
496 }
else if (value == ValueName::ArrayUInt32) {
497 return ValueType::ArrayUInt32;
498 }
else if (value == ValueName::ArrayUInt64) {
499 return ValueType::ArrayUInt64;
500 }
else if (value == ValueName::ArrayPointer) {
501 return ValueType::ArrayPointer;
502 }
else if (value == ValueName::ArrayFloat) {
503 return ValueType::ArrayFloat;
504 }
else if (value == ValueName::ArrayDouble) {
505 return ValueType::ArrayDouble;
506 }
else if (value == ValueName::ArrayString) {
507 return ValueType::ArrayString;
508 }
else if (value == ValueName::ArrayAny) {
509 return ValueType::ArrayAny;
510 }
else if (value == ValueName::ArrayVector2) {
511 return ValueType::ArrayVector2;
512 }
else if (value == ValueName::ArrayVector3) {
513 return ValueType::ArrayVector3;
514 }
else if (value == ValueName::ArrayVector4) {
515 return ValueType::ArrayVector4;
516 }
else if (value == ValueName::ArrayMatrix4x4) {
517 return ValueType::ArrayMatrix4x4;
518 }
else if (value == ValueName::Vector2) {
519 return ValueType::Vector2;
520 }
else if (value == ValueName::Vector3) {
521 return ValueType::Vector3;
522 }
else if (value == ValueName::Vector4) {
523 return ValueType::Vector4;
524 }
else if (value == ValueName::Matrix4x4) {
525 return ValueType::Matrix4x4;
527 return ValueType::Invalid;
constexpr bool IsBool(ValueType type) noexcept
Tests whether a given type is a 1-bit boolean.
constexpr bool IsDouble(ValueType type) noexcept
Tests whether a given type is a double.
constexpr bool IsChar16(ValueType type) noexcept
Tests whether a given type is a 16-bit character.
constexpr bool IsFloating(ValueType type) noexcept
Tests whether a given type is a scalar floating point of any size.
constexpr bool IsAny(ValueType type) noexcept
Tests whether a given type is an any.
constexpr bool IsVoid(ValueType type) noexcept
Tests whether a given type is ValueType::Void.
constexpr bool IsChar8(ValueType type) noexcept
Tests whether a given type is an 8-bit character.
constexpr bool IsBetween(T x, T a, T b) noexcept
Checks if a value is between two other values.
constexpr bool IsUInt32(ValueType type) noexcept
Tests whether a given type is a 32-bit unsigned integer.
constexpr bool IsString(ValueType type) noexcept
Tests whether a given type is a string.
constexpr bool IsUInt8(ValueType type) noexcept
Tests whether a given type is an 8-bit unsigned integer.
constexpr bool IsStruct(ValueType type) noexcept
Tests whether a given type is a POD (plain old data) structure of any size.
constexpr bool IsFloat(ValueType type) noexcept
Tests whether a given type is a float.
constexpr std::string_view ToString(ValueType value) noexcept
Convert a ValueType enum value to its string representation.
constexpr bool IsPointer(ValueType type) noexcept
Tests whether a given type is a pointer.
constexpr bool IsValid(ValueType type) noexcept
Tests whether a given type is a valid non-void type.
constexpr bool IsScalar(ValueType type) noexcept
Tests whether a given type is scalar (has no vector part).
constexpr bool IsInt64(ValueType type) noexcept
Tests whether a given type is a 64-bit integer.
constexpr bool IsFunction(ValueType type) noexcept
Tests whether a given type is a C-function pointer.
constexpr bool IsUInt16(ValueType type) noexcept
Tests whether a given type is a 16-bit unsigned integer.
constexpr bool IsObject(ValueType type) noexcept
Tests whether a given type is an object of any size.
constexpr ValueType FromString(std::string_view value) noexcept
Convert a string representation to a ValueType enum value.
constexpr bool IsInt16(ValueType type) noexcept
Tests whether a given type is a 16-bit integer.
constexpr bool IsInt32(ValueType type) noexcept
Tests whether a given type is a 32-bit integer.
constexpr bool IsInt8(ValueType type) noexcept
Tests whether a given type is an 8-bit integer.
constexpr bool IsArray(ValueType type) noexcept
Tests whether a given type is an array of any size.
constexpr bool IsUInt64(ValueType type) noexcept
Tests whether a given type is a 64-bit unsigned integer.
constexpr bool IsHiddenParam(ValueType type) noexcept
Checks if a given ValueType is considered a hidden object parameter.