[Stats] Migrate RTCStats/Test to Attributes. One in series of CLs to migrate from Members() to Attributes() to unblock code deletion. Adds and makes use of has_value(), holds_alternative<T>() and get<T>() convenience methods. Bug: webrtc:15164 Change-Id: I2ae9869a5d1de3f3875c70494c9781d69da7f936 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/334160 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Evan Shrubsole <eshr@google.com> Cr-Commit-Position: refs/heads/main@{#41510}
diff --git a/stats/attribute.cc b/stats/attribute.cc index 36cdc454..b2e2986 100644 --- a/stats/attribute.cc +++ b/stats/attribute.cc
@@ -99,6 +99,11 @@ return attribute_; } +bool Attribute::has_value() const { + return absl::visit([](const auto* attr) { return attr->has_value(); }, + attribute_); +} + RTCStatsMemberInterface::Type Attribute::type() const { return absl::visit([](const auto* attr) { return attr->type(); }, attribute_); }