CommonLibVR
Loading...
Searching...
No Matches
Offset.h
Go to the documentation of this file.
1#pragma once
2
3#include "REL/Module.h"
4
5namespace REL
6{
7 class Offset
8 {
9 public:
10 constexpr Offset() noexcept = default;
11
12 explicit constexpr Offset(std::size_t a_offset) noexcept :
13 _offset(a_offset)
14 {}
15
16 constexpr Offset& operator=(std::size_t a_offset) noexcept
17 {
18 _offset = a_offset;
19 return *this;
20 }
21
22 [[nodiscard]] std::uintptr_t address() const { return base() + offset(); }
23 [[nodiscard]] constexpr std::size_t offset() const noexcept { return _offset; }
24
25 private:
26 [[nodiscard]] static std::uintptr_t base() { return Module::get().base(); }
27
28 std::size_t _offset{ 0 };
29 };
30}
std::uintptr_t base() const noexcept
Definition Module.h:60
static Module & get()
Definition Module.h:54
Definition Offset.h:8
constexpr Offset() noexcept=default
std::uintptr_t address() const
Definition Offset.h:22
constexpr Offset & operator=(std::size_t a_offset) noexcept
Definition Offset.h:16
constexpr std::size_t offset() const noexcept
Definition Offset.h:23
Definition ID.h:9
Definition EffectArchetypes.h:65