File indexing completed on 2024-11-10 04:40:39
0001 /* 0002 SPDX-FileCopyrightText: 2006 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "collectionstatistics.h" 0008 0009 #include <QDebug> 0010 #include <QSharedData> 0011 0012 using namespace Akonadi; 0013 0014 /** 0015 * @internal 0016 */ 0017 class Akonadi::CollectionStatisticsPrivate : public QSharedData 0018 { 0019 public: 0020 qint64 count = -1; 0021 qint64 unreadCount = -1; 0022 qint64 size = -1; 0023 }; 0024 0025 CollectionStatistics::CollectionStatistics() 0026 : d(new CollectionStatisticsPrivate) 0027 { 0028 } 0029 0030 CollectionStatistics::CollectionStatistics(const CollectionStatistics &other) 0031 : d(other.d) 0032 { 0033 } 0034 0035 CollectionStatistics::~CollectionStatistics() = default; 0036 0037 qint64 CollectionStatistics::count() const 0038 { 0039 return d->count; 0040 } 0041 0042 void CollectionStatistics::setCount(qint64 count) 0043 { 0044 d->count = count; 0045 } 0046 0047 qint64 CollectionStatistics::unreadCount() const 0048 { 0049 return d->unreadCount; 0050 } 0051 0052 void CollectionStatistics::setUnreadCount(qint64 count) 0053 { 0054 d->unreadCount = count; 0055 } 0056 0057 qint64 CollectionStatistics::size() const 0058 { 0059 return d->size; 0060 } 0061 0062 void CollectionStatistics::setSize(qint64 size) 0063 { 0064 d->size = size; 0065 } 0066 0067 CollectionStatistics &CollectionStatistics::operator=(const CollectionStatistics &other) 0068 { 0069 d = other.d; 0070 return *this; 0071 } 0072 0073 QDebug operator<<(QDebug d, const CollectionStatistics &s) 0074 { 0075 return d << "CollectionStatistics:\n" 0076 << " count:" << s.count() << '\n' 0077 << " unread count:" << s.unreadCount() << '\n' 0078 << " size:" << s.size(); 0079 }