![]() |
mFrame
|
布林值靜態工具類 更多...
#include <Booleans.h>
靜態公開方法(Static Public Methods) | |
| static bool | isTrue (const char *str, int count) |
| 判斷字串是否代表真值 (true) | |
| static bool | isFalse (const char *str, int count) |
| 判斷字串是否代表假值 (false) | |
| static bool | isBoolean (const char *str, int count) |
| 判斷字串是否為布林值字串 | |
| static bool | parseBoolean (bool &result, const char *str, int count) |
| 解析字串為布林值 | |
靜態公開屬性 | |
| static constexpr const char *const | TEXT_TRUE = "true" |
| 真值的字符串表示 | |
| static constexpr const char *const | TEXT_FALSE = "false" |
| 假值的字符串表示 | |
| static constexpr const int | TEXT_TRUE_LENGTH |
| "true"字符串的長度 | |
| static constexpr const int | TEXT_FALSE_LENGTH |
| "false"字符串的長度 | |
保護方法(Protected Methods) | |
| virtual | ~Booleans (void) override=default |
| Destroy the Booleans object. | |
保護方法(Protected Methods) 繼承自 ufm::lang::NonInstantiable | |
| NonInstantiable (void)=delete | |
| 禁止實例化 NonInstantiable 類別 | |
| NonInstantiable (const NonInstantiable &)=delete | |
| 禁止複製建構函式 | |
| virtual | ~NonInstantiable (void) override=default |
| Destroy the Non Instantiable object. | |
| NonInstantiable & | operator= (const NonInstantiable &)=delete |
| NonInstantiable & | operator= (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::Object & | getObject (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::Thread * | currentThread (void) const |
| 取得當前執行緒指標 | |
| virtual int | hashcode (void) const |
| 返回對象的哈希碼值。支持這種方法是為了散列表,如HashMap提供的那樣。 | |
公開方法(Public Methods) 繼承自 ufm::lang::Interface | |
| virtual | ~Interface (void)=default |
| 虛擬析構函式 | |
布林值靜態工具類
此類提供了布林(bool)類型的靜態工具方法,用於字串解析和格式判斷。 作為工具類,Booleans類不能被實例化,所有方法均為靜態方法。 主要功能包括:
|
static |
判斷字串是否為布林值字串
同時檢查 isTrue 或 isFalse。
| str | 字串來源 |
| count | 字元長度,-1 表示自動判斷至 '\0' |
|
static |
判斷字串是否代表假值 (false)
比較字串與 TEXT_FALSE,忽略大小寫。
| str | 字串來源 |
| count | 字元長度,-1 表示自動判斷至 '\0' |
|
static |
判斷字串是否代表真值 (true)
比較字串與 TEXT_TRUE,忽略大小寫。
| str | 字串來源 |
| count | 字元長度,-1 表示自動判斷至 '\0' |
|
static |
解析字串為布林值
若 str 為 "true",result 回傳 true;若為 "false",result 回傳 false。
| result | 參考參數,存放解析後的布林值 |
| str | 字串來源 |
| count | 字元長度,-1 表示自動判斷至 '\0' |
|
staticconstexpr |
"false"字符串的長度
|
staticconstexpr |
"true"字符串的長度