From 09ecb419dd6a9513e6e4583e68a2d3cec952cf6b Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sat, 29 Nov 2014 19:36:24 +0000 Subject: [PATCH] Added isFromClass, see https://dev.vatsim-germany.org/boards/22/topics/2207?r=2230#message-2230 --- src/blackmisc/statusmessage.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/blackmisc/statusmessage.h b/src/blackmisc/statusmessage.h index 6d203cefb..00952d265 100644 --- a/src/blackmisc/statusmessage.h +++ b/src/blackmisc/statusmessage.h @@ -88,6 +88,14 @@ namespace BlackMisc //! Info or debug, no warning or error bool isSeverityInfoOrLess() const { return this->m_severity == SeverityInfo || this->m_severity == SeverityDebug; } + //! Returns true if this message was sent by an instance of class T. + template + bool isFromClass(const T *pointer = nullptr) const + { + CLogCategoryList classCategories(pointer); + return std::all_of(classCategories.begin(), classCategories.end(), [this](const CLogCategory & cat) { return m_categories.contains(cat); }); + } + //! Mark the message as having been handled by the given object void markAsHandledBy(const QObject *object) const;