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 QORGANIZERITEMDETAILFILTER_P_H
35#define QORGANIZERITEMDETAILFILTER_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/qorganizeritemdetailfilter.h>
49#include <QtOrganizer/private/qorganizeritemfilter_p.h>
50
51QT_BEGIN_NAMESPACE_ORGANIZER
52
53class QOrganizerItemDetailFilterPrivate : public QOrganizerItemFilterPrivate
54{
55public:
56 QOrganizerItemDetailFilterPrivate()
57 : QOrganizerItemFilterPrivate(), m_detailType(QOrganizerItemDetail::TypeUndefined), m_detailFields(QList<int>()), m_flags(0)
58 {
59 }
60
61 QOrganizerItemDetailFilterPrivate(const QOrganizerItemDetailFilterPrivate& other)
62 : QOrganizerItemFilterPrivate(other), m_detailType(other.m_detailType), m_detailFields(other.m_detailFields),
63 m_exactValues(other.m_exactValues), m_flags(other.m_flags)
64 {
65 }
66
67 virtual bool compare(const QOrganizerItemFilterPrivate *other) const
68 {
69 const QOrganizerItemDetailFilterPrivate *od = static_cast<const QOrganizerItemDetailFilterPrivate *>(other);
70 if (od) {
71 return (m_detailType == od->m_detailType) && (m_detailFields == od->m_detailFields)
72 && (m_exactValues == od->m_exactValues) && (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_detailFields << m_exactValues << 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_detailFields >> m_exactValues >> 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() << "QOrganizerItemDetailFilter(";
102 dbg.nospace() << "detailType=";
103 dbg.nospace() << m_detailType;
104 dbg.nospace() << ",";
105 dbg.nospace() << "detailFields=";
106 dbg.nospace() << m_detailFields;
107 dbg.nospace() << ",";
108 dbg.nospace() << "values=";
109 dbg.nospace() << m_exactValues;
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(QOrganizerItemDetailFilter, QOrganizerItemFilter::DetailFilter)
119
120 QOrganizerItemDetail m_detail;
121 QOrganizerItemDetail::DetailType m_detailType;
122 QList<int> m_detailFields;
123 QVariantList m_exactValues;
124 QOrganizerItemFilter::MatchFlags m_flags;
125};
126
127QT_END_NAMESPACE_ORGANIZER
128
129#endif // QORGANIZERITEMDETAILFILTER_P_H
130

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