mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 22:45:52 +00:00
Start vault implementation
This commit is contained in:
committed by
Bronek Kozicki
parent
1a032f04e3
commit
ff8c6491d7
@@ -152,8 +152,7 @@ public:
|
||||
getText() const override;
|
||||
|
||||
// TODO(tom): options should be an enum.
|
||||
Json::Value
|
||||
getJson(JsonOptions options) const override;
|
||||
Json::Value getJson(JsonOptions = JsonOptions::none) const override;
|
||||
|
||||
void
|
||||
addWithoutSigningFields(Serializer& s) const;
|
||||
@@ -482,9 +481,19 @@ private:
|
||||
template <class T>
|
||||
class STObject::Proxy
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
using value_type = typename T::value_type;
|
||||
|
||||
value_type
|
||||
value() const;
|
||||
|
||||
value_type
|
||||
operator*() const;
|
||||
|
||||
T const*
|
||||
operator->() const;
|
||||
|
||||
protected:
|
||||
STObject* st_;
|
||||
SOEStyle style_;
|
||||
TypedField<T> const* f_;
|
||||
@@ -493,9 +502,6 @@ protected:
|
||||
|
||||
Proxy(STObject* st, TypedField<T> const* f);
|
||||
|
||||
value_type
|
||||
value() const;
|
||||
|
||||
T const*
|
||||
find() const;
|
||||
|
||||
@@ -510,7 +516,7 @@ template <typename U>
|
||||
concept IsArithmetic = std::is_arithmetic_v<U> || std::is_same_v<U, STAmount>;
|
||||
|
||||
template <class T>
|
||||
class STObject::ValueProxy : private Proxy<T>
|
||||
class STObject::ValueProxy : public Proxy<T>
|
||||
{
|
||||
private:
|
||||
using value_type = typename T::value_type;
|
||||
@@ -536,6 +542,20 @@ public:
|
||||
|
||||
operator value_type() const;
|
||||
|
||||
template <typename U>
|
||||
friend bool
|
||||
operator==(U const& lhs, STObject::ValueProxy<T> const& rhs)
|
||||
{
|
||||
return rhs.value() == lhs;
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
friend bool
|
||||
operator!=(U const& lhs, STObject::ValueProxy<T> const& rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
private:
|
||||
friend class STObject;
|
||||
|
||||
@@ -543,7 +563,7 @@ private:
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class STObject::OptionalProxy : private Proxy<T>
|
||||
class STObject::OptionalProxy : public Proxy<T>
|
||||
{
|
||||
private:
|
||||
using value_type = typename T::value_type;
|
||||
@@ -563,15 +583,6 @@ public:
|
||||
explicit
|
||||
operator bool() const noexcept;
|
||||
|
||||
/** Return the contained value
|
||||
|
||||
Throws:
|
||||
|
||||
STObject::FieldErr if !engaged()
|
||||
*/
|
||||
value_type
|
||||
operator*() const;
|
||||
|
||||
operator optional_type() const;
|
||||
|
||||
/** Explicit conversion to std::optional */
|
||||
@@ -715,6 +726,20 @@ STObject::Proxy<T>::value() const -> value_type
|
||||
return value_type{};
|
||||
}
|
||||
|
||||
template <class T>
|
||||
auto
|
||||
STObject::Proxy<T>::operator*() const -> value_type
|
||||
{
|
||||
return this->value();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T const*
|
||||
STObject::Proxy<T>::operator->() const
|
||||
{
|
||||
return this->find();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T const*
|
||||
STObject::Proxy<T>::find() const
|
||||
@@ -790,13 +815,6 @@ STObject::OptionalProxy<T>::operator bool() const noexcept
|
||||
return engaged();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
auto
|
||||
STObject::OptionalProxy<T>::operator*() const -> value_type
|
||||
{
|
||||
return this->value();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
STObject::OptionalProxy<T>::operator typename STObject::OptionalProxy<
|
||||
T>::optional_type() const
|
||||
|
||||
Reference in New Issue
Block a user