MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
TextMacros.h File Reference

Use leading TEXT_ without parenthesis for Unreal compatible text literals. More...

#include "CoreMinimal.h"
#include "Mcro/FunctionTraits.h"

Go to the source code of this file.

Namespaces

namespace  Mcro
 
namespace  Mcro::Text
 
namespace  Mcro::Text::Macros
 This namespace is used by MCRO text literal macros, don't use it directly!
 

Macros

#define UTF8TEXT_PASTE_   u8""
 
#define UTF16TEXT_PASTE_   u""
 
#define WIDETEXT_PASTE_   L""
 
#define UTF8TEXT_   UTF8TEXT_PASTE_
 
#define UTF16TEXT_   UTF16TEXT_PASTE_
 
#define WIDETEXT_   WIDETEXT_PASTE_
 
#define TEXT_PASTE_   WIDETEXT_
 
#define TEXT_   TEXT_PASTE_
 A convenience alternative to Unreal's own TEXT macro but this one doesn't require parenthesis around the text literal, relying on string literal concatenation rules of C++.
 
#define LOCTEXT_(key)
 A convenience alternative to Unreal's own LOCTEXT macro but this one doesn't require parenthesis around the text literal.
 
#define NSLOCTEXT_(ns, key)
 A convenience alternative to Unreal's own NSLOCTEXT macro but this one doesn't require parenthesis around the text literal.
 
#define INVTEXT_    Mcro::Text::Macros::FDefer_AsCultureInvariant() / TEXT_
 A convenience alternative to Unreal's own INVTEXT macro but this one doesn't require parenthesis around the text literal.
 

Typedefs

using Mcro::Text::Macros::FDefer_AsLocalizable_Advanced = TDeferFunctionArguments<&AsLocalizable_Advanced>
 
using Mcro::Text::Macros::FDefer_AsCultureInvariant = TDeferFunctionArguments<&AsCultureInvariant>
 

Functions

FORCEINLINE FText Mcro::Text::Macros::AsLocalizable_Advanced (const FTextKey &Namespace, const FTextKey &Key, const TCHAR *String)
 
FORCEINLINE FText Mcro::Text::Macros::AsCultureInvariant (const TCHAR *String)
 
template<auto FunctionPtr>
auto operator/ (Mcro::FunctionTraits::TDeferFunctionArguments< FunctionPtr > &&deferrer, const TCHAR *literal)
 

Detailed Description

Use leading TEXT_ without parenthesis for Unreal compatible text literals.

Author
David Mórász
Date
2025

Definition in file TextMacros.h.

Macro Definition Documentation

◆ INVTEXT_

A convenience alternative to Unreal's own INVTEXT macro but this one doesn't require parenthesis around the text literal.

Definition at line 91 of file TextMacros.h.

◆ LOCTEXT_

#define LOCTEXT_ ( key)
Value:
Mcro::Text::Macros::FDefer_AsLocalizable_Advanced(TEXT(LOCTEXT_NAMESPACE), TEXT(key)) / TEXT_
#define TEXT_
A convenience alternative to Unreal's own TEXT macro but this one doesn't require parenthesis around ...
Definition TextMacros.h:47
TDeferFunctionArguments<&AsLocalizable_Advanced > FDefer_AsLocalizable_Advanced
Definition TextMacros.h:58

A convenience alternative to Unreal's own LOCTEXT macro but this one doesn't require parenthesis around the text literal.

Definition at line 77 of file TextMacros.h.

◆ NSLOCTEXT_

#define NSLOCTEXT_ ( ns,
key )
Value:

A convenience alternative to Unreal's own NSLOCTEXT macro but this one doesn't require parenthesis around the text literal.

Definition at line 84 of file TextMacros.h.

◆ TEXT_

#define TEXT_   TEXT_PASTE_

A convenience alternative to Unreal's own TEXT macro but this one doesn't require parenthesis around the text literal, relying on string literal concatenation rules of C++.

Definition at line 47 of file TextMacros.h.

◆ TEXT_PASTE_

#define TEXT_PASTE_   WIDETEXT_

Definition at line 39 of file TextMacros.h.

◆ UTF16TEXT_

#define UTF16TEXT_   UTF16TEXT_PASTE_

Definition at line 33 of file TextMacros.h.

◆ UTF16TEXT_PASTE_

#define UTF16TEXT_PASTE_   u""

Definition at line 24 of file TextMacros.h.

◆ UTF8TEXT_

#define UTF8TEXT_   UTF8TEXT_PASTE_

Definition at line 32 of file TextMacros.h.

◆ UTF8TEXT_PASTE_

#define UTF8TEXT_PASTE_   u8""

Definition at line 23 of file TextMacros.h.

◆ WIDETEXT_

#define WIDETEXT_   WIDETEXT_PASTE_

Definition at line 34 of file TextMacros.h.

◆ WIDETEXT_PASTE_

#define WIDETEXT_PASTE_   L""

Definition at line 29 of file TextMacros.h.

Function Documentation

◆ operator/()

template<auto FunctionPtr>
auto operator/ ( Mcro::FunctionTraits::TDeferFunctionArguments< FunctionPtr > && deferrer,
const TCHAR * literal )

Definition at line 68 of file TextMacros.h.