diff options
| author | 2018-08-01 23:55:59 -0400 | |
|---|---|---|
| committer | 2018-08-01 23:56:02 -0400 | |
| commit | 2bc4ab395850efa84ba879c7a9bcff5df6768a39 (patch) | |
| tree | b98ab7cd3c22772ba4108c3c8e7f8185f3caf09a /src | |
| parent | sink_details: std::move std::function instances (diff) | |
| download | yuzu-2bc4ab395850efa84ba879c7a9bcff5df6768a39.tar.gz yuzu-2bc4ab395850efa84ba879c7a9bcff5df6768a39.tar.xz yuzu-2bc4ab395850efa84ba879c7a9bcff5df6768a39.zip | |
sink_details: Deduplicate long std::function repetition
We can just use type aliases to avoid needing to write the same long
type twice
Diffstat (limited to 'src')
| -rw-r--r-- | src/audio_core/sink_details.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/audio_core/sink_details.h b/src/audio_core/sink_details.h index 4f9027762..ea666c554 100644 --- a/src/audio_core/sink_details.h +++ b/src/audio_core/sink_details.h | |||
| @@ -14,16 +14,18 @@ namespace AudioCore { | |||
| 14 | class Sink; | 14 | class Sink; |
| 15 | 15 | ||
| 16 | struct SinkDetails { | 16 | struct SinkDetails { |
| 17 | SinkDetails(const char* id_, std::function<std::unique_ptr<Sink>(std::string)> factory_, | 17 | using FactoryFn = std::function<std::unique_ptr<Sink>(std::string)>; |
| 18 | std::function<std::vector<std::string>()> list_devices_) | 18 | using ListDevicesFn = std::function<std::vector<std::string>()>; |
| 19 | |||
| 20 | SinkDetails(const char* id_, FactoryFn factory_, ListDevicesFn list_devices_) | ||
| 19 | : id(id_), factory(std::move(factory_)), list_devices(std::move(list_devices_)) {} | 21 | : id(id_), factory(std::move(factory_)), list_devices(std::move(list_devices_)) {} |
| 20 | 22 | ||
| 21 | /// Name for this sink. | 23 | /// Name for this sink. |
| 22 | const char* id; | 24 | const char* id; |
| 23 | /// A method to call to construct an instance of this type of sink. | 25 | /// A method to call to construct an instance of this type of sink. |
| 24 | std::function<std::unique_ptr<Sink>(std::string device_id)> factory; | 26 | FactoryFn factory; |
| 25 | /// A method to call to list available devices. | 27 | /// A method to call to list available devices. |
| 26 | std::function<std::vector<std::string>()> list_devices; | 28 | ListDevicesFn list_devices; |
| 27 | }; | 29 | }; |
| 28 | 30 | ||
| 29 | extern const std::vector<SinkDetails> g_sink_details; | 31 | extern const std::vector<SinkDetails> g_sink_details; |