布尔值 (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',否则返回 'false'。您也可以传递两个字符串作为位置参数来指定对真/假返回什么。例如,bool.to_string('yes', 'no') 如果布尔值为真则返回 yes,如果为假则返回 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 |
当布尔值为 |
[可选]
|
搜索结果为