Skip to content

Commit 2c6a7f5

Browse files
committed
Turn hook format examples into tables
1 parent 04c247a commit 2c6a7f5

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

modules/ROOT/pages/Development/Cpp/hooking.adoc

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,20 +182,49 @@ Depending on the type of function you are attempting to hook and what you want t
182182
==== Const Functions
183183

184184
When hooking a `const` function you will need to prefix the "self" pointer with `const`.
185-
[horizontal]
186-
*Non-Const Function*:: `(auto& scope, SomeClass* self)`
187-
*Const Function*:: `(auto& scope, *const* SomeClass* self)`
185+
186+
[cols="1,4a"]
187+
|===
188+
| Is Const? | Format
189+
190+
| Non-Const
191+
| `(auto& scope, SomeClass* self)`
192+
193+
| Const
194+
| `(auto& scope, *const* SomeClass* self)`
195+
196+
|===
188197

189198
==== Hooking AFTER
190199

191200
For "after" hooks, add the `_AFTER` postfix to the macro names.
192201

193-
Be aware that the hook function signature changes accordingly and will no longer need the "scope":
194-
[horizontal]
195-
*Non-Virtual*:: `SUBSCRIBE_METHOD_AFTER(SomeClass::MemberFunction, []([*return value by reference,*] SomeClass* self [*,parameters*]))`
196-
*Virtual*:: `SUBSCRIBE_METHOD_VIRTUAL_AFTER(SomeClass::MemberFunction, []([*return value by reference,*] SomeClass* self [*,parameters*]))`
202+
Be aware that the hook function signature changes accordingly and no longer needs the "scope".
203+
204+
The below examples are for non-virtual functions.
205+
For virtual functions, use `SUBSCRIBE_METHOD_VIRTUAL_AFTER` instead of `SUBSCRIBE_METHOD_AFTER`.
206+
207+
[cols="1,1,4a"]
208+
|===
209+
| Return? | Parameters? | Format
210+
211+
| ❌
212+
| ❌
213+
| `SUBSCRIBE_METHOD_AFTER(SomeClass::MemberFunction, [](SomeClass* self))`
214+
215+
| ✔️
216+
| ❌
217+
| `SUBSCRIBE_METHOD_AFTER(SomeClass::MemberFunction, [](auto returnValue, SomeClass* self))`
218+
219+
| ❌
220+
| ✔️
221+
| `SUBSCRIBE_METHOD_AFTER(SomeClass::MemberFunction, [](SomeClass* self, int arg1, int arg2))`
222+
223+
| ✔️
224+
| ✔️
225+
| `SUBSCRIBE_METHOD_AFTER(SomeClass::MemberFunction, [](auto returnValue, SomeClass* self, int arg1, int arg2))`
197226

198-
**★ [*return value by reference,*] and [*,parameters*] are to be replaced if present, do NOT leave it as is!**
227+
|===
199228

200229
==== FORCEINLINE Functions
201230

0 commit comments

Comments
 (0)