CommonLibSSE (Parapets fork)
ConcreteFormFactory.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/I/IFormFactory.h"
4 #include "RE/T/TESForm.h"
5 
6 namespace RE
7 {
8  template <class T, FormType FORM_TYPE>
10  {
11  public:
12  ~ConcreteFormFactory() override; // 00
13 
14  protected:
15  // override (IFormFactory)
16  TESForm* CreateImpl() override; // 01
17 
18  public:
19  const char* GetFormName() const override; // 02 - { return _name; }
20  [[nodiscard]] FormType GetFormType() const override; // 03 - { return FORM_TYPE; }
21 
22  inline T* Create()
23  {
24  return static_cast<T*>(CreateImpl());
25  }
26 
27  protected:
28  // members
29  const char* _name; // 08
30  };
31  static_assert(sizeof(ConcreteFormFactory<TESForm, FormType::None>) == 0x10);
32 
33  template <class T>
35  {
36  return static_cast<ConcreteFormFactory<T, T::FORMTYPE>*>(GetFormFactoryByType(T::FORMTYPE));
37  }
38 }
Definition: ConcreteFormFactory.h:10
~ConcreteFormFactory() override
FormType GetFormType() const override
const char * _name
Definition: ConcreteFormFactory.h:29
TESForm * CreateImpl() override
T * Create()
Definition: ConcreteFormFactory.h:22
const char * GetFormName() const override
Definition: IFormFactory.h:19
static IFormFactory * GetFormFactoryByType(FormType a_formType)
static ConcreteFormFactory< T, T::FORMTYPE > * GetConcreteFormFactoryByType()
Definition: ConcreteFormFactory.h:34
Definition: TESForm.h:34
Definition: AbsorbEffect.h:6
FormType
Definition: FormTypes.h:139