libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::Print::Printf::Compiler< Source > Class Template Reference

单个 printf 源字符串的编译期前端,负责解析并降为共享格式语义 / Compile-time printf frontend that parses and lowers one source string More...

#include <printf_frontend_detail.hpp>

Public Types

using ErrorType = Printf::Error
 

Static Public Member Functions

static constexpr const char * SourceData ()
 返回去掉结尾零字节后的源字符串数据 / Return the underlying source bytes without the terminating zero byte
 
static constexpr size_t SourceSize ()
 返回去掉结尾零字节后的源字符串长度 / Return the source length without the terminating zero byte
 
static consteval ErrorType Walk (auto &visitor)
 按源串顺序遍历这条字面量,并产出文本片段和最终字段记录 / Walk the literal in source order and emit text spans plus final field records
 

Detailed Description

template<Text Source>
class LibXR::Print::Printf::Compiler< Source >

单个 printf 源字符串的编译期前端,负责解析并降为共享格式语义 / Compile-time printf frontend that parses and lowers one source string

Template Parameters
Sourceprintf 风格格式串字面量 / Printf-style format literal

Definition at line 82 of file printf_frontend_detail.hpp.

Member Typedef Documentation

◆ ErrorType

template<Text Source>
using LibXR::Print::Printf::Compiler< Source >::ErrorType = Printf::Error

Definition at line 85 of file printf_frontend_detail.hpp.

Member Function Documentation

◆ SourceData()

template<Text Source>
static constexpr const char * LibXR::Print::Printf::Compiler< Source >::SourceData ( )
inlinestaticnodiscardconstexpr

返回去掉结尾零字节后的源字符串数据 / Return the underlying source bytes without the terminating zero byte

Returns
指向当前格式字面量正文的指针 / Returns a pointer to the literal body

Definition at line 92 of file printf_frontend_detail.hpp.

92{ return Source.Data(); }

◆ SourceSize()

template<Text Source>
static constexpr size_t LibXR::Print::Printf::Compiler< Source >::SourceSize ( )
inlinestaticnodiscardconstexpr

返回去掉结尾零字节后的源字符串长度 / Return the source length without the terminating zero byte

Returns
当前格式字面量正文长度 / Returns the literal-body size

Definition at line 98 of file printf_frontend_detail.hpp.

98{ return Source.Size(); }

◆ Walk()

template<Text Source>
static consteval ErrorType LibXR::Print::Printf::Compiler< Source >::Walk ( auto & visitor)
inlinestaticnodiscardconsteval

按源串顺序遍历这条字面量,并产出文本片段和最终字段记录 / Walk the literal in source order and emit text spans plus final field records

Parameters
visitor接收文本片段与最终字段记录的 visitor / Visitor receiving text spans and final field records
Returns
首个源级解析错误或字段选择错误;成功时返回 Error::None / Returns the first source-level parse or field-selection error; returns Error::None on success

Definition at line 108 of file printf_frontend_detail.hpp.

109 {
110 return Detail::PrintfCompile::WalkSourceAsFormatFields<Source>(visitor);
111 }

The documentation for this class was generated from the following files: