-
Notifications
You must be signed in to change notification settings - Fork 102
Open
Description
Hello, I'm using sourcehook in my extensions and would like to propose that it should be changed.
I see several drawbacks in the current implementation:
- The code in sourcehook.h is hard to read.
- Debugging the code generated by SH_DECL_* macros is difficult because they contain many nested macros with generated variable names.
- The macros cannot be wrapped into classes and they always have to be defined at the top of the CPP file.
- All the hooks have to be managed "manually" as there is no RAII to handle them.
- There is a separate macro for different number of arguments.
- The macros are not well handled by Visual Studio and Qt Creator.
One templated class could replace all the SH_DECL_* macros and solve these problems.
template<typename R, typename... A> // return type and argument types
class VirtualHookHandler
{
public:
void Reconfigure(...);
void Enable(...);
void Disable(...);
void AddListener(...);
void RemoveListener(...);
void CallOriginal(...);
...
};
Metadata
Metadata
Assignees
Labels
No labels