libxr  1.0
Want to be the best embedded framework
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
 

Data Fields

size_t arg_index = 0
 source argument index consumed by this field / 当前字段消耗的源参数索引
 
ValueKind type = ValueKind::None
 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
 parsed 0 flag / 已解析的 0 标志
 
bool upper_case = false
 implied uppercase output / 隐含的大写输出标志
 
bool positional = false
 whether arg_index came from n$ syntax / arg_index 是否来自 n$ 语法
 
uint8_t width = 0
 parsed field width / 已解析的字段宽度
 
bool has_precision = false
 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 32 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 52 of file printf_frontend_spec.hpp.

53 {
54 uint8_t flags = 0;
55 if (left_align)
56 {
57 flags |= static_cast<uint8_t>(FormatFlag::LeftAlign);
58 }
59 if (force_sign)
60 {
61 flags |= static_cast<uint8_t>(FormatFlag::ForceSign);
62 }
63 if (space_sign)
64 {
65 flags |= static_cast<uint8_t>(FormatFlag::SpaceSign);
66 }
67 if (alternate)
68 {
69 flags |= static_cast<uint8_t>(FormatFlag::Alternate);
70 }
71 if (zero_pad)
72 {
73 flags |= static_cast<uint8_t>(FormatFlag::ZeroPad);
74 }
75 if (upper_case)
76 {
77 flags |= static_cast<uint8_t>(FormatFlag::UpperCase);
78 }
79 return flags;
80 }
bool upper_case
implied uppercase output / 隐含的大写输出标志
bool left_align
parsed - flag / 已解析的 - 标志
bool force_sign
parsed + flag / 已解析的 + 标志
bool zero_pad
parsed 0 flag / 已解析的 0 标志
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 86 of file printf_frontend_spec.hpp.

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

Field Documentation

◆ alternate

bool Conversion::alternate = false

parsed # flag / 已解析的 # 标志

Definition at line 40 of file printf_frontend_spec.hpp.

◆ arg_index

size_t Conversion::arg_index = 0

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

Definition at line 34 of file printf_frontend_spec.hpp.

◆ force_sign

bool Conversion::force_sign = false

parsed + flag / 已解析的 + 标志

Definition at line 38 of file printf_frontend_spec.hpp.

◆ has_precision

bool Conversion::has_precision = false

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

Definition at line 45 of file printf_frontend_spec.hpp.

◆ left_align

bool Conversion::left_align = false

parsed - flag / 已解析的 - 标志

Definition at line 37 of file printf_frontend_spec.hpp.

◆ length

Length Conversion::length = Length::Default

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

Definition at line 36 of file printf_frontend_spec.hpp.

◆ positional

bool Conversion::positional = false

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

Definition at line 43 of file printf_frontend_spec.hpp.

◆ precision

uint8_t Conversion::precision = 0

parsed precision value / 已解析的精度值

Definition at line 46 of file printf_frontend_spec.hpp.

◆ space_sign

bool Conversion::space_sign = false

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

Definition at line 39 of file printf_frontend_spec.hpp.

◆ type

ValueKind Conversion::type = ValueKind::None

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

Definition at line 35 of file printf_frontend_spec.hpp.

◆ upper_case

bool Conversion::upper_case = false

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

Definition at line 42 of file printf_frontend_spec.hpp.

◆ width

uint8_t Conversion::width = 0

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

Definition at line 44 of file printf_frontend_spec.hpp.

◆ zero_pad

bool Conversion::zero_pad = false

parsed 0 flag / 已解析的 0 标志

Definition at line 41 of file printf_frontend_spec.hpp.


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