| 1 |
name: cfg_data |
| 2 |
long_name: Configuration data object |
| 3 |
description: | |
| 4 |
This object encapsulates |
| 5 |
configuration values to be used for generating configuration files. A |
| 6 |
more in-depth description can be found in the [the configuration wiki |
| 7 |
page](Configuration.md). |
| 8 |
|
| 9 |
methods: |
| 10 |
- name: set |
| 11 |
returns: void |
| 12 |
description: Sets a variable to a given value |
| 13 |
|
| 14 |
posargs: |
| 15 |
varname: |
| 16 |
type: str |
| 17 |
description: The name of the variable to set |
| 18 |
value: |
| 19 |
type: str | int | bool |
| 20 |
description: The value to set |
| 21 |
|
| 22 |
kwargs: |
| 23 |
description: |
| 24 |
type: str |
| 25 |
description: | |
| 26 |
Message / Comment that will be written in the |
| 27 |
result file. The replacement assumes a file with C syntax. If your |
| 28 |
generated file is source code in some other language, you probably |
| 29 |
don't want to add a description field because it most likely will |
| 30 |
cause a syntax error. |
| 31 |
|
| 32 |
- name: set10 |
| 33 |
returns: void |
| 34 |
description: | |
| 35 |
Is the same as [[cfg_data.set]] but the value |
| 36 |
is either `true` or `false` and will be written as 1 or 0, |
| 37 |
respectively |
| 38 |
|
| 39 |
posargs: |
| 40 |
varname: |
| 41 |
type: str |
| 42 |
description: The name of the variable to set |
| 43 |
value: |
| 44 |
type: bool | int |
| 45 |
description: | |
| 46 |
The value to set as either `1` or `0` |
| 47 |
|
| 48 |
Passing numbers was never intended to work, and since 0.62 it has been |
| 49 |
deprecated. It will be removed in a future version of Meson. If you |
| 50 |
need to pass numbers use the `.set` method. |
| 51 |
warnings: |
| 52 |
- numeric values < 0 have the surprising behavior of being converted to |
| 53 |
`true`, values > 1 have the more expected but unintentional behavior of |
| 54 |
being interpreted as `true`. |
| 55 |
|
| 56 |
kwargs_inherit: cfg_data.set |
| 57 |
|
| 58 |
- name: set_quoted |
| 59 |
returns: void |
| 60 |
description: Is same as [[cfg_data.set]] but quotes the value in double quotes (`"`) |
| 61 |
|
| 62 |
posargs: |
| 63 |
varname: |
| 64 |
type: str |
| 65 |
description: The name of the variable to set |
| 66 |
value: |
| 67 |
type: str | int | bool |
| 68 |
description: The value to set |
| 69 |
|
| 70 |
kwargs_inherit: cfg_data.set |
| 71 |
|
| 72 |
- name: get |
| 73 |
returns: str | int | bool |
| 74 |
since: 0.38.0 |
| 75 |
description: | |
| 76 |
Returns the value of `varname`, if the |
| 77 |
value has not been set returns `default_value` if it is defined |
| 78 |
*(since 0.38.0)* and errors out if not |
| 79 |
|
| 80 |
posargs: |
| 81 |
varname: |
| 82 |
type: str |
| 83 |
description: The name of the variable to query |
| 84 |
|
| 85 |
optargs: |
| 86 |
default_value: |
| 87 |
type: str | int | bool |
| 88 |
description: The default value to return when `varname` does not exist |
| 89 |
|
| 90 |
- name: get_unquoted |
| 91 |
returns: str | int | bool |
| 92 |
since: 0.44.0 |
| 93 |
description: | |
| 94 |
Returns the value |
| 95 |
of `varname` but without surrounding double quotes (`"`). If the value has |
| 96 |
not been set returns `default_value` if it is defined and errors out if not. |
| 97 |
|
| 98 |
posargs: |
| 99 |
varname: |
| 100 |
type: str |
| 101 |
description: The name of the variable to query |
| 102 |
|
| 103 |
optargs: |
| 104 |
default_value: |
| 105 |
type: str | int | bool |
| 106 |
description: The default value to return when `varname` does not exist |
| 107 |
|
| 108 |
- name: has |
| 109 |
returns: bool |
| 110 |
description: returns `true` if the specified variable is set |
| 111 |
posargs: |
| 112 |
varname: |
| 113 |
type: str |
| 114 |
description: The name of the variable to query |
| 115 |
|
| 116 |
- name: keys |
| 117 |
returns: list[str] |
| 118 |
since: 0.57.0 |
| 119 |
description: | |
| 120 |
Returns an array of keys of |
| 121 |
the configuration data object. |
| 122 |
|
| 123 |
You can iterate over this array with the [`foreach` |
| 124 |
statement](Syntax.md#foreach-statements). |
| 125 |
|
| 126 |
- name: merge_from |
| 127 |
returns: void |
| 128 |
since: 0.42.0 |
| 129 |
description: | |
| 130 |
Takes as argument a different |
| 131 |
configuration data object and copies all entries from that object to |
| 132 |
the current. |
| 133 |
|
| 134 |
posargs: |
| 135 |
other: |
| 136 |
type: cfg_data |
| 137 |
description: The other [[@cfg_data]] object to merge into this one. |