KIMAP Library
imapset.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KIMAP_IMAPSET_H
00021 #define KIMAP_IMAPSET_H
00022
00023 #include "kimap_export.h"
00024
00025 #include <QtCore/QByteArray>
00026 #include <QtCore/QDebug>
00027 #include <QtCore/QList>
00028 #include <QtCore/QMetaType>
00029 #include <QtCore/QSharedDataPointer>
00030
00031 namespace KIMAP {
00032
00037 class KIMAP_EXPORT ImapInterval
00038 {
00039 public:
00043 typedef qint64 Id;
00044
00048 typedef QList<ImapInterval> List;
00049
00053 ImapInterval();
00054
00058 ImapInterval( const ImapInterval &other );
00059
00065 explicit ImapInterval( Id begin, Id end = 0 );
00066
00070 ~ImapInterval();
00071
00075 ImapInterval& operator=( const ImapInterval &other );
00076
00080 bool operator==( const ImapInterval &other ) const;
00081
00086 Id size() const;
00087
00091 bool hasDefinedBegin() const;
00092
00097 Id begin() const;
00098
00102 bool hasDefinedEnd() const;
00103
00108 Id end() const;
00109
00113 void setBegin( Id value );
00114
00118 void setEnd( Id value );
00119
00123 QByteArray toImapSequence() const;
00124
00125 private:
00126 class Private;
00127 QSharedDataPointer<Private> d;
00128 };
00129
00135 class KIMAP_EXPORT ImapSet
00136 {
00137 public:
00141 typedef qint64 Id;
00142
00146 ImapSet();
00147
00151 ImapSet( Id begin, Id end );
00152
00156 explicit ImapSet( Id value );
00157
00161 ImapSet( const ImapSet &other );
00162
00166 ~ImapSet();
00167
00171 ImapSet& operator=( const ImapSet &other );
00172
00179 void add( const QList<Id> &values );
00180
00185 void add( const ImapInterval &interval );
00186
00190 QByteArray toImapSequenceSet() const;
00191
00195 ImapInterval::List intervals() const;
00196
00200 bool isEmpty() const;
00201
00202 private:
00203 class Private;
00204 QSharedDataPointer<Private> d;
00205 };
00206
00207 }
00208
00209 KIMAP_EXPORT QDebug& operator<<( QDebug& d, const KIMAP::ImapInterval &interval );
00210
00211 Q_DECLARE_METATYPE( KIMAP::ImapInterval )
00212 Q_DECLARE_METATYPE( KIMAP::ImapInterval::List )
00213 Q_DECLARE_METATYPE( KIMAP::ImapSet )
00214
00215 #endif