CommonLibSSE (powerof3)
NativeFunctionBase.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSFixedString.h"
4 #include "RE/I/IFunction.h"
5 #include "RE/T/TypeInfo.h"
6 #include "RE/V/VDescTable.h"
7 
8 namespace RE
9 {
10  namespace BSScript
11  {
12  namespace Internal
13  {
14  class VirtualMachine;
15  }
16 
17  class StackFrame;
18  class Variable;
19 
20  namespace NF_util
21  {
23  {
24  public:
25  inline static constexpr auto RTTI = RTTI_BSScript__NF_util__NativeFunctionBase;
26 
27  NativeFunctionBase() = delete;
28  explicit NativeFunctionBase(std::string_view a_fnName, std::string_view a_className, bool a_isStatic, std::uint16_t a_numParams);
29  ~NativeFunctionBase() override = default; // 00
30 
31  // override (IFunction)
32  const BSFixedString& GetName() const override; // 01
33  const BSFixedString& GetObjectTypeName() const override; // 02
34  const BSFixedString& GetStateName() const override; // 03
35  TypeInfo GetReturnType() const override; // 04
36  std::uint32_t GetParamCount() const override; // 05
37  void GetParam(std::uint32_t a_idx, BSFixedString& a_nameOut, TypeInfo& a_typeOut) const override; // 06
38  std::uint32_t GetStackFrameSize() const override; // 07
39  bool GetIsNative() const override; // 08
40  bool GetIsStatic() const override; // 09
41  bool GetIsEmpty() const override; // 0A
42  FunctionType GetFunctionType() const override; // 0B
43  std::uint32_t GetUserFlags() const override; // 0C
44  const BSFixedString& GetDocString() const override; // 0D
45  void InsertLocals(StackFrame* a_frame) override; // 0E
46  CallResult Call(const BSTSmartPointer<Stack>& a_stack, ErrorLogger* a_logger, Internal::VirtualMachine* a_vm, bool a_arg4) override; // 0F
47  const BSFixedString& GetSourceFilename() const override; // 10
48  bool TranslateIPToLineNumber(std::uint32_t a_taskletExecutionOffset, std::uint32_t& a_lineNumberOut) const override; // 11
49  bool GetVarNameForStackIndex(std::uint32_t a_idx, BSFixedString& a_nameOut) const override; // 12
50  bool CanBeCalledFromTasklets() const override; // 13
51  void SetCallableFromTasklets(bool a_callable) override; // 14
52 
53  // add
54  virtual bool HasStub() const = 0; // 15
55  virtual bool MarshallAndDispatch(Variable& a_baseValue, Internal::VirtualMachine& a_vm, VMStackID a_stackID, Variable& a_resultValue, const StackFrame& a_frame) const = 0; // 16
56 
57  protected:
58  // members
64  bool _isStatic; // 40
65  bool _isCallableFromTasklet{ false }; // 41
66  bool _isLatent{ false }; // 42
67  std::uint8_t _pad43{ 0 }; // 43
68  std::uint32_t _userFlags{ 0 }; // 44
70  };
71  static_assert(sizeof(NativeFunctionBase) == 0x50);
72  }
73  }
74 }
Definition: ErrorLogger.h:13
Definition: IFunction.h:23
CallResult
Definition: IFunction.h:35
FunctionType
Definition: IFunction.h:28
Definition: VirtualMachine.h:46
Definition: NativeFunctionBase.h:23
std::uint32_t GetParamCount() const override
TypeInfo _retType
Definition: NativeFunctionBase.h:62
bool _isLatent
Definition: NativeFunctionBase.h:66
bool CanBeCalledFromTasklets() const override
const BSFixedString & GetName() const override
BSFixedString _name
Definition: NativeFunctionBase.h:59
std::uint32_t GetUserFlags() const override
bool _isCallableFromTasklet
Definition: NativeFunctionBase.h:65
static constexpr auto RTTI
Definition: NativeFunctionBase.h:25
const BSFixedString & GetStateName() const override
bool TranslateIPToLineNumber(std::uint32_t a_taskletExecutionOffset, std::uint32_t &a_lineNumberOut) const override
void GetParam(std::uint32_t a_idx, BSFixedString &a_nameOut, TypeInfo &a_typeOut) const override
BSFixedString _docString
Definition: NativeFunctionBase.h:69
CallResult Call(const BSTSmartPointer< Stack > &a_stack, ErrorLogger *a_logger, Internal::VirtualMachine *a_vm, bool a_arg4) override
NativeFunctionBase(std::string_view a_fnName, std::string_view a_className, bool a_isStatic, std::uint16_t a_numParams)
const BSFixedString & GetSourceFilename() const override
void InsertLocals(StackFrame *a_frame) override
bool GetVarNameForStackIndex(std::uint32_t a_idx, BSFixedString &a_nameOut) const override
FunctionType GetFunctionType() const override
Internal::VDescTable _descTable
Definition: NativeFunctionBase.h:63
BSFixedString _stateName
Definition: NativeFunctionBase.h:61
const BSFixedString & GetDocString() const override
void SetCallableFromTasklets(bool a_callable) override
std::uint32_t GetStackFrameSize() const override
std::uint8_t _pad43
Definition: NativeFunctionBase.h:67
BSFixedString _objName
Definition: NativeFunctionBase.h:60
TypeInfo GetReturnType() const override
bool _isStatic
Definition: NativeFunctionBase.h:64
const BSFixedString & GetObjectTypeName() const override
std::uint32_t _userFlags
Definition: NativeFunctionBase.h:68
virtual bool MarshallAndDispatch(Variable &a_baseValue, Internal::VirtualMachine &a_vm, VMStackID a_stackID, Variable &a_resultValue, const StackFrame &a_frame) const =0
Definition: StackFrame.h:15
Definition: TypeInfo.h:10
Definition: Variable.h:15
Definition: BSTSmartPointer.h:37
Definition: AbsorbEffect.h:6
std::uint32_t VMStackID
Definition: BSCoreTypes.h:8
constexpr REL::ID RTTI_BSScript__NF_util__NativeFunctionBase
Definition: Offsets_RTTI.h:2204
Definition: VDescTable.h:15