mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-19 18:45:52 +00:00
Introduce MPT support (XLS-33d): (#5143)
Amendment: - MPTokensV1 New Transactions: - MPTokenIssuanceCreate - MPTokenIssuanceDestroy - MPTokenIssuanceSet - MPTokenAuthorize Modified Transactions: - Payment - Clawback New Objects: - MPTokenIssuance - MPToken API updates: - ledger_entry - account_objects - ledger_data Other: - Add += and -= operators to ValueProxy Read full spec: https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0033d-multi-purpose-tokens --------- Co-authored-by: Shawn Xie <shawnxie920@gmail.com> Co-authored-by: Howard Hinnant <howard.hinnant@gmail.com> Co-authored-by: Ed Hennis <ed@ripple.com> Co-authored-by: John Freeman <jfreeman08@gmail.com>
This commit is contained in:
committed by
GitHub
parent
63209c2646
commit
23c37fa506
@@ -226,6 +226,8 @@ public:
|
||||
|
||||
uint160
|
||||
getFieldH160(SField const& field) const;
|
||||
uint192
|
||||
getFieldH192(SField const& field) const;
|
||||
uint256
|
||||
getFieldH256(SField const& field) const;
|
||||
AccountID
|
||||
@@ -498,6 +500,11 @@ protected:
|
||||
assign(U&& u);
|
||||
};
|
||||
|
||||
// Constraint += and -= ValueProxy operators
|
||||
// to value types that support arithmetic operations
|
||||
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>
|
||||
{
|
||||
@@ -513,6 +520,16 @@ public:
|
||||
std::enable_if_t<std::is_assignable_v<T, U>, ValueProxy&>
|
||||
operator=(U&& u);
|
||||
|
||||
// Convenience operators for value types supporting
|
||||
// arithmetic operations
|
||||
template <IsArithmetic U>
|
||||
ValueProxy&
|
||||
operator+=(U const& u);
|
||||
|
||||
template <IsArithmetic U>
|
||||
ValueProxy&
|
||||
operator-=(U const& u);
|
||||
|
||||
operator value_type() const;
|
||||
|
||||
private:
|
||||
@@ -731,6 +748,24 @@ STObject::ValueProxy<T>::operator=(U&& u)
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <IsArithmetic U>
|
||||
STObject::ValueProxy<T>&
|
||||
STObject::ValueProxy<T>::operator+=(U const& u)
|
||||
{
|
||||
this->assign(this->value() + u);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <IsArithmetic U>
|
||||
STObject::ValueProxy<T>&
|
||||
STObject::ValueProxy<T>::operator-=(U const& u)
|
||||
{
|
||||
this->assign(this->value() - u);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
STObject::ValueProxy<T>::operator value_type() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user