From 44db72ead568fe7ce22e1999aac02fd9aac9beea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 10 Oct 2015 05:55:55 +0200 Subject: GH-93 add an option to not copy saves on instance copy --- logic/pathmatcher/IPathMatcher.h | 2 +- logic/pathmatcher/MultiMatcher.h | 2 +- logic/pathmatcher/RegexpMatcher.h | 17 +++++++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) (limited to 'logic/pathmatcher') diff --git a/logic/pathmatcher/IPathMatcher.h b/logic/pathmatcher/IPathMatcher.h index 806a750a..1d410947 100644 --- a/logic/pathmatcher/IPathMatcher.h +++ b/logic/pathmatcher/IPathMatcher.h @@ -8,5 +8,5 @@ public: public: virtual ~IPathMatcher(){}; - virtual bool matches(const QString &string) = 0; + virtual bool matches(const QString &string) const = 0; }; diff --git a/logic/pathmatcher/MultiMatcher.h b/logic/pathmatcher/MultiMatcher.h index e018967c..91f70aa4 100644 --- a/logic/pathmatcher/MultiMatcher.h +++ b/logic/pathmatcher/MultiMatcher.h @@ -15,7 +15,7 @@ public: return *this; } - virtual bool matches(const QString &string) override + virtual bool matches(const QString &string) const override { for(auto iter: m_matchers) { diff --git a/logic/pathmatcher/RegexpMatcher.h b/logic/pathmatcher/RegexpMatcher.h index f3cf90b1..da552123 100644 --- a/logic/pathmatcher/RegexpMatcher.h +++ b/logic/pathmatcher/RegexpMatcher.h @@ -5,13 +5,26 @@ class RegexpMatcher : public IPathMatcher { public: virtual ~RegexpMatcher() {}; - RegexpMatcher(QString regexp) + RegexpMatcher(const QString ®exp) { m_regexp.setPattern(regexp); m_onlyFilenamePart = !regexp.contains('/'); } - virtual bool matches(const QString &string) override + RegexpMatcher &caseSensitive(bool cs = true) + { + if(cs) + { + m_regexp.setPatternOptions(QRegularExpression::CaseInsensitiveOption); + } + else + { + m_regexp.setPatternOptions(QRegularExpression::NoPatternOption); + } + return *this; + } + + virtual bool matches(const QString &string) const override { if(m_onlyFilenamePart) { -- cgit v1.2.3