Warning, file /include/QtGui/qpageranges.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004 #ifndef QPAGERANGES_H
0005 #define QPAGERANGES_H
0006
0007 #include <QtGui/qtguiglobal.h>
0008 #include <QtCore/qstring.h>
0009 #include <QtCore/qlist.h>
0010 #include <QtCore/qshareddata.h>
0011 #include <QtCore/qmetatype.h>
0012
0013 QT_BEGIN_NAMESPACE
0014
0015 class QDebug;
0016 class QDataStream;
0017 class QPageRangesPrivate;
0018 QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPageRangesPrivate, Q_GUI_EXPORT)
0019
0020 class Q_GUI_EXPORT QPageRanges
0021 {
0022 public:
0023 QPageRanges();
0024 ~QPageRanges();
0025
0026 QPageRanges(const QPageRanges &other) noexcept;
0027 QPageRanges &operator=(const QPageRanges &other) noexcept;
0028
0029 QPageRanges(QPageRanges &&other) noexcept = default;
0030 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPageRanges)
0031 void swap(QPageRanges &other) noexcept
0032 { d.swap(other.d); }
0033
0034 friend bool operator==(const QPageRanges &lhs, const QPageRanges &rhs) noexcept
0035 { return lhs.isEqual(rhs); }
0036 friend bool operator!=(const QPageRanges &lhs, const QPageRanges &rhs) noexcept
0037 { return !lhs.isEqual(rhs); }
0038
0039 struct Range {
0040 int from = -1;
0041 int to = -1;
0042 bool contains(int pageNumber) const noexcept
0043 { return from <= pageNumber && to >= pageNumber; }
0044 friend bool operator==(Range lhs, Range rhs) noexcept
0045 { return lhs.from == rhs.from && lhs.to == rhs.to; }
0046 friend bool operator!=(Range lhs, Range rhs) noexcept
0047 { return !(lhs == rhs); }
0048 friend bool operator<(Range lhs, Range rhs) noexcept
0049 { return lhs.from < rhs.from || (!(rhs.from < lhs.from) && lhs.to < rhs.to); }
0050 };
0051
0052 void addPage(int pageNumber);
0053 void addRange(int from, int to);
0054 QList<Range> toRangeList() const;
0055 void clear();
0056
0057 QString toString() const;
0058 static QPageRanges fromString(const QString &ranges);
0059
0060 bool contains(int pageNumber) const;
0061 bool isEmpty() const;
0062 int firstPage() const;
0063 int lastPage() const;
0064
0065 void detach();
0066
0067 private:
0068 bool isEqual(const QPageRanges &other) const noexcept;
0069
0070 QExplicitlySharedDataPointer<QPageRangesPrivate> d;
0071 };
0072
0073 #ifndef QT_NO_DATASTREAM
0074 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPageRanges &);
0075 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPageRanges &);
0076 #endif
0077
0078 #ifndef QT_NO_DEBUG_STREAM
0079 Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QPageRanges &pageRanges);
0080 #endif
0081
0082 Q_DECLARE_SHARED(QPageRanges)
0083 Q_DECLARE_TYPEINFO(QPageRanges::Range, Q_RELOCATABLE_TYPE);
0084
0085 QT_END_NAMESPACE
0086
0087 QT_DECL_METATYPE_EXTERN(QPageRanges, Q_GUI_EXPORT)
0088
0089 #endif