summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-11-27 17:58:11 +0100
committerDavid Robillard <d@drobilla.net>2020-11-27 21:42:52 +0100
commit96b68f0c39b02b41f96245cedcc156c60c3317e2 (patch)
tree7d53160bb696be28dc637314b6b9d377ff66a7e3
parentf66e011d34fa511690e5b4863849ac9104f08d9d (diff)
downloadpatchage-96b68f0c39b02b41f96245cedcc156c60c3317e2.tar.gz
patchage-96b68f0c39b02b41f96245cedcc156c60c3317e2.tar.bz2
patchage-96b68f0c39b02b41f96245cedcc156c60c3317e2.zip
Explicitly delete or define all special member functions
-rw-r--r--.clang-tidy1
-rw-r--r--src/AlsaDriver.hpp6
-rw-r--r--src/Driver.hpp8
-rw-r--r--src/JackDriver.hpp6
-rw-r--r--src/Patchage.hpp6
-rw-r--r--src/PatchageModule.hpp6
-rw-r--r--src/PatchagePort.hpp6
-rw-r--r--src/PortID.hpp18
-rw-r--r--src/Widget.hpp5
9 files changed, 48 insertions, 14 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 694942a..6048690 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -6,7 +6,6 @@ Checks: >
-*-narrowing-conversions,
-*-no-malloc,
-*-non-private-member-variables-in-classes,
- -*-special-member-functions,
-*-unused-macros,
-*-uppercase-literal-suffix,
-*-vararg,
diff --git a/src/AlsaDriver.hpp b/src/AlsaDriver.hpp
index 92c303f..2af3553 100644
--- a/src/AlsaDriver.hpp
+++ b/src/AlsaDriver.hpp
@@ -39,6 +39,12 @@ class AlsaDriver : public Driver
public:
explicit AlsaDriver(Patchage* app);
+ AlsaDriver(const AlsaDriver&) = delete;
+ AlsaDriver& operator=(const AlsaDriver&) = delete;
+
+ AlsaDriver(AlsaDriver&&) = delete;
+ AlsaDriver& operator=(AlsaDriver&&) = delete;
+
~AlsaDriver() override;
void attach(bool launch_daemon) override;
diff --git a/src/Driver.hpp b/src/Driver.hpp
index 58f6c4d..b0373af 100644
--- a/src/Driver.hpp
+++ b/src/Driver.hpp
@@ -28,6 +28,14 @@ class PatchageCanvas;
class Driver
{
public:
+ Driver() = default;
+
+ Driver(const Driver&) = delete;
+ Driver& operator=(const Driver&) = delete;
+
+ Driver(Driver&&) = delete;
+ Driver& operator=(Driver&&) = delete;
+
virtual ~Driver() = default;
virtual void process_events(Patchage* app) = 0;
diff --git a/src/JackDriver.hpp b/src/JackDriver.hpp
index c5e075e..442ce74 100644
--- a/src/JackDriver.hpp
+++ b/src/JackDriver.hpp
@@ -42,6 +42,12 @@ class JackDriver : public Driver
public:
explicit JackDriver(Patchage* app);
+ JackDriver(const JackDriver&) = delete;
+ JackDriver& operator=(const JackDriver&) = delete;
+
+ JackDriver(JackDriver&&) = delete;
+ JackDriver& operator=(JackDriver&&) = delete;
+
~JackDriver() override;
void attach(bool launch_daemon) override;
diff --git a/src/Patchage.hpp b/src/Patchage.hpp
index ba02710..98537a1 100644
--- a/src/Patchage.hpp
+++ b/src/Patchage.hpp
@@ -61,6 +61,12 @@ public:
Patchage(int argc, char** argv);
~Patchage();
+ Patchage(const Patchage&) = delete;
+ Patchage& operator=(const Patchage&) = delete;
+
+ Patchage(Patchage&&) = delete;
+ Patchage& operator=(Patchage&&) = delete;
+
const std::shared_ptr<PatchageCanvas>& canvas() const { return _canvas; }
Gtk::Window* window() { return _main_win.get(); }
diff --git a/src/PatchageModule.hpp b/src/PatchageModule.hpp
index 249f0ce..aa25546 100644
--- a/src/PatchageModule.hpp
+++ b/src/PatchageModule.hpp
@@ -41,6 +41,12 @@ public:
double x = 0,
double y = 0);
+ PatchageModule(const PatchageModule&) = delete;
+ PatchageModule& operator=(const PatchageModule&) = delete;
+
+ PatchageModule(PatchageModule&&) = delete;
+ PatchageModule& operator=(PatchageModule&&) = delete;
+
~PatchageModule() override;
void split();
diff --git a/src/PatchagePort.hpp b/src/PatchagePort.hpp
index 8811feb..b790f0d 100644
--- a/src/PatchagePort.hpp
+++ b/src/PatchagePort.hpp
@@ -60,6 +60,12 @@ public:
signal_event().connect(sigc::mem_fun(this, &PatchagePort::on_event));
}
+ PatchagePort(const PatchagePort&) = delete;
+ PatchagePort& operator=(const PatchagePort&) = delete;
+
+ PatchagePort(PatchagePort&&) = delete;
+ PatchagePort& operator=(PatchagePort&&) = delete;
+
~PatchagePort() override = default;
/** Returns the full name of this port, as "modulename:portname" */
diff --git a/src/PortID.hpp b/src/PortID.hpp
index 8132639..c29d662 100644
--- a/src/PortID.hpp
+++ b/src/PortID.hpp
@@ -59,21 +59,13 @@ struct PortID
}
#endif
- PortID(const PortID& copy)
- : type(copy.type)
- {
- memcpy(&id, &copy.id, sizeof(id));
- }
+ PortID(const PortID& copy) = default;
+ PortID& operator=(const PortID& copy) = default;
- PortID& operator=(const PortID& copy)
- {
- if (&copy != this) {
- type = copy.type;
- memcpy(&id, &copy.id, sizeof(id));
- }
+ PortID(PortID&& id) = default;
+ PortID& operator=(PortID&& id) = default;
- return *this;
- }
+ ~PortID() = default;
Type type = Type::nothing;
diff --git a/src/Widget.hpp b/src/Widget.hpp
index f1db218..4182d40 100644
--- a/src/Widget.hpp
+++ b/src/Widget.hpp
@@ -33,6 +33,11 @@ public:
Widget(const Widget&) = delete;
Widget& operator=(const Widget&) = delete;
+ Widget(Widget&&) = delete;
+ Widget& operator=(Widget&&) = delete;
+
+ ~Widget() = default;
+
void destroy() { delete _me; }
W* get() { return _me; }