1 | /* |
2 | Copyright (c) 2006 Volker Krause <vkrause@kde.org> |
3 | |
4 | This library is free software; you can redistribute it and/or modify it |
5 | under the terms of the GNU Library General Public License as published by |
6 | the Free Software Foundation; either version 2 of the License, or (at your |
7 | option) any later version. |
8 | |
9 | This library is distributed in the hope that it will be useful, but WITHOUT |
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public |
12 | License for more details. |
13 | |
14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to the |
16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
17 | 02110-1301, USA. |
18 | */ |
19 | |
20 | #include "collectionstatistics.h" |
21 | |
22 | #include <QtCore/QSharedData> |
23 | #include <QtCore/QDebug> |
24 | |
25 | using namespace Akonadi; |
26 | |
27 | /** |
28 | * @internal |
29 | */ |
30 | class CollectionStatistics::Private : public QSharedData |
31 | { |
32 | public: |
33 | Private() |
34 | : QSharedData() |
35 | , count(-1) |
36 | , unreadCount(-1) |
37 | , size(-1) |
38 | {} |
39 | |
40 | Private(const Private &other) |
41 | : QSharedData(other) |
42 | { |
43 | count = other.count; |
44 | unreadCount = other.unreadCount; |
45 | size = other.size; |
46 | } |
47 | |
48 | qint64 count; |
49 | qint64 unreadCount; |
50 | qint64 size; |
51 | }; |
52 | |
53 | CollectionStatistics::CollectionStatistics() |
54 | : d(new Private) |
55 | { |
56 | } |
57 | |
58 | CollectionStatistics::CollectionStatistics(const CollectionStatistics &other) |
59 | : d(other.d) |
60 | { |
61 | } |
62 | |
63 | CollectionStatistics::~CollectionStatistics() |
64 | { |
65 | } |
66 | |
67 | qint64 CollectionStatistics::count() const |
68 | { |
69 | return d->count; |
70 | } |
71 | |
72 | void CollectionStatistics::setCount(qint64 count) |
73 | { |
74 | d->count = count; |
75 | } |
76 | |
77 | qint64 CollectionStatistics::unreadCount() const |
78 | { |
79 | return d->unreadCount; |
80 | } |
81 | |
82 | void CollectionStatistics::setUnreadCount(qint64 count) |
83 | { |
84 | d->unreadCount = count; |
85 | } |
86 | |
87 | qint64 CollectionStatistics::size() const |
88 | { |
89 | return d->size; |
90 | } |
91 | |
92 | void CollectionStatistics::setSize(qint64 size) |
93 | { |
94 | d->size = size; |
95 | } |
96 | |
97 | CollectionStatistics &CollectionStatistics::operator =(const CollectionStatistics &other) |
98 | { |
99 | d = other.d; |
100 | return *this; |
101 | } |
102 | |
103 | QDebug operator<<(QDebug d, const CollectionStatistics &s) |
104 | { |
105 | return d << "CollectionStatistics:" << endl |
106 | << " count:" << s.count() << endl |
107 | << " unread count:" << s.unreadCount() << endl |
108 | << " size:" << s.size(); |
109 | } |
110 | |