| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QXMLUTILS_P_H |
| 5 | #define QXMLUTILS_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists for the convenience |
| 12 | // of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header |
| 13 | // file may change from version to version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QtCore/private/qglobal_p.h> |
| 19 | #include <QtCore/qstring.h> |
| 20 | |
| 21 | QT_BEGIN_NAMESPACE |
| 22 | |
| 23 | class QString; |
| 24 | class QChar; |
| 25 | class QXmlCharRange; |
| 26 | |
| 27 | /*! |
| 28 | \internal |
| 29 | \short This class contains helper functions related to XML, for validating character classes, |
| 30 | productions in the XML specification, and so on. |
| 31 | */ |
| 32 | class Q_CORE_EXPORT QXmlUtils |
| 33 | { |
| 34 | public: |
| 35 | static bool isEncName(QStringView encName); |
| 36 | static bool isChar(const char32_t c); |
| 37 | static bool isNameChar(const QChar c); |
| 38 | static bool isLetter(const QChar c); |
| 39 | static bool isNCName(QStringView ncName); |
| 40 | static bool isPublicID(QStringView candidate); |
| 41 | |
| 42 | private: |
| 43 | typedef const QXmlCharRange *RangeIter; |
| 44 | static bool rangeContains(RangeIter begin, RangeIter end, const QChar c); |
| 45 | static bool isBaseChar(const QChar c); |
| 46 | static bool isDigit(const QChar c); |
| 47 | static bool isExtender(const QChar c); |
| 48 | static bool isIdeographic(const QChar c); |
| 49 | static bool isCombiningChar(const QChar c); |
| 50 | }; |
| 51 | |
| 52 | QT_END_NAMESPACE |
| 53 | |
| 54 | #endif |
| 55 | |