From a872f8b07498c85f0f2eb8b55462ac9df9ce4677 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 28 Nov 2020 15:15:29 +0100 Subject: Factor out ClientType --- src/ClientID.hpp | 8 +++----- src/ClientType.hpp | 27 +++++++++++++++++++++++++++ src/PortID.hpp | 8 +++----- 3 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 src/ClientType.hpp (limited to 'src') diff --git a/src/ClientID.hpp b/src/ClientID.hpp index d58c5ee..43b56ec 100644 --- a/src/ClientID.hpp +++ b/src/ClientID.hpp @@ -17,6 +17,8 @@ #ifndef PATCHAGE_CLIENTID_HPP #define PATCHAGE_CLIENTID_HPP +#include "ClientType.hpp" + #include #include #include @@ -26,11 +28,7 @@ /// An ID for some client (program) that has ports struct ClientID { - enum class Type - { - jack, - alsa, - }; + using Type = ClientType; ClientID(const ClientID& copy) = default; ClientID& operator=(const ClientID& copy) = default; diff --git a/src/ClientType.hpp b/src/ClientType.hpp new file mode 100644 index 0000000..622b3d8 --- /dev/null +++ b/src/ClientType.hpp @@ -0,0 +1,27 @@ +/* This file is part of Patchage. + * Copyright 2020 David Robillard + * + * Patchage is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * Patchage is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License + * along with Patchage. If not, see . + */ + +#ifndef PATCHAGE_CLIENTTYPE_HPP +#define PATCHAGE_CLIENTTYPE_HPP + +/// A type of client (program) with supported ports +enum class ClientType +{ + jack, + alsa, +}; + +#endif // PATCHAGE_CLIENTTYPE_HPP diff --git a/src/PortID.hpp b/src/PortID.hpp index a0f1bb9..4887a27 100644 --- a/src/PortID.hpp +++ b/src/PortID.hpp @@ -17,6 +17,8 @@ #ifndef PATCHAGE_PORTID_HPP #define PATCHAGE_PORTID_HPP +#include "ClientType.hpp" + #include #include #include @@ -26,11 +28,7 @@ /// An ID for some port on a client (program) struct PortID { - enum class Type - { - jack, - alsa, - }; + using Type = ClientType; PortID(const PortID& copy) = default; PortID& operator=(const PortID& copy) = default; -- cgit v1.2.1