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 QORGANIZERITEMDETAILFIELDFILTER_P_H
35#define QORGANIZERITEMDETAILFIELDFILTER_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/qorganizeritemdetailfieldfilter.h>
49#include <QtOrganizer/private/qorganizeritemfilter_p.h>
50
51QT_BEGIN_NAMESPACE_ORGANIZER
52
53class QOrganizerItemDetailFieldFilterPrivate : public QOrganizerItemFilterPrivate
54{
55public:
56 QOrganizerItemDetailFieldFilterPrivate()
57 : QOrganizerItemFilterPrivate(), m_detailType(QOrganizerItemDetail::TypeUndefined), m_detailField(-1), m_flags(0)
58 {
59 }
60
61 QOrganizerItemDetailFieldFilterPrivate(const QOrganizerItemDetailFieldFilterPrivate& other)
62 : QOrganizerItemFilterPrivate(other), m_detailType(other.m_detailType), m_detailField(other.m_detailField),
63 m_exactValue(other.m_exactValue), m_flags(other.m_flags)
64 {
65 }
66
67 virtual bool compare(const QOrganizerItemFilterPrivate *other) const
68 {
69 const QOrganizerItemDetailFieldFilterPrivate *od = static_cast<const QOrganizerItemDetailFieldFilterPrivate *>(other);
70 if (od) {
71 return (m_detailType == od->m_detailType) && (m_detailField == od->m_detailField)
72 && (m_exactValue == od->m_exactValue) && (m_flags == od->m_flags);
73 }
74 return false;
75 }
76
77#ifndef QT_NO_DATASTREAM
78 QDataStream &outputToStream(QDataStream &stream, quint8 formatVersion) const
79 {
80 if (formatVersion == 1)
81 stream << m_detailType << m_detailField << m_exactValue << static_cast<quint32>(m_flags);
82 return stream;
83 }
84
85 QDataStream &inputFromStream(QDataStream &stream, quint8 formatVersion)
86 {
87 if (formatVersion == 1) {
88 quint32 flags;
89 quint32 defId;
90 stream >> defId >> m_detailField >> m_exactValue >> flags;
91 m_detailType = static_cast<QOrganizerItemDetail::DetailType>(defId);
92 m_flags = static_cast<QOrganizerItemFilter::MatchFlags>(flags);
93 }
94 return stream;
95 }
96#endif // QT_NO_DATASTREAM
97
98#ifndef QT_NO_DEBUG_STREAM
99 QDebug &debugStreamOut(QDebug &dbg) const
100 {
101 dbg.nospace() << "QOrganizerItemDetailFieldFilter(";
102 dbg.nospace() << "detailType=";
103 dbg.nospace() << m_detailType;
104 dbg.nospace() << ",";
105 dbg.nospace() << "detailField=";
106 dbg.nospace() << m_detailField;
107 dbg.nospace() << ",";
108 dbg.nospace() << "value=";
109 dbg.nospace() << m_exactValue;
110 dbg.nospace() << ",";
111 dbg.nospace() << "matchFlags=";
112 dbg.nospace() << static_cast<quint32>(m_flags);
113 dbg.nospace() << ")";
114 return dbg.maybeSpace();
115 }
116#endif // QT_NO_DEBUG_STREAM
117
118 Q_IMPLEMENT_ORGANIZERITEMFILTER_VIRTUALCTORS(QOrganizerItemDetailFieldFilter, QOrganizerItemFilter::DetailFieldFilter)
119
120 QOrganizerItemDetail::DetailType m_detailType;
121 int m_detailField;
122 QVariant m_exactValue;
123 QOrganizerItemFilter::MatchFlags m_flags;
124};
125
126QT_END_NAMESPACE_ORGANIZER
127
128#endif // QORGANIZERITEMDETAILFIELDFILTER_P_H
129

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