Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Nullable::HasValidValue so people won't try to use it. #26535

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ CHIP_ERROR Encode(const ConcreteReadAttributePath & aPath, AttributeValueEncoder
// CONFIG_BUILD_FOR_HOST_UNIT_TEST is true, so we can test how the other side
// responds.
#if !CONFIG_BUILD_FOR_HOST_UNIT_TEST
if (!x.HasValidValue())
if (!x.ExistingValueInEncodableRange())
{
return CHIP_IM_GLOBAL_STATUS(ConstraintError);
}
Expand Down Expand Up @@ -313,7 +313,7 @@ CHIP_ERROR Decode(const ConcreteDataAttributePath & aPath, AttributeValueDecoder

// We have a value; decode it.
ReturnErrorOnFailure(Decode(aPath, aDecoder, x.SetNonNull()));
if (!x.HasValidValue())
if (!x.ExistingValueInEncodableRange())
{
return CHIP_IM_GLOBAL_STATUS(ConstraintError);
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/data-model/Decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ CHIP_ERROR Decode(TLV::TLVReader & reader, Nullable<X> & x)

// We have a value; decode it.
ReturnErrorOnFailure(Decode(reader, x.SetNonNull()));
if (!x.HasValidValue())
if (!x.ExistingValueInEncodableRange())
{
return CHIP_IM_GLOBAL_STATUS(ConstraintError);
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/data-model/Encode.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag, const Nullable<X> & x)
// CONFIG_BUILD_FOR_HOST_UNIT_TEST is true, so we can test how the other side
// responds.
#if !CONFIG_BUILD_FOR_HOST_UNIT_TEST
if (!x.HasValidValue())
if (!x.ExistingValueInEncodableRange())
{
return CHIP_IM_GLOBAL_STATUS(ConstraintError);
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/data-model/Nullable.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct Nullable : protected Optional<T>
template <
typename U = std::decay_t<T>,
typename std::enable_if_t<(std::is_integral<U>::value && !std::is_same<U, bool>::value) || std::is_enum<U>::value, int> = 0>
constexpr bool HasValidValue() const
constexpr bool ExistingValueInEncodableRange() const
{
return NumericAttributeTraits<T>::CanRepresentValue(/* isNullable = */ true, Value());
}
Expand All @@ -74,7 +74,7 @@ struct Nullable : protected Optional<T>
template <typename U = std::decay_t<T>,
typename std::enable_if_t<(!std::is_integral<U>::value || std::is_same<U, bool>::value) && !std::is_enum<U>::value,
int> = 0>
constexpr bool HasValidValue() const
constexpr bool ExistingValueInEncodableRange() const
{
return true;
}
Expand Down