布林值 (bool
)
布林值物件,其值為 true
或 false
由以下項目傳回
布林值物件由下列函式和方法傳回
add_languages()
get_option()
is_disabler()
is_variable()
build_tgt.found()
cfg_data.get()
cfg_data.get_unquoted()
cfg_data.has()
compiler.check_header()
compiler.compiles()
compiler.has_argument()
compiler.has_define()
compiler.has_function()
compiler.has_function_attribute()
compiler.has_header()
compiler.has_header_symbol()
compiler.has_link_argument()
compiler.has_member()
compiler.has_members()
compiler.has_multi_arguments()
compiler.has_multi_link_arguments()
compiler.has_type()
compiler.links()
compiler.symbols_have_underscore_prefix()
dep.found()
dict.has_key()
disabler.found()
external_program.found()
feature.allowed()
feature.auto()
feature.disabled()
feature.enabled()
int.is_even()
int.is_odd()
list.contains()
meson.can_run_host_binaries()
meson.has_exe_wrapper()
meson.has_external_property()
meson.is_cross_build()
meson.is_subproject()
meson.is_unity()
module.found()
runresult.compiled()
str.contains()
str.endswith()
str.startswith()
str.version_compare()
subproject.found()
布林值方法
bool.to_int()
若為 true
則傳回 1
,若為 false
則傳回 0
簽名
int to_int()
bool.to_string()
若布林值為 true 則傳回字串 'true'
,否則傳回 'false'
。您也可以傳遞兩個字串作為位置引數,以指定 true/false 的傳回值。例如,bool.to_string('yes', 'no')
若布林值為 true 則傳回 yes
,若為 false 則傳回 no
。
簽名
# Returns the string `'true'` if the boolean is true or `'false'` otherwise
str to_string(
str [true_str], # The string to return when the boolean is `true`
str [false_str], # The string to return when the boolean is `false`
)
引數
方法 bool.to_string()
接受下列位置引數
名稱 | 類型 | 描述 | 標籤 |
---|---|---|---|
true_str |
字串 (str) |
當布林值為 |
[選用]
|
false_str |
字串 (str) |
字串 (str) |
[選用]
|
預設值 = 'false'