modernize: Reformat ALL the source... again!
[quassel.git] / src / qtui / qtuimessageprocessor.h
index f31f75b..e204f1d 100644 (file)
 #ifndef QTUIMESSAGEPROCESSOR_H_
 #define QTUIMESSAGEPROCESSOR_H_
 
-#include <QTimer>
 #include <utility>
 
+#include <QTimer>
+
 #include "abstractmessageprocessor.h"
 #include "expressionmatch.h"
 #include "nickhighlightmatcher.h"
@@ -33,12 +34,13 @@ class QtUiMessageProcessor : public AbstractMessageProcessor
     Q_OBJECT
 
 public:
-    enum Mode {
+    enum Mode
+    {
         TimerBased,
         Concurrent
     };
 
-    QtUiMessageProcessor(QObject *parent);
+    QtUiMessageProcessor(QObjectparent);
 
     inline bool isProcessing() const { return _processing; }
     inline Mode processMode() const { return _processMode; }
@@ -46,8 +48,8 @@ public:
     void reset() override;
 
 public slots:
-    void process(Message &msg) override;
-    void process(QList<Message> &msgs) override;
+    void process(Messagemsg) override;
+    void process(QList<Message>msgs) override;
 
     /**
      * Network removed from system
@@ -60,9 +62,9 @@ public slots:
 
 private slots:
     void processNextMessage();
-    void nicksCaseSensitiveChanged(const QVariant &variant);
-    void highlightListChanged(const QVariant &variant);
-    void highlightNickChanged(const QVariant &variant);
+    void nicksCaseSensitiveChanged(const QVariantvariant);
+    void highlightListChanged(const QVariantvariant);
+    void highlightNickChanged(const QVariantvariant);
 
 private:
     /**
@@ -85,10 +87,12 @@ private:
          * @param isEnabled        True if enabled, otherwise false
          * @param chanName         String representing a channel name expression to match
          */
-        LegacyHighlightRule(QString contents, bool isRegEx, bool isCaseSensitive, bool isEnabled,
-                      QString chanName)
-            : _contents(std::move(contents)), _isRegEx(isRegEx), _isCaseSensitive(isCaseSensitive),
-              _isEnabled(isEnabled), _chanName(std::move(chanName))
+        LegacyHighlightRule(QString contents, bool isRegEx, bool isCaseSensitive, bool isEnabled, QString chanName)
+            : _contents(std::move(contents))
+            , _isRegEx(isRegEx)
+            , _isCaseSensitive(isCaseSensitive)
+            , _isEnabled(isEnabled)
+            , _chanName(std::move(chanName))
         {
             _cacheInvalid = true;
             // Cache expression matches on construction
@@ -112,15 +116,14 @@ private:
          *
          * @return String representing a phrase or expression to match
          */
-        inline QString contents() const {
-            return _contents;
-        }
+        inline QString contents() const { return _contents; }
         /**
          * Sets the message contents this rule matches
          *
          * @param contents String representing a phrase or expression to match
          */
-        inline void setContents(const QString &contents) {
+        inline void setContents(const QString& contents)
+        {
             _contents = contents;
             _cacheInvalid = true;
         }
@@ -130,15 +133,14 @@ private:
          *
          * @return True if regular expression, otherwise false
          */
-        inline bool isRegEx() const {
-            return _isRegEx;
-        }
+        inline bool isRegEx() const { return _isRegEx; }
         /**
          * Sets if this rule is a regular expression rule
          *
          * @param isRegEx True if regular expression, otherwise false
          */
-        inline void setIsRegEx(bool isRegEx) {
+        inline void setIsRegEx(bool isRegEx)
+        {
             _isRegEx = isRegEx;
             _cacheInvalid = true;
         }
@@ -148,15 +150,14 @@ private:
          *
          * @return True if case sensitive, otherwise false
          */
-        inline bool isCaseSensitive() const {
-            return _isCaseSensitive;
-        }
+        inline bool isCaseSensitive() const { return _isCaseSensitive; }
         /**
          * Sets if this rule is case sensitive
          *
          * @param isCaseSensitive True if case sensitive, otherwise false
          */
-        inline void setIsCaseSensitive(bool isCaseSensitive) {
+        inline void setIsCaseSensitive(bool isCaseSensitive)
+        {
             _isCaseSensitive = isCaseSensitive;
             _cacheInvalid = true;
         }
@@ -166,17 +167,13 @@ private:
          *
          * @return True if enabled, otherwise false
          */
-        inline bool isEnabled() const {
-            return _isEnabled;
-        }
+        inline bool isEnabled() const { return _isEnabled; }
         /**
          * Sets if this rule is enabled and active
          *
          * @param isEnabled True if enabled, otherwise false
          */
-        inline void setIsEnabled(bool isEnabled) {
-            _isEnabled = isEnabled;
-        }
+        inline void setIsEnabled(bool isEnabled) { _isEnabled = isEnabled; }
 
         /**
          * Gets the channel name this rule matches
@@ -185,15 +182,14 @@ private:
          *
          * @return String representing a phrase or expression to match
          */
-        inline QString chanName() const {
-            return _chanName;
-        }
+        inline QString chanName() const { return _chanName; }
         /**
          * Sets the channel name this rule matches
          *
          * @param chanName String representing a phrase or expression to match
          */
-        inline void setChanName(const QString &chanName) {
+        inline void setChanName(const QString& chanName)
+        {
             _chanName = chanName;
             _cacheInvalid = true;
         }
@@ -203,7 +199,8 @@ private:
          *
          * @return Expression matcher to compare with message contents
          */
-        inline ExpressionMatch contentsMatcher() const {
+        inline ExpressionMatch contentsMatcher() const
+        {
             if (_cacheInvalid) {
                 determineExpressions();
             }
@@ -215,14 +212,15 @@ private:
          *
          * @return Expression matcher to compare with channel name
          */
-        inline ExpressionMatch chanNameMatcher() const {
+        inline ExpressionMatch chanNameMatcher() const
+        {
             if (_cacheInvalid) {
                 determineExpressions();
             }
             return _chanNameMatch;
         }
 
-        bool operator!=(const LegacyHighlightRule &other) const;
+        bool operator!=(const LegacyHighlightRuleother) const;
 
     private:
         /**
@@ -238,31 +236,30 @@ private:
 
         // These represent internal cache and should be safe to mutate in 'const' functions
         // See https://stackoverflow.com/questions/3141087/what-is-meant-with-const-at-end-of-function-declaration
-        mutable bool _cacheInvalid = true;           ///< If true, match cache needs redone
-        mutable ExpressionMatch _contentsMatch = {}; ///< Expression match cache for message content
-        mutable ExpressionMatch _chanNameMatch = {}; ///< Expression match cache for channel name
+        mutable bool _cacheInvalid = true;            ///< If true, match cache needs redone
+        mutable ExpressionMatch _contentsMatch = {};  ///< Expression match cache for message content
+        mutable ExpressionMatch _chanNameMatch = {};  ///< Expression match cache for channel name
     };
 
     using LegacyHighlightRuleList = QList<LegacyHighlightRule>;
 
-    void checkForHighlight(Message &msg);
+    void checkForHighlight(Messagemsg);
     void startProcessing();
 
     using HighlightNickType = NotificationSettings::HighlightNickType;
 
-    LegacyHighlightRuleList _highlightRuleList; ///< Custom highlight rule list
-    NickHighlightMatcher _nickMatcher = {};     ///< Nickname highlight matcher
+    LegacyHighlightRuleList _highlightRuleList;  ///< Custom highlight rule list
+    NickHighlightMatcher _nickMatcher = {};      ///< Nickname highlight matcher
 
     /// Nickname highlighting mode
     HighlightNickType _highlightNick = HighlightNickType::CurrentNick;
-    bool _nicksCaseSensitive = false; ///< If true, match nicknames with exact case
+    bool _nicksCaseSensitive = false;  ///< If true, match nicknames with exact case
 
-    QList<QList<Message> > _processQueue;
+    QList<QList<Message>> _processQueue;
     QList<Message> _currentBatch;
     QTimer _processTimer;
     bool _processing;
     Mode _processMode;
 };
 
-
 #endif