struct ConstantValue

Defined at line 22 of file ../../tools/fidl/fidlc/src/values.h

ConstantValue represents the concrete _value_ of a constant. (For the

_declaration_, see Const. For the _use_, see Constant.) ConstantValue has

derived classes for all the different kinds of constants.

Public Members

Kind kind

Public Methods

bool Convert (Kind kind, std::unique_ptr<ConstantValue> * out_value)
std::unique_ptr<ConstantValue> Clone ()
void ~ConstantValue ()

Defined at line 23 of file ../../tools/fidl/fidlc/src/values.h

template <typename ValueType>
std::optional<ValueType> AsNumeric ()

If this is a NumericConstantValue

<ValueType

>, returns the ValueType.

Defined at line 117 of file ../../tools/fidl/fidlc/src/values.h

std::optional<uint64_t> AsUnsigned ()

If this is a NumericConstantValue

<uint

??_t>, returns it widened to uint64_t.

std::optional<int64_t> AsSigned ()

If this is a NumericConstantValue

<int

??_t> returns it widened to int64_t.

std::optional<std::string_view> AsString ()

If this is StringConstantValue, returns the std::string_view.

Protected Methods

void ConstantValue (Kind kind)

Defined at line 60 of file ../../tools/fidl/fidlc/src/values.h

Enumerations

enum Kind
Name Value
kInt8 0
kInt16 1
kInt32 2
kInt64 3
kUint8 4
kZxUchar 5
kUint16 6
kUint32 7
kUint64 8
kZxUsize64 9
kZxUintptr64 10
kFloat32 11
kFloat64 12
kBool 13
kString 14
kDocComment 15

Defined at line 25 of file ../../tools/fidl/fidlc/src/values.h