字串格式化類別,提供格式化輸入與輸出的相關方法
更多...
#include <StringFormat.h>
|
static int | pointerVa (void *buffer, size_t bufferSize, const char *format, va_list args) |
| 使用 va_list 參數格式化字串到緩衝區
|
|
static int | memoryVa (const ufm::lang::Memory &memory, const char *format, va_list args) |
| 使用 va_list 參數格式化字串到 Memory 物件
|
|
static int | writeBufferVa (ufm::lang::Appendable &appendable, const char *format, va_list args) |
| 使用 va_list 參數格式化字串並寫入 Appendable
|
|
static int | pointer (void *buffer, uint32 bufferSize, const char *format,...) |
| 使用格式化字串和可變參數寫入緩衝區
|
|
static int | memory (const ufm::lang::Memory &memory, const char *format,...) |
| 使用格式化字串和可變參數寫入 Memory
|
|
static int | writeBuffer (ufm::lang::Appendable &appendable, const char *format,...) |
| 使用格式化字串和可變參數寫入 Appendable
|
|
static int | scanVa (const char *src, const char *format, va_list args) |
| 使用 va_list 參數從字串中掃描資料
|
|
static int | scan (const char *src, const char *format,...) |
| 使用可變參數從字串中掃描資料
|
|
static int | size (const char *src) |
| 計算 C 字串長度
|
|
static bool | isEmpty (const char *src) |
| 檢查字串是否為空
|
|
◆ ~StringFormat()
virtual ufm::lang::StringFormat::~StringFormat |
( |
void | | ) |
|
|
overrideprotectedvirtualdefault |
◆ isEmpty()
static bool ufm::lang::StringFormat::isEmpty |
( |
const char * | src | ) |
|
|
static |
檢查字串是否為空
判斷 src 是否為 nullptr 或第一個字元為 '\0'
- 參數
-
- 傳回值
- bool true 表示空字串
-
bool false 表示非空字串
◆ memory()
static int ufm::lang::StringFormat::memory |
( |
const ufm::lang::Memory & | memory, |
|
|
const char * | format, |
|
|
| ... ) |
|
static |
使用格式化字串和可變參數寫入 Memory
根據格式字串和參數,將結果寫入 Memory 物件
- 參數
-
memory | 目標 Memory 物件 |
format | printf 風格的格式字串 |
... | 可變參數列表 |
- 傳回值
- int 寫入的字元數
◆ memoryVa()
static int ufm::lang::StringFormat::memoryVa |
( |
const ufm::lang::Memory & | memory, |
|
|
const char * | format, |
|
|
va_list | args ) |
|
static |
使用 va_list 參數格式化字串到 Memory 物件
根據格式化字串和 va_list 參數,將結果寫入 Memory
- 參數
-
memory | 目標 Memory 物件 |
format | 格式化字串 |
args | va_list 變數參數列表 |
- 傳回值
- int 寫入的字元數
◆ pointer()
static int ufm::lang::StringFormat::pointer |
( |
void * | buffer, |
|
|
uint32 | bufferSize, |
|
|
const char * | format, |
|
|
| ... ) |
|
static |
使用格式化字串和可變參數寫入緩衝區
將格式化結果寫入指定緩衝區,會自動在結尾加上 '\0'
- 參數
-
buffer | 緩衝區指標 |
bufferSize | 緩衝區大小 (位元組) |
format | printf 風格的格式字串 |
... | 可變參數列表 |
- 傳回值
- int 寫入緩衝區的字元數 (不含結尾 '\0')
◆ pointerVa()
static int ufm::lang::StringFormat::pointerVa |
( |
void * | buffer, |
|
|
size_t | bufferSize, |
|
|
const char * | format, |
|
|
va_list | args ) |
|
static |
使用 va_list 參數格式化字串到緩衝區
依據指定格式字串和變數參數列表,將結果寫入緩衝區
- 參數
-
buffer | 緩衝區指標 (void*,可轉為 char*) |
bufferSize | 緩衝區大小 (位元組) |
format | 格式化字串,遵循 printf 規則 |
args | va_list 變數參數列表 |
- 傳回值
- int 寫入的字元數 (不含終止符)
◆ scan()
static int ufm::lang::StringFormat::scan |
( |
const char * | src, |
|
|
const char * | format, |
|
|
| ... ) |
|
static |
使用可變參數從字串中掃描資料
類似 scanf,根據格式字串,從 src 讀取資料
- 參數
-
src | 原始字串 |
format | scanf 風格的格式字串 |
... | 可變參數列表 |
- 傳回值
- int 成功掃描的項目數
◆ scanVa()
static int ufm::lang::StringFormat::scanVa |
( |
const char * | src, |
|
|
const char * | format, |
|
|
va_list | args ) |
|
static |
使用 va_list 參數從字串中掃描資料
類似 scanf,根據格式化字串和 va_list,從 src 讀取對應資料
- 參數
-
src | 原始字串 |
format | scanf 風格的格式字串 |
args | va_list 變數參數列表 |
- 傳回值
- int 成功掃描的項目數
◆ size()
static int ufm::lang::StringFormat::size |
( |
const char * | src | ) |
|
|
static |
計算 C 字串長度
返回不包含終止符的字元數
- 參數
-
- 傳回值
- int 字串長度
◆ writeBuffer()
static int ufm::lang::StringFormat::writeBuffer |
( |
ufm::lang::Appendable & | appendable, |
|
|
const char * | format, |
|
|
| ... ) |
|
static |
◆ writeBufferVa()
static int ufm::lang::StringFormat::writeBufferVa |
( |
ufm::lang::Appendable & | appendable, |
|
|
const char * | format, |
|
|
va_list | args ) |
|
static |
此類別(class) 文件是由下列檔案中產生: