~ubuntu-branches/ubuntu/vivid/kate/vivid-proposed

« back to all changes in this revision

Viewing changes to addons/kate/katesql/cachedsqlquerymodel.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2014-12-04 16:49:41 UTC
  • mfrom: (1.6.6)
  • Revision ID: package-import@ubuntu.com-20141204164941-l3qbvsly83hhlw2v
Tags: 4:14.11.97-0ubuntu1
* New upstream release
* Update build-deps and use pkg-kde v3 for Qt 5 build
* kate-data now kate5-data for co-installability

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
Copyright (C) 2010  Marco Mentasti  <marcomentasti@gmail.com>
3
 
 
4
 
This library is free software; you can redistribute it and/or
5
 
modify it under the terms of the GNU Library General Public
6
 
License version 2 as published by the Free Software Foundation.
7
 
 
8
 
This library is distributed in the hope that it will be useful,
9
 
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
 
Library General Public License for more details.
12
 
 
13
 
You should have received a copy of the GNU Library General Public License
14
 
along with this library; see the file COPYING.LIB.  If not, write to
15
 
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16
 
Boston, MA 02110-1301, USA.
17
 
*/
18
 
 
19
 
#ifndef CACHEDSQLQUERYMODEL_H
20
 
#define CACHEDSQLQUERYMODEL_H
21
 
 
22
 
#include <qsqlquerymodel.h>
23
 
#include <qsqlrecord.h>
24
 
#include <qcontiguouscache.h>
25
 
 
26
 
class CachedSqlQueryModel : public QSqlQueryModel
27
 
{
28
 
  Q_OBJECT
29
 
public:
30
 
  explicit CachedSqlQueryModel(QObject *parent = 0, int cacheCapacity = 1000);
31
 
 
32
 
  QVariant data(const QModelIndex &item, int role = Qt::DisplayRole) const;
33
 
  QSqlRecord record(int row) const;
34
 
  void clear();
35
 
 
36
 
  int cacheCapacity() const;
37
 
 
38
 
public slots:
39
 
  void clearCache();
40
 
  void setCacheCapacity(int);
41
 
 
42
 
  protected:
43
 
    virtual void queryChange();
44
 
 
45
 
private:
46
 
  void cacheRecords(int from, int to) const;
47
 
 
48
 
  mutable QContiguousCache<QSqlRecord> cache;
49
 
};
50
 
 
51
 
#endif // CACHEDSQLQUERYMODEL_H