wut  v1.7.0
Wii U Toolchain
ISettingAccessorDetails.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <nn/result.h>
4 #include <nn/sl/sl_cpp.h>
5 #include <wut.h>
6 
7 #ifdef __cplusplus
8 
9 namespace nn::sl {
10  class TitleIconCache;
11  class DataCreator;
12  class Condition;
13  class DrcManager;
14  class KillerNotificationSelector;
15  class QuickStartApplicationSelector;
16  namespace details {
17  class ISettingAccessorBase;
19 
21 
22  struct WUT_PACKED ISettingAccessorInternalVTable {
23  ISettingAccessorBase *instance; // Is normally padding
24  uint32_t info;
25  WUT_PADDING_BYTES(4);
26  uint32_t destructor;
27  WUT_PADDING_BYTES(4);
29  };
30  WUT_CHECK_SIZE(ISettingAccessorInternalVTable, 0x18);
31  WUT_CHECK_OFFSET(ISettingAccessorInternalVTable, 0x00, instance);
32  WUT_CHECK_OFFSET(ISettingAccessorInternalVTable, 0x14, GetFn);
33 
34  typedef struct WUT_PACKED ISettingAccessorInternal {
37  WUT_CHECK_SIZE(ISettingAccessorInternal, 0x04);
38  WUT_CHECK_OFFSET(ISettingAccessorInternal, 0x00, vtable);
39 
41  friend class nn::sl::TitleIconCache;
42  friend class nn::sl::DataCreator;
43  friend class nn::sl::Condition;
44  friend class nn::sl::DrcManager;
47 
48  public:
49  ISettingAccessorBase() = default;
50 
51  virtual ~ISettingAccessorBase() = default;
52 
53  virtual nn::Result Get(nn::sl::Setting *) const = 0;
54 
55  private:
56  virtual details::ISettingAccessorInternal *GetInternal() = 0;
57  };
58 
59 
61  public:
62  explicit SettingAccessorFromPtr(details::ISettingAccessorInternal *ptr) : mInstancePtr(ptr) {
63  }
64 
65  nn::Result Get(nn::sl::Setting *outSetting) const override {
66  if (!mInstancePtr) {
68  }
69  return mInstancePtr->vtable->GetFn(mInstancePtr, outSetting);
70  }
71 
72  private:
73  details::ISettingAccessorInternal *GetInternal() override {
74  return mInstancePtr;
75  }
76 
78  };
79  } // namespace details
80 } // namespace nn::sl
81 
82 #endif
Result value type used by nn libraries.
Definition: result.h:68
@ LEVEL_FATAL
Definition: result.h:73
@ RESULT_MODULE_NN_SL
Definition: result.h:114
virtual nn::Result Get(nn::sl::Setting *) const =0
nn::Result Get(nn::sl::Setting *outSetting) const override
SettingAccessorFromPtr(details::ISettingAccessorInternal *ptr)
struct nn::sl::details::ISettingAccessorInternal ISettingAccessorInternal
nn::Result(* ISettingAccessor_GetFn)(ISettingAccessorInternal *, Setting *)