aboutsummaryrefslogtreecommitdiff
path: root/launcher/pathmatcher
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-08-15 12:16:00 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-08-15 12:16:00 +0300
commitc94ee67077076fdfb3ad04e93a0de2ae32b6a4e5 (patch)
tree437dec3be224cae5e229eeaa4ac9ebeedffd03e3 /launcher/pathmatcher
parent019e5ca3e819f5daf9933bc0fb091784b0ca561f (diff)
parent8f5bb982cd27dd9158b63d826769c168455a139b (diff)
downloadPrismLauncher-c94ee67077076fdfb3ad04e93a0de2ae32b6a4e5.tar.gz
PrismLauncher-c94ee67077076fdfb3ad04e93a0de2ae32b6a4e5.tar.bz2
PrismLauncher-c94ee67077076fdfb3ad04e93a0de2ae32b6a4e5.zip
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into curseforge-url-handle3
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/pathmatcher')
-rw-r--r--launcher/pathmatcher/FSTreeMatcher.h20
-rw-r--r--launcher/pathmatcher/IPathMatcher.h13
-rw-r--r--launcher/pathmatcher/MultiMatcher.h23
-rw-r--r--launcher/pathmatcher/RegexpMatcher.h28
4 files changed, 33 insertions, 51 deletions
diff --git a/launcher/pathmatcher/FSTreeMatcher.h b/launcher/pathmatcher/FSTreeMatcher.h
index b84af294..52f1404d 100644
--- a/launcher/pathmatcher/FSTreeMatcher.h
+++ b/launcher/pathmatcher/FSTreeMatcher.h
@@ -1,21 +1,15 @@
#pragma once
-#include "IPathMatcher.h"
#include <SeparatorPrefixTree.h>
#include <QRegularExpression>
+#include "IPathMatcher.h"
-class FSTreeMatcher : public IPathMatcher
-{
-public:
- virtual ~FSTreeMatcher() {};
- FSTreeMatcher(SeparatorPrefixTree<'/'> & tree) : m_fsTree(tree)
- {
- }
+class FSTreeMatcher : public IPathMatcher {
+ public:
+ virtual ~FSTreeMatcher(){};
+ FSTreeMatcher(SeparatorPrefixTree<'/'>& tree) : m_fsTree(tree) {}
- bool matches(const QString &string) const override
- {
- return m_fsTree.covers(string);
- }
+ bool matches(const QString& string) const override { return m_fsTree.covers(string); }
- SeparatorPrefixTree<'/'> & m_fsTree;
+ SeparatorPrefixTree<'/'>& m_fsTree;
};
diff --git a/launcher/pathmatcher/IPathMatcher.h b/launcher/pathmatcher/IPathMatcher.h
index 192782d7..cd612197 100644
--- a/launcher/pathmatcher/IPathMatcher.h
+++ b/launcher/pathmatcher/IPathMatcher.h
@@ -1,13 +1,12 @@
#pragma once
-#include <memory>
#include <QString>
+#include <memory>
-class IPathMatcher
-{
-public:
+class IPathMatcher {
+ public:
typedef std::shared_ptr<IPathMatcher> Ptr;
-public:
- virtual ~IPathMatcher(){};
- virtual bool matches(const QString &string) const = 0;
+ public:
+ virtual ~IPathMatcher() {}
+ virtual bool matches(const QString& string) const = 0;
};
diff --git a/launcher/pathmatcher/MultiMatcher.h b/launcher/pathmatcher/MultiMatcher.h
index 8bc1b6ee..10159580 100644
--- a/launcher/pathmatcher/MultiMatcher.h
+++ b/launcher/pathmatcher/MultiMatcher.h
@@ -1,26 +1,21 @@
-#include "IPathMatcher.h"
#include <SeparatorPrefixTree.h>
#include <QRegularExpression>
+#include "IPathMatcher.h"
-class MultiMatcher : public IPathMatcher
-{
-public:
- virtual ~MultiMatcher() {};
- MultiMatcher()
- {
- }
- MultiMatcher &add(Ptr add)
+class MultiMatcher : public IPathMatcher {
+ public:
+ virtual ~MultiMatcher(){};
+ MultiMatcher() {}
+ MultiMatcher& add(Ptr add)
{
m_matchers.append(add);
return *this;
}
- virtual bool matches(const QString &string) const override
+ virtual bool matches(const QString& string) const override
{
- for(auto iter: m_matchers)
- {
- if(iter->matches(string))
- {
+ for (auto iter : m_matchers) {
+ if (iter->matches(string)) {
return true;
}
}
diff --git a/launcher/pathmatcher/RegexpMatcher.h b/launcher/pathmatcher/RegexpMatcher.h
index 825d488c..a6a3e616 100644
--- a/launcher/pathmatcher/RegexpMatcher.h
+++ b/launcher/pathmatcher/RegexpMatcher.h
@@ -1,36 +1,30 @@
-#include "IPathMatcher.h"
#include <QRegularExpression>
+#include "IPathMatcher.h"
-class RegexpMatcher : public IPathMatcher
-{
-public:
- virtual ~RegexpMatcher() {};
- RegexpMatcher(const QString &regexp)
+class RegexpMatcher : public IPathMatcher {
+ public:
+ virtual ~RegexpMatcher() {}
+ RegexpMatcher(const QString& regexp)
{
m_regexp.setPattern(regexp);
m_onlyFilenamePart = !regexp.contains('/');
}
- RegexpMatcher &caseSensitive(bool cs = true)
+ RegexpMatcher& caseSensitive(bool cs = true)
{
- if(cs)
- {
+ if (cs) {
m_regexp.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
- }
- else
- {
+ } else {
m_regexp.setPatternOptions(QRegularExpression::NoPatternOption);
}
return *this;
}
- virtual bool matches(const QString &string) const override
+ virtual bool matches(const QString& string) const override
{
- if(m_onlyFilenamePart)
- {
+ if (m_onlyFilenamePart) {
auto slash = string.lastIndexOf('/');
- if(slash != -1)
- {
+ if (slash != -1) {
auto part = string.mid(slash + 1);
return m_regexp.match(part).hasMatch();
}