collectionstatistics.cpp
00001 /* 00002 Copyright (c) 2006 Volker Krause <vkrause@kde.org> 00003 00004 This library is free software; you can redistribute it and/or modify it 00005 under the terms of the GNU Library General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or (at your 00007 option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, but WITHOUT 00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00012 License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to the 00016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 02110-1301, USA. 00018 */ 00019 00020 #include "collectionstatistics.h" 00021 00022 #include <QtCore/QSharedData> 00023 #include <QtCore/QDebug> 00024 00025 using namespace Akonadi; 00026 00030 class CollectionStatistics::Private : public QSharedData 00031 { 00032 public: 00033 Private() : 00034 QSharedData(), 00035 count( -1 ), 00036 unreadCount( -1 ), 00037 size( -1 ) 00038 {} 00039 00040 Private( const Private &other ) : 00041 QSharedData( other ) 00042 { 00043 count = other.count; 00044 unreadCount = other.unreadCount; 00045 size = other.size; 00046 } 00047 00048 qint64 count; 00049 qint64 unreadCount; 00050 qint64 size; 00051 }; 00052 00053 00054 CollectionStatistics::CollectionStatistics() : 00055 d( new Private ) 00056 { 00057 } 00058 00059 CollectionStatistics::CollectionStatistics(const CollectionStatistics &other) : 00060 d( other.d ) 00061 { 00062 } 00063 00064 CollectionStatistics::~CollectionStatistics() 00065 { 00066 } 00067 00068 qint64 CollectionStatistics::count( ) const 00069 { 00070 return d->count; 00071 } 00072 00073 void CollectionStatistics::setCount( qint64 count ) 00074 { 00075 d->count = count; 00076 } 00077 00078 qint64 CollectionStatistics::unreadCount( ) const 00079 { 00080 return d->unreadCount; 00081 } 00082 00083 void CollectionStatistics::setUnreadCount( qint64 count ) 00084 { 00085 d->unreadCount = count; 00086 } 00087 00088 qint64 CollectionStatistics::size( ) const 00089 { 00090 return d->size; 00091 } 00092 00093 void CollectionStatistics::setSize( qint64 size ) 00094 { 00095 d->size = size; 00096 } 00097 00098 CollectionStatistics& CollectionStatistics::operator =(const CollectionStatistics & other) 00099 { 00100 d = other.d; 00101 return *this; 00102 } 00103 00104 QDebug operator<<( QDebug d, const CollectionStatistics& s ) 00105 { 00106 return d << "CollectionStatistics:" << endl 00107 << " count:" << s.count() << endl 00108 << " unread count:" << s.unreadCount() << endl 00109 << " size:" << s.size(); 00110 }