43template <Pr
int::Text Source>
46 for (
size_t i = 0; i < Source.Size(); ++i)
48 if (Source.data[i] ==
'{' || Source.data[i] ==
'}')
60template <Pr
int::Text Source>
63 for (
size_t i = 0; i < Source.Size(); ++i)
65 if (Source.data[i] ==
'%')
77template <Pr
int::Text Source>
80 return Print::Detail::FormatFrontend::Analyze<Source>().error ==
81 Print::Detail::FormatFrontend::Error::None;
88template <Pr
int::Text Source>
91 return Print::Detail::PrintfCompile::Analyze<Source>().error ==
92 Print::Printf::Error::None;
106template <Print::Text Source,
typename... Args>
124template <Print::Text Source,
typename... Args>
133 return Print::Printf::template Matches<Source, Args...>();
142template <
Frontend Forced, Print::Text Source,
typename... Args>
145 constexpr bool format_match =
FormatMatches<Source, Args...>();
146 constexpr bool printf_match =
PrintfMatches<Source, Args...>();
156 else if constexpr (format_match && !printf_match)
160 else if constexpr (!format_match && printf_match)
164 else if constexpr (!format_match && !printf_match)
173 if constexpr (format_uses_syntax && !printf_uses_syntax)
177 else if constexpr (!format_uses_syntax && printf_uses_syntax)
181 else if constexpr (!format_uses_syntax && !printf_uses_syntax)
197template <
Frontend Forced, Print::Text Source,
typename... Args>
200 constexpr auto resolution =
ResolveFrontend<Forced, Source, Args...>();
206 "LibXR::Logger: XR_FMT(...) literal is not accepted by the brace frontend");
213 "LibXR::Logger: XR_PRINTF(...) literal is not accepted by the printf frontend");
227 "LibXR::Logger: literal is ambiguous between brace and printf "
228 "frontends; use XR_FMT(...) or XR_PRINTF(...)");
234 "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.
@ 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.