cutelyst  3.7.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
pagination.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2015-2022 Daniel Nicoletti <dantti12@gmail.com>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef PAGINATION_H
6 #define PAGINATION_H
7 
8 #include <QVariantMap>
9 #include <Cutelyst/cutelyst_global.h>
10 
11 namespace Cutelyst {
12 
13 class CUTELYST_PLUGIN_UTILS_PAGINATION_EXPORT Pagination : public QVariantMap
14 {
15  Q_GADGET
16  Q_PROPERTY(int limit READ limit CONSTANT)
17  Q_PROPERTY(int offset READ offset CONSTANT)
18  Q_PROPERTY(int currentPage READ currentPage CONSTANT)
19  Q_PROPERTY(int lastPage READ lastPage CONSTANT)
20  Q_PROPERTY(int numberOfItems READ numberOfItems CONSTANT)
21  Q_PROPERTY(bool enableFirst READ enableFirst CONSTANT)
22  Q_PROPERTY(bool enableLast READ enableLast CONSTANT)
23  Q_PROPERTY(QVector<int> pages READ pages CONSTANT)
24 public:
25  Pagination() = default;
33  Pagination(int numberOfItems, int itemsPerPage, int currentPage, int pageLinks = 10);
34  virtual ~Pagination();
35 
39  int limit() const;
40 
44  int offset() const;
45 
49  static int offset(int itemsPerPage, int currentPage);
50 
54  int currentPage() const;
55 
59  int lastPage() const;
60 
64  int numberOfItems() const;
65 
69  bool enableFirst() const;
70 
74  bool enableLast() const;
75 
79  QVector<int> pages() const;
80 };
81 
82 }
83 Q_DECLARE_METATYPE(Cutelyst::Pagination)
84 
85 #endif // PAGINATION_H
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:8