Make link regular expression only be created once

This commit is contained in:
Rasmus Karlsson
2018-06-28 00:24:21 +02:00
committed by fourtf
parent 7fe8ff97e0
commit 20c17c3377
4 changed files with 114 additions and 41 deletions
+27
View File
@@ -0,0 +1,27 @@
#pragma once
#include <QRegularExpressionMatch>
#include <QString>
namespace chatterino {
class LinkParser
{
public:
explicit LinkParser(const QString &unparsedString);
bool hasMatch() const
{
return this->match_.hasMatch();
}
QString getCaptured() const
{
return this->match_.captured();
}
private:
QRegularExpressionMatch match_;
};
} // namespace chatterino