|
libxr
1.0
Want to be the best embedded framework
|
按编译格式 profile 特化的、按输出端类型区分的字节码执行器 / Per-sink bytecode executor specialized by the compiled format profile More...
#include <writer_executor.hpp>
Public Member Functions | |
| Executor (Sink &sink, const uint8_t *codes, const uint8_t *args) | |
| 将一个输出端、一份编译字节块和一份参数字节块绑定起来 / Bind one sink with one compiled byte blob and one packed argument blob | |
| ErrorCode | Run () |
持续执行记录流,直到遇到 FormatOp::End / Run until the compiled record stream reaches FormatOp::End | |
Private Member Functions | |
| ErrorCode | WriteRaw (std::string_view text) |
| 运行期执行器共享的字段写出原语,供所有操作码路径复用 / Executor-side field-writing primitives shared by all runtime opcodes | |
| ErrorCode | WritePadding (char fill, size_t count) |
| 向输出端写入重复填充字符 / Write repeated fill characters into the sink | |
| ErrorCode | WriteTextField (std::string_view text, const Spec &spec) |
| 按宽度与对齐策略写出一个文本字段 / Write one text field with width/alignment policy applied | |
| ErrorCode | WriteIntegerField (char sign_char, std::string_view prefix, std::string_view digits, const Spec &spec) |
| 按符号、前缀、精度与填充策略写出一个整数载荷 / Write one integer payload with sign, prefix, precision, and padding policy applied | |
| ErrorCode | WriteFloatField (char sign_char, std::string_view text, const Spec &spec) |
| 按符号与字段填充策略写出一个浮点文本载荷 / Write one float text payload with sign and field padding applied | |
| template<std::signed_integral Int> | |
| ErrorCode | WriteSigned (const Spec &spec, Int value) |
| 通过共享整数字段路径写出一个有符号整数值 / Write one signed integer value through the shared integer-field path | |
| template<FormatType Type, std::unsigned_integral UInt> | |
| ErrorCode | WriteUnsigned (const Spec &spec, UInt value) |
| 通过共享整数字段路径写出一个无符号整数语义值 / Write one unsigned integer semantic value through the shared integer-field path | |
| template<uint8_t Base, bool UpperCase = false, bool InlineAlternateOctal = false, std::unsigned_integral UInt> | |
| ErrorCode | WriteUnsignedDigits (std::string_view prefix, const Spec &spec, UInt value) |
| 按编译期进制/大小写/八进制备用格式参数复用无符号数字载荷写出逻辑 / Reuse the unsigned-digit payload writer with compile-time radix, case, and octal-alternate parameters | |
| ErrorCode | WritePointer (const Spec &spec, uintptr_t value) |
| 按规范指针字段策略写出一个指针值 / Write one pointer value using the canonical pointer field policy | |
| ErrorCode | WriteCharacter (const Spec &spec, char ch) |
| 写出一个字符字段值 / Write one character field value | |
| ErrorCode | WriteString (const Spec &spec, std::string_view text) |
| 写出一个字符串字段值,并在需要时应用精度截断 / Write one string field value, including precision truncation when present | |
| template<typename T > | |
| ErrorCode | WriteFloat (FormatType type, const Spec &spec, T value) |
| 通过共享浮点文本后端写出一个浮点语义值 / Write one float semantic value through the shared float-text backend | |
| ErrorCode | WriteU32Dec (uint32_t value) |
| 单个原始 uint32_t 十进制字段的快路径。 / Fast path for one raw uint32_t decimal field. | |
| ErrorCode | WriteU32ZeroPadWidth (uint8_t width, uint32_t value) |
| 单个零填充 uint32_t 十进制字段的快路径。 / Fast path for one zero-padded uint32_t decimal field. | |
| ErrorCode | WriteStringRaw (std::string_view text) |
| 单个原始字符串参数的快路径。 / Fast path for one raw string argument. | |
| ErrorCode | WriteF32FixedPrec (uint8_t precision, float value) |
| 单个带显式精度的定点 float 快路径。 / Fast path for one fixed float with explicit precision. | |
| ErrorCode | WriteF64FixedPrec (uint8_t precision, double value) |
| 单个带显式精度的定点 double 快路径。 / Fast path for one fixed double with explicit precision. | |
| template<std::signed_integral Int> | |
| ErrorCode | DispatchSignedField () |
运行期执行器中 GenericField 的分发桥接函数 / GenericField dispatch bridges for the runtime executor | |
| template<FormatType Type, std::unsigned_integral UInt> | |
| ErrorCode | DispatchUnsignedField () |
| 读取一个无符号载荷并转发给选定的整数语义写出路径 / Read one unsigned payload and forward it to the selected integer semantic writer | |
| template<FormatType Type, typename Float > | |
| ErrorCode | DispatchFloatField () |
| 读取一个浮点载荷并转发给选定的浮点语义写出路径 / Read one float payload and forward it to the selected float semantic writer | |
| ErrorCode | DispatchPointerField () |
| 读取一个指针载荷并走指针字段写出路径 / Read one pointer payload and write it through the pointer field path | |
| ErrorCode | DispatchCharacterField () |
| 读取一个字符载荷并走字符字段写出路径 / Read one character payload and write it through the character field path | |
| ErrorCode | DispatchStringField () |
| 读取一个字符串载荷并走字符串字段写出路径 / Read one string payload and write it through the string field path | |
| ErrorCode | DispatchGenericField (FormatType type) |
将一个 GenericField 载荷分发到对应的宽回退路径 / Dispatch one GenericField payload to the corresponding wide fallback | |
| ErrorCode | DispatchOp (FormatOp op) |
| 将一个运行期操作码分发到选中的特化路径 / Dispatch one runtime opcode to the selected specialized path | |
Static Private Member Functions | |
| template<std::signed_integral Int> | |
| static char | ResolveSignChar (Int value, const Spec &spec) |
| 执行器的具体运行期数值写出函数 / Concrete runtime value writers for the executor | |
| template<typename T > | |
| static char | ResolveFloatSignChar (T value, const Spec &spec) |
| 为一个浮点载荷确定最终可见的符号字符 / Resolve the visible sign character for one float payload | |
Private Attributes | |
| Sink & | sink_ |
| CodeReader | codes_ |
| ArgumentReader | args_ |
按编译格式 profile 特化的、按输出端类型区分的字节码执行器 / Per-sink bytecode executor specialized by the compiled format profile
Definition at line 7 of file writer_executor.hpp.
| Writer::Executor< Sink, Profile >::Executor | ( | Sink & | sink, |
| const uint8_t * | codes, | ||
| const uint8_t * | args ) |
将一个输出端、一份编译字节块和一份参数字节块绑定起来 / Bind one sink with one compiled byte blob and one packed argument blob
writer 执行器的顶层运行期操作码循环。 / Top-level runtime opcode loop for the writer executor.
| sink | 输出端 / Destination sink |
| codes | 指向编译字节块的指针 / Pointer to the compiled byte blob |
| args | 指向运行期参数打包字节块的指针;无参数时可为空 / Pointer to the packed runtime argument blob, or null when no arguments exist |
将一个输出端、码流和参数字节块绑定到当前执行器 / Bind one sink, code stream, and packed-argument blob to this executor
| sink | 输出端 / Destination sink |
| codes | 指向编译字节流的指针 / Pointer to the compiled byte stream |
| args | 指向已打包参数字节块的指针;无参数时可为空 / Pointer to the packed argument blob, or null when no arguments exist |
Definition at line 14 of file writer_executor_opcode.hpp.
|
nodiscardprivate |
读取一个字符载荷并走字符字段写出路径 / Read one character payload and write it through the character field path
Definition at line 60 of file writer_executor_generic.hpp.
|
nodiscardprivate |
读取一个浮点载荷并转发给选定的浮点语义写出路径 / Read one float payload and forward it to the selected float semantic writer
| Type | 运行期浮点语义类型 / Runtime float semantic type |
| Float | 打包浮点存储类型 / Packed float storage type |
Definition at line 40 of file writer_executor_generic.hpp.
|
nodiscardprivate |
将一个 GenericField 载荷分发到对应的宽回退路径 / Dispatch one GenericField payload to the corresponding wide fallback
将一个 GenericField 语义类型分发到具体宽回退写出路径 / Dispatch one GenericField semantic type to the concrete wide fallback writer
| type | GenericField 记录携带的语义字段类型 / Semantic field type carried by the GenericField record |
| type | 当前 GenericField 携带的运行期语义类型 / Runtime semantic type carried by this GenericField |
Definition at line 81 of file writer_executor_generic.hpp.
|
nodiscardprivate |
将一个运行期操作码分发到选中的特化路径 / Dispatch one runtime opcode to the selected specialized path
将一个顶层操作码分发到其特化运行期路径 / Dispatches one top-level opcode to its specialized runtime path.
| op | 解码后的运行期操作码 / Decoded runtime opcode |
| op | Decoded runtime opcode. / 解码后的运行期操作码。 |
Definition at line 54 of file writer_executor_opcode.hpp.
|
nodiscardprivate |
读取一个指针载荷并走指针字段写出路径 / Read one pointer payload and write it through the pointer field path
Definition at line 50 of file writer_executor_generic.hpp.
|
nodiscardprivate |
运行期执行器中 GenericField 的分发桥接函数 / GenericField dispatch bridges for the runtime executor
读取一个有符号载荷并转发给具体有符号写出路径 / Read one signed payload and forward it to the concrete signed writer
| Int | 有符号打包存储类型 / Signed packed-storage type |
Definition at line 14 of file writer_executor_generic.hpp.
|
nodiscardprivate |
读取一个字符串载荷并走字符串字段写出路径 / Read one string payload and write it through the string field path
Definition at line 70 of file writer_executor_generic.hpp.
|
nodiscardprivate |
读取一个无符号载荷并转发给选定的整数语义写出路径 / Read one unsigned payload and forward it to the selected integer semantic writer
| Type | 运行期整数语义类型 / Runtime integer semantic type |
| UInt | 无符号打包存储类型 / Unsigned packed-storage type |
Definition at line 27 of file writer_executor_generic.hpp.
|
staticnodiscardprivate |
为一个浮点载荷确定最终可见的符号字符 / Resolve the visible sign character for one float payload
| T | 浮点类型 / Float type |
| value | 当前要输出的浮点值 / Float value being emitted |
| spec | 解码后的字段规格 / Decoded field spec |
、'+'、' '或'\0'/ Returns'-','+',' ', or'\0'` Definition at line 42 of file writer_executor_value.hpp.
|
staticnodiscardprivate |
执行器的具体运行期数值写出函数 / Concrete runtime value writers for the executor
为一个有符号整数载荷确定最终可见的符号字符 / Resolve the visible sign character for one signed integer payload
| Int | 有符号整数类型 / Signed integer type |
| value | 当前要输出的整数值 / Integer value being emitted |
| spec | 解码后的字段规格 / Decoded field spec |
、'+'、' '或'\0'/ Returns'-','+',' ', or'\0'` Definition at line 16 of file writer_executor_value.hpp.
|
nodiscard |
持续执行记录流,直到遇到 FormatOp::End / Run until the compiled record stream reaches FormatOp::End
运行操作码循环,直到遇到 End 或首个 sink/运行期错误 / Runs the opcode loop until End or the first sink/runtime error.
ErrorCode::OK / Returns the first sink or runtime error, or ErrorCode::OK when the record stream finishes normallyErrorCode::OK on normal completion, or the first sink / runtime error. / 正常结束返回 ErrorCode::OK;否则返回首个 sink/运行期错误。 Definition at line 29 of file writer_executor_opcode.hpp.
|
nodiscardprivate |
写出一个字符字段值 / Write one character field value
| spec | 解码后的字段规格 / Decoded field spec |
| ch | 待写出的字符值 / Character value to write |
Definition at line 193 of file writer_executor_value.hpp.
|
nodiscardprivate |
单个带显式精度的定点 float 快路径。 / Fast path for one fixed float with explicit precision.
写出一个 float32 定点精度快路径字段 / Write one float32 fixed-precision fast-path field
| precision | 显式定点精度 / Explicit fixed precision |
| value | 待写出的浮点值 / Float value to write |
Definition at line 326 of file writer_executor_value.hpp.
|
nodiscardprivate |
单个带显式精度的定点 double 快路径。 / Fast path for one fixed double with explicit precision.
通过通用浮点写出路径写出一个 double 定点精度字段 / Write one double fixed-precision field through the generic float writer
| precision | 显式定点精度 / Explicit fixed precision |
| value | 待写出的 double 值 / Double value to write |
Definition at line 360 of file writer_executor_value.hpp.
|
nodiscardprivate |
通过共享浮点文本后端写出一个浮点语义值 / Write one float semantic value through the shared float-text backend
| T | 浮点类型 / Float type |
| type | 运行期浮点语义类型 / Runtime float semantic type |
| spec | 解码后的字段规格 / Decoded field spec |
| value | 待写出的浮点值 / Float value to write |
Definition at line 227 of file writer_executor_value.hpp.
|
nodiscardprivate |
按符号与字段填充策略写出一个浮点文本载荷 / Write one float text payload with sign and field padding applied
| sign_char | 最终可见的符号字符;无符号时为 ‘’\0'/ Visible sign character, or'\0'when absent @param text 已完成格式化的浮点文本载荷 / Already formatted float text payload @param spec 解码后的字段规格 / Decoded field spec @return 返回首个 sink 错误;成功时返回ErrorCode::OK/ Returns the first sink error, orErrorCode::OK` on success |
Definition at line 170 of file writer_executor_field.hpp.
|
nodiscardprivate |
按符号、前缀、精度与填充策略写出一个整数载荷 / Write one integer payload with sign, prefix, precision, and padding policy applied
| sign_char | 最终可见的符号字符;无符号时为 ‘’\0'/ Visible sign character, or'\0'when absent @param prefix 输出在数字前面的前缀 / Prefix emitted ahead of the digits @param digits 十进制、二进制、八进制或十六进制数字载荷 / Decimal, binary, octal, or hex digit payload @param spec 解码后的字段规格 / Decoded field spec @return 返回首个 sink 错误;成功时返回ErrorCode::OK/ Returns the first sink error, orErrorCode::OK` on success |
Definition at line 91 of file writer_executor_field.hpp.
|
nodiscardprivate |
向输出端写入重复填充字符 / Write repeated fill characters into the sink
| fill | 填充字符 / Fill character |
| count | 重复次数 / Repeat count |
ErrorCode::OK / Returns the first sink error, or ErrorCode::OK when all fill bytes are written Definition at line 25 of file writer_executor_field.hpp.
|
nodiscardprivate |
按规范指针字段策略写出一个指针值 / Write one pointer value using the canonical pointer field policy
| spec | 解码后的字段规格 / Decoded field spec |
| value | 以 uintptr_t 编码的指针值 / Pointer value encoded as uintptr_t |
Definition at line 170 of file writer_executor_value.hpp.
|
nodiscardprivate |
运行期执行器共享的字段写出原语,供所有操作码路径复用 / Executor-side field-writing primitives shared by all runtime opcodes
将一段原始文本直接写入输出端 / Write one raw text chunk directly into the sink
| text | Text chunk to write. / 待写出的文本片段。 |
Definition at line 13 of file writer_executor_field.hpp.
|
nodiscardprivate |
通过共享整数字段路径写出一个有符号整数值 / Write one signed integer value through the shared integer-field path
| Int | 有符号整数类型 / Signed integer type |
| spec | 解码后的字段规格 / Decoded field spec |
| value | 待写出的整数值 / Integer value to write |
Definition at line 68 of file writer_executor_value.hpp.
|
nodiscardprivate |
写出一个字符串字段值,并在需要时应用精度截断 / Write one string field value, including precision truncation when present
| spec | 解码后的字段规格 / Decoded field spec |
| text | 待写出的字符串载荷 / String payload to write |
Definition at line 205 of file writer_executor_value.hpp.
|
nodiscardprivate |
单个原始字符串参数的快路径。 / Fast path for one raw string argument.
写出一个原始字符串快路径字段 / Writes one raw string fast-path field.
| text | String payload to write. / 待写出的字符串载荷。 |
Definition at line 314 of file writer_executor_value.hpp.
|
nodiscardprivate |
按宽度与对齐策略写出一个文本字段 / Write one text field with width/alignment policy applied
| text | 上层归一化后的文本载荷 / Text payload after higher-level normalization |
| spec | 解码后的字段规格 / Decoded field spec |
ErrorCode::OK / Returns the first sink error, or ErrorCode::OK on success Definition at line 51 of file writer_executor_field.hpp.
|
nodiscardprivate |
单个原始 uint32_t 十进制字段的快路径。 / Fast path for one raw uint32_t decimal field.
写出一个原始 uint32 十进制快路径字段 / Writes one raw uint32 decimal fast-path field.
| value | Unsigned value to write. / 待写出的无符号值。 |
Definition at line 281 of file writer_executor_value.hpp.
|
nodiscardprivate |
单个零填充 uint32_t 十进制字段的快路径。 / Fast path for one zero-padded uint32_t decimal field.
写出一个带零填充宽度的 uint32_t 十进制快路径字段 / Write one zero-padded uint32_t decimal fast-path field
| width | 目标零填充宽度 / Target zero-padded width |
| value | 待写出的无符号值 / Unsigned value to write |
Definition at line 295 of file writer_executor_value.hpp.
|
nodiscardprivate |
通过共享整数字段路径写出一个无符号整数语义值 / Write one unsigned integer semantic value through the shared integer-field path
| Type | 运行期整数语义类型 / Runtime integer semantic type |
| UInt | 无符号整数类型 / Unsigned integer type |
| spec | 解码后的字段规格 / Decoded field spec |
| value | 待写出的整数值 / Integer value to write |
This bridge does not format digits itself; it only maps one runtime integer semantic type onto the shared compile-time radix/case helper above. 这个桥接函数本身不直接格式化数字;它只负责把运行期整数语义类型映射到上面的 编译期进制/大小写共享辅助路径。
Definition at line 135 of file writer_executor_value.hpp.
|
nodiscardprivate |
按编译期进制/大小写/八进制备用格式参数复用无符号数字载荷写出逻辑 / Reuse the unsigned-digit payload writer with compile-time radix, case, and octal-alternate parameters
通过共享整数字段路径写出一个无符号整数语义值 / Write one unsigned integer semantic value through the shared integer-field path
| Base | 整数进制 / Integer radix |
| UpperCase | 十六进制数字是否使用大写字符 / Whether hexadecimal digits should use uppercase characters |
| InlineAlternateOctal | 是否把 %#o 的前导 0 直接并入数字载荷 / Whether %#o should inline its leading 0 into the digit payload |
| UInt | 无符号整数类型 / Unsigned integer type |
| prefix | 脱离数字载荷输出的前缀 / Prefix emitted outside the digit payload |
| spec | 解码后的字段规格 / Decoded field spec |
| value | 待写出的整数值 / Integer value to write |
| Base | 整数进制 / Integer radix |
| UpperCase | 十六进制数字是否使用大写字符 / Whether hexadecimal digits should use uppercase characters |
| InlineAlternateOctal | 是否把 %#o 的前导 0 直接并入数字载荷 / Whether %#o should inline its leading 0 into the digit payload |
| UInt | 无符号整数类型 / Unsigned integer type |
| prefix | 脱离数字载荷输出的前缀 / Prefix emitted outside the digit payload |
| spec | 解码后的字段规格 / Decoded field spec |
| value | 待写出的整数值 / Integer value to write |
Definition at line 99 of file writer_executor_value.hpp.
|
private |
Definition at line 131 of file writer_executor.hpp.
|
private |
Definition at line 130 of file writer_executor.hpp.
|
private |
Definition at line 129 of file writer_executor.hpp.