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

Data Structures

struct  Compiled
 One brace-style source bound to a concrete call-site argument list. More...
 

Public Types

using Error = Print::Detail::FormatFrontend::Error
 Public brace-style compile-time failure categories.
 
template<typename... Args>
using Compiler = Print::Detail::FormatFrontend::Compiler<Source, Args...>
 Frontend adapter bound to one concrete C++ argument list.
 

Public Member Functions

template<Print::OutputSink Sink, typename... Args>
ErrorCode WriteTo (Sink &sink, Args &&... args) const
 Writes this format into one sink and returns only the sink status. / 将当前格式写入一个输出端,并且只返回 sink 状态
 

Static Public Member Functions

static constexpr size_t ArgumentCount ()
 Returns the required call-site argument count addressed by this source. / 返回当前源串会寻址的调用点参数个数
 
template<typename... Args>
static consteval bool Matches ()
 Returns true when Args... are accepted by this brace frontend. / 判断 Args... 是否能被当前 brace 前端接受
 

Private Types

using SourceError = Print::Detail::FormatFrontend::Error
 

Static Private Attributes

static constexpr auto source_analysis
 

Detailed Description

template<Print::Text Source>
class LibXR::Format< Source >

Definition at line 14 of file format_surface.hpp.

Member Typedef Documentation

◆ Compiler

template<Print::Text Source>
template<typename... Args>
using LibXR::Format< Source >::Compiler = Print::Detail::FormatFrontend::Compiler<Source, Args...>

Frontend adapter bound to one concrete C++ argument list.

绑定到一组具体 C++ 参数类型上的前端适配器。

Definition at line 54 of file format_surface.hpp.

◆ Error

template<Print::Text Source>
using LibXR::Format< Source >::Error = Print::Detail::FormatFrontend::Error

Public brace-style compile-time failure categories.

面向用户的 brace 风格编译期失败类别。

Definition at line 47 of file format_surface.hpp.

◆ SourceError

template<Print::Text Source>
using LibXR::Format< Source >::SourceError = Print::Detail::FormatFrontend::Error
private

Definition at line 17 of file format_surface.hpp.

Member Function Documentation

◆ ArgumentCount()

template<Print::Text Source>
static constexpr size_t LibXR::Format< Source >::ArgumentCount ( )
inlinestaticnodiscardconstexpr

Returns the required call-site argument count addressed by this source. / 返回当前源串会寻址的调用点参数个数

Definition at line 142 of file format_surface.hpp.

143 {
144 return source_analysis.required_argument_count;
145 }

◆ Matches()

template<Print::Text Source>
template<typename... Args>
static consteval bool LibXR::Format< Source >::Matches ( )
inlinestaticnodiscardconsteval

Returns true when Args... are accepted by this brace frontend. / 判断 Args... 是否能被当前 brace 前端接受

Definition at line 149 of file format_surface.hpp.

150 {
151 if constexpr (sizeof...(Args) != source_analysis.required_argument_count)
152 {
153 return false;
154 }
155 else
156 {
157 using Frontend = Compiler<std::remove_cvref_t<Args>...>;
158 return Print::FormatCompiler<Frontend>::Compile().compile_error == Error::None;
159 }
160 }
Print::Detail::FormatFrontend::Compiler< Source, Args... > Compiler
Frontend adapter bound to one concrete C++ argument list.
static consteval auto Compile()
Compiles the frontend into one final compiled format.

◆ WriteTo()

template<Print::Text Source>
template<Print::OutputSink Sink, typename... Args>
ErrorCode LibXR::Format< Source >::WriteTo ( Sink & sink,
Args &&... args ) const
inlinenodiscard

Writes this format into one sink and returns only the sink status. / 将当前格式写入一个输出端,并且只返回 sink 状态

Definition at line 164 of file format_surface.hpp.

165 {
166 using Built = Compiled<std::remove_cvref_t<Args>...>;
167 return Print::Writer::template RunArgumentOrder<Sink, Built, Built::ArgumentOrder()>(
168 sink, Built{}, std::forward<Args>(args)...);
169 }

Field Documentation

◆ source_analysis

template<Print::Text Source>
auto LibXR::Format< Source >::source_analysis
inlinestaticconstexprprivate
Initial value:
=
Print::Detail::FormatFrontend::Analyze<Source>()

Definition at line 18 of file format_surface.hpp.


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