| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
| 4 | ** Contact: http://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the QtOrganizer module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at http://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 2.1 or version 3 as published by the Free |
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and |
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the |
| 22 | ** following information to ensure the GNU Lesser General Public License |
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and |
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
| 25 | ** |
| 26 | ** As a special exception, The Qt Company gives you certain additional |
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception |
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
| 29 | ** |
| 30 | ** $QT_END_LICENSE$ |
| 31 | ** |
| 32 | ****************************************************************************/ |
| 33 | |
| 34 | #ifndef QORGANIZERITEMFILTER_H |
| 35 | #define QORGANIZERITEMFILTER_H |
| 36 | |
| 37 | #include <QtCore/qnamespace.h> |
| 38 | #include <QtCore/qshareddata.h> |
| 39 | |
| 40 | #include <QtOrganizer/qorganizerglobal.h> |
| 41 | |
| 42 | QT_BEGIN_NAMESPACE_ORGANIZER |
| 43 | |
| 44 | class QOrganizerItemFilterPrivate; |
| 45 | class Q_ORGANIZER_EXPORT QOrganizerItemFilter |
| 46 | { |
| 47 | public: |
| 48 | enum FilterType { |
| 49 | InvalidFilter = 0, |
| 50 | DetailFilter, |
| 51 | DetailFieldFilter, |
| 52 | DetailRangeFilter, |
| 53 | IntersectionFilter, |
| 54 | UnionFilter, |
| 55 | IdFilter, |
| 56 | CollectionFilter, |
| 57 | DefaultFilter |
| 58 | }; |
| 59 | |
| 60 | QOrganizerItemFilter(); |
| 61 | QOrganizerItemFilter(const QOrganizerItemFilter &other); |
| 62 | ~QOrganizerItemFilter(); |
| 63 | |
| 64 | QOrganizerItemFilter &operator=(const QOrganizerItemFilter &other); |
| 65 | |
| 66 | FilterType type() const; |
| 67 | |
| 68 | // Qt::MatchFlags don't quite match here |
| 69 | enum MatchFlag { |
| 70 | MatchExactly = Qt::MatchExactly, // 0 |
| 71 | MatchContains = Qt::MatchContains, // 1 |
| 72 | MatchStartsWith = Qt::MatchStartsWith, // 2 |
| 73 | MatchEndsWith = Qt::MatchEndsWith, // 3 |
| 74 | MatchFixedString = Qt::MatchFixedString, // 8 |
| 75 | MatchCaseSensitive = Qt::MatchCaseSensitive // 16 |
| 76 | }; |
| 77 | Q_DECLARE_FLAGS(MatchFlags, MatchFlag) |
| 78 | |
| 79 | bool operator==(const QOrganizerItemFilter &other) const; |
| 80 | bool operator!=(const QOrganizerItemFilter &other) const { return !operator==(other); } |
| 81 | |
| 82 | protected: |
| 83 | explicit QOrganizerItemFilter(QOrganizerItemFilterPrivate *d); |
| 84 | QSharedDataPointer<QOrganizerItemFilterPrivate> d_ptr; |
| 85 | |
| 86 | protected: |
| 87 | friend class QOrganizerItemFilterPrivate; |
| 88 | |
| 89 | #ifndef QT_NO_DATASTREAM |
| 90 | Q_ORGANIZER_EXPORT friend QDataStream &operator<<(QDataStream &out, const QOrganizerItemFilter &filter); |
| 91 | Q_ORGANIZER_EXPORT friend QDataStream &operator>>(QDataStream &in, QOrganizerItemFilter &filter); |
| 92 | #endif // QT_NO_DATASTREAM |
| 93 | |
| 94 | #ifndef QT_NO_DEBUG_STREAM |
| 95 | Q_ORGANIZER_EXPORT friend QDebug operator<<(QDebug dbg, const QOrganizerItemFilter &filter); |
| 96 | #endif // QT_NO_DEBUG_STREAM |
| 97 | }; |
| 98 | |
| 99 | #define Q_DECLARE_ORGANIZERITEMFILTER_PRIVATE(Class) \ |
| 100 | inline Class##Private* d_func(); \ |
| 101 | inline const Class##Private* d_func() const; \ |
| 102 | friend class Class##Private; |
| 103 | |
| 104 | const Q_ORGANIZER_EXPORT QOrganizerItemFilter operator&(const QOrganizerItemFilter &left, const QOrganizerItemFilter &right); |
| 105 | const Q_ORGANIZER_EXPORT QOrganizerItemFilter operator|(const QOrganizerItemFilter &left, const QOrganizerItemFilter &right); |
| 106 | |
| 107 | #ifndef QT_NO_DATASTREAM |
| 108 | Q_ORGANIZER_EXPORT QDataStream &operator<<(QDataStream &out, const QOrganizerItemFilter &filter); |
| 109 | Q_ORGANIZER_EXPORT QDataStream &operator>>(QDataStream &in, QOrganizerItemFilter &filter); |
| 110 | #endif // QT_NO_DATASTREAM |
| 111 | #ifndef QT_NO_DEBUG_STREAM |
| 112 | Q_ORGANIZER_EXPORT QDebug operator<<(QDebug dbg, const QOrganizerItemFilter &filter); |
| 113 | #endif // QT_NO_DEBUG_STREAM |
| 114 | |
| 115 | QT_END_NAMESPACE_ORGANIZER |
| 116 | |
| 117 | QT_BEGIN_NAMESPACE |
| 118 | Q_DECLARE_TYPEINFO(QTORGANIZER_PREPEND_NAMESPACE(QOrganizerItemFilter), Q_MOVABLE_TYPE); |
| 119 | Q_DECLARE_OPERATORS_FOR_FLAGS(QTORGANIZER_PREPEND_NAMESPACE(QOrganizerItemFilter::MatchFlags)) |
| 120 | QT_END_NAMESPACE |
| 121 | |
| 122 | #endif // QORGANIZERITEMFILTER_H |
| 123 | |