[turbine] Make applicationData return const&
All checks were successful
Build / build (push) Successful in 2m35s

This commit is contained in:
Gary Talent 2024-03-23 17:19:33 -05:00
parent 41e08d67aa
commit e3c74637db
3 changed files with 4 additions and 5 deletions

View File

@ -45,13 +45,12 @@ void setApplicationData(Context &ctx, T *applicationData) noexcept {
} }
[[nodiscard]] [[nodiscard]]
ox::AnyPtr &applicationDataRaw(Context &ctx) noexcept; ox::AnyPtr const&applicationDataRaw(Context &ctx) noexcept;
template<typename T> template<typename T>
[[nodiscard]] [[nodiscard]]
T *applicationData(Context &ctx) noexcept { T *applicationData(Context &ctx) noexcept {
auto const ptr = applicationDataRaw(ctx); return applicationDataRaw(ctx).get<T>();
return ptr.get<T>();
} }
void setKeyEventHandler(Context &ctx, KeyEventHandler h) noexcept; void setKeyEventHandler(Context &ctx, KeyEventHandler h) noexcept;

View File

@ -22,7 +22,7 @@ void setApplicationDataRaw(Context &ctx, ox::AnyPtr const&applicationData) noexc
ctx.applicationData = applicationData; ctx.applicationData = applicationData;
} }
ox::AnyPtr &applicationDataRaw(Context &ctx) noexcept { ox::AnyPtr const&applicationDataRaw(Context &ctx) noexcept {
return ctx.applicationData; return ctx.applicationData;
} }

View File

@ -24,7 +24,7 @@ void setApplicationDataRaw(Context &ctx, ox::AnyPtr const&applicationData) noexc
ctx.applicationData = applicationData; ctx.applicationData = applicationData;
} }
ox::AnyPtr &applicationDataRaw(Context &ctx) noexcept { ox::AnyPtr const&applicationDataRaw(Context &ctx) noexcept {
return ctx.applicationData; return ctx.applicationData;
} }