UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Message.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "Core/Chrono.h"
5#include "Core/Types.h"
6#include "UI/Progress.h"
7
8namespace UE::CADKernel
9{
10extern const char* VerboseLevelConstNames[];
11extern const char* VerboseConstDescHelp[];
12
13
15{
16 friend class FProgressManager;
17
18private:
19 static int32 NumberOfIndentation;
20 static int32 OldPercent;
21
22 static void VPrintf(EVerboseLevel Level, const TCHAR* Text, ...);
23
24 static void VReportPrintF(FString Header, const TCHAR* Text, ...);
25
26public:
27
28 template <typename FmtType, typename... Types>
29 static void Printf(EVerboseLevel Level, const FmtType& Text, Types... Args)
30 {
31 static_assert((TIsValidVariadicFunctionArg<Types>::Value && ...), "Invalid argument(s) passed to FString::Printf");
32 VPrintf(Level, Text, Args...);
33 }
34
35 template <typename FmtType, typename... Types>
36 static void Error(const FmtType& Text, Types... Args)
37 {
38 static_assert((TIsValidVariadicFunctionArg<Types>::Value && ...), "Invalid argument(s) passed to FString::Printf");
39 FString CompleteText = TEXT("ERROR: ");
41 VPrintf(Log, *CompleteText, Args...);
42 }
43
44 template <typename FmtType, typename... Types>
45 static void Warning(const FmtType& Text, Types... Args)
46 {
47 static_assert((TIsValidVariadicFunctionArg<Types>::Value && ...), "Invalid argument(s) passed to FString::Printf");
48 FString CompleteText = TEXT("WARNING: ");
50 VPrintf(Log, *CompleteText, Args...);
51 }
52
53 template <typename FmtType, typename... Types>
54 static void FillReportFile(const FmtType Header, const FmtType Text, Types... Args)
55 {
56 static_assert((TIsValidVariadicFunctionArg<Types>::Value && ...), "Invalid argument(s) passed to FString::Printf");
57 VReportPrintF(Header, Text, Args...);
58 }
59
61 {
62#ifdef CADKERNEL_DEV
63 int64 Time = FChrono::ConvertInto<std::chrono::microseconds>(Duration);
64#else
66#endif
67 VReportPrintF(Header, TEXT("%lld"), Time);
68 }
69
70 static void FillReportFile(const TCHAR* Header, double Count)
71 {
72 VReportPrintF(Header, TEXT("%f"), Count);
73 }
74
75 static void FillReportFile(const TCHAR* Header, int32 Count)
76 {
77 VReportPrintF(Header, TEXT("%d"), Count);
78 }
79
80 static void Indent(int32 InNumberOfIndent = 1)
81 {
82 NumberOfIndentation += InNumberOfIndent;
83 }
84
86 {
87 NumberOfIndentation -= InNumberOfIndent;
88 if (NumberOfIndentation < 0)
89 {
90 NumberOfIndentation = 0;
91 }
92 }
93
94};
95} // namespace UE::CADKernel
96
97#define ERROR_FUNCTION_CALL_NOT_EXPECTED \
98{ \
99 FMessage::Printf(Log, TEXT("CALL of \" %s \" NOT EXPECTED at line %d of the file %s\n"), __func__, __LINE__, __FILE__); \
100}
101
102#define ERROR_NOT_EXPECTED \
103{ \
104 FMessage::Printf(Log, TEXT("Error not expected in \" %S \" at line %d of the file %S\n"), __func__, __LINE__, __FILE__); \
105}
106
107#define NOT_IMPLEMENTED \
108{ \
109 FMessage::Printf(Log, TEXT("The function \" %s \" at line %d of the file %s is not implemented"), __func__, __LINE__, __FILE__); \
110}
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition Message.h:15
static void Error(const FmtType &Text, Types... Args)
Definition Message.h:36
static void Printf(EVerboseLevel Level, const FmtType &Text, Types... Args)
Definition Message.h:29
static void Indent(int32 InNumberOfIndent=1)
Definition Message.h:80
static void FillReportFile(const FmtType Header, const FmtType Text, Types... Args)
Definition Message.h:54
static void Warning(const FmtType &Text, Types... Args)
Definition Message.h:45
static void FillReportFile(const TCHAR *Header, FDuration Duration)
Definition Message.h:60
static void FillReportFile(const TCHAR *Header, int32 Count)
Definition Message.h:75
static void Deindent(int32 InNumberOfIndent=1)
Definition Message.h:85
static void FillReportFile(const TCHAR *Header, double Count)
Definition Message.h:70
Definition Progress.h:12
Definition CADEntity.cpp:23
uint64 FDuration
Definition Chrono.h:27
const char * VerboseConstDescHelp[]
Definition Message.cpp:22
const char * VerboseLevelConstNames[]
Definition Message.cpp:14
EVerboseLevel
Definition Types.h:104
Definition IsValidVariadicFunctionArg.h:14