QSlotObjectBase: make Operation enum protected
We don't want people to go and call through the function pointer directly. Change-Id: I386645239974f008d513eaa62593c1141b294b60 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
parent
4570d0ac24
commit
2d78e24191
@ -106,6 +106,9 @@ namespace QtPrivate {
|
|||||||
// don't use virtual functions here; we don't want the
|
// don't use virtual functions here; we don't want the
|
||||||
// compiler to create tons of per-polymorphic-class stuff that
|
// compiler to create tons of per-polymorphic-class stuff that
|
||||||
// we'll never need. We just use one function pointer.
|
// we'll never need. We just use one function pointer.
|
||||||
|
typedef void (*ImplFn)(int which, QSlotObjectBase* this_, QObject *receiver, void **args, bool *ret);
|
||||||
|
const ImplFn impl;
|
||||||
|
protected:
|
||||||
enum Operation {
|
enum Operation {
|
||||||
Destroy,
|
Destroy,
|
||||||
Call,
|
Call,
|
||||||
@ -113,10 +116,9 @@ namespace QtPrivate {
|
|||||||
|
|
||||||
NumOperations
|
NumOperations
|
||||||
};
|
};
|
||||||
typedef void (*ImplFn)(int which, QSlotObjectBase* this_, QObject *receiver, void **args, bool *ret);
|
public:
|
||||||
const ImplFn impl;
|
|
||||||
|
|
||||||
explicit QSlotObjectBase(ImplFn fn) : ref(1), impl(fn) {}
|
explicit QSlotObjectBase(ImplFn fn) : ref(1), impl(fn) {}
|
||||||
|
|
||||||
inline void destroy() { impl(Destroy, this, 0, 0, 0); }
|
inline void destroy() { impl(Destroy, this, 0, 0, 0); }
|
||||||
inline bool compare(void **a) { bool ret; impl(Compare, this, 0, a, &ret); return ret; }
|
inline bool compare(void **a) { bool ret; impl(Compare, this, 0, a, &ret); return ret; }
|
||||||
inline void call(QObject *r, void **a) { impl(Call, this, r, a, 0); }
|
inline void call(QObject *r, void **a) { impl(Call, this, r, a, 0); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user