summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2022-11-28 15:19:01 +0100
committerLioncash <mathew1800@gmail.com>2022-11-28 16:00:37 +0100
commit2ec7d0b5fda0fe6cbafcc235e3d8cc91b0dc81e0 (patch)
treec61fdcf120b96a0487e24f16c6f48b5fb44fafb5 /src/common
parentcommon/input: Pass ParamPackage by const reference in CreateDevice (diff)
downloadyuzu-2ec7d0b5fda0fe6cbafcc235e3d8cc91b0dc81e0.tar
yuzu-2ec7d0b5fda0fe6cbafcc235e3d8cc91b0dc81e0.tar.gz
yuzu-2ec7d0b5fda0fe6cbafcc235e3d8cc91b0dc81e0.tar.bz2
yuzu-2ec7d0b5fda0fe6cbafcc235e3d8cc91b0dc81e0.tar.lz
yuzu-2ec7d0b5fda0fe6cbafcc235e3d8cc91b0dc81e0.tar.xz
yuzu-2ec7d0b5fda0fe6cbafcc235e3d8cc91b0dc81e0.tar.zst
yuzu-2ec7d0b5fda0fe6cbafcc235e3d8cc91b0dc81e0.zip
Diffstat (limited to 'src/common')
-rw-r--r--src/common/input.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/common/input.h b/src/common/input.h
index 4030ad2e5..449e0193f 100644
--- a/src/common/input.h
+++ b/src/common/input.h
@@ -383,6 +383,16 @@ void RegisterFactory(const std::string& name, std::shared_ptr<Factory<InputDevic
}
}
+inline void RegisterInputFactory(const std::string& name,
+ std::shared_ptr<Factory<InputDevice>> factory) {
+ RegisterFactory<InputDevice>(name, std::move(factory));
+}
+
+inline void RegisterOutputFactory(const std::string& name,
+ std::shared_ptr<Factory<OutputDevice>> factory) {
+ RegisterFactory<OutputDevice>(name, std::move(factory));
+}
+
/**
* Unregisters an input device factory.
* @tparam InputDeviceType the type of input devices the factory can create
@@ -395,6 +405,14 @@ void UnregisterFactory(const std::string& name) {
}
}
+inline void UnregisterInputFactory(const std::string& name) {
+ UnregisterFactory<InputDevice>(name);
+}
+
+inline void UnregisterOutputFactory(const std::string& name) {
+ UnregisterFactory<OutputDevice>(name);
+}
+
/**
* Create an input device from given paramters.
* @tparam InputDeviceType the type of input devices to create
@@ -416,6 +434,14 @@ std::unique_ptr<InputDeviceType> CreateDeviceFromString(const std::string& param
return pair->second->Create(package);
}
+inline std::unique_ptr<InputDevice> CreateInputDeviceFromString(const std::string& params) {
+ return CreateDeviceFromString<InputDevice>(params);
+}
+
+inline std::unique_ptr<OutputDevice> CreateOutputDeviceFromString(const std::string& params) {
+ return CreateDeviceFromString<OutputDevice>(params);
+}
+
/**
* Create an input device from given parameters.
* @tparam InputDeviceType the type of input devices to create
@@ -435,4 +461,12 @@ std::unique_ptr<InputDeviceType> CreateDevice(const ParamPackage& package) {
return pair->second->Create(package);
}
+inline std::unique_ptr<InputDevice> CreateInputDevice(const ParamPackage& package) {
+ return CreateDevice<InputDevice>(package);
+}
+
+inline std::unique_ptr<OutputDevice> CreateOutputDevice(const ParamPackage& package) {
+ return CreateDevice<OutputDevice>(package);
+}
+
} // namespace Common::Input