2 Copyright 2013-2015 Mats Sjöberg
4 This file is part of the Pumpa programme.
6 Pumpa is free software: you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 Pumpa is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Pumpa. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef _QASABSTRACTOBJECTLIST_H_
21 #define _QASABSTRACTOBJECTLIST_H_
23 #include "qasabstractobject.h"
27 //------------------------------------------------------------------------------
29 class QASAbstractObjectList
: public QASAbstractObject
{
33 QASAbstractObjectList(int asType
, QString url
, QObject
* parent
);
36 virtual void update(QVariantMap json
, bool older
, bool updateOnly
=false);
38 QString
prevLink() const {
39 return m_prevLink
.isEmpty() ? m_url
: m_prevLink
;
41 QString
nextLink() const { return m_nextLink
; }
43 size_t size() const { return m_items
.size(); }
45 QASAbstractObject
* at(size_t i
) const {
51 qulonglong
totalItems() const { return m_totalItems
; }
52 QString
url() const { return m_url
; }
53 QString
urlOrProxy() const;
54 virtual QString
apiLink() const { return urlOrProxy(); }
55 bool hasMore() const { return m_hasMore
; }
57 void addObject(QASAbstractObject
*);
58 void removeObject(QASAbstractObject
*, bool signal
=true);
59 bool contains(QASAbstractObject
* obj
) const {
60 return m_item_set
.contains(obj
);
63 bool firstTime() const { return m_firstTime
; }
66 virtual QASAbstractObject
* getAbstractObject(QVariantMap json
,
69 QString m_displayName
;
71 qulonglong m_totalItems
;
76 QList
<QASAbstractObject
*> m_items
;
77 QSet
<QASAbstractObject
*> m_item_set
;
79 QString m_prevLink
, m_nextLink
;
84 #endif /* _QASABSTRACTOBJECTLIST_H_ */