mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-07 02:36:47 +00:00
Merge develop into ConfidentialTransfer (#6987)
Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: chuanshanjida <chuanshanjida@outlook.com> Co-authored-by: Ed Hennis <ed@ripple.com> Co-authored-by: Bart <bthomee@users.noreply.github.com> Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com> Co-authored-by: Zhiyuan Wang <96991820+Kassaking7@users.noreply.github.com> Co-authored-by: Alex Kremer <akremer@ripple.com> Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com> Co-authored-by: Sergey Kuznetsov <skuznetsov@ripple.com> Co-authored-by: JCW <a1q123456@users.noreply.github.com> Co-authored-by: xrplf-ai-reviewer[bot] <266832837+xrplf-ai-reviewer[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Gregory Tsipenyuk <gregtatcam@users.noreply.github.com> Co-authored-by: chuanshanjida <chuanshanjida@outlook.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
This commit is contained in:
@@ -62,7 +62,7 @@ class STObject : public STBase, public CountedObject<STObject>
|
||||
public:
|
||||
using iterator = boost::transform_iterator<Transform, STObject::list_type::const_iterator>;
|
||||
|
||||
virtual ~STObject() = default;
|
||||
~STObject() override = default;
|
||||
STObject(STObject const&) = default;
|
||||
|
||||
template <typename F>
|
||||
@@ -436,8 +436,7 @@ private:
|
||||
// by value.
|
||||
template <
|
||||
typename T,
|
||||
typename V = typename std::remove_cv<
|
||||
typename std::remove_reference<decltype(std::declval<T>().value())>::type>::type>
|
||||
typename V = std::remove_cv_t<std::remove_reference_t<decltype(std::declval<T>().value())>>>
|
||||
V
|
||||
getFieldByValue(SField const& field) const;
|
||||
|
||||
@@ -579,7 +578,7 @@ class STObject::OptionalProxy : public Proxy<T>
|
||||
private:
|
||||
using value_type = typename T::value_type;
|
||||
|
||||
using optional_type = std::optional<typename std::decay<value_type>::type>;
|
||||
using optional_type = std::optional<std::decay_t<value_type>>;
|
||||
|
||||
public:
|
||||
OptionalProxy(OptionalProxy const&) = default;
|
||||
@@ -704,7 +703,7 @@ class STObject::FieldErr : public std::runtime_error
|
||||
template <class T>
|
||||
STObject::Proxy<T>::Proxy(STObject* st, TypedField<T> const* f) : st_(st), f_(f)
|
||||
{
|
||||
if (st_->mType)
|
||||
if (st_->mType != nullptr)
|
||||
{
|
||||
// STObject has associated template
|
||||
if (!st_->peekAtPField(*f_))
|
||||
@@ -770,9 +769,13 @@ STObject::Proxy<T>::assign(U&& u)
|
||||
}
|
||||
T* t = nullptr;
|
||||
if (style_ == soeINVALID)
|
||||
{
|
||||
t = dynamic_cast<T*>(st_->getPField(*f_, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
t = dynamic_cast<T*>(st_->makeFieldPresent(*f_));
|
||||
}
|
||||
XRPL_ASSERT(t, "xrpl::STObject::Proxy::assign : type cast succeeded");
|
||||
*t = std::forward<U>(u);
|
||||
}
|
||||
@@ -858,9 +861,13 @@ STObject::OptionalProxy<T>::operator=(
|
||||
-> OptionalProxy&
|
||||
{
|
||||
if (v)
|
||||
{
|
||||
this->assign(std::move(*v));
|
||||
}
|
||||
else
|
||||
{
|
||||
disengage();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -869,9 +876,13 @@ auto
|
||||
STObject::OptionalProxy<T>::operator=(optional_type const& v) -> OptionalProxy&
|
||||
{
|
||||
if (v)
|
||||
{
|
||||
this->assign(*v);
|
||||
}
|
||||
else
|
||||
{
|
||||
disengage();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -903,9 +914,13 @@ STObject::OptionalProxy<T>::disengage()
|
||||
if (this->style_ == soeREQUIRED || this->style_ == soeDEFAULT)
|
||||
Throw<STObject::FieldErr>("Template field error '" + this->f_->getName() + "'");
|
||||
if (this->style_ == soeINVALID)
|
||||
{
|
||||
this->st_->delField(*this->f_);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->st_->makeFieldAbsent(*this->f_);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@@ -1058,9 +1073,11 @@ STObject::at(TypedField<T> const& f) const
|
||||
{
|
||||
auto const b = peekAtPField(f);
|
||||
if (!b)
|
||||
{
|
||||
// This is a free object (no constraints)
|
||||
// with no template
|
||||
Throw<STObject::FieldErr>("Missing field: " + f.getName());
|
||||
}
|
||||
|
||||
if (auto const u = dynamic_cast<T const*>(b))
|
||||
return u->value();
|
||||
@@ -1138,9 +1155,13 @@ STObject::setFieldH160(SField const& field, base_uint<160, Tag> const& v)
|
||||
|
||||
using Bits = STBitString<160>;
|
||||
if (auto cf = dynamic_cast<Bits*>(rf))
|
||||
{
|
||||
cf->setValue(v);
|
||||
}
|
||||
else
|
||||
{
|
||||
Throw<std::runtime_error>("Wrong field type");
|
||||
}
|
||||
}
|
||||
|
||||
inline bool
|
||||
@@ -1188,7 +1209,10 @@ STObject::getFieldByConstRef(SField const& field, V const& empty) const
|
||||
SerializedTypeID const id = rf->getSType();
|
||||
|
||||
if (id == STI_NOTPRESENT)
|
||||
{
|
||||
// NOLINTNEXTLINE(bugprone-return-const-ref-from-parameter)
|
||||
return empty; // optional field not present
|
||||
}
|
||||
|
||||
T const* cf = dynamic_cast<T const*>(rf);
|
||||
|
||||
@@ -1203,7 +1227,7 @@ template <typename T, typename V>
|
||||
void
|
||||
STObject::setFieldUsingSetValue(SField const& field, V value)
|
||||
{
|
||||
static_assert(!std::is_lvalue_reference<V>::value, "");
|
||||
static_assert(!std::is_lvalue_reference_v<V>, "");
|
||||
|
||||
STBase* rf = getPField(field, true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user