mFrame
載入中...
搜尋中...
無符合項目
ufm::lang::StringFormat 類別 參考文件final

字串格式化類別,提供格式化輸入與輸出的相關方法 更多...

#include <StringFormat.h>

類別ufm::lang::StringFormat的繼承圖:
ufm::lang::NonInstantiable ufm::lang::Object ufm::lang::Interface

靜態公開方法(Static Public Methods)

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)
 檢查字串是否為空
 

保護方法(Protected Methods)

virtual ~StringFormat (void) override=default
 禁止實例化 StringFormat 類別
 
- 保護方法(Protected Methods) 繼承自 ufm::lang::NonInstantiable
 NonInstantiable (void)=delete
 禁止實例化 NonInstantiable 類別
 
 NonInstantiable (const NonInstantiable &)=delete
 禁止複製建構函式
 
virtual ~NonInstantiable (void) override=default
 Destroy the Non Instantiable object.
 
NonInstantiableoperator= (const NonInstantiable &)=delete
 
NonInstantiableoperator= (NonInstantiable &&)=delete
 

額外的繼承成員

- 公開方法(Public Methods) 繼承自 ufm::lang::Object
void * operator new (size_t n)
 使用運算子 new 分配記憶體
 
void * operator new (size_t n, void *p)
 在指定記憶體上調用運算子 new
 
virtual ufm::lang::ObjectgetObject (void) override
 取得對應的 Object 物件
 
void delay (int milliseconds) const
 延遲指定的毫秒數進行執行緒等待
 
bool equals (Object *object) const
 判斷與另一物件是否為相同參照(指標型態比較)
 
bool equals (Object &object) const
 判斷與另一物件是否為相同參照(參照型態比較)
 
void wait (void) const
 使當前線程等待直到被通知
 
bool wait (int timeout) const
 等待通知或超時
 
bool yield (void) const
 讓執行緒讓渡控制權給同優先權的下一個執行緒
 
int lock (void) const
 核心鎖定,鎖定期間禁止線程切換
 
int unlock (void) const
 核心解鎖
 
ufm::sys::ThreadcurrentThread (void) const
 取得當前執行緒指標
 
virtual int hashcode (void) const
 返回對象的哈希碼值。支持這種方法是為了散列表,如HashMap提供的那樣。
 
- 公開方法(Public Methods) 繼承自 ufm::lang::Interface
virtual ~Interface (void)=default
 虛擬析構函式
 

詳細描述

字串格式化類別,提供格式化輸入與輸出的相關方法

建構子與解構子說明文件

◆ ~StringFormat()

virtual ufm::lang::StringFormat::~StringFormat ( void )
overrideprotectedvirtualdefault

禁止實例化 StringFormat 類別

此建構函式被設計為私有,以防止此類別被實例化。

函式成員說明文件

◆ isEmpty()

static bool ufm::lang::StringFormat::isEmpty ( const char * src)
static

檢查字串是否為空

判斷 src 是否為 nullptr 或第一個字元為 '\0'

參數
src原始字串指標
傳回值
bool true 表示空字串
bool false 表示非空字串

◆ memory()

static int ufm::lang::StringFormat::memory ( const ufm::lang::Memory & memory,
const char * format,
... )
static

使用格式化字串和可變參數寫入 Memory

根據格式字串和參數,將結果寫入 Memory 物件

參數
memory目標 Memory 物件
formatprintf 風格的格式字串
...可變參數列表
傳回值
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格式化字串
argsva_list 變數參數列表
傳回值
int 寫入的字元數

◆ pointer()

static int ufm::lang::StringFormat::pointer ( void * buffer,
uint32 bufferSize,
const char * format,
... )
static

使用格式化字串和可變參數寫入緩衝區

將格式化結果寫入指定緩衝區,會自動在結尾加上 '\0'

參數
buffer緩衝區指標
bufferSize緩衝區大小 (位元組)
formatprintf 風格的格式字串
...可變參數列表
傳回值
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 規則
argsva_list 變數參數列表
傳回值
int 寫入的字元數 (不含終止符)

◆ scan()

static int ufm::lang::StringFormat::scan ( const char * src,
const char * format,
... )
static

使用可變參數從字串中掃描資料

類似 scanf,根據格式字串,從 src 讀取資料

參數
src原始字串
formatscanf 風格的格式字串
...可變參數列表
傳回值
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原始字串
formatscanf 風格的格式字串
argsva_list 變數參數列表
傳回值
int 成功掃描的項目數

◆ size()

static int ufm::lang::StringFormat::size ( const char * src)
static

計算 C 字串長度

返回不包含終止符的字元數

參數
src以 '\0' 結尾的原始字串
傳回值
int 字串長度

◆ writeBuffer()

static int ufm::lang::StringFormat::writeBuffer ( ufm::lang::Appendable & appendable,
const char * format,
... )
static

使用格式化字串和可變參數寫入 Appendable

根據格式字串,將結果附加至 Appendable

參數
appendable目標 Appendable 物件
formatprintf 風格的格式字串
...可變參數列表
傳回值
int 寫入的字元數

◆ writeBufferVa()

static int ufm::lang::StringFormat::writeBufferVa ( ufm::lang::Appendable & appendable,
const char * format,
va_list args )
static

使用 va_list 參數格式化字串並寫入 Appendable

根據格式化字串和參數,將結果附加至 Appendable 物件

參數
appendable目標 Appendable 物件
format格式化字串
argsva_list 變數參數列表
傳回值
int 寫入的字元數

此類別(class) 文件是由下列檔案中產生: