Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 44 additions & 44 deletions common/value.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1941,53 +1941,53 @@ optional_ref<const BytesValue> Value::AsBytes() const& {
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<BytesValue> Value::AsBytes() && {
if (auto* alternative = variant_.As<BytesValue>(); alternative != nullptr) {
return std::move(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<DoubleValue> Value::AsDouble() const {
if (const auto* alternative = variant_.As<DoubleValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<DurationValue> Value::AsDuration() const {
if (const auto* alternative = variant_.As<DurationValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

optional_ref<const ErrorValue> Value::AsError() const& {
if (const auto* alternative = variant_.As<ErrorValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<ErrorValue> Value::AsError() && {
if (auto* alternative = variant_.As<ErrorValue>(); alternative != nullptr) {
return std::move(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<IntValue> Value::AsInt() const {
if (const auto* alternative = variant_.As<IntValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<ListValue> Value::AsList() const& {
Expand All @@ -2007,7 +2007,7 @@ absl::optional<ListValue> Value::AsList() const& {
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<ListValue> Value::AsList() && {
Expand All @@ -2027,7 +2027,7 @@ absl::optional<ListValue> Value::AsList() && {
alternative != nullptr) {
return std::move(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<MapValue> Value::AsMap() const& {
Expand All @@ -2047,7 +2047,7 @@ absl::optional<MapValue> Value::AsMap() const& {
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<MapValue> Value::AsMap() && {
Expand All @@ -2067,158 +2067,158 @@ absl::optional<MapValue> Value::AsMap() && {
alternative != nullptr) {
return std::move(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<MessageValue> Value::AsMessage() const& {
if (const auto* alternative = variant_.As<ParsedMessageValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<MessageValue> Value::AsMessage() && {
if (auto* alternative = variant_.As<ParsedMessageValue>();
alternative != nullptr) {
return std::move(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<NullValue> Value::AsNull() const {
if (const auto* alternative = variant_.As<NullValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

optional_ref<const OpaqueValue> Value::AsOpaque() const& {
if (const auto* alternative = variant_.As<OpaqueValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<OpaqueValue> Value::AsOpaque() && {
if (auto* alternative = variant_.As<OpaqueValue>(); alternative != nullptr) {
return std::move(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

optional_ref<const OptionalValue> Value::AsOptional() const& {
if (const auto* alternative = variant_.As<OpaqueValue>();
alternative != nullptr && alternative->IsOptional()) {
return static_cast<const OptionalValue&>(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<OptionalValue> Value::AsOptional() && {
if (auto* alternative = variant_.As<OpaqueValue>();
alternative != nullptr && alternative->IsOptional()) {
return static_cast<OptionalValue&&>(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

optional_ref<const ParsedJsonListValue> Value::AsParsedJsonList() const& {
if (const auto* alternative = variant_.As<ParsedJsonListValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<ParsedJsonListValue> Value::AsParsedJsonList() && {
if (auto* alternative = variant_.As<ParsedJsonListValue>();
alternative != nullptr) {
return std::move(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

optional_ref<const ParsedJsonMapValue> Value::AsParsedJsonMap() const& {
if (const auto* alternative = variant_.As<ParsedJsonMapValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<ParsedJsonMapValue> Value::AsParsedJsonMap() && {
if (auto* alternative = variant_.As<ParsedJsonMapValue>();
alternative != nullptr) {
return std::move(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

optional_ref<const CustomListValue> Value::AsCustomList() const& {
if (const auto* alternative = variant_.As<CustomListValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<CustomListValue> Value::AsCustomList() && {
if (auto* alternative = variant_.As<CustomListValue>();
alternative != nullptr) {
return std::move(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

optional_ref<const CustomMapValue> Value::AsCustomMap() const& {
if (const auto* alternative = variant_.As<CustomMapValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<CustomMapValue> Value::AsCustomMap() && {
if (auto* alternative = variant_.As<CustomMapValue>();
alternative != nullptr) {
return std::move(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

optional_ref<const ParsedMapFieldValue> Value::AsParsedMapField() const& {
if (const auto* alternative = variant_.As<ParsedMapFieldValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<ParsedMapFieldValue> Value::AsParsedMapField() && {
if (auto* alternative = variant_.As<ParsedMapFieldValue>();
alternative != nullptr) {
return std::move(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

optional_ref<const ParsedMessageValue> Value::AsParsedMessage() const& {
if (const auto* alternative = variant_.As<ParsedMessageValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<ParsedMessageValue> Value::AsParsedMessage() && {
if (auto* alternative = variant_.As<ParsedMessageValue>();
alternative != nullptr) {
return std::move(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

optional_ref<const ParsedRepeatedFieldValue> Value::AsParsedRepeatedField()
Expand All @@ -2227,46 +2227,46 @@ optional_ref<const ParsedRepeatedFieldValue> Value::AsParsedRepeatedField()
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<ParsedRepeatedFieldValue> Value::AsParsedRepeatedField() && {
if (auto* alternative = variant_.As<ParsedRepeatedFieldValue>();
alternative != nullptr) {
return std::move(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

optional_ref<const CustomStructValue> Value::AsCustomStruct() const& {
if (const auto* alternative = variant_.As<CustomStructValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<CustomStructValue> Value::AsCustomStruct() && {
if (auto* alternative = variant_.As<CustomStructValue>();
alternative != nullptr) {
return std::move(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

optional_ref<const StringValue> Value::AsString() const& {
if (const auto* alternative = variant_.As<StringValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<StringValue> Value::AsString() && {
if (auto* alternative = variant_.As<StringValue>(); alternative != nullptr) {
return std::move(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<StructValue> Value::AsStruct() const& {
Expand All @@ -2283,7 +2283,7 @@ absl::optional<StructValue> Value::AsStruct() const& {
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<StructValue> Value::AsStruct() && {
Expand All @@ -2299,53 +2299,53 @@ absl::optional<StructValue> Value::AsStruct() && {
alternative != nullptr) {
return std::move(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<TimestampValue> Value::AsTimestamp() const {
if (const auto* alternative = variant_.As<TimestampValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

optional_ref<const TypeValue> Value::AsType() const& {
if (const auto* alternative = variant_.As<TypeValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<TypeValue> Value::AsType() && {
if (auto* alternative = variant_.As<TypeValue>(); alternative != nullptr) {
return std::move(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<UintValue> Value::AsUint() const {
if (const auto* alternative = variant_.As<UintValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

optional_ref<const UnknownValue> Value::AsUnknown() const& {
if (const auto* alternative = variant_.As<UnknownValue>();
alternative != nullptr) {
return *alternative;
}
return absl::nullopt;
return std::nullopt;
}

absl::optional<UnknownValue> Value::AsUnknown() && {
if (auto* alternative = variant_.As<UnknownValue>(); alternative != nullptr) {
return std::move(*alternative);
}
return absl::nullopt;
return std::nullopt;
}

const BytesValue& Value::GetBytes() const& {
Expand Down
Loading
Loading