diff options
author | Ryan Cao <70191398+ryanccn@users.noreply.github.com> | 2022-11-21 23:19:50 +0800 |
---|---|---|
committer | Ryan Cao <70191398+ryanccn@users.noreply.github.com> | 2022-11-21 23:19:50 +0800 |
commit | f916ce875266ea2070c10f80ded35b66d315418c (patch) | |
tree | 5aa0caaac52847222a23482ff5fba7b41fca0f26 /launcher/pathmatcher/SimplePrefixMatcher.h | |
parent | 7096f02b88e982df6c770113146a07874a1e9d0f (diff) | |
parent | 5cc91965d09070437af8c17113c5740401b127dd (diff) | |
download | PrismLauncher-f916ce875266ea2070c10f80ded35b66d315418c.tar.gz PrismLauncher-f916ce875266ea2070c10f80ded35b66d315418c.tar.bz2 PrismLauncher-f916ce875266ea2070c10f80ded35b66d315418c.zip |
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into import-resource-pack-dialog-uwu
Diffstat (limited to 'launcher/pathmatcher/SimplePrefixMatcher.h')
-rw-r--r-- | launcher/pathmatcher/SimplePrefixMatcher.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/launcher/pathmatcher/SimplePrefixMatcher.h b/launcher/pathmatcher/SimplePrefixMatcher.h new file mode 100644 index 00000000..fc1f5ced --- /dev/null +++ b/launcher/pathmatcher/SimplePrefixMatcher.h @@ -0,0 +1,25 @@ +// SPDX-FileCopyrightText: 2022 Sefa Eyeoglu <contact@scrumplex.net> +// +// SPDX-License-Identifier: GPL-3.0-only + +#include <QRegularExpression> +#include "IPathMatcher.h" + +class SimplePrefixMatcher : public IPathMatcher { + public: + virtual ~SimplePrefixMatcher(){}; + SimplePrefixMatcher(const QString& prefix) + { + m_prefix = prefix; + m_isPrefix = prefix.endsWith('/'); + } + + virtual bool matches(const QString& string) const override + { + if (m_isPrefix) + return string.startsWith(m_prefix); + return string == m_prefix; + } + QString m_prefix; + bool m_isPrefix = false; +}; |