Merge branch 'master' of ssh://pumpa.branchable.com
[larjonas-pumpa.git] / src / qascollection.h
blob590188439e8f0306567674e72a4461f4fcb19ffe
1 /*
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 _QASCOLLECTION_H_
21 #define _QASCOLLECTION_H_
23 #include "qasactivity.h"
24 #include "qasabstractobject.h"
25 #include "qasabstractobjectlist.h"
27 //------------------------------------------------------------------------------
29 class QASCollection : public QASAbstractObjectList {
30 Q_OBJECT
32 protected:
33 QASCollection(QString url, QObject* parent);
35 public:
36 static void clearCache();
38 static QASCollection* initCollection(QString url, QObject* parent);
39 static QASCollection* getCollection(QVariantMap json, QObject* parent,
40 int id);
42 QASActivity* at(size_t i) const {
43 return qobject_cast<QASActivity*>(QASAbstractObjectList::at(i));
46 private:
47 virtual QASAbstractObject* getAbstractObject(QVariantMap json,
48 QObject* parent);
50 static QMap<QString, QASCollection*> s_collections;
53 #endif /* _QASCOLLECTION_H_ */