libxr
Embedded C++ framework for bare-metal, RTOS and Linux
Loading...
Searching...
No Matches
Conversion Struct Reference

单个 printf 转换在降为共享格式前的解析结果 / One parsed printf conversion before lowering into the shared format More...

#include <printf_frontend_spec.hpp>

Public Member Functions

constexpr uint8_t FlagsByte () const
 将前端解析出的标志位打包成共享的 FormatFlag 字节 / Pack the parsed frontend flags into the shared FormatFlag byte
 
constexpr uint8_t PrecisionByte () const
 返回共享精度字节;若未显式指定精度则为 0xFF / Return the shared precision byte, or 0xFF when precision is absent
 

Public Attributes

size_t arg_index
 当前字段消耗的源参数索引 / source argument index consumed by this field
 
ValueKind type
 转换项归一化后的语义类别 / semantic conversion category
 
Length length = Length::Default
 已解析的长度修饰符 / parsed length modifier
 
bool left_align = false
 已解析的 - 标志 / parsed - flag
 
bool force_sign = false
 已解析的 + 标志 / parsed + flag
 
bool space_sign = false
 已解析的空格正号标志 / parsed space-sign flag
 
bool alternate = false
 已解析的 # 标志 / parsed # flag
 
bool zero_pad = false
 已解析的 0 标志 / parsed 0 flag
 
bool upper_case = false
 隐含的大写输出标志 / implied uppercase output
 
bool positional
 arg_index 是否来自 n$ 语法 / whether arg_index came from n$ syntax
 
uint8_t width = 0
 已解析的字段宽度 / parsed field width
 
bool has_precision
 是否显式提供了精度 / whether precision was explicitly provided
 
uint8_t precision = 0
 已解析的精度值 / parsed precision value
 

Detailed Description

单个 printf 转换在降为共享格式前的解析结果 / One parsed printf conversion before lowering into the shared format

Definition at line 34 of file printf_frontend_spec.hpp.

Member Function Documentation

◆ FlagsByte()

uint8_t Conversion::FlagsByte ( ) const
inlinenodiscardconstexpr

将前端解析出的标志位打包成共享的 FormatFlag 字节 / Pack the parsed frontend flags into the shared FormatFlag byte

Returns
返回打包后的共享 FormatFlag 字节 / Returns the packed shared FormatFlag byte

Definition at line 60 of file printf_frontend_spec.hpp.

61 {
62 uint8_t flags = 0;
63 if (left_align)
64 {
65 flags |= static_cast<uint8_t>(FormatFlag::LeftAlign);
66 }
67 if (force_sign)
68 {
69 flags |= static_cast<uint8_t>(FormatFlag::ForceSign);
70 }
71 if (space_sign)
72 {
73 flags |= static_cast<uint8_t>(FormatFlag::SpaceSign);
74 }
75 if (alternate)
76 {
77 flags |= static_cast<uint8_t>(FormatFlag::Alternate);
78 }
79 if (zero_pad)
80 {
81 flags |= static_cast<uint8_t>(FormatFlag::ZeroPad);
82 }
83 if (upper_case)
84 {
85 flags |= static_cast<uint8_t>(FormatFlag::UpperCase);
86 }
87 return flags;
88 }
bool upper_case
隐含的大写输出标志 / implied uppercase output
bool left_align
已解析的 - 标志 / parsed - flag
bool force_sign
已解析的 + 标志 / parsed + flag
bool zero_pad
已解析的 0 标志 / parsed 0 flag
bool space_sign
已解析的空格正号标志 / parsed space-sign flag
bool alternate
已解析的 # 标志 / parsed # flag

◆ PrecisionByte()

uint8_t Conversion::PrecisionByte ( ) const
inlinenodiscardconstexpr

返回共享精度字节;若未显式指定精度则为 0xFF / Return the shared precision byte, or 0xFF when precision is absent

Returns
返回运行期协议期望的共享精度字节 / Returns the shared precision byte expected by the runtime protocol

Definition at line 96 of file printf_frontend_spec.hpp.

97 {
98 return has_precision ? precision : std::numeric_limits<uint8_t>::max();
99 }
uint8_t precision
已解析的精度值 / parsed precision value
bool has_precision
是否显式提供了精度 / whether precision was explicitly provided

Member Data Documentation

◆ alternate

bool Conversion::alternate = false

已解析的 # 标志 / parsed # flag

Definition at line 44 of file printf_frontend_spec.hpp.

◆ arg_index

size_t Conversion::arg_index
Initial value:
=
0

当前字段消耗的源参数索引 / source argument index consumed by this field

Definition at line 36 of file printf_frontend_spec.hpp.

◆ force_sign

bool Conversion::force_sign = false

已解析的 + 标志 / parsed + flag

Definition at line 42 of file printf_frontend_spec.hpp.

◆ has_precision

bool Conversion::has_precision
Initial value:
=
false

是否显式提供了精度 / whether precision was explicitly provided

Definition at line 50 of file printf_frontend_spec.hpp.

◆ left_align

bool Conversion::left_align = false

已解析的 - 标志 / parsed - flag

Definition at line 41 of file printf_frontend_spec.hpp.

◆ length

Length Conversion::length = Length::Default

已解析的长度修饰符 / parsed length modifier

Definition at line 40 of file printf_frontend_spec.hpp.

◆ positional

bool Conversion::positional
Initial value:
=
false

arg_index 是否来自 n$ 语法 / whether arg_index came from n$ syntax

Definition at line 47 of file printf_frontend_spec.hpp.

◆ precision

uint8_t Conversion::precision = 0

已解析的精度值 / parsed precision value

Definition at line 52 of file printf_frontend_spec.hpp.

◆ space_sign

bool Conversion::space_sign = false

已解析的空格正号标志 / parsed space-sign flag

Definition at line 43 of file printf_frontend_spec.hpp.

◆ type

ValueKind Conversion::type
Initial value:
=
ValueKind::None

转换项归一化后的语义类别 / semantic conversion category

Definition at line 38 of file printf_frontend_spec.hpp.

◆ upper_case

bool Conversion::upper_case = false

隐含的大写输出标志 / implied uppercase output

Definition at line 46 of file printf_frontend_spec.hpp.

◆ width

uint8_t Conversion::width = 0

已解析的字段宽度 / parsed field width

Definition at line 49 of file printf_frontend_spec.hpp.

◆ zero_pad

bool Conversion::zero_pad = false

已解析的 0 标志 / parsed 0 flag

Definition at line 45 of file printf_frontend_spec.hpp.


The documentation for this struct was generated from the following file: