qxLib
names.h
Go to the documentation of this file.
1 /**
2 
3  @file names.h
4  @author Khrapov
5  @date 24.07.2025
6  @copyright © Nick Khrapov, 2025. All right reserved.
7 
8 **/
9 #pragma once
10 
11 #include <qx/macros/common.h>
12 
13 /**
14  @def QX_STRINGIFY
15  @brief Macro can be used to turn any text in your code into a string,
16  but only the exact text between the parentheses
17  There are no variable dereferencing or macro substitutions or any other sort of thing done.
18  @param name - name to convert to the string
19 **/
20 #define QX_STRINGIFY(name) #name
21 
22 /**
23  @def QX_LINE_NAME
24  @brief Do magic! Creates a unique name using the line number
25  @param prefix - name prefix
26 **/
27 #define QX_LINE_NAME(prefix) _QX_JOIN(prefix, __LINE__)
28 
29 /**
30  @brief Get a method name (without className::), while statically verifying that the method exists
31  @param className - class name
32  @param methodName - method name
33 **/
34 #define QX_METHOD_NAME(className, methodName) \
35  ((void)sizeof(&className::methodName), QX_STRINGIFY(methodName)))
36 
37 /**
38  @brief Get a full method name (className::methodName), while statically verifying that the method exists
39  @param className - class name
40  @param methodName - method name
41 **/
42 #define QX_FULL_METHOD_NAME(className, methodName) \
43  ((void)sizeof(&className::methodName), QX_STRINGIFY(className) "::" QX_STRINGIFY(methodName)))