| 1 | // Copyright (C) 2020 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 QPAGERANGES_H |
| 5 | #define |
| 6 | |
| 7 | #include <QtGui/qtguiglobal.h> |
| 8 | #include <QtCore/qstring.h> |
| 9 | #include <QtCore/qlist.h> |
| 10 | #include <QtCore/qshareddata.h> |
| 11 | #include <QtCore/qmetatype.h> |
| 12 | |
| 13 | QT_BEGIN_NAMESPACE |
| 14 | |
| 15 | class QDebug; |
| 16 | class QDataStream; |
| 17 | class ; |
| 18 | QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPageRangesPrivate, Q_GUI_EXPORT) |
| 19 | |
| 20 | class Q_GUI_EXPORT |
| 21 | { |
| 22 | public: |
| 23 | (); |
| 24 | (); |
| 25 | |
| 26 | (const QPageRanges &other) noexcept; |
| 27 | QPageRanges &(const QPageRanges &other) noexcept; |
| 28 | |
| 29 | (QPageRanges &&other) noexcept = default; |
| 30 | QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPageRanges) |
| 31 | void (QPageRanges &other) noexcept |
| 32 | { d.swap(other&: other.d); } |
| 33 | |
| 34 | friend bool (const QPageRanges &lhs, const QPageRanges &rhs) noexcept |
| 35 | { return lhs.isEqual(other: rhs); } |
| 36 | friend bool (const QPageRanges &lhs, const QPageRanges &rhs) noexcept |
| 37 | { return !lhs.isEqual(other: rhs); } |
| 38 | |
| 39 | struct { |
| 40 | int = -1; |
| 41 | int = -1; |
| 42 | bool (int pageNumber) const noexcept |
| 43 | { return from <= pageNumber && to >= pageNumber; } |
| 44 | friend bool (Range lhs, Range rhs) noexcept |
| 45 | { return lhs.from == rhs.from && lhs.to == rhs.to; } |
| 46 | friend bool (Range lhs, Range rhs) noexcept |
| 47 | { return !(lhs == rhs); } |
| 48 | friend bool (Range lhs, Range rhs) noexcept |
| 49 | { return lhs.from < rhs.from || (!(rhs.from < lhs.from) && lhs.to < rhs.to); } |
| 50 | }; |
| 51 | |
| 52 | void (int pageNumber); |
| 53 | void (int from, int to); |
| 54 | QList<Range> () const; |
| 55 | void (); |
| 56 | |
| 57 | QString () const; |
| 58 | static QPageRanges (const QString &ranges); |
| 59 | |
| 60 | bool (int pageNumber) const; |
| 61 | bool () const; |
| 62 | int () const; |
| 63 | int () const; |
| 64 | |
| 65 | void (); |
| 66 | |
| 67 | private: |
| 68 | bool (const QPageRanges &other) const noexcept; |
| 69 | |
| 70 | QExplicitlySharedDataPointer<QPageRangesPrivate> ; |
| 71 | }; |
| 72 | |
| 73 | #ifndef QT_NO_DATASTREAM |
| 74 | Q_GUI_EXPORT QDataStream &(QDataStream &, const QPageRanges &); |
| 75 | Q_GUI_EXPORT QDataStream &(QDataStream &, QPageRanges &); |
| 76 | #endif |
| 77 | |
| 78 | #ifndef QT_NO_DEBUG_STREAM |
| 79 | Q_GUI_EXPORT QDebug (QDebug dbg, const QPageRanges &); |
| 80 | #endif |
| 81 | |
| 82 | Q_DECLARE_SHARED(QPageRanges) |
| 83 | Q_DECLARE_TYPEINFO(QPageRanges::Range, Q_RELOCATABLE_TYPE); |
| 84 | |
| 85 | QT_END_NAMESPACE |
| 86 | |
| 87 | QT_DECL_METATYPE_EXTERN(QPageRanges, Q_GUI_EXPORT) |
| 88 | |
| 89 | #endif // QPAGERANGES_H |
| 90 | |