CommonLibSSE NG
GFxResourceKey.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace RE
4 {
6  {
7  public:
8  using KeyHandle = void*;
9 
10  enum class KeyType
11  {
12  kNone,
13  kUnique,
14  kFile,
15  kGradient,
16  kSubImage
17  };
18 
20  {
21  public:
22  virtual ~KeyInterface(); // 00
23 
24  // add
25  virtual void AddRef(KeyHandle a_data) = 0; // 01
26  virtual void Release(KeyHandle a_data) = 0; // 02
27  virtual KeyType GetKeyType(KeyHandle a_data) const = 0; // 03
28  virtual UPInt GetHashCode(KeyHandle a_data) const = 0; // 04
29  virtual bool KeyEquals(KeyHandle a_data, const GFxResourceKey& a_other) = 0; // 05
30  virtual const char* GetFileURL(KeyHandle a_data) const; // 06
31  };
32 
33  class HashOp
34  {
35  public:
37  {
38  return a_key._keyInterface ? a_key._keyInterface->GetHashCode(a_key._keyData) : 0;
39  }
40  };
41 
43  GFxResourceKey(KeyInterface* a_keyIntfc, KeyHandle a_keyHandle);
46 
48  bool operator==(const GFxResourceKey& a_other) const;
49  [[nodiscard]] KeyType GetKeyType() const;
50  [[nodiscard]] const char* GetFileURL() const;
51  [[nodiscard]] KeyInterface* GetKeyInterface() const;
52  [[nodiscard]] KeyHandle GetKeyData() const;
53 
54  protected:
55  // members
58  };
59  static_assert(sizeof(GFxResourceKey) == 0x10);
60 }
Definition: GFxResourceKey.h:34
UPInt operator()(const GFxResourceKey &a_key)
Definition: GFxResourceKey.h:36
Definition: GFxResourceKey.h:20
virtual void Release(KeyHandle a_data)=0
virtual KeyType GetKeyType(KeyHandle a_data) const =0
virtual void AddRef(KeyHandle a_data)=0
virtual bool KeyEquals(KeyHandle a_data, const GFxResourceKey &a_other)=0
virtual UPInt GetHashCode(KeyHandle a_data) const =0
virtual const char * GetFileURL(KeyHandle a_data) const
Definition: GFxResourceKey.h:6
KeyHandle GetKeyData() const
KeyInterface * GetKeyInterface() const
GFxResourceKey & operator=(const GFxResourceKey &a_rhs)
KeyInterface * _keyInterface
Definition: GFxResourceKey.h:56
GFxResourceKey(const GFxResourceKey &a_rhs)
bool operator==(const GFxResourceKey &a_other) const
KeyHandle _keyData
Definition: GFxResourceKey.h:57
void * KeyHandle
Definition: GFxResourceKey.h:8
KeyType GetKeyType() const
const char * GetFileURL() const
KeyType
Definition: GFxResourceKey.h:11
GFxResourceKey(KeyInterface *a_keyIntfc, KeyHandle a_keyHandle)
Definition: AbsorbEffect.h:6
std::size_t UPInt
Definition: SFTypes.h:5