#pragma once
-#include <QString>
-#include <QStringList>
+#include "common-export.h"
-#if QT_VERSION >= 0x050000
#include <QRegularExpression>
-#else
-#include <QRegExp>
-#endif
+#include <QString>
+#include <QStringList>
/**
* Expression matcher with multiple modes of operation and automatic caching for performance
*/
-class ExpressionMatch
+class COMMON_EXPORT ExpressionMatch
{
public:
/// Expression matching mode
-#if QT_VERSION >= 0x050000
enum class MatchMode {
-#else
- enum MatchMode {
-#endif
MatchPhrase, ///< Match phrase as specified, no special handling
MatchMultiPhrase, ///< Match phrase as specified, split on \n only
MatchWildcard, ///< Match wildcards, "!" at start inverts, "\" escapes
/**
* Construct an empty ExpressionMatch
*/
- ExpressionMatch() {}
+ ExpressionMatch() = default;
/**
* Construct an Expression match with the given parameters
*
* @param regExString Regular expression string
* @param caseSensitive If true, match case-sensitively, otherwise ignore case when matching
- * @return Configured QRegExp class on Qt 4, QRegularExpression on Qt 5
+ * @return Configured QRegularExpression
*/
-#if QT_VERSION >= 0x050000
static QRegularExpression regExFactory(const QString ®ExString, bool caseSensitive);
-#else
- static QRegExp regExFactory(const QString ®ExString, bool caseSensitive);
-#endif
/**
* Escapes any regular expression characters in a string so they have no special meaning
bool _sourceExpressionEmpty = false; ///< Cached expression match string is empty
/// Underlying regular expression matching instance for normal (noninverted) rules
-#if QT_VERSION >= 0x050000
QRegularExpression _matchRegEx = {};
-#else
- QRegExp _matchRegEx = {};
-#endif
bool _matchRegExActive = false; ///< If true, use normal expression in matching
/// Underlying regular expression matching instance for inverted rules
-#if QT_VERSION >= 0x050000
QRegularExpression _matchInvertRegEx = {};
-#else
- QRegExp _matchInvertRegEx = {};
-#endif
bool _matchInvertRegExActive = false; ///< If true, use invert expression in matching
};