#include <attribute.h>
AST node holding a set of Attribute
nodes.
◆ AttributeSet() [1/2]
Constructs a set from from a vector of attributes.
- Parameters
-
a | vector to initialize attribute set from |
m | meta data to associate with the node |
◆ AttributeSet() [2/2]
hilti::AttributeSet::AttributeSet |
( |
Meta |
m = Meta() | ) |
|
|
inline |
Constructs an empty set.
- Parameters
-
m | meta data to associate with the node |
◆ add() [1/2]
Returns a new attribute set that adds one element.
- Parameters
-
s | set to add to. |
a | element to add. |
- Returns
s
with `a' added
◆ add() [2/2]
Returns a new attribute set that adds one element.
- Parameters
-
s | set to add to. |
a | element to add. |
- Returns
s
with `a' added
◆ attributes()
auto hilti::AttributeSet::attributes |
( |
| ) |
const |
|
inline |
Returns the set's attributes.
◆ coerceValueTo()
Result<bool> hilti::AttributeSet::coerceValueTo |
( |
const std::string & |
tag, |
|
|
const Type & |
dst |
|
) |
| |
|
inline |
If an attribute of a given name exists and has an expression value, the value is coerced to a specified type. If not, nothing is done.
- Returns
- A successful return value if either the coercion succeeded (then the result's value is true), or nothing was to be done (then the result's value is false); a failures if a coercion would have been necessary, but failed.
◆ find() [1/2]
Retrieves an attribute with a given name from the set. If multiple attributes with that tag exist, it's undefined which is returned.
- Returns
- attribute if found
◆ find() [2/2]
Retrieves an attribute with a given name from a set, dealing correctly with an unset optional set. If multiple attributes with that tag exist, it's undefined which is returned.
- Parameters
-
- Returns
- attribute if found
◆ findAll() [1/3]
auto hilti::AttributeSet::findAll |
( |
std::string_view |
tag | ) |
const |
|
inline |
Retrieves all attributes with a given name from the set.
- Returns
- all attributes with matching name
◆ findAll() [2/3]
Retrieves all attribute with a given name from a set, dealing correctly with an unset optional set.
- Parameters
-
- Returns
- all attributes with matching name
◆ findAll() [3/3]
Retrieves all attribute with a given name from a set, dealing correctly with an unset optional set.
- Parameters
-
- Returns
- all attributes with matching name
◆ has() [1/2]
bool hilti::AttributeSet::has |
( |
std::string_view |
tag | ) |
const |
|
inline |
Returns true if there's an attribute with a given name in the set.
- Parameters
-
◆ has() [2/2]
static bool hilti::AttributeSet::has |
( |
const std::optional< AttributeSet > & |
attrs, |
|
|
std::string_view |
tag |
|
) |
| |
|
inlinestatic |
Returns true if there's an attribute with a given name in a set, dealing correctly with an unset optional set.
- Parameters
-
attrs | set to inspect |
true | if found |
◆ operator bool()
hilti::AttributeSet::operator bool |
( |
| ) |
const |
|
inline |
Returns true if the set has at least one element.
◆ properties()
auto hilti::AttributeSet::properties |
( |
| ) |
const |
|
inline |
Implements Node
interface.
The documentation for this class was generated from the following file:
- /home/docs/checkouts/readthedocs.org/user_builds/spicy-docs/checkouts/v1.7.0/hilti/toolchain/include/ast/attribute.h