chore: reformat

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu
2023-08-14 18:16:53 +02:00
parent 779f70057b
commit 91ba4cf75e
603 changed files with 15840 additions and 16257 deletions

View File

@ -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;
};

View File

@ -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:
public:
virtual ~IPathMatcher() {}
virtual bool matches(const QString &string) const = 0;
virtual bool matches(const QString& string) const = 0;
};

View File

@ -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;
}
}

View File

@ -1,36 +1,30 @@
#include "IPathMatcher.h"
#include <QRegularExpression>
#include "IPathMatcher.h"
class RegexpMatcher : public IPathMatcher
{
public:
class RegexpMatcher : public IPathMatcher {
public:
virtual ~RegexpMatcher() {}
RegexpMatcher(const QString &regexp)
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();
}