1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-23 10:52:13 +00:00

libstrat: mark ServiceObjectHolder functions const

This commit is contained in:
Michael Scire 2018-10-30 12:23:21 -07:00 committed by SciresM
parent 7309c7f358
commit 44175058f6

View file

@ -72,7 +72,7 @@ class ServiceObjectHolder {
explicit ServiceObjectHolder(std::shared_ptr<ServiceImpl>&& s) : srv(std::move(s)), dispatch_table(DispatchTable<ServiceImpl>()), entry_count(DispatchTableEntryCount<ServiceImpl>()) { } explicit ServiceObjectHolder(std::shared_ptr<ServiceImpl>&& s) : srv(std::move(s)), dispatch_table(DispatchTable<ServiceImpl>()), entry_count(DispatchTableEntryCount<ServiceImpl>()) { }
template <typename ServiceImpl> template <typename ServiceImpl>
ServiceImpl *GetServiceObject() { ServiceImpl *GetServiceObject() const {
if (GetServiceId() == ServiceObjectId<ServiceImpl>()) { if (GetServiceId() == ServiceObjectId<ServiceImpl>()) {
return static_cast<ServiceImpl *>(this->srv.get()); return static_cast<ServiceImpl *>(this->srv.get());
} }
@ -80,19 +80,19 @@ class ServiceObjectHolder {
} }
template<typename ServiceImpl> template<typename ServiceImpl>
ServiceImpl *GetServiceObjectUnsafe() { ServiceImpl *GetServiceObjectUnsafe() const {
return static_cast<ServiceImpl *>(this->srv.get()); return static_cast<ServiceImpl *>(this->srv.get());
} }
const ServiceCommandMeta *GetDispatchTable() { const ServiceCommandMeta *GetDispatchTable() const {
return this->dispatch_table; return this->dispatch_table;
} }
size_t GetDispatchTableEntryCount() { size_t GetDispatchTableEntryCount() const {
return this->entry_count; return this->entry_count;
} }
constexpr uintptr_t GetServiceId() { constexpr uintptr_t GetServiceId() const {
return reinterpret_cast<uintptr_t>(this->dispatch_table); return reinterpret_cast<uintptr_t>(this->dispatch_table);
} }
@ -109,11 +109,11 @@ class ServiceObjectHolder {
return *this; return *this;
} }
explicit operator bool() { explicit operator bool() const {
return this->srv != nullptr; return this->srv != nullptr;
} }
bool operator!() { bool operator!() const {
return this->srv == nullptr; return this->srv == nullptr;
} }
@ -123,7 +123,7 @@ class ServiceObjectHolder {
this->entry_count = 0; this->entry_count = 0;
} }
ServiceObjectHolder Clone() { ServiceObjectHolder Clone() const {
ServiceObjectHolder clone(*this); ServiceObjectHolder clone(*this);
return clone; return clone;
} }