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 QtContacts 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 QCONTACTFILTER_H
35#define QCONTACTFILTER_H
36
37#include <QtCore/qshareddata.h>
38
39#include <QtContacts/qcontactsglobal.h>
40
41QT_BEGIN_NAMESPACE_CONTACTS
42
43/* Manual Q_DECLARE_CONTACTFILTER_PRIVATE macro */
44
45#define Q_DECLARE_CONTACTFILTER_PRIVATE(Class) \
46 inline Class##Private* d_func(); \
47 inline const Class##Private* d_func() const; \
48 friend class Class##Private;
49
50class QContactFilterPrivate;
51class Q_CONTACTS_EXPORT QContactFilter
52{
53public:
54 QContactFilter();
55 ~QContactFilter();
56 QContactFilter(const QContactFilter& other);
57 QContactFilter& operator=(const QContactFilter& other);
58
59 enum FilterType {
60 InvalidFilter,
61 ContactDetailFilter,
62 ContactDetailRangeFilter,
63 ChangeLogFilter,
64 ActionFilter,
65 RelationshipFilter,
66 IntersectionFilter,
67 UnionFilter,
68 IdFilter,
69 DefaultFilter,
70 CollectionFilter
71 };
72
73 FilterType type() const;
74
75 enum MatchFlag {
76 MatchExactly = 0x0000, // 0
77 MatchContains = 0x0001, // 1
78 MatchStartsWith = 0x0002, // 2
79 MatchEndsWith = 0x0004, // 4
80 MatchFixedString = 0x0008, // 8
81 MatchCaseSensitive = 0x0010, // 16
82 MatchPhoneNumber = 0x400, //1024
83 MatchKeypadCollation = 0x800 //2048
84 };
85 Q_DECLARE_FLAGS(MatchFlags, MatchFlag)
86
87 bool operator==(const QContactFilter& other) const;
88 bool operator!=(const QContactFilter& other) const {return !operator==(other);}
89
90protected:
91 explicit QContactFilter(QContactFilterPrivate* d);
92
93protected:
94 friend class QContactFilterPrivate;
95#ifndef QT_NO_DATASTREAM
96 Q_CONTACTS_EXPORT friend QDataStream& operator<<(QDataStream& out, const QContactFilter& filter);
97 Q_CONTACTS_EXPORT friend QDataStream& operator>>(QDataStream& in, QContactFilter& filter);
98#endif
99#ifndef QT_NO_DEBUG_STREAM
100 Q_CONTACTS_EXPORT friend QDebug operator<<(QDebug dbg, const QContactFilter& filter);
101#endif
102 QSharedDataPointer<QContactFilterPrivate> d_ptr;
103};
104
105Q_DECLARE_OPERATORS_FOR_FLAGS(QContactFilter::MatchFlags)
106
107const Q_CONTACTS_EXPORT QContactFilter operator&(const QContactFilter& left, const QContactFilter& right);
108const Q_CONTACTS_EXPORT QContactFilter operator|(const QContactFilter& left, const QContactFilter& right);
109
110#ifndef QT_NO_DATASTREAM
111Q_CONTACTS_EXPORT QDataStream& operator<<(QDataStream& out, const QContactFilter& filter);
112Q_CONTACTS_EXPORT QDataStream& operator>>(QDataStream& in, QContactFilter& filter);
113#endif
114#ifndef QT_NO_DEBUG_STREAM
115Q_CONTACTS_EXPORT QDebug operator<<(QDebug dbg, const QContactFilter& filter);
116#endif
117
118QT_END_NAMESPACE_CONTACTS
119
120QT_BEGIN_NAMESPACE
121Q_DECLARE_TYPEINFO(QTCONTACTS_PREPEND_NAMESPACE(QContactFilter), Q_MOVABLE_TYPE);
122QT_END_NAMESPACE
123
124#endif // QCONTACTFILTER_H
125

source code of qtpim/src/contacts/qcontactfilter.h