libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::Print::Text< N > Struct Template Reference

作为 printf 格式源的结构化字符串字面量包装 / Structural literal wrapper used as the NTTP source for printf formats More...

#include <printf.hpp>

Public Member Functions

constexpr Text (const char(&text)[N])
 将字符串字面量复制到结构化 NTTP 对象中 / Copy the string literal into the structural NTTP object
 
constexpr size_t Size () const
 返回不含结尾零字节的格式串长度 / Return the format length without the terminating zero byte
 
constexpr const char * Data () const
 返回含结尾零字节的字面量指针 / Return the literal bytes including the terminating zero byte
 

Data Fields

char data [N] {}
 含结尾零字节的字面量字节序列 / Literal bytes including the terminating zero byte
 

Detailed Description

template<size_t N>
struct LibXR::Print::Text< N >

作为 printf 格式源的结构化字符串字面量包装 / Structural literal wrapper used as the NTTP source for printf formats

Definition at line 16 of file printf.hpp.

Constructor & Destructor Documentation

◆ Text()

template<size_t N>
LibXR::Print::Text< N >::Text ( const char(&) text[N])
inlineconstexpr

将字符串字面量复制到结构化 NTTP 对象中 / Copy the string literal into the structural NTTP object

Parameters
text原始字符串字面量 / Source string literal

Definition at line 29 of file printf.hpp.

30 {
31 for (size_t i = 0; i < N; ++i)
32 {
33 data[i] = text[i];
34 }
35 }
char data[N]
含结尾零字节的字面量字节序列 / Literal bytes including the terminating zero byte
Definition printf.hpp:22

Member Function Documentation

◆ Data()

template<size_t N>
const char * LibXR::Print::Text< N >::Data ( ) const
inlinenodiscardconstexpr

返回含结尾零字节的字面量指针 / Return the literal bytes including the terminating zero byte

Returns
指向含结尾零字节的字面量字节序列 / Returns a pointer to the literal bytes including the trailing zero byte

Definition at line 50 of file printf.hpp.

50{ return data; }

◆ Size()

template<size_t N>
size_t LibXR::Print::Text< N >::Size ( ) const
inlinenodiscardconstexpr

返回不含结尾零字节的格式串长度 / Return the format length without the terminating zero byte

Returns
不含结尾零字节的字面量长度 / Returns the literal size without the trailing zero byte

Definition at line 43 of file printf.hpp.

43{ return N - 1; }

Field Documentation

◆ data

template<size_t N>
char LibXR::Print::Text< N >::data[N] {}

含结尾零字节的字面量字节序列 / Literal bytes including the terminating zero byte

Definition at line 22 of file printf.hpp.

22{};

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