|
libxr
Embedded C++ framework for bare-metal, RTOS and Linux
|
运行期构造、长期保留的 NUL 结尾字符串视图。 Runtime-built retained NUL-terminated string view. More...
#include <libxr_string.hpp>
Public Member Functions | |
| constexpr | RuntimeStringView ()=default |
| 构造一个空的有效视图 / Constructs an empty valid view. | |
| RuntimeStringView (const RuntimeStringView &)=delete | |
| RuntimeStringView & | operator= (const RuntimeStringView &)=delete |
| RuntimeStringView (RuntimeStringView &&other) noexcept | |
| 移动构造并接管保留存储句柄 / Move-constructs by taking the retained storage handle. | |
| RuntimeStringView & | operator= (RuntimeStringView &&)=delete |
| RuntimeStringView (std::string_view text) | |
| 拷贝文本到保留存储 / Copies text into retained storage. | |
| template<size_t N> requires (Source.Size() == 0 && sizeof...(Args) == 0) | |
| RuntimeStringView (char(&text)[N]) | |
| 按文本语义拷贝一个有界可变字符数组 / Copies one bounded mutable char array as text. | |
| template<size_t N> requires (Source.Size() == 0 && sizeof...(Args) == 0) | |
| RuntimeStringView (const char(&text)[N]) | |
| 按文本语义拷贝一个有界只读字符数组 / Copies one bounded const char array as text. | |
| template<typename CharPtr > requires (Source.Size() == 0 && sizeof...(Args) == 0 && (std::is_same_v<CharPtr, char*> || std::is_same_v<CharPtr, const char*>)) | |
| RuntimeStringView (CharPtr text) | |
| RuntimeStringView (std::nullptr_t text) | |
| template<typename First , typename Second , typename... Rest> requires (Source.Size() == 0 && sizeof...(Args) == 0) | |
| RuntimeStringView (First &&first, Second &&second, Rest &&... rest) | |
| 拼接多个文本片段到保留存储 / Concatenates text parts into retained storage. | |
| template<typename... CallArgs> requires ((Source.Size() != 0 || sizeof...(Args) != 0) && Detail::RuntimeStringArgumentTypes<Args...>::template matches<CallArgs...>) | |
| ErrorCode | Reformat (CallArgs &&... args) |
| 使用绑定的 brace-style 格式重写当前内容。 Rewrite current content with the bound brace-style format. | |
| template<typename... CallArgs> requires ((Source.Size() != 0 || sizeof...(Args) != 0) && Detail::RuntimeStringArgumentTypes<Args...>::template matches<CallArgs...>) | |
| ErrorCode | Reprintf (CallArgs &&... args) |
| 使用绑定的 printf-style 格式重写当前内容。 Rewrite current content with the bound printf-style format. | |
| constexpr std::string_view | View () const |
| 返回当前只读视图 / Returns the current read-only view. | |
| const char * | CStr () const |
| 返回 NUL 结尾 C 字符串 / Returns a NUL-terminated C string. | |
| constexpr size_t | Size () const |
| 返回不含结尾 NUL 的文本长度 / Returns the text size excluding the trailing NUL. | |
| constexpr bool | Empty () const |
| 返回当前可见文本是否为空 / Returns whether the current visible text is empty. | |
| constexpr ErrorCode | Status () const |
| 返回最近一次操作状态 / Returns the latest operation status. | |
| constexpr | operator std::string_view () const |
| 转换为只读字符串视图 / Converts to a read-only string view. | |
| operator const char * () const | |
| 转换为 NUL 结尾 C 字符串 / Converts to a NUL-terminated C string. | |
运行期构造、长期保留的 NUL 结尾字符串视图。 Runtime-built retained NUL-terminated string view.
文本构造用于模块名、topic 名、后缀拼接等只构造一次的名字。 格式化构造绑定字面量和参数类型,第一次 Reformat() / Reprintf() 前从编译后的格式元数据计算最大容量,之后只复用该容量。对象析构时 不释放已分配存储。
Text construction is for retained names such as module names and topic suffixes. Formatted instances bind the literal and argument types, compute maximum capacity from compiled format metadata before the first rewrite, then reuse that capacity. Allocated storage is intentionally not released by the object destructor.
Definition at line 250 of file libxr_string.hpp.
|
inlinenoexcept |
移动构造并接管保留存储句柄 / Move-constructs by taking the retained storage handle.
Definition at line 269 of file libxr_string.hpp.
|
inlineexplicit |
拷贝文本到保留存储 / Copies text into retained storage.
Definition at line 284 of file libxr_string.hpp.
|
inlineexplicit |
按文本语义拷贝一个有界可变字符数组 / Copies one bounded mutable char array as text.
Definition at line 292 of file libxr_string.hpp.
|
inlineexplicit |
按文本语义拷贝一个有界只读字符数组 / Copies one bounded const char array as text.
Definition at line 300 of file libxr_string.hpp.
|
inlineexplicit |
拷贝 NUL 结尾 C 字符串指针到保留存储。 Copies a NUL-terminated C-string pointer into retained storage.
Definition at line 311 of file libxr_string.hpp.
|
inlineexplicit |
保留裸 nullptr 入口以维持运行期空指针检查语义。 Preserves the old bare-nullptr entry for runtime null checks.
Definition at line 318 of file libxr_string.hpp.
|
inlineexplicit |
拼接多个文本片段到保留存储 / Concatenates text parts into retained storage.
Definition at line 326 of file libxr_string.hpp.
|
inlinenodiscard |
返回 NUL 结尾 C 字符串 / Returns a NUL-terminated C string.
Definition at line 389 of file libxr_string.hpp.
|
inlinenodiscardconstexpr |
返回当前可见文本是否为空 / Returns whether the current visible text is empty.
Definition at line 393 of file libxr_string.hpp.
|
inlinenodiscard |
转换为 NUL 结尾 C 字符串 / Converts to a NUL-terminated C string.
Definition at line 399 of file libxr_string.hpp.
|
inlinenodiscardconstexpr |
转换为只读字符串视图 / Converts to a read-only string view.
Definition at line 397 of file libxr_string.hpp.
|
inlinenodiscard |
使用绑定的 brace-style 格式重写当前内容。 Rewrite current content with the bound brace-style format.
Definition at line 339 of file libxr_string.hpp.
|
inlinenodiscard |
使用绑定的 printf-style 格式重写当前内容。 Rewrite current content with the bound printf-style format.
Definition at line 363 of file libxr_string.hpp.
|
inlinenodiscardconstexpr |
返回不含结尾 NUL 的文本长度 / Returns the text size excluding the trailing NUL.
Definition at line 391 of file libxr_string.hpp.
|
inlinenodiscardconstexpr |
返回最近一次操作状态 / Returns the latest operation status.
Definition at line 395 of file libxr_string.hpp.
|
inlinenodiscardconstexpr |
返回当前只读视图 / Returns the current read-only view.
Definition at line 383 of file libxr_string.hpp.