42template <Pr
int::Text Source>
45 for (
size_t i = 0; i < Source.Size(); ++i)
47 if (Source.data[i] ==
'{' || Source.data[i] ==
'}')
59template <Pr
int::Text Source>
62 for (
size_t i = 0; i < Source.Size(); ++i)
64 if (Source.data[i] ==
'%')
76template <Pr
int::Text Source>
79 return Print::Detail::FormatFrontend::Analyze<Source>().error ==
80 Print::Detail::FormatFrontend::Error::None;
87template <Pr
int::Text Source>
90 return Print::Detail::PrintfCompile::Analyze<Source>().error ==
91 Print::Printf::Error::None;
105template <Print::Text Source,
typename... Args>
123template <Print::Text Source,
typename... Args>
132 return Print::Printf::template Matches<Source, Args...>();
141template <
Frontend Forced, Print::Text Source,
typename... Args>
144 constexpr bool format_match =
FormatMatches<Source, Args...>();
145 constexpr bool printf_match =
PrintfMatches<Source, Args...>();
155 else if constexpr (format_match && !printf_match)
159 else if constexpr (!format_match && printf_match)
163 else if constexpr (!format_match && !printf_match)
172 if constexpr (format_uses_syntax && !printf_uses_syntax)
176 else if constexpr (!format_uses_syntax && printf_uses_syntax)
180 else if constexpr (!format_uses_syntax && !printf_uses_syntax)
196template <
Frontend Forced, Print::Text Source,
typename... Args>
199 constexpr auto resolution =
ResolveFrontend<Forced, Source, Args...>();
204 "LibXR::Logger: XR_FMT(...) literal is not accepted by the brace frontend");
211 "LibXR::Logger: XR_PRINTF(...) literal is not accepted by the printf frontend");
225 "LibXR::Logger: literal is ambiguous between brace and printf frontends; use XR_FMT(...) or XR_PRINTF(...)");
231 "LibXR::Logger: literal matches neither brace nor printf frontend");
Logger 的字面量前端选择片段 Literal-frontend selection fragment of Logger
consteval bool UsesPrintfSyntax()
Returns whether one valid printf literal actually uses printf syntax.
consteval Resolution ResolveFrontend()
Selects the logger frontend for one literal plus one concrete argument list.
Frontend
Logger literal frontend selection mode.
@ Auto
select brace or printf automatically / 自动选择 brace 或 printf
@ Format
force brace-style frontend / 强制使用 brace 风格前端
@ Printf
force printf-style frontend / 强制使用 printf 风格前端
consteval bool FormatSourceValid()
Returns whether one brace-style source is source-level valid.
consteval bool FormatMatches()
Returns whether one argument list is accepted by the brace frontend, guarded by source-level validity...
consteval bool PrintfMatches()
Returns whether one argument list is accepted by the printf frontend, guarded by source-level validit...
consteval bool UsesFormatSyntax()
Returns whether one valid brace literal actually uses brace syntax.
Resolution
Result of resolving one logger literal against the available frontends.
@ Ambiguous
both frontends remain valid and both syntaxes are used / 两个前端都可用且都真的使用了自己的语法
@ Format
select brace-style frontend / 选择 brace 风格前端
@ None
matches neither frontend / 两个前端都不匹配
@ Printf
select printf-style frontend / 选择 printf 风格前端
consteval Frontend SelectFrontend()
Selects the final logger frontend after validating the resolution result.
consteval bool PrintfSourceValid()
Returns whether one printf-style source is source-level valid.