16 explicit Address(
void* address) noexcept : _address(address) {}
18 explicit operator bool() const noexcept {
return _address !=
nullptr; }
19 void*
Ptr() const noexcept {
return _address; }
22 void* _address =
nullptr;
30 explicit ClassTable(
void* table) noexcept : _table(table) {}
32 explicit operator bool() const noexcept {
return _table !=
nullptr; }
33 void*
Ptr() const noexcept {
return _table; }
36 void* _table =
nullptr;
43template <
class Ret,
class...
Args>
48 explicit Fn(
void* address) noexcept : _address(address) {}
50 explicit operator bool() const noexcept {
return _address !=
nullptr; }
51 void*
Ptr() const noexcept {
return _address; }
55 return std::bit_cast<Ret (*)(
Args...)>(_address)(std::forward<Args>(args)...);
59 void* _address =
nullptr;
67template <
class Ret,
class Object,
class...
Args>
72 VirtualFn(
int index,
void* table) noexcept : _index(index), _table(table) {}
74 explicit operator bool() const noexcept {
return _index >= 0 && _table !=
nullptr; }
75 int Index() const noexcept {
return _index; }
76 void*
Table() const noexcept {
return _table; }
80 auto* vtable = *
reinterpret_cast<void***
>(object);
81 return std::bit_cast<Ret (*)(Object*,
Args...)>(vtable[_index])(
object, std::forward<Args>(args)...);
86 void* _table =
nullptr;
95 explicit constexpr Offset(
int value) noexcept : _value(value) {}
97 explicit constexpr operator bool() const noexcept {
return _value >= 0; }
98 constexpr int Value() const noexcept {
return _value; }
103 if (_value >= 0 && base)
105 std::memcpy(&out,
static_cast<const uint8_t*
>(base) + _value,
sizeof(
T));
110 void Write(
void* base,
const T& value)
const
112 if (_value >= 0 && base)
114 std::memcpy(
static_cast<uint8_t*
>(base) + _value, &value,
sizeof(
T));
128 explicit constexpr Offset(
int value) noexcept : _value(value) {}
130 explicit constexpr operator bool() const noexcept {
return _value >= 0; }
131 constexpr int Value() const noexcept {
return _value; }
133 const void*
Ptr(
const void* base)
const
135 if (_value < 0 || !base)
139 return static_cast<const uint8_t*
>(base) + _value;
void * Ptr() const noexcept
Address(void *address) noexcept
ClassTable(void *table) noexcept
void * Ptr() const noexcept
Ret operator()(Args... args) const
void * Ptr() const noexcept
Fn(void *address) noexcept
constexpr Offset(int value) noexcept
const void * Ptr(const void *base) const
constexpr int Value() const noexcept
constexpr int Value() const noexcept
constexpr Offset(int value) noexcept
T Read(const void *base) const
void Write(void *base, const T &value) const
VirtualFn(int index, void *table) noexcept
void * Table() const noexcept
Ret operator()(Object *object, Args... args) const
int Index() const noexcept
The argument types a command handler's parameter list is written in.