Refureku v2.2.0
C++17 runtime reflection library.
Function.h
1
8#pragma once
9
10#include "Refureku/TypeInfo/Functions/FunctionBase.h"
11#include "Refureku/TypeInfo/Functions/EFunctionFlags.h"
12#include "Refureku/TypeInfo/Functions/NonMemberFunction.h"
13
14namespace rfk
15{
16 class Function final : public FunctionBase
17 {
18 public:
19 REFUREKU_API Function(char const* name,
20 std::size_t id,
21 Type const& returnType,
22 ICallable* internalFunction,
23 EFunctionFlags flags) noexcept;
24 Function(Function&&) = delete;
25 REFUREKU_API ~Function() noexcept;
26
43 template <typename ReturnType = void, typename... ArgTypes>
44 ReturnType invoke(ArgTypes&&... args) const;
45
68 template <typename ReturnType = void, typename... ArgTypes>
69 ReturnType checkedInvoke(ArgTypes&&... args) const;
70
76 RFK_NODISCARD REFUREKU_API bool isInline() const noexcept;
77
83 RFK_NODISCARD REFUREKU_API bool isStatic() const noexcept;
84
90 RFK_NODISCARD REFUREKU_API EFunctionFlags getFlags() const noexcept;
91
92 private:
93 //Forward declaration
94 class FunctionImpl;
95
96 RFK_GEN_GET_PIMPL(FunctionImpl, Entity::getPimpl())
97
108 template <typename ReturnType, typename... ArgTypes>
109 ReturnType internalInvoke(ArgTypes&&... args) const;
110 };
111
113 template <auto FuncPtr>
114 Function const* getFunction() noexcept;
115
116 REFUREKU_TEMPLATE_API(rfk::Allocator<Function const*>);
117 REFUREKU_TEMPLATE_API(rfk::Vector<Function const*, rfk::Allocator<Function const*>>);
118
119 #include "Refureku/TypeInfo/Functions/Function.inl"
120}
Definition: Allocator.h:19
Definition: Entity.h:29
Definition: FunctionBase.h:17
Definition: Function.h:17
ReturnType invoke(ArgTypes &&... args) const
Call the function with the forwarded argument(s) if any, and return the result. Providing bad return ...
RFK_NODISCARD REFUREKU_API bool isStatic() const noexcept
Check whether this function is static or not.
RFK_NODISCARD REFUREKU_API EFunctionFlags getFlags() const noexcept
Get the flags qualifying this function.
RFK_NODISCARD REFUREKU_API bool isInline() const noexcept
Check whether this function is inline or not.
ReturnType checkedInvoke(ArgTypes &&... args) const
Call the function with the forwarded argument(s) if any, and return the result. The return type and a...
Definition: ICallable.h:13
Definition: Type.h:20
Definition: Vector.h:19
Definition: Allocator.h:16
EFunctionFlags
Definition: EFunctionFlags.h:17
Function const * getFunction() noexcept