mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-21 19:12:42 +02:00
Use "final" and "override" where appropriate (#117)
This commit is contained in:
parent
59d7f41ca5
commit
76b1f49766
@ -4,8 +4,8 @@
|
|||||||
#include "ipc_templating.hpp"
|
#include "ipc_templating.hpp"
|
||||||
|
|
||||||
class IServiceObject {
|
class IServiceObject {
|
||||||
public:
|
protected:
|
||||||
virtual ~IServiceObject() { }
|
virtual ~IServiceObject() { }
|
||||||
virtual Result dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_id, u8 *pointer_buffer, size_t pointer_buffer_size) = 0;
|
virtual Result dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_id, u8 *pointer_buffer, size_t pointer_buffer_size) = 0;
|
||||||
virtual Result handle_deferred() = 0;
|
virtual Result handle_deferred() = 0;
|
||||||
};
|
};
|
||||||
|
@ -23,7 +23,7 @@ template <typename T>
|
|||||||
class IServer;
|
class IServer;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class ServiceSession : public IWaitable {
|
class ServiceSession final : public IWaitable {
|
||||||
static_assert(std::is_base_of<IServiceObject, T>::value, "Service Objects must derive from IServiceObject");
|
static_assert(std::is_base_of<IServiceObject, T>::value, "Service Objects must derive from IServiceObject");
|
||||||
|
|
||||||
T *service_object;
|
T *service_object;
|
||||||
@ -39,7 +39,7 @@ class ServiceSession : public IWaitable {
|
|||||||
this->service_object = new T();
|
this->service_object = new T();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~ServiceSession() {
|
~ServiceSession() override {
|
||||||
delete this->service_object;
|
delete this->service_object;
|
||||||
if (server_handle) {
|
if (server_handle) {
|
||||||
svcCloseHandle(server_handle);
|
svcCloseHandle(server_handle);
|
||||||
@ -54,23 +54,23 @@ class ServiceSession : public IWaitable {
|
|||||||
Handle get_client_handle() { return this->client_handle; }
|
Handle get_client_handle() { return this->client_handle; }
|
||||||
|
|
||||||
/* IWaitable */
|
/* IWaitable */
|
||||||
virtual unsigned int get_num_waitables() {
|
unsigned int get_num_waitables() override {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void get_waitables(IWaitable **dst) {
|
void get_waitables(IWaitable **dst) override {
|
||||||
dst[0] = this;
|
dst[0] = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void delete_child(IWaitable *child) {
|
void delete_child(IWaitable *child) override {
|
||||||
/* TODO: Panic, because we can never have any children. */
|
/* TODO: Panic, because we can never have any children. */
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Handle get_handle() {
|
Handle get_handle() override {
|
||||||
return this->server_handle;
|
return this->server_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void handle_deferred() {
|
void handle_deferred() override {
|
||||||
Result rc = this->service_object->handle_deferred();
|
Result rc = this->service_object->handle_deferred();
|
||||||
int handle_index;
|
int handle_index;
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ class ServiceSession : public IWaitable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result handle_signaled(u64 timeout) {
|
Result handle_signaled(u64 timeout) override {
|
||||||
Result rc;
|
Result rc;
|
||||||
int handle_index;
|
int handle_index;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#define SYSTEMEVENT_INDEX_WAITHANDLE 0
|
#define SYSTEMEVENT_INDEX_WAITHANDLE 0
|
||||||
#define SYSTEMEVENT_INDEX_SGNLHANDLE 1
|
#define SYSTEMEVENT_INDEX_SGNLHANDLE 1
|
||||||
|
|
||||||
class SystemEvent : public IEvent {
|
class SystemEvent final : public IEvent {
|
||||||
public:
|
public:
|
||||||
SystemEvent(EventCallback callback) : IEvent(0, callback) {
|
SystemEvent(EventCallback callback) : IEvent(0, callback) {
|
||||||
Handle wait_h;
|
Handle wait_h;
|
||||||
@ -20,7 +20,7 @@ class SystemEvent : public IEvent {
|
|||||||
this->handles.push_back(sig_h);
|
this->handles.push_back(sig_h);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result signal_event() {
|
Result signal_event() override {
|
||||||
return svcSignalEvent(this->handles[SYSTEMEVENT_INDEX_SGNLHANDLE]);
|
return svcSignalEvent(this->handles[SYSTEMEVENT_INDEX_SGNLHANDLE]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user