summaryrefslogtreecommitdiff
path: root/kimap/imapset.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kimap/imapset.cpp')
-rw-r--r--kimap/imapset.cpp40
1 files changed, 17 insertions, 23 deletions
diff --git a/kimap/imapset.cpp b/kimap/imapset.cpp
index 6c4e9ea..8588452 100644
--- a/kimap/imapset.cpp
+++ b/kimap/imapset.cpp
@@ -56,6 +56,7 @@ class ImapSet::Private : public QSharedData
ImapInterval::List intervals;
};
+
ImapInterval::ImapInterval() :
d( new Private )
{
@@ -79,9 +80,8 @@ ImapInterval::~ ImapInterval()
ImapInterval& ImapInterval::operator =(const ImapInterval & other)
{
- if ( this != &other ) {
+ if ( this != & other )
d = other.d;
- }
return *this;
}
@@ -92,12 +92,10 @@ bool ImapInterval::operator ==(const ImapInterval & other) const
ImapInterval::Id ImapInterval::size() const
{
- if ( !d->begin && !d->end ) {
+ if ( !d->begin && !d->end )
return 0;
- }
- if ( d->begin && !d->end ) {
+ if ( d->begin && !d->end )
return Q_INT64_C( 0x7FFFFFFFFFFFFFFF ) - d->begin + 1;
- }
return d->end - d->begin + 1;
}
@@ -118,9 +116,8 @@ bool ImapInterval::hasDefinedEnd() const
ImapInterval::Id ImapInterval::end() const
{
- if ( hasDefinedEnd() ) {
+ if ( hasDefinedEnd() )
return d->end;
- }
return 0xFFFFFFFF; // should be INT_MAX, but where is that defined again?
}
@@ -140,19 +137,16 @@ void ImapInterval::setEnd(Id value)
QByteArray ImapInterval::toImapSequence() const
{
- if ( size() == 0 ) {
+ if ( size() == 0 )
return QByteArray();
- }
- if ( size() == 1 ) {
+ if ( size() == 1 )
return QByteArray::number( d->begin );
- }
QByteArray rv;
rv += QByteArray::number( d->begin ) + ':';
- if ( hasDefinedEnd() ) {
+ if ( hasDefinedEnd() )
rv += QByteArray::number( d->end );
- } else {
+ else
rv += '*';
- }
return rv;
}
@@ -164,7 +158,7 @@ ImapInterval ImapInterval::fromImapSequence( const QByteArray &sequence )
}
bool ok = false;
- Id begin = values[0].toLongLong( &ok );
+ Id begin = values[0].toLongLong(&ok);
if ( !ok ) {
return ImapInterval();
@@ -178,7 +172,7 @@ ImapInterval ImapInterval::fromImapSequence( const QByteArray &sequence )
end = 0;
} else {
ok = false;
- end = values[1].toLongLong( &ok );
+ end = values[1].toLongLong(&ok);
if ( !ok ) {
return ImapInterval();
}
@@ -215,9 +209,8 @@ ImapSet::~ImapSet()
ImapSet & ImapSet::operator =(const ImapSet & other)
{
- if ( this != &other ) {
+ if ( this != &other )
d = other.d;
- }
return *this;
}
@@ -245,7 +238,7 @@ void ImapSet::add(const QList<Id> & values)
{
QList<Id> vals = values;
qSort( vals );
- for ( int i = 0; i < vals.count(); ++i ) {
+ for( int i = 0; i < vals.count(); ++i ) {
const int begin = vals[i];
Q_ASSERT( begin >= 0 );
if ( i == vals.count() - 1 ) {
@@ -255,7 +248,7 @@ void ImapSet::add(const QList<Id> & values)
do {
++i;
Q_ASSERT( vals[i] >= 0 );
- if ( vals[i] != ( vals[i - 1] + 1 ) ) {
+ if ( vals[i] != (vals[i - 1] + 1) ) {
--i;
break;
}
@@ -283,7 +276,7 @@ QByteArray ImapSet::toImapSequenceSet() const
QList<QByteArray>::ConstIterator it = rv.constBegin();
++it;
for ( ; it != rv.constEnd(); ++it ) {
- result += ',' + ( *it );
+ result += ',' + (*it);
}
}
@@ -296,7 +289,7 @@ ImapSet ImapSet::fromImapSequenceSet( const QByteArray &sequence )
QList<QByteArray> intervals = sequence.split( ',' );
- foreach ( const QByteArray &interval, intervals ) {
+ foreach( const QByteArray &interval, intervals ) {
if ( !interval.isEmpty() ) {
result.add( ImapInterval::fromImapSequence( interval ) );
}
@@ -326,3 +319,4 @@ QDebug& operator<<( QDebug &d, const ImapSet &set )
d << set.toImapSequenceSet();
return d;
}
+