class ParsedProperties

Defined at line 201 of file ../../sdk/lib/driver/devicetree/visitors/property-parser.h

Helper class to hold the parsed properties and provide utility functions to access the values

appropriately.

Public Methods

void AddProperty (const PropertyName & name, std::any value)

Defined at line 37 of file ../../sdk/lib/driver/devicetree/visitors/property-parser.cc

void ParsedProperties (std::map<PropertyName, std::any> properties)

Defined at line 203 of file ../../sdk/lib/driver/devicetree/visitors/property-parser.h

template <typename T>
auto Get (const PropertyName & name)

Gets the parsed value for a property named `name`, cast to type `T`.

Returns an `std::optional

<T

>` containing the value if the property exists

and can be cast to `T`. Otherwise, returns `std::nullopt`.

Example usage:

To get a single string property:

auto str_prop = props.Get

<std

::string>("string-property");

To get an array of uint32s:

auto arr_prop = props.Get

<std

::vector

<uint32

_t>>("uint32-array-property");

To get a list of references:

auto ref_prop = props.Get

<fdf

_devicetree::References>("reference-property");

if (ref_prop) {

for (const auto

&

ref : *ref_prop) {

// process reference

}

A special case is provided for `bool`. `Get

<bool

>("property-name")` will

return `true` if the property exists and is true, and `false` otherwise

(if it does not exist or is false).

Defined at line 230 of file ../../sdk/lib/driver/devicetree/visitors/property-parser.h