TreeFrogFramework  1.18
tactionhelper.h
Go to the documentation of this file.
1 #ifndef TACTIONHELPER_H
2 #define TACTIONHELPER_H
3 
4 #include <QStringList>
5 #include <QByteArray>
6 #include <QUrl>
7 #include <QPair>
8 #include <QVariant>
9 #include <TGlobal>
10 
11 class TActionController;
12 
13 
15 {
16 public:
17  virtual ~TActionHelper() { }
18  QUrl url(const QString &controller = QString(), const QString &action = QString(),
19  const QStringList &args = QStringList(), const QVariantMap &query = QVariantMap()) const;
20  QUrl url(const QString &controller, const QString &action, const QStringList &args,
21  const QString &query) const;
22  QUrl url(const QString &controller, const QString &action, int arg) const;
23  QUrl url(const QString &controller, const QString &action, uint arg) const;
24  QUrl url(const QString &controller, const QString &action, qint64 arg) const;
25  QUrl url(const QString &controller, const QString &action, quint64 arg) const;
26  QUrl url(const QString &controller, const QString &action, const QString &arg) const;
27  QUrl url(const QString &controller, const QString &action, const QVariant &arg) const;
28  QUrl url(const QString &controller, const QString &action, const QVariantMap &query) const;
29 
30  QUrl urla(const QString &action = QString(), const QStringList &args = QStringList(),
31  const QVariantMap &query = QVariantMap()) const;
32  QUrl urla(const QString &action, const QStringList &args, const QString &query) const;
33  QUrl urla(const QString &action, int arg) const;
34  QUrl urla(const QString &action, uint arg) const;
35  QUrl urla(const QString &action, qint64 arg) const;
36  QUrl urla(const QString &action, quint64 arg) const;
37  QUrl urla(const QString &action, const QString &arg) const;
38  QUrl urla(const QString &action, const QVariant &arg) const;
39  QUrl urla(const QString &action, const QVariantMap &query) const;
40 
41  QUrl urlq(const QVariantMap &query) const;
42  QUrl urlq(const QString &query) const;
43 
44 protected:
45  virtual const TActionController *controller() const = 0;
46 };
47 
48 
49 inline QUrl TActionHelper::url(const QString &controller, const QString &action, int arg) const
50 {
51  return url(controller, action, QStringList(QString::number(arg)));
52 }
53 
54 inline QUrl TActionHelper::url(const QString &controller, const QString &action, uint arg) const
55 {
56  return url(controller, action, QStringList(QString::number(arg)));
57 }
58 
59 inline QUrl TActionHelper::url(const QString &controller, const QString &action, qint64 arg) const
60 {
61  return url(controller, action, QStringList(QString::number(arg)));
62 }
63 
64 inline QUrl TActionHelper::url(const QString &controller, const QString &action, quint64 arg) const
65 {
66  return url(controller, action, QStringList(QString::number(arg)));
67 }
68 
69 inline QUrl TActionHelper::url(const QString &controller, const QString &action, const QString &arg) const
70 {
71  return url(controller, action, QStringList(arg));
72 }
73 
74 inline QUrl TActionHelper::url(const QString &controller, const QString &action, const QVariantMap &query) const
75 {
76  return url(controller, action, QStringList(), query);
77 }
78 
79 inline QUrl TActionHelper::urla(const QString &action, const QStringList &args, const QVariantMap &query) const
80 {
81  return url(QString(), action, args, query);
82 }
83 
84 inline QUrl TActionHelper::urla(const QString &action, const QStringList &args, const QString &query) const
85 {
86  return url(QString(), action, args, query);
87 }
88 
89 inline QUrl TActionHelper::urla(const QString &action, const QString &arg) const
90 {
91  return url(QString(), action, QStringList(arg));
92 }
93 
94 inline QUrl TActionHelper::urla(const QString &action, int arg) const
95 {
96  return url(QString(), action, QStringList(QString::number(arg)));
97 }
98 
99 inline QUrl TActionHelper::urla(const QString &action, uint arg) const
100 {
101  return url(QString(), action, QStringList(QString::number(arg)));
102 }
103 
104 inline QUrl TActionHelper::urla(const QString &action, qint64 arg) const
105 {
106  return url(QString(), action, QStringList(QString::number(arg)));
107 }
108 
109 inline QUrl TActionHelper::urla(const QString &action, quint64 arg) const
110 {
111  return url(QString(), action, QStringList(QString::number(arg)));
112 }
113 
114 inline QUrl TActionHelper::urla(const QString &action, const QVariantMap &query) const
115 {
116  return url(QString(), action, QStringList(), query);
117 }
118 
119 inline QUrl TActionHelper::urlq(const QVariantMap &query) const
120 {
121  return url(QString(), QString(), QStringList(), query);
122 }
123 
124 inline QUrl TActionHelper::urlq(const QString &query) const
125 {
126  return url(QString(), QString(), QStringList(), query);
127 }
128 
129 #endif // TACTIONHELPER_H
#define T_CORE_EXPORT
Definition: tglobal.h:81
QUrl urla(const QString &action=QString(), const QStringList &args=QStringList(), const QVariantMap &query=QVariantMap()) const
Returns a QUrl to action of the current controller with arguments args.
Definition: tactionhelper.h:79
virtual ~TActionHelper()
Definition: tactionhelper.h:17
QUrl urlq(const QVariantMap &query) const
This function overloads url(const QString &, const QString &, const QStringList &, const QVariantMap &) const.
Definition: tactionhelper.h:119
The TActionHelper class is the base class of all helpers.
Definition: tactionhelper.h:14
QUrl url(const QString &controller=QString(), const QString &action=QString(), const QStringList &args=QStringList(), const QVariantMap &query=QVariantMap()) const
Returns a QUrl to action of controller with arguments args.
Definition: tactionhelper.cpp:27
The TActionController class is the base class of all action controllers.
Definition: tactioncontroller.h:28