CommonLibSSE NG
NiObjectNET.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSFixedString.h"
4 #include "RE/N/NiObject.h"
5 #include "RE/N/NiSmartPointer.h"
6 
7 namespace RE
8 {
9  class NiExtraData;
10  class NiTimeController;
11 
12  class NiObjectNET : public NiObject
13  {
14  public:
15  inline static constexpr auto RTTI = RTTI_NiObjectNET;
16  inline static auto Ni_RTTI = NiRTTI_NiObjectNET;
17 
18  ~NiObjectNET() override; // 00
19 
20  // override (NiObject)
21  const NiRTTI* GetRTTI() const override; // 02
22  void LoadBinary(NiStream& a_stream) override; // 18
23  void LinkObject(NiStream& a_stream) override; // 19
24  bool RegisterStreamables(NiStream& a_stream) override; // 1A
25  void SaveBinary(NiStream& a_stream) override; // 1B
26  bool IsEqual(NiObject* a_object) override; // 1C
27  void ProcessClone(NiCloningProcess& a_cloning) override; // 1D
28  void PostLinkObject(NiStream& a_stream) override; // 1E
29 
30  bool AddExtraData(const BSFixedString& a_key, NiExtraData* a_extra);
31  bool AddExtraData(NiExtraData* a_extra);
32  void DeleteExtraData(std::uint16_t a_extraDataIndex);
33  [[nodiscard]] NiTimeController* GetControllers() const;
34  NiTimeController* GetController(const NiRTTI* a_rtti) const;
35 
36  template <class T>
37  [[nodiscard]] T* GetController() const;
38 
39  [[nodiscard]] NiExtraData* GetExtraData(const BSFixedString& a_key) const;
40  template <class T>
41  [[nodiscard]] T* GetExtraData(const BSFixedString& a_key) const;
42 
43  [[nodiscard]] NiExtraData* GetExtraDataAt(std::uint16_t a_extraDataIndex) const;
44  [[nodiscard]] std::uint16_t GetExtraDataSize() const;
45  [[nodiscard]] bool HasExtraData(const BSFixedString& a_key) const;
46  bool InsertExtraData(NiExtraData* a_extra);
48  bool RemoveExtraData(const BSFixedString& a_key);
49  bool RemoveExtraDataAt(std::uint16_t a_extraDataIndex);
50  bool SetExtraDataSize(std::uint16_t a_size);
51 
52  // members
55  NiExtraData** extra; // 20
56  std::uint16_t extraDataSize; // 28
57  std::uint16_t maxSize; // 2A
58  std::uint32_t pad2C; // 2C
59  };
60  static_assert(sizeof(NiObjectNET) == 0x30);
61 
62  template <class T>
64  {
65  const REL::Relocation<const NiRTTI*> rtti{ T::Ni_RTTI };
66  return static_cast<T*>(GetController(rtti.get()));
67  }
68 
69  template <class T>
71  {
72  return static_cast<T*>(GetExtraData(a_key));
73  }
74 }
Definition: Relocation.h:204
Definition: NiCloningProcess.h:10
Definition: NiExtraData.h:9
Definition: NiObjectNET.h:13
bool AddExtraData(NiExtraData *a_extra)
void LoadBinary(NiStream &a_stream) override
static auto Ni_RTTI
Definition: NiObjectNET.h:16
void LinkObject(NiStream &a_stream) override
BSFixedString name
Definition: NiObjectNET.h:53
bool InsertExtraData(NiExtraData *a_extra)
~NiObjectNET() override
NiTimeController * GetController(const NiRTTI *a_rtti) const
NiPointer< NiTimeController > controllers
Definition: NiObjectNET.h:54
bool SetExtraDataSize(std::uint16_t a_size)
NiExtraData * GetExtraData(const BSFixedString &a_key) const
bool RegisterStreamables(NiStream &a_stream) override
NiExtraData ** extra
Definition: NiObjectNET.h:55
bool AddExtraData(const BSFixedString &a_key, NiExtraData *a_extra)
std::uint32_t pad2C
Definition: NiObjectNET.h:58
std::uint16_t GetExtraDataSize() const
bool HasExtraData(const BSFixedString &a_key) const
void DeleteExtraData(std::uint16_t a_extraDataIndex)
std::uint16_t maxSize
Definition: NiObjectNET.h:57
NiExtraData * GetExtraDataAt(std::uint16_t a_extraDataIndex) const
bool IsEqual(NiObject *a_object) override
static constexpr auto RTTI
Definition: NiObjectNET.h:15
void ProcessClone(NiCloningProcess &a_cloning) override
void SaveBinary(NiStream &a_stream) override
bool RemoveExtraDataAt(std::uint16_t a_extraDataIndex)
const NiRTTI * GetRTTI() const override
std::uint16_t extraDataSize
Definition: NiObjectNET.h:56
NiTimeController * GetControllers() const
void PostLinkObject(NiStream &a_stream) override
T * GetController() const
Definition: NiObjectNET.h:63
bool RemoveExtraData(const BSFixedString &a_key)
void RemoveAllExtraData()
Definition: NiObject.h:37
Definition: NiSmartPointer.h:9
Definition: NiRTTI.h:6
Definition: NiStream.h:29
Definition: NiTimeController.h:13
Definition: AbsorbEffect.h:6
constexpr REL::VariantID RTTI_NiObjectNET(684826, 392519, 0x1eda5e8)
constexpr REL::VariantID NiRTTI_NiObjectNET(523910, 410491, 0x316ad08)