DtkCore
DTK Core module
载入中...
搜索中...
未找到
Dtk::Core::DVtableHook类 参考

struct  CheckCompatibleArguments
 
struct  CheckCompatibleArguments< List, List >
 
struct  FunctionPointer
 
struct  FunctionPointer< Ret(Obj::*)(Args...) const >
 
struct  FunctionPointer< Ret(Obj::*)(Args...)>
 
class  OverrideDestruct
 
struct  StdFunWrap
 
struct  StdFunWrap< StdFun, Ret(Obj::*)(Args...) const >
 
struct  StdFunWrap< StdFun, Ret(Obj::*)(Args...)>
 

静态 Public 成员函数

static quintptr toQuintptr (const void *ptr)
 
static int getVtableSize (quintptr **obj)
 
static quintptr * getVtableOfObject (const void *obj)
 
template<typename T >
static quintptr * getVtableOfClass ()
 
static int getDestructFunIndex (quintptr **obj, std::function< void(void)> destoryObjFun)
 
static constexpr const QObject * getQObject (...)
 
static constexpr const QObject * getQObject (const QObject *obj)
 
static void autoCleanVtable (const void *obj)
 
static bool ensureVtable (const void *obj, std::function< void(void)> destoryObjFun)
 
static bool hasVtable (const void *obj)
 
static void resetVtable (const void *obj)
 
static quintptr resetVfptrFun (const void *obj, quintptr functionOffset)
 
static quintptr originalFun (const void *obj, quintptr functionOffset)
 
static bool forceWriteMemory (void *adr, const void *data, size_t length)
 
static QFunctionPointer resolve (const char *symbol)
 
template<typename Fun1 , typename Fun2 >
static bool overrideVfptrFun (quintptr *vfptr_t1, Fun1 fun1, quintptr *vfptr_t2, Fun2 fun2, bool forceWrite)
 
template<typename Fun1 , typename Fun2 >
static bool overrideVfptrFun (const typename QtPrivate::FunctionPointer< Fun1 >::Object *t1, Fun1 fun1, const typename QtPrivate::FunctionPointer< Fun2 >::Object *t2, Fun2 fun2)
 
template<typename Class , typename Fun1 , typename Fun2 >
static bool overrideVfptrFun (Fun1 fun1, const typename QtPrivate::FunctionPointer< Fun2 >::Object *t2, Fun2 fun2)
 
template<typename Fun1 , typename Fun2 >
static bool overrideVfptrFun (Fun1 fun1, const typename QtPrivate::FunctionPointer< Fun2 >::Object *t2, Fun2 fun2)
 
static bool ::type overrideVfptrFun (quintptr *vfptr_t1, Fun1 fun1, Fun2 fun2, bool forceWrite)
 
template<typename Fun1 , typename Fun2 >
static std::enable_if< QtPrivate::FunctionPointer< Fun2 >::ArgumentCount==-1, bool >::type overrideVfptrFun (quintptr *vfptr_t1, Fun1 fun1, Fun2 fun2, bool forceWrite)
 
template<typename Fun1 , typename Fun2 >
static bool overrideVfptrFun (const typename QtPrivate::FunctionPointer< Fun1 >::Object *t1, Fun1 fun1, Fun2 fun2)
 
template<typename Class , typename Fun1 , typename Fun2 >
static bool overrideVfptrFun (Fun1 fun1, Fun2 fun2)
 
template<typename Fun1 , typename Fun2 >
static bool overrideVfptrFun (Fun1 fun1, Fun2 fun2)
 
template<typename Fun1 >
static bool resetVfptrFun (const typename QtPrivate::FunctionPointer< Fun1 >::Object *obj, Fun1 fun)
 
template<typename Fun >
static Fun originalFun (const typename QtPrivate::FunctionPointer< Fun >::Object *obj, Fun fun)
 
template<typename Fun , typename... Args>
static QtPrivate::FunctionPointer< Fun >::ReturnType callOriginalFun (typename QtPrivate::FunctionPointer< Fun >::Object *obj, Fun fun, Args &&... args)
 

成员函数说明

◆ overrideVfptrFun() [1/3]

template<typename Fun1 , typename Fun2 >
template< typename Fun1, typename Fun2 > static bool Dtk::Core::DVtableHook::overrideVfptrFun ( const typename QtPrivate::FunctionPointer< Fun1 >::Object *  t1,
Fun1  fun1,
Fun2  fun2 
)
inlinestatic
注解
重载多继承类中的多个虚函数时,fun1务必标记成一个类名的函数。否则可能出现内存泄露的情况
例如 class A 继承于 B,C,D,当需要重载B中的foo1,C中的foo2时,以下函数的fun1需要统一标记为&A::foo1和&A::foo2
因为如果分开写为&B::foo1和&C::foo2的话,指针转换内部会记录多张虚表,重载多份析构函数,可能导致最开始的部分无法正常析构!

◆ overrideVfptrFun() [2/3]

static bool ::type Dtk::Core::DVtableHook::overrideVfptrFun ( quintptr *  vfptr_t1,
Fun1  fun1,
Fun2  fun2,
bool  forceWrite 
)
inlinestatic

({code}) in the form of a code is to eliminate - Wstrict - aliasing build warnings

◆ overrideVfptrFun() [3/3]

template<typename Fun1 , typename Fun2 >
static bool Dtk::Core::DVtableHook::overrideVfptrFun ( quintptr *  vfptr_t1,
Fun1  fun1,
quintptr *  vfptr_t2,
Fun2  fun2,
bool  forceWrite 
)
inlinestatic

({code}) in the form of a code is to eliminate - Wstrict - aliasing build warnings


该类的文档由以下文件生成: