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 QORGANIZERITEMDETAILRANGEFILTER_P_H
35#define QORGANIZERITEMDETAILRANGEFILTER_P_H
36
37//
38// W A R N I N G
39// -------------
40//
41// This file is not part of the Qt API. It exists purely as an
42// implementation detail. This header file may change from version to
43// version without notice, or even be removed.
44//
45// We mean it.
46//
47
48#include <QtOrganizer/qorganizeritemdetailrangefilter.h>
49#include <QtOrganizer/private/qorganizeritemfilter_p.h>
50
51QT_BEGIN_NAMESPACE_ORGANIZER
52
53class QOrganizerItemDetailRangeFilterPrivate : public QOrganizerItemFilterPrivate
54{
55public:
56 QOrganizerItemDetailRangeFilterPrivate()
57 : QOrganizerItemFilterPrivate(), m_detailType(QOrganizerItemDetail::TypeUndefined), m_detailField(-1), m_flags(0), m_rangeflags(0)
58 {
59 }
60
61 QOrganizerItemDetailRangeFilterPrivate(const QOrganizerItemDetailRangeFilterPrivate& other)
62 : QOrganizerItemFilterPrivate(other), m_detailType(other.m_detailType), m_detailField(other.m_detailField),
63 m_minValue(other.m_minValue), m_maxValue(other.m_maxValue), m_flags(other.m_flags), m_rangeflags(other.m_rangeflags)
64 {
65 }
66
67 virtual bool compare(const QOrganizerItemFilterPrivate *other) const
68 {
69 const QOrganizerItemDetailRangeFilterPrivate *od = static_cast<const QOrganizerItemDetailRangeFilterPrivate *>(other);
70 if (od) {
71 return (m_detailType == od->m_detailType) && (m_detailField == od->m_detailField)
72 && (m_minValue == od->m_minValue) && (m_maxValue == od->m_maxValue)
73 && (m_flags == od->m_flags) && (m_rangeflags == od->m_rangeflags);
74 }
75 return false;
76 }
77
78#ifndef QT_NO_DATASTREAM
79 QDataStream &outputToStream(QDataStream &stream, quint8 formatVersion) const
80 {
81 if (formatVersion == 1) {
82 stream << m_detailType << m_detailField << m_minValue << m_maxValue
83 << static_cast<quint32>(m_flags)
84 << static_cast<quint32>(m_rangeflags);
85 }
86 return stream;
87 }
88
89 QDataStream &inputFromStream(QDataStream &stream, quint8 formatVersion)
90 {
91 if (formatVersion == 1) {
92 quint32 flags;
93 quint32 rangeFlags;
94 quint32 defId;
95 stream >> defId >> m_detailField >> m_minValue >> m_maxValue >> flags >> rangeFlags;
96 m_detailType = static_cast<QOrganizerItemDetail::DetailType>(defId);
97 m_flags = static_cast<QOrganizerItemFilter::MatchFlags>(flags);
98 m_rangeflags = static_cast<QOrganizerItemDetailRangeFilter::RangeFlags>(rangeFlags);
99 }
100 return stream;
101 }
102#endif // QT_NO_DATASTREAM
103
104#ifndef QT_NO_DEBUG_STREAM
105 QDebug &debugStreamOut(QDebug &dbg) const
106 {
107 dbg.nospace() << "QOrganizerItemDetailRangeFilter(";
108 dbg.nospace() << "detailType=";
109 dbg.nospace() << m_detailType;
110 dbg.nospace() << ",";
111 dbg.nospace() << "detailField=";
112 dbg.nospace() << m_detailField;
113 dbg.nospace() << ",";
114 dbg.nospace() << "minValue=";
115 dbg.nospace() << m_minValue;
116 dbg.nospace() << ",";
117 dbg.nospace() << "maxValue=";
118 dbg.nospace() << m_maxValue;
119 dbg.nospace() << ",";
120 dbg.nospace() << "matchFlags=";
121 dbg.nospace() << static_cast<quint32>(m_flags);
122 dbg.nospace() << ",";
123 dbg.nospace() << "rangeFlags=";
124 dbg.nospace() << static_cast<quint32>(m_rangeflags);
125 dbg.nospace() << ")";
126 return dbg.maybeSpace();
127 }
128#endif // QT_NO_DEBUG_STREAM
129
130 Q_IMPLEMENT_ORGANIZERITEMFILTER_VIRTUALCTORS(QOrganizerItemDetailRangeFilter, QOrganizerItemFilter::DetailRangeFilter)
131
132 QOrganizerItemDetail::DetailType m_detailType;
133 int m_detailField;
134 QVariant m_minValue;
135 QVariant m_maxValue;
136 QOrganizerItemFilter::MatchFlags m_flags;
137 QOrganizerItemDetailRangeFilter::RangeFlags m_rangeflags;
138};
139
140QT_END_NAMESPACE_ORGANIZER
141
142#endif // QORGANIZERITEMDETAILRANGEFILTER_P_H
143

source code of qtpim/src/organizer/filters/qorganizeritemdetailrangefilter_p.h