wahyu-GTA-Online-OUTDATED-B.../subVersion/CallbackProxy.h

38 lines
873 B
C
Raw Permalink Normal View History

2020-11-06 18:55:46 +07:00
#pragma once
#ifndef __CALLBACK_PROXY_H__
#define __CALLBACK_PROXY_H__
//Tobject:<3A><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD>Tparam<61>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
template<typename Tobject, typename Tparam>
class CallbackProxy
{
typedef void (Tobject::* CbFun)(Tparam*);
public:
void Set(Tobject* pInstance, CbFun pFun);
bool Exec(Tparam* pParam);
private:
CbFun pCbFun; //<2F>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
Tobject* m_pInstance; //<2F><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>
};
//<2F><><EFBFBD>õ<EFBFBD><C3B5>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
template<typename Tobject, typename Tparam>
void CallbackProxy<Tobject, Tparam>::Set(Tobject* pInstance, CbFun pFun)
{
m_pInstance = pInstance;
pCbFun = pFun;
};
//<2F><><EFBFBD>ûص<C3BB><D8B5><EFBFBD><EFBFBD><EFBFBD>
template<typename Tobject, typename Tparam>
bool CallbackProxy<Tobject, Tparam>::Exec(Tparam* pParam)
{
(m_pInstance->*pCbFun)(pParam);
return true;
}
extern std::map<int, CallbackProxy<hack, float>*>* g_pCBMap;
#endif