General: Add missing override specifiers

Adds override specifiers that I missed for other platforms when
initially applying them to the codebase.
This commit is contained in:
Lioncash 2019-08-16 03:05:00 -04:00 committed by Phillip Stephens
parent 80c1103b44
commit 386ec8e6cc
11 changed files with 81 additions and 83 deletions

View File

@ -8,13 +8,12 @@ class HIDListenerBSD final : public IHIDListener {
public:
HIDListenerBSD(DeviceFinder& finder) : m_finder(finder) {}
~HIDListenerBSD() override = default;
~HIDListenerBSD() {}
bool startScanning() override { return false; }
bool stopScanning() override { return false; }
bool startScanning() { return false; }
bool stopScanning() { return false; }
bool scanNow() { return false; }
bool scanNow() override { return false; }
};
IHIDListener* IHIDListenerNew(DeviceFinder& finder) { return new HIDListenerBSD(finder); }

View File

@ -23,7 +23,7 @@ class HIDDeviceIOKit : public IHIDDevice {
std::condition_variable m_initCond;
std::thread m_thread;
bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length) {
bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length) override {
if (m_usbIntf) {
IOReturn res = m_usbIntf->WritePipe(m_usbIntf.storage(), m_usbIntfOutPipe, (void*)data, length);
return res == kIOReturnSuccess;
@ -31,7 +31,7 @@ class HIDDeviceIOKit : public IHIDDevice {
return false;
}
size_t _receiveUSBInterruptTransfer(uint8_t* data, size_t length) {
size_t _receiveUSBInterruptTransfer(uint8_t* data, size_t length) override {
if (m_usbIntf) {
UInt32 readSize = length;
IOReturn res = m_usbIntf->ReadPipe(m_usbIntf.storage(), m_usbIntfInPipe, data, &readSize);
@ -42,7 +42,7 @@ class HIDDeviceIOKit : public IHIDDevice {
return 0;
}
std::vector<uint8_t> _getReportDescriptor() {
std::vector<uint8_t> _getReportDescriptor() override {
if (m_hidIntf) {
if (CFTypeRef desc = IOHIDDeviceGetProperty(m_hidIntf.get(), CFSTR(kIOHIDReportDescriptorKey))) {
CFIndex len = CFDataGetLength(CFDataRef(desc));
@ -54,7 +54,7 @@ class HIDDeviceIOKit : public IHIDDevice {
return {};
}
bool _sendHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message) {
bool _sendHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message) override {
/* HACK: A bug in IOBluetoothGamepadHIDDriver prevents raw output report transmission
* USB driver appears to work correctly */
if (m_hidIntf && !m_isBt) {
@ -64,7 +64,7 @@ class HIDDeviceIOKit : public IHIDDevice {
return false;
}
size_t _receiveHIDReport(uint8_t* data, size_t length, HIDReportType tp, uint32_t message) {
size_t _receiveHIDReport(uint8_t* data, size_t length, HIDReportType tp, uint32_t message) override {
if (m_hidIntf) {
CFIndex readSize = length;
IOReturn res = IOHIDDeviceGetReport(m_hidIntf.get(), IOHIDReportType(tp), message, data, &readSize);
@ -273,13 +273,13 @@ class HIDDeviceIOKit : public IHIDDevice {
device->m_hidIntf.reset();
}
void _deviceDisconnected() { m_runningTransferLoop = false; }
void _deviceDisconnected() override { m_runningTransferLoop = false; }
public:
HIDDeviceIOKit(DeviceToken& token, const std::shared_ptr<DeviceBase>& devImp)
: m_token(token), m_devImp(devImp), m_devPath(token.getDevicePath()) {}
void _startThread() {
void _startThread() override {
std::unique_lock<std::mutex> lk(m_initMutex);
DeviceType dType = m_token.getDeviceType();
if (dType == DeviceType::USB)
@ -295,7 +295,7 @@ public:
m_initCond.wait(lk);
}
~HIDDeviceIOKit() {
~HIDDeviceIOKit() override {
m_runningTransferLoop = false;
if (m_thread.joinable())
m_thread.detach();

View File

@ -11,13 +11,13 @@ public:
HIDDeviceNX(DeviceToken& token, const std::shared_ptr<DeviceBase>& devImp)
: m_token(token), m_devImp(devImp), m_devPath(token.getDevicePath()) {}
void _deviceDisconnected() {}
bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length) { return false; }
size_t _receiveUSBInterruptTransfer(uint8_t* data, size_t length) { return 0; }
std::vector<uint8_t> _getReportDescriptor() { return {}; }
bool _sendHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message) { return false; }
size_t _receiveHIDReport(uint8_t* data, size_t length, HIDReportType tp, uint32_t message) { return 0; }
void _startThread() {}
void _deviceDisconnected() override {}
bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length) override { return false; }
size_t _receiveUSBInterruptTransfer(uint8_t* data, size_t length) override { return 0; }
std::vector<uint8_t> _getReportDescriptor() override { return {}; }
bool _sendHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message) override { return false; }
size_t _receiveHIDReport(uint8_t* data, size_t length, HIDReportType tp, uint32_t message) override { return 0; }
void _startThread() override {}
};
std::shared_ptr<IHIDDevice> IHIDDeviceNew(DeviceToken& token, const std::shared_ptr<DeviceBase>& devImp) {

View File

@ -9,12 +9,12 @@ class HIDDeviceUWP : public IHIDDevice {
public:
HIDDeviceUWP(DeviceToken& token, const std::shared_ptr<DeviceBase>& devImp) {}
void _deviceDisconnected() {}
bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length) { return false; }
size_t _receiveUSBInterruptTransfer(uint8_t* data, size_t length) { return 0; }
bool _sendHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message) { return false; }
size_t _receiveHIDReport(uint8_t* data, size_t length, HIDReportType tp, uint32_t message) { return false; }
void _startThread() {}
void _deviceDisconnected() override {}
bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length) override { return false; }
size_t _receiveUSBInterruptTransfer(uint8_t* data, size_t length) override { return 0; }
bool _sendHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message) override { return false; }
size_t _receiveHIDReport(uint8_t* data, size_t length, HIDReportType tp, uint32_t message) override { return false; }
void _startThread() override {}
};
std::shared_ptr<IHIDDevice> IHIDDeviceNew(DeviceToken& token, const std::shared_ptr<DeviceBase>& devImp) {

View File

@ -40,7 +40,7 @@ class HIDDeviceUdev final : public IHIDDevice {
std::condition_variable m_initCond;
std::thread m_thread;
bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length) {
bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length) override {
if (m_devFd) {
usbdevfs_bulktransfer xfer = {m_usbIntfOutPipe | USB_DIR_OUT, (unsigned)length, 30, (void*)data};
int ret = ioctl(m_devFd, USBDEVFS_BULK, &xfer);
@ -51,7 +51,7 @@ class HIDDeviceUdev final : public IHIDDevice {
return false;
}
size_t _receiveUSBInterruptTransfer(uint8_t* data, size_t length) {
size_t _receiveUSBInterruptTransfer(uint8_t* data, size_t length) override {
if (m_devFd) {
usbdevfs_bulktransfer xfer = {m_usbIntfInPipe | USB_DIR_IN, (unsigned)length, 30, data};
return ioctl(m_devFd, USBDEVFS_BULK, &xfer);
@ -209,9 +209,9 @@ class HIDDeviceUdev final : public IHIDDevice {
udev_device_unref(udevDev);
}
void _deviceDisconnected() { m_runningTransferLoop = false; }
void _deviceDisconnected() override { m_runningTransferLoop = false; }
std::vector<uint8_t> _getReportDescriptor() {
std::vector<uint8_t> _getReportDescriptor() override {
/* Report descriptor size */
int reportDescSize;
if (ioctl(m_devFd, HIDIOCGRDESCSIZE, &reportDescSize) == -1)
@ -227,7 +227,7 @@ class HIDDeviceUdev final : public IHIDDevice {
return ret;
}
bool _sendHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message) {
bool _sendHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message) override {
if (m_devFd) {
if (tp == HIDReportType::Feature) {
int ret = ioctl(m_devFd, HIDIOCSFEATURE(length), data);
@ -244,7 +244,7 @@ class HIDDeviceUdev final : public IHIDDevice {
return false;
}
size_t _receiveHIDReport(uint8_t* data, size_t length, HIDReportType tp, uint32_t message) {
size_t _receiveHIDReport(uint8_t* data, size_t length, HIDReportType tp, uint32_t message) override {
if (m_devFd) {
if (tp == HIDReportType::Feature) {
data[0] = message;
@ -261,7 +261,7 @@ public:
HIDDeviceUdev(DeviceToken& token, const std::shared_ptr<DeviceBase>& devImp)
: m_token(token), m_devImp(devImp), m_devPath(token.getDevicePath()) {}
void _startThread() {
void _startThread() override {
std::unique_lock<std::mutex> lk(m_initMutex);
DeviceType dType = m_token.getDeviceType();
if (dType == DeviceType::USB)
@ -277,7 +277,7 @@ public:
m_initCond.wait(lk);
}
~HIDDeviceUdev() {
~HIDDeviceUdev() override {
m_runningTransferLoop = false;
if (m_thread.joinable())
m_thread.detach();

View File

@ -16,8 +16,7 @@ class HIDDeviceBSD final : public IHIDDevice {
public:
HIDDeviceBSD(DeviceToken& token, DeviceBase& devImp) : m_token(token), m_devImp(devImp) {}
~HIDDeviceBSD() {}
~HIDDeviceBSD() override = default;
};
std::shared_ptr<IHIDDevice> IHIDDeviceNew(DeviceToken& token, const std::shared_ptr<DeviceBase>& devImp) {

View File

@ -263,23 +263,23 @@ public:
m_scanningEnabled = false;
}
~HIDListenerIOKit() {
~HIDListenerIOKit() override {
// CFRunLoopRemoveSource(m_listenerRunLoop, IONotificationPortGetRunLoopSource(m_llPort), kCFRunLoopDefaultMode);
IONotificationPortDestroy(m_llPort);
}
/* Automatic device scanning */
bool startScanning() {
bool startScanning() override {
m_scanningEnabled = true;
return true;
}
bool stopScanning() {
bool stopScanning() override {
m_scanningEnabled = false;
return true;
}
/* Manual device scanning */
bool scanNow() {
bool scanNow() override {
IOObjectPointer<io_iterator_t> iter;
if (IOServiceGetMatchingServices(kIOMasterPortDefault, IOServiceMatching(m_usbClass), &iter) == kIOReturnSuccess) {
devicesConnectedUSBLL(this, iter.get());

View File

@ -8,9 +8,9 @@ class HIDListenerNX : public IHIDListener {
public:
HIDListenerNX(DeviceFinder& finder) : m_finder(finder) {}
bool startScanning() { return false; }
bool stopScanning() { return false; }
bool scanNow() { return false; }
bool startScanning() override { return false; }
bool stopScanning() override { return false; }
bool scanNow() override { return false; }
};
std::unique_ptr<IHIDListener> IHIDListenerNew(DeviceFinder& finder) { return std::make_unique<HIDListenerNX>(finder); }

View File

@ -9,11 +9,11 @@ public:
HIDListenerUWP(DeviceFinder& finder) {}
/* Automatic device scanning */
bool startScanning() { return false; }
bool stopScanning() { return false; }
bool startScanning() override { return false; }
bool stopScanning() override { return false; }
/* Manual device scanning */
bool scanNow() { return false; }
bool scanNow() override { return false; }
};
std::unique_ptr<IHIDListener> IHIDListenerNew(DeviceFinder& finder) { return std::make_unique<HIDListenerUWP>(finder); }

View File

@ -187,7 +187,7 @@ public:
m_udevThread = std::thread(std::bind(&HIDListenerUdev::_udevProc, this), this);
}
~HIDListenerUdev() {
~HIDListenerUdev() override {
pthread_cancel(m_udevThread.native_handle());
if (m_udevThread.joinable())
m_udevThread.join();
@ -195,17 +195,17 @@ public:
}
/* Automatic device scanning */
bool startScanning() {
bool startScanning() override {
m_scanningEnabled = true;
return true;
}
bool stopScanning() {
bool stopScanning() override {
m_scanningEnabled = false;
return true;
}
/* Manual device scanning */
bool scanNow() {
bool scanNow() override {
udev_enumerate* uenum = udev_enumerate_new(GetUdev());
udev_enumerate_add_match_subsystem(uenum, "usb");
udev_enumerate_add_match_subsystem(uenum, "bluetooth");

View File

@ -13,13 +13,13 @@
namespace boo {
class DolphinSmashAdapterCallback : public IDolphinSmashAdapterCallback {
void controllerConnected(unsigned idx, EDolphinControllerType) {
void controllerConnected(unsigned idx, EDolphinControllerType) override {
// printf("CONTROLLER %u CONNECTED\n", idx);
}
void controllerDisconnected(unsigned idx) {
void controllerDisconnected(unsigned idx) override {
// printf("CONTROLLER %u DISCONNECTED\n", idx);
}
void controllerUpdate(unsigned idx, EDolphinControllerType, const DolphinControllerState& state) {
void controllerUpdate(unsigned idx, EDolphinControllerType, const DolphinControllerState& state) override {
// printf("CONTROLLER %u UPDATE %d %d\n", idx, state.m_leftStick[0], state.m_leftStick[1]);
// printf(" %d %d\n", state.m_rightStick[0], state.m_rightStick[1]);
// printf(" %d %d\n", state.m_analogTriggers[0], state.m_analogTriggers[1]);
@ -27,8 +27,8 @@ class DolphinSmashAdapterCallback : public IDolphinSmashAdapterCallback {
};
class DualshockPadCallback : public IDualshockPadCallback {
void controllerDisconnected() { printf("CONTROLLER DISCONNECTED\n"); }
void controllerUpdate(DualshockPad& pad, const DualshockPadState& state) {
void controllerDisconnected() override { printf("CONTROLLER DISCONNECTED\n"); }
void controllerUpdate(DualshockPad& pad, const DualshockPadState& state) override {
static time_t timeTotal;
static time_t lastTime = 0;
timeTotal = time(NULL);
@ -63,9 +63,9 @@ class DualshockPadCallback : public IDualshockPadCallback {
};
class GenericPadCallback : public IGenericPadCallback {
void controllerConnected() { printf("CONTROLLER CONNECTED\n"); }
void controllerDisconnected() { printf("CONTROLLER DISCONNECTED\n"); }
void valueUpdate(const HIDMainItem& item, int32_t value) {
void controllerConnected() override { printf("CONTROLLER CONNECTED\n"); }
void controllerDisconnected() override { printf("CONTROLLER DISCONNECTED\n"); }
void valueUpdate(const HIDMainItem& item, int32_t value) override {
const char* pageName = item.GetUsagePageName();
const char* usageName = item.GetUsageName();
if (pageName) {
@ -83,8 +83,8 @@ class GenericPadCallback : public IGenericPadCallback {
};
class NintendoPowerACallback : public INintendoPowerACallback {
void controllerDisconnected() { fprintf(stderr, "CONTROLLER DISCONNECTED\n"); }
void controllerUpdate(const NintendoPowerAState& state) {
void controllerDisconnected() override { fprintf(stderr, "CONTROLLER DISCONNECTED\n"); }
void controllerUpdate(const NintendoPowerAState& state) override {
fprintf(stderr,
"%i %i\n"
"%i %i\n",
@ -105,7 +105,7 @@ class TestDeviceFinder : public DeviceFinder {
public:
TestDeviceFinder()
: DeviceFinder({dev_typeid(DolphinSmashAdapter), dev_typeid(NintendoPowerA), dev_typeid(GenericPad)}) {}
void deviceConnected(DeviceToken& tok) {
void deviceConnected(DeviceToken& tok) override {
auto dev = tok.openAndGetDevice();
if (!dev)
return;
@ -125,7 +125,7 @@ public:
m_generic->setCallback(&m_genericCb);
}
}
void deviceDisconnected(DeviceToken&, DeviceBase* device) {
void deviceDisconnected(DeviceToken&, DeviceBase* device) override {
if (m_smashAdapter.get() == device)
m_smashAdapter.reset();
if (m_ds3.get() == device)
@ -143,55 +143,55 @@ struct CTestWindowCallback : IWindowCallback {
bool m_rectDirty = false;
bool m_windowInvalid = false;
void resized(const SWindowRect& rect, bool sync) {
void resized(const SWindowRect& rect, bool sync) override {
m_lastRect = rect;
m_rectDirty = true;
fprintf(stderr, "Resized %d, %d (%d, %d)\n", rect.size[0], rect.size[1], rect.location[0], rect.location[1]);
}
void mouseDown(const SWindowCoord& coord, EMouseButton button, EModifierKey mods) {
void mouseDown(const SWindowCoord& coord, EMouseButton button, EModifierKey mods) override {
fprintf(stderr, "Mouse Down %d (%f,%f)\n", int(button), coord.norm[0], coord.norm[1]);
}
void mouseUp(const SWindowCoord& coord, EMouseButton button, EModifierKey mods) {
void mouseUp(const SWindowCoord& coord, EMouseButton button, EModifierKey mods) override {
fprintf(stderr, "Mouse Up %d (%f,%f)\n", int(button), coord.norm[0], coord.norm[1]);
}
void mouseMove(const SWindowCoord& coord) {
void mouseMove(const SWindowCoord& coord) override {
// fprintf(stderr, "Mouse Move (%f,%f)\n", coord.norm[0], coord.norm[1]);
}
void mouseEnter(const SWindowCoord& coord) {
void mouseEnter(const SWindowCoord& coord) override {
fprintf(stderr, "Mouse entered (%f,%f)\n", coord.norm[0], coord.norm[1]);
}
void mouseLeave(const SWindowCoord& coord) { fprintf(stderr, "Mouse left (%f,%f)\n", coord.norm[0], coord.norm[1]); }
void scroll(const SWindowCoord& coord, const SScrollDelta& scroll) {
void mouseLeave(const SWindowCoord& coord) override { fprintf(stderr, "Mouse left (%f,%f)\n", coord.norm[0], coord.norm[1]); }
void scroll(const SWindowCoord& coord, const SScrollDelta& scroll) override {
// fprintf(stderr, "Mouse Scroll (%f,%f) (%f,%f)\n", coord.norm[0], coord.norm[1], scroll.delta[0],
// scroll.delta[1]);
}
void touchDown(const STouchCoord& coord, uintptr_t tid) {
void touchDown(const STouchCoord& coord, uintptr_t tid) override {
// fprintf(stderr, "Touch Down %16lX (%f,%f)\n", tid, coord.coord[0], coord.coord[1]);
}
void touchUp(const STouchCoord& coord, uintptr_t tid) {
void touchUp(const STouchCoord& coord, uintptr_t tid) override {
// fprintf(stderr, "Touch Up %16lX (%f,%f)\n", tid, coord.coord[0], coord.coord[1]);
}
void touchMove(const STouchCoord& coord, uintptr_t tid) {
void touchMove(const STouchCoord& coord, uintptr_t tid) override {
// fprintf(stderr, "Touch Move %16lX (%f,%f)\n", tid, coord.coord[0], coord.coord[1]);
}
void charKeyDown(unsigned long charCode, EModifierKey mods, bool isRepeat) {}
void charKeyUp(unsigned long charCode, EModifierKey mods) {}
void specialKeyDown(ESpecialKey key, EModifierKey mods, bool isRepeat) {
void charKeyDown(unsigned long charCode, EModifierKey mods, bool isRepeat) override {}
void charKeyUp(unsigned long charCode, EModifierKey mods) override {}
void specialKeyDown(ESpecialKey key, EModifierKey mods, bool isRepeat) override {
if (key == ESpecialKey::Enter && True(mods & EModifierKey::Alt))
m_fullscreenToggleRequested = true;
}
void specialKeyUp(ESpecialKey key, EModifierKey mods) {}
void modKeyDown(EModifierKey mod, bool isRepeat) {}
void modKeyUp(EModifierKey mod) {}
void specialKeyUp(ESpecialKey key, EModifierKey mods) override {}
void modKeyDown(EModifierKey mod, bool isRepeat) override {}
void modKeyUp(EModifierKey mod) override {}
void windowMoved(const SWindowRect& rect) {
void windowMoved(const SWindowRect& rect) override {
// fprintf(stderr, "Moved %d, %d (%d, %d)\n", rect.size[0], rect.size[1], rect.location[0], rect.location[1]);
}
void destroyed() { m_windowInvalid = true; }
void destroyed() override { m_windowInvalid = true; }
};
struct TestApplicationCallback : IApplicationCallback {
@ -389,7 +389,7 @@ struct TestApplicationCallback : IApplicationCallback {
} BooTrace);
}
int appMain(IApplication* app) {
int appMain(IApplication* app) override {
mainWindow = app->newWindow(_SYS_STR("YAY!"));
mainWindow->setCallback(&windowCallback);
mainWindow->showWindow();
@ -455,8 +455,8 @@ struct TestApplicationCallback : IApplicationCallback {
m_binding.reset();
return 0;
}
void appQuitting(IApplication*) { running = false; }
void appFilesOpen(IApplication*, const std::vector<SystemString>& paths) {
void appQuitting(IApplication*) override { running = false; }
void appFilesOpen(IApplication*, const std::vector<SystemString>& paths) override {
fprintf(stderr, "OPENING: ");
for (const SystemString& path : paths) {
#if _WIN32