qxLib
Macros
names.h File Reference
#include <qx/macros/common.h>

Go to the source code of this file.

Macros

#define QX_STRINGIFY(name)   #name
 Macro can be used to turn any text in your code into a string, but only the exact text between the parentheses There are no variable dereferencing or macro substitutions or any other sort of thing done. More...
 
#define QX_LINE_NAME(prefix)   _QX_JOIN(prefix, __LINE__)
 Do magic! Creates a unique name using the line number. More...
 
#define QX_C_CONSTANT_CASE(name)
 A helper to avoid duplication when converting c libs constants to string literals. More...
 
#define QX_METHOD_NAME(className, methodName)    ((void)sizeof(&className::methodName), QX_STRINGIFY(methodName)))
 Get a method name (without className::), while statically verifying that the method exists. More...
 
#define QX_FULL_METHOD_NAME(className, methodName)    ((void)sizeof(&className::methodName), QX_STRINGIFY(className) "::" QX_STRINGIFY(methodName))
 Get a full method name (className::methodName), while statically verifying that the method exists. More...
 

Detailed Description

Author
Khrapov
Date
24.07.2025

Definition in file names.h.

Macro Definition Documentation

◆ QX_C_CONSTANT_CASE

#define QX_C_CONSTANT_CASE (   name)
Value:
case name: \
return #name

A helper to avoid duplication when converting c libs constants to string literals.

Parameters
name- c constant
static const char* GlfwErrorCodeToString(int nErrorCode)
{
switch (nErrorCode)
{
QX_C_CONSTANT_CASE(GLFW_NO_ERROR);
QX_C_CONSTANT_CASE(GLFW_NOT_INITIALIZED);
QX_C_CONSTANT_CASE(GLFW_NO_CURRENT_CONTEXT);
QX_C_CONSTANT_CASE(GLFW_INVALID_ENUM);
QX_C_CONSTANT_CASE(GLFW_INVALID_VALUE);
QX_C_CONSTANT_CASE(GLFW_OUT_OF_MEMORY);
QX_C_CONSTANT_CASE(GLFW_API_UNAVAILABLE);
QX_C_CONSTANT_CASE(GLFW_VERSION_UNAVAILABLE);
QX_C_CONSTANT_CASE(GLFW_PLATFORM_ERROR);
QX_C_CONSTANT_CASE(GLFW_FORMAT_UNAVAILABLE);
QX_C_CONSTANT_CASE(GLFW_NO_WINDOW_CONTEXT);
}
return "GLFW_UNKNOWN_ERROR";
}
#define QX_C_CONSTANT_CASE(name)
A helper to avoid duplication when converting c libs constants to string literals.
Definition: names.h:54

Definition at line 54 of file names.h.

◆ QX_FULL_METHOD_NAME

#define QX_FULL_METHOD_NAME (   className,
  methodName 
)     ((void)sizeof(&className::methodName), QX_STRINGIFY(className) "::" QX_STRINGIFY(methodName))

Get a full method name (className::methodName), while statically verifying that the method exists.

Parameters
className- class name
methodName- method name

Definition at line 71 of file names.h.

◆ QX_LINE_NAME

#define QX_LINE_NAME (   prefix)    _QX_JOIN(prefix, __LINE__)

Do magic! Creates a unique name using the line number.

Parameters
prefix- name prefix

Definition at line 27 of file names.h.

◆ QX_METHOD_NAME

#define QX_METHOD_NAME (   className,
  methodName 
)     ((void)sizeof(&className::methodName), QX_STRINGIFY(methodName)))

Get a method name (without className::), while statically verifying that the method exists.

Parameters
className- class name
methodName- method name

Definition at line 63 of file names.h.

◆ QX_STRINGIFY

#define QX_STRINGIFY (   name)    #name

Macro can be used to turn any text in your code into a string, but only the exact text between the parentheses There are no variable dereferencing or macro substitutions or any other sort of thing done.

Parameters
name- name to convert to the string

Definition at line 20 of file names.h.