Refureku v2.2.0
C++17 runtime reflection library.
StaticField.h
1
8#pragma once
9
10#include <cassert>
11#include <type_traits> //std::is_rvalue_reference_v, std::is_lvalue_reference_v, std::is_const_v...
12#include <utility> //std::forward, std::move
13
14#include "Refureku/TypeInfo/Variables/FieldBase.h"
15
16namespace rfk
17{
18 class StaticField final : public FieldBase
19 {
20 public:
21 REFUREKU_INTERNAL StaticField(char const* name,
22 std::size_t id,
23 Type const& type,
24 EFieldFlags flags,
25 Struct const* owner,
26 void* ptr,
27 Entity const* outerEntity = nullptr) noexcept;
28 REFUREKU_INTERNAL StaticField(char const* name,
29 std::size_t id,
30 Type const& type,
31 EFieldFlags flags,
32 Struct const* owner,
33 void const* constPtr,
34 Entity const* outerEntity = nullptr) noexcept;
35 REFUREKU_INTERNAL StaticField(StaticField&&) noexcept;
36 REFUREKU_INTERNAL ~StaticField() noexcept;
37
53 template <typename ValueType>
54 RFK_NODISCARD ValueType get() const;
55
68 template <typename ValueType>
69 void set(ValueType&& value) const;
70
80 REFUREKU_API void set(void const* valuePtr,
81 std::size_t valueSize) const;
82
89 RFK_NODISCARD REFUREKU_API void* getPtr() const;
90
96 RFK_NODISCARD REFUREKU_API void const* getConstPtr() const noexcept;
97
98 protected:
99 //Forward declaration
100 class StaticFieldImpl;
101
102 RFK_GEN_GET_PIMPL(StaticFieldImpl, Entity::getPimpl())
103 };
104
105 REFUREKU_TEMPLATE_API(rfk::Allocator<StaticField const*>);
106 REFUREKU_TEMPLATE_API(rfk::Vector<StaticField const*, rfk::Allocator<StaticField const*>>);
107
108 #include "Refureku/TypeInfo/Variables/StaticField.inl"
109}
Definition: Allocator.h:19
Definition: Entity.h:29
Definition: FieldBase.h:20
Definition: StaticField.h:19
RFK_NODISCARD REFUREKU_API void * getPtr() const
Get a non-const pointer to this static field. Performing non-const operations on the pointer if the s...
REFUREKU_API void set(void const *valuePtr, std::size_t valueSize) const
Copy dataSize bytes starting from data into the static field. This method is not safe if you provide ...
void set(ValueType &&value) const
Set the data corresponding to this static field. This method is not safe if you provide a wrong Value...
RFK_NODISCARD REFUREKU_API void const * getConstPtr() const noexcept
Get a const pointer to this static field.
RFK_NODISCARD ValueType get() const
Get the data corresponding to this static field. This method in not safe if you provide a wrong Value...
Definition: Struct.h:40
Definition: Type.h:20
Definition: Vector.h:19
Definition: Allocator.h:16
EFieldFlags
Definition: EFieldFlags.h:16