| 1 | // For license of this file, see <project-root-folder>/LICENSE.md. |
| 2 | |
| 3 | /**************************************************************************** |
| 4 | ** |
| 5 | ** Copyright (C) 2016 Giuseppe D'Angelo <[email protected]>. |
| 6 | ** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, [email protected], author Giuseppe D'Angelo |
| 7 | *<[email protected]> |
| 8 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 9 | ** Contact: https://www.qt.io/licensing/ |
| 10 | ** |
| 11 | ** This file is part of the QtCore module of the Qt Toolkit. |
| 12 | ** |
| 13 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 14 | ** Commercial License Usage |
| 15 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 16 | ** accordance with the commercial license agreement provided with the |
| 17 | ** Software or, alternatively, in accordance with the terms contained in |
| 18 | ** a written agreement between you and The Qt Company. For licensing terms |
| 19 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 20 | ** information use the contact form at https://www.qt.io/contact-us. |
| 21 | ** |
| 22 | ** GNU Lesser General Public License Usage |
| 23 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 24 | ** General Public License version 3 as published by the Free Software |
| 25 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 26 | ** packaging of this file. Please review the following information to |
| 27 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 28 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 29 | ** |
| 30 | ** GNU General Public License Usage |
| 31 | ** Alternatively, this file may be used under the terms of the GNU |
| 32 | ** General Public License version 2.0 or (at your option) the GNU General |
| 33 | ** Public license version 3 or any later version approved by the KDE Free |
| 34 | ** Qt Foundation. The licenses are as published by the Free Software |
| 35 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 36 | ** included in the packaging of this file. Please review the following |
| 37 | ** information to ensure the GNU General Public License requirements will |
| 38 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 39 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 40 | ** |
| 41 | ** $QT_END_LICENSE$ |
| 42 | ** |
| 43 | ****************************************************************************/ |
| 44 | |
| 45 | #ifndef REGEXFACTORY_H |
| 46 | #define REGEXFACTORY_H |
| 47 | |
| 48 | #include "definitions/definitions.h" |
| 49 | |
| 50 | #include <QRegularExpression> |
| 51 | #include <QString> |
| 52 | |
| 53 | class RegexFactory { |
| 54 | public: |
| 55 | static QString anchoredPattern(const QString& expression); |
| 56 | static QString wildcardToRegularExpression(const QString& pattern); |
| 57 | |
| 58 | private: |
| 59 | explicit RegexFactory() = delete; |
| 60 | }; |
| 61 | |
| 62 | inline QString RegexFactory::anchoredPattern(const QString& expression) { |
| 63 | return QL1S("\\A(?:") + expression + QL1S(")\\z"); |
| 64 | } |
| 65 | |
| 66 | #endif // REGEXFACTORY_H |