diff options
author | x12xx12x <44411062+12xx12@users.noreply.github.com> | 2023-05-29 16:31:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-29 16:31:18 +0200 |
commit | 26b7e5ad9edebfce0cbb51a5ba606bb0b334ad2d (patch) | |
tree | 9df629b0cabb165811701afb6a76ea62ada35a63 /src/Globals.h | |
parent | Anvil: Refactored to use shared_ptr. (diff) | |
download | cuberite-26b7e5ad9edebfce0cbb51a5ba606bb0b334ad2d.tar cuberite-26b7e5ad9edebfce0cbb51a5ba606bb0b334ad2d.tar.gz cuberite-26b7e5ad9edebfce0cbb51a5ba606bb0b334ad2d.tar.bz2 cuberite-26b7e5ad9edebfce0cbb51a5ba606bb0b334ad2d.tar.lz cuberite-26b7e5ad9edebfce0cbb51a5ba606bb0b334ad2d.tar.xz cuberite-26b7e5ad9edebfce0cbb51a5ba606bb0b334ad2d.tar.zst cuberite-26b7e5ad9edebfce0cbb51a5ba606bb0b334ad2d.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Globals.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Globals.h b/src/Globals.h index 93a24120d..e4dbe97d6 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -387,9 +387,21 @@ auto ToUnsigned(T a_Val) return static_cast<std::make_unsigned_t<T>>(a_Val); } +// https://stackoverflow.com/questions/1666802/is-there-a-class-macro-in-c +constexpr std::string_view methodName(std::string_view a_PrettyFunction) +{ + size_t Bracket = a_PrettyFunction.rfind("("); + size_t Space = a_PrettyFunction.rfind(" ", Bracket) + 1; + return a_PrettyFunction.substr(Space, Bracket - Space); +} +// https://stackoverflow.com/questions/48857887/pretty-function-in-visual-c +#if !defined(__PRETTY_FUNCTION__) && !defined(__GNUC__) +#define __PRETTY_FUNCTION__ __FUNCSIG__ +#endif +#define __METHOD_NAME__ methodName(__PRETTY_FUNCTION__) // Common headers (part 2, with macros): #include "Vector3.h" |