wut v1.8.0
Wii U Toolchain
Loading...
Searching...
No Matches
ITimeAccessor.h
Go to the documentation of this file.
1#pragma once
2
3#include <coreinit/time.h>
4#include <nn/result.h>
6#include <nn/sl/sl_cpp.h>
7#include <wut.h>
8
9#ifdef __cplusplus
10
11namespace nn::sl {
12
14
15 public:
17 InitInternalVtable();
18 }
19
21 InitInternalVtable();
22 }
23
25 InitInternalVtable();
26 return *this;
27 }
28
30 InitInternalVtable();
31 return *this;
32 }
33
34 ~ITimeAccessor() override = default;
35
36 private:
37 static nn::Result GetNetworkTimeWrapper(details::ITimeAccessorInternal *instance, OSTime *timeOut, bool *successOut) {
38 return instance->vtable->instance->GetNetworkTime(timeOut, successOut);
39 }
40 static nn::Result GetLocalTimeWrapper(details::ITimeAccessorInternal *instance, OSTime *timeOut, bool *successOut) {
41 return instance->vtable->instance->GetLocalTime(timeOut, successOut);
42 }
43
44 details::ITimeAccessorInternal *GetInternal() override {
45 return &mInstance;
46 }
47
48 void InitInternalVtable() {
49 mVTable = {.instance = this,
50 .GetNetworkTimeFn = &GetNetworkTimeWrapper,
51 .GetLocalTimeFn = &GetLocalTimeWrapper};
52 mInstance.vtable = &mVTable;
53 }
54
55 details::ITimeAccessorInternal mInstance{};
56 details::ITimeAccessorInternalVTable mVTable{};
57 };
58
60} // namespace nn::sl
61
62#endif
Result value type used by nn libraries.
Definition result.h:68
ITimeAccessor & operator=(const ITimeAccessor &other)
ITimeAccessor(ITimeAccessor &src)
ITimeAccessor & operator=(ITimeAccessor &&src) noexcept
~ITimeAccessor() override=default
virtual nn::Result GetLocalTime(OSTime *, bool *) const =0
virtual nn::Result GetNetworkTime(OSTime *, bool *) const =0
int64_t OSTime
Definition time.h:18
details::ITimeAccessorBase & GetDefaultTimeAccessor()