Configuration data object (cfg_data)
This object encapsulates configuration values to be used for generating configuration files. A more in-depth description can be found in the the configuration wiki page.
Returned by
Configuration data object objects are returned by the following functions and methods:
Configuration data object methods
cfg_data.get()
Returns the value of varname, if the
value has not been set returns default_value if it is defined
(since 0.38.0) and errors out if not
Signature
(since 0.38.0)
# Returns the value of `varname`, if the
(追記) str (追記ここまで) | (追記) int (追記ここまで) | (追記) bool (追記ここまで) get(
(追記) str (追記ここまで) varname, # The name of the variable to query
(追記) str (追記ここまで) | (追記) int (追記ここまで) | (追記) bool (追記ここまで) [default_value], # The default value to return when `varname` does not exist
)
Arguments
The method cfg_data.get() accepts the following positional arguments:
| Name | Type | Description | Tags |
|---|---|---|---|
varname |
(追記) str (追記ここまで) |
The name of the variable to query |
|
default_value |
(追記) str (追記ここまで) | (追記) int (追記ここまで) | (追記) bool (追記ここまで)
|
The default value to return when |
[optional] |
cfg_data.get_unquoted()
Returns the value
of varname but without surrounding double quotes ("). If the value has
not been set returns default_value if it is defined and errors out if not.
Signature
(since 0.44.0)
# Returns the value
(追記) str (追記ここまで) | (追記) int (追記ここまで) | (追記) bool (追記ここまで) get_unquoted(
(追記) str (追記ここまで) varname, # The name of the variable to query
(追記) str (追記ここまで) | (追記) int (追記ここまで) | (追記) bool (追記ここまで) [default_value], # The default value to return when `varname` does not exist
)
Arguments
The method cfg_data.get_unquoted() accepts the following positional arguments:
| Name | Type | Description | Tags |
|---|---|---|---|
varname |
(追記) str (追記ここまで) |
The name of the variable to query |
|
default_value |
(追記) str (追記ここまで) | (追記) int (追記ここまで) | (追記) bool (追記ここまで)
|
The default value to return when |
[optional] |
cfg_data.has()
returns true if the specified variable is set
Signature
# returns `true` if the specified variable is set
(追記) bool (追記ここまで) has(
(追記) str (追記ここまで) varname, # The name of the variable to query
)
Arguments
The method cfg_data.has() accepts the following positional arguments:
| Name | Type | Description | Tags |
|---|---|---|---|
varname |
(追記) str (追記ここまで) |
The name of the variable to query |
cfg_data.keys()
Returns an array of keys of the configuration data object.
You can iterate over this array with the foreach
statement.
Signature
(since 0.57.0)
(追記) array (追記ここまで)[(追記) str (追記ここまで)] keys()
cfg_data.merge_from()
Takes as argument a different configuration data object and copies all entries from that object to the current.
Signature
(since 0.42.0)
# Takes as argument a different
(追記) void (追記ここまで) merge_from(
(追記) cfg_data (追記ここまで) other, # The other (追記) cfg_data (追記ここまで) object to merge into this one.
)
Arguments
The method cfg_data.merge_from() accepts the following positional arguments:
| Name | Type | Description | Tags |
|---|---|---|---|
other |
(追記) cfg_data (追記ここまで) |
The other (追記) |
cfg_data.set()
Sets a variable to a given value
Signature
# Sets a variable to a given value
(追記) void (追記ここまで) set(
(追記) str (追記ここまで) varname, # The name of the variable to set
(追記) str (追記ここまで) | (追記) int (追記ここまで) | (追記) bool (追記ここまで) value, # The value to set
# Keyword arguments:
description : (追記) str (追記ここまで) # Message / Comment that will be written in the
)
Arguments
The method cfg_data.set() accepts the following positional arguments:
| Name | Type | Description | Tags |
|---|---|---|---|
varname |
(追記) str (追記ここまで) |
The name of the variable to set |
|
value |
(追記) str (追記ここまで) | (追記) int (追記ここまで) | (追記) bool (追記ここまで)
|
The value to set |
Finally, cfg_data.set()
accepts the following keyword arguments:
| Name | Type | Description | Tags |
|---|---|---|---|
description |
(追記) str (追記ここまで) |
Message / Comment that will be written in the result file. The replacement assumes a file with C syntax. If your generated file is source code in some other language, you probably don't want to add a description field because it most likely will cause a syntax error. |
cfg_data.set10()
Is the same as (追記) cfg_data.set() (追記ここまで) but the value
is either true or false and will be written as 1 or 0,
respectively
Signature
# Is the same as (追記) cfg_data.set() (追記ここまで) but the value
(追記) void (追記ここまで) set10(
(追記) str (追記ここまで) varname, # The name of the variable to set
(追記) bool (追記ここまで) | (追記) int (追記ここまで) value, # The value to set as either `1` or `0`
# Keyword arguments:
description : (追記) str (追記ここまで) # Message / Comment that will be written in the
)
Arguments
The method cfg_data.set10() accepts the following positional arguments:
| Name | Type | Description | Tags |
|---|---|---|---|
varname |
(追記) str (追記ここまで) |
The name of the variable to set |
|
value |
(追記) bool (追記ここまで) | (追記) int (追記ここまで)
|
The value to set as either Passing numbers was never intended to work, and since 0.62 it has been
deprecated. It will be removed in a future version of Meson. If you
need to pass numbers use the |
Finally, cfg_data.set10()
accepts the following keyword arguments:
| Name | Type | Description | Tags |
|---|---|---|---|
description |
(追記) str (追記ここまで) |
Message / Comment that will be written in the result file. The replacement assumes a file with C syntax. If your generated file is source code in some other language, you probably don't want to add a description field because it most likely will cause a syntax error. |
cfg_data.set_quoted()
Is same as (追記) cfg_data.set() (追記ここまで) but quotes the value in double quotes (")
Signature
# Is same as (追記) cfg_data.set() (追記ここまで) but quotes the value in double quotes (`"`)
(追記) void (追記ここまで) set_quoted(
(追記) str (追記ここまで) varname, # The name of the variable to set
(追記) str (追記ここまで) | (追記) int (追記ここまで) | (追記) bool (追記ここまで) value, # The value to set
# Keyword arguments:
description : (追記) str (追記ここまで) # Message / Comment that will be written in the
)
Arguments
The method cfg_data.set_quoted() accepts the following positional arguments:
| Name | Type | Description | Tags |
|---|---|---|---|
varname |
(追記) str (追記ここまで) |
The name of the variable to set |
|
value |
(追記) str (追記ここまで) | (追記) int (追記ここまで) | (追記) bool (追記ここまで)
|
The value to set |
Finally, cfg_data.set_quoted()
accepts the following keyword arguments:
| Name | Type | Description | Tags |
|---|---|---|---|
description |
(追記) str (追記ここまで) |
Message / Comment that will be written in the result file. The replacement assumes a file with C syntax. If your generated file is source code in some other language, you probably don't want to add a description field because it most likely will cause a syntax error. |
The results of the search are