MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
Macros.h File Reference
#include "CoreMinimal.h"
#include "HAL/PreprocessorHelpers.h"
#include "boost/preprocessor.hpp"
#include "Misc/EngineVersionComparison.h"

Go to the source code of this file.

Macros

#define PREPROCESSOR_TO_TEXT(x)
 
#define MACRO_OVERLOAD(prefix, ...)
 Implement preprocessor function overloading based on argument count for a set of macros following a distinct convention. Individual overloads must have a trailing number corresponding to the number of arguments they accept.
 
#define DEFAULT_ON_EMPTY(value, default)
 Returns given default value when input value is empty.
 
#define MCRO_VERSION_NUM_2(major, minor)
 
#define MCRO_VERSION_NUM_3(major, minor, patch)
 
#define MCRO_VERSION_NUM_4(major, minor, patch, rev)
 
#define VERSION_NUM(...)
 Store a semantic version in an uint64 number.
 
#define UNREAL_VERSION_NUM   VERSION_NUM(ENGINE_MAJOR_VERSION, ENGINE_MINOR_VERSION, ENGINE_PATCH_VERSION)
 VERSION_NUM representation of current Engine version.
 
#define UNREAL_VERSION(op, ...)
 Macro for conveniently comparing unreal version for code compile compatibility cases.
 
#define MCRO_FORWARD_FUNCTION   Forward
 
#define FWD(...)
 Shorten forwarding expression with this macro so one may not need to specify explicit type.
 

Detailed Description

Author
David Mórász
Date
2025

Definition in file Macros.h.

Macro Definition Documentation

◆ DEFAULT_ON_EMPTY

#define DEFAULT_ON_EMPTY ( value,
default )
Value:
BOOST_PP_IF(BOOST_PP_CHECK_EMPTY(value), default, value)

Returns given default value when input value is empty.

Definition at line 74 of file Macros.h.

◆ FWD

#define FWD ( ...)
Value:
#define MCRO_FORWARD_FUNCTION
Definition Macros.h:129

Shorten forwarding expression with this macro so one may not need to specify explicit type.

Definition at line 134 of file Macros.h.

◆ MACRO_OVERLOAD

#define MACRO_OVERLOAD ( prefix,
... )
Value:
PREPROCESSOR_APPEND_VA_ARG_COUNT(prefix, __VA_ARGS__)(__VA_ARGS__)

Implement preprocessor function overloading based on argument count for a set of macros following a distinct convention. Individual overloads must have a trailing number corresponding to the number of arguments they accept.

For example:

#define FOO_3(a, b, c) a##b##c
#define FOO_2(a, b) a##b
#define FOO_1(a) a
#define FOO(...) MACRO_OVERLOAD(FOO_, __VA_ARGS__)
FOO(1) // -> 1
FOO(1, 2) // -> 12
FOO(1, 2, 3) // -> 123

Definition at line 71 of file Macros.h.

◆ MCRO_FORWARD_FUNCTION

#define MCRO_FORWARD_FUNCTION   Forward

Definition at line 129 of file Macros.h.

◆ MCRO_VERSION_NUM_2

#define MCRO_VERSION_NUM_2 ( major,
minor )
Value:
( ((0x000000000000FFFFULL & major) << 48) \
| ((0x000000000000FFFFULL & minor) << 32) \
)

Definition at line 76 of file Macros.h.

◆ MCRO_VERSION_NUM_3

#define MCRO_VERSION_NUM_3 ( major,
minor,
patch )
Value:
( ((0x000000000000FFFFULL & major) << 48) \
| ((0x000000000000FFFFULL & minor) << 32) \
| ((0x000000000000FFFFULL & patch) << 16) \
)

Definition at line 81 of file Macros.h.

◆ MCRO_VERSION_NUM_4

#define MCRO_VERSION_NUM_4 ( major,
minor,
patch,
rev )
Value:
( ((0x000000000000FFFFULL & major) << 48) \
| ((0x000000000000FFFFULL & minor) << 32) \
| ((0x000000000000FFFFULL & patch) << 16) \
| ((0x000000000000FFFFULL & rev) << 0) \
)

Definition at line 87 of file Macros.h.

◆ PREPROCESSOR_TO_TEXT

#define PREPROCESSOR_TO_TEXT ( x)
Value:
TEXT(PREPROCESSOR_TO_STRING(x))

Definition at line 51 of file Macros.h.

◆ UNREAL_VERSION

#define UNREAL_VERSION ( op,
... )
Value:
#define VERSION_NUM(...)
Store a semantic version in an uint64 number.
Definition Macros.h:102
#define UNREAL_VERSION_NUM
VERSION_NUM representation of current Engine version.
Definition Macros.h:105

Macro for conveniently comparing unreal version for code compile compatibility cases.

Definition at line 108 of file Macros.h.

◆ UNREAL_VERSION_NUM

#define UNREAL_VERSION_NUM   VERSION_NUM(ENGINE_MAJOR_VERSION, ENGINE_MINOR_VERSION, ENGINE_PATCH_VERSION)

VERSION_NUM representation of current Engine version.

Definition at line 105 of file Macros.h.

◆ VERSION_NUM

#define VERSION_NUM ( ...)
Value:
MACRO_OVERLOAD(MCRO_VERSION_NUM_, __VA_ARGS__)
#define MACRO_OVERLOAD(prefix,...)
Implement preprocessor function overloading based on argument count for a set of macros following a d...
Definition Macros.h:71

Store a semantic version in an uint64 number.

Parameters
major0xFFFF'0000'0000'0000ULL
minor0x0000'FFFF'0000'0000ULL
patch0x0000'0000'FFFF'0000ULL
rev0x0000'0000'0000'FFFFULL
Remarks
Each component can go up to 65535

Definition at line 102 of file Macros.h.