From 2b17ded785be71f93c3f88a5ae1ca38759fb5d7e Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 10 Mar 2020 20:17:40 +0100 Subject: [PATCH] Add convenience ControlFlags operators Explicit functions for operator&=~ and operator|= --- libs/pbd/controllable.cc | 12 ++++++++++++ libs/pbd/pbd/controllable.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/libs/pbd/controllable.cc b/libs/pbd/controllable.cc index 5d9b924ab5..16e03d8827 100644 --- a/libs/pbd/controllable.cc +++ b/libs/pbd/controllable.cc @@ -100,6 +100,18 @@ Controllable::set_flags (Flag f) _flags = f; } +void +Controllable::set_flag (Flag f) +{ + _flags = Flag ((int)_flags | f); +} + +void +Controllable::clear_flag (Flag f) +{ + _flags = Flag ((int)_flags & ~f); +} + void Controllable::add (Controllable& ctl) { diff --git a/libs/pbd/pbd/controllable.h b/libs/pbd/pbd/controllable.h index 95e75eb3be..05e014caf4 100644 --- a/libs/pbd/pbd/controllable.h +++ b/libs/pbd/pbd/controllable.h @@ -163,6 +163,9 @@ public: Flag flags() const { return _flags; } void set_flags (Flag f); + void set_flag (Flag f); ///< _flags |= f; + void clear_flag (Flag f); ///< _flags &= ~f; + static boost::shared_ptr by_id (const PBD::ID&); static void dump_registry ();