CommonLibSSE NG
Loading...
Searching...
No Matches
BGSKeywordForm.h
Go to the documentation of this file.
1#pragma once
2
3#include "RE/B/BGSKeyword.h"
4#include "RE/B/BSContainer.h"
6
7namespace RE
8{
9 class BGSKeyword;
10
12 {
13 public:
14 inline static constexpr auto RTTI = RTTI_BGSKeywordForm;
15
16 ~BGSKeywordForm() override; // 00
17
18 // override (BaseFormComponent)
19 void InitializeDataComponent() override; // 01 - { return; }
20 void ClearDataComponent() override; // 02
21 void CopyComponent(BaseFormComponent* a_rhs) override; // 03
22
23 // add
24 [[nodiscard]] virtual bool HasKeyword(const BGSKeyword* a_keyword) const; // 04
25 [[nodiscard]] virtual BGSKeyword* GetDefaultKeyword() const; // 05 - { return 0; }
26
27 bool AddKeyword(BGSKeyword* a_keyword);
28 bool AddKeywords(const std::vector<BGSKeyword*>& a_keywords);
29 [[nodiscard]] bool ContainsKeywordString(std::string_view a_editorID) const;
30 void ForEachKeyword(std::function<BSContainer::ForEachResult(BGSKeyword&)> a_callback) const;
31 [[nodiscard]] std::optional<BGSKeyword*> GetKeywordAt(std::uint32_t a_idx) const;
32 [[nodiscard]] std::optional<std::uint32_t> GetKeywordIndex(BGSKeyword* a_keyword) const;
33 [[nodiscard]] std::uint32_t GetNumKeywords() const;
34 [[nodiscard]] bool HasKeywordID(FormID a_formID) const;
35 [[nodiscard]] bool HasKeywordString(std::string_view a_editorID) const;
36 bool RemoveKeyword(std::uint32_t a_index);
37 bool RemoveKeyword(BGSKeyword* a_keyword);
38 bool RemoveKeywords(const std::vector<RE::BGSKeyword*>& a_keywords);
39
40 [[nodiscard]] std::span<BGSKeyword*> GetKeywords()
41 {
42 return { keywords, numKeywords };
43 }
44
45 [[nodiscard]] std::span<BGSKeyword* const> GetKeywords() const
46 {
47 return { keywords, numKeywords };
48 }
49
50 // members
51 BGSKeyword** keywords; // 08 - KWDA
52 std::uint32_t numKeywords; // 10 - KSIZ
53 std::uint32_t pad14; // 14
54
55 private:
56 void CopyKeywords(const std::vector<RE::BGSKeyword*>& a_copiedData);
57 };
58 static_assert(sizeof(BGSKeywordForm) == 0x18);
59}
Definition BGSKeywordForm.h:12
std::optional< BGSKeyword * > GetKeywordAt(std::uint32_t a_idx) const
virtual BGSKeyword * GetDefaultKeyword() const
std::uint32_t numKeywords
Definition BGSKeywordForm.h:52
bool RemoveKeywords(const std::vector< RE::BGSKeyword * > &a_keywords)
std::uint32_t pad14
Definition BGSKeywordForm.h:53
bool HasKeywordID(FormID a_formID) const
bool RemoveKeyword(BGSKeyword *a_keyword)
std::span< BGSKeyword * > GetKeywords()
Definition BGSKeywordForm.h:40
static constexpr auto RTTI
Definition BGSKeywordForm.h:14
std::span< BGSKeyword *const > GetKeywords() const
Definition BGSKeywordForm.h:45
bool AddKeyword(BGSKeyword *a_keyword)
void InitializeDataComponent() override
void ForEachKeyword(std::function< BSContainer::ForEachResult(BGSKeyword &)> a_callback) const
BGSKeyword ** keywords
Definition BGSKeywordForm.h:51
bool AddKeywords(const std::vector< BGSKeyword * > &a_keywords)
bool ContainsKeywordString(std::string_view a_editorID) const
virtual bool HasKeyword(const BGSKeyword *a_keyword) const
~BGSKeywordForm() override
void CopyComponent(BaseFormComponent *a_rhs) override
bool HasKeywordString(std::string_view a_editorID) const
void ClearDataComponent() override
std::uint32_t GetNumKeywords() const
bool RemoveKeyword(std::uint32_t a_index)
std::optional< std::uint32_t > GetKeywordIndex(BGSKeyword *a_keyword) const
Definition BGSKeyword.h:10
Definition BaseFormComponent.h:8
ForEachResult
Definition BSContainer.h:6
Definition AbsorbEffect.h:6
std::uint32_t FormID
Definition BSCoreTypes.h:5
constexpr REL::VariantID RTTI_BGSKeywordForm(513855, 392223, 0x1ed6e18)