qxLib
Classes | Macros
common.h File Reference
#include <qx/containers/string/string_setup.h>
#include <qx/meta/qualifiers.h>

Go to the source code of this file.

Classes

class  qx::details::call_before_main_invoker< lambda_type >
 

Macros

#define QX_EMPTY_MACRO   static_assert(true)
 Placeholder for disabled macros. More...
 
#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_LINE   int(_QX_JOIN(__LINE__, U))
 Same as LINE, but fixes some problems when using it in constexpr context.
 
#define QX_SHORT_FILE   qx::details::last_slash(QX_TEXT(__FILE__))
 Cuts full absolute path to the file name only ex: "C:\folder1\foler2\file.h" => "file.h".
 
#define QX_SINGLE_ARGUMENT(...)   __VA_ARGS__
 Let macro param containing commas work fine "#define FOO(type, name) type name" FOO(QX_SINGLE_ARGUMENT(std::map<int, int>), map_var);. More...
 
#define QX_CONST_CAST_THIS()   const_cast<qx::switch_const_t<std::remove_pointer_t<decltype(this)>>*>(this)
 This macro is made for situations where you have a const method and you need exactly the same method but non-const. More...
 
#define QX_CALL_BEFORE_MAIN   inline volatile qx::details::call_before_main_invoker QX_LINE_NAME(_stubCallBeforeMain)
 Calls this lambda before the main invocation. More...
 

Detailed Description

Author
Khrapov
Date
17.06.2019

Definition in file common.h.

Macro Definition Documentation

◆ QX_CALL_BEFORE_MAIN

#define QX_CALL_BEFORE_MAIN   inline volatile qx::details::call_before_main_invoker QX_LINE_NAME(_stubCallBeforeMain)

Calls this lambda before the main invocation.

Note
This function must be in an object file, that is actually linked to your exe
{
};
#define QX_CALL_BEFORE_MAIN
Calls this lambda before the main invocation.
Definition: common.h:128

Definition at line 128 of file common.h.

◆ QX_CONST_CAST_THIS

#define QX_CONST_CAST_THIS ( )    const_cast<qx::switch_const_t<std::remove_pointer_t<decltype(this)>>*>(this)

This macro is made for situations where you have a const method and you need exactly the same method but non-const.

Warning
You can also use it in vice-versa situations, but be careful as it will break your const guarantees
int foo() const
{
// some complicated stuff
}
int foo()
{
}
#define QX_CONST_CAST_THIS()
This macro is made for situations where you have a const method and you need exactly the same method ...
Definition: common.h:97

Definition at line 97 of file common.h.

◆ QX_EMPTY_MACRO

#define QX_EMPTY_MACRO   static_assert(true)

Placeholder for disabled macros.

Has no effect and work correctly with "if else" You can use it in the end of a macro to enforce user to add ; after it

Definition at line 20 of file common.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 39 of file common.h.

◆ QX_SINGLE_ARGUMENT

#define QX_SINGLE_ARGUMENT (   ...)    __VA_ARGS__

Let macro param containing commas work fine "#define FOO(type, name) type name" FOO(QX_SINGLE_ARGUMENT(std::map<int, int>), map_var);.

Parameters
...- param containing commas

Definition at line 79 of file common.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 29 of file common.h.