mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-01 08:25:51 +00:00
Tidy up STPathElement constructor
This commit is contained in:
committed by
Scott Schurr
parent
23f47adb60
commit
1842878c40
@@ -24,6 +24,8 @@
|
|||||||
#include <ripple/protocol/SField.h>
|
#include <ripple/protocol/SField.h>
|
||||||
#include <ripple/protocol/STBase.h>
|
#include <ripple/protocol/STBase.h>
|
||||||
#include <ripple/protocol/UintTypes.h>
|
#include <ripple/protocol/UintTypes.h>
|
||||||
|
#include <boost/optional.hpp>
|
||||||
|
#include <cassert>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
@@ -48,6 +50,40 @@ private:
|
|||||||
get_hash (STPathElement const& element);
|
get_hash (STPathElement const& element);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
STPathElement(
|
||||||
|
boost::optional<AccountID> const& account,
|
||||||
|
boost::optional<Currency> const& currency,
|
||||||
|
boost::optional<AccountID> const& issuer)
|
||||||
|
: mType (typeNone)
|
||||||
|
{
|
||||||
|
if (! account)
|
||||||
|
{
|
||||||
|
is_offer_ = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
is_offer_ = false;
|
||||||
|
mAccountID = *account;
|
||||||
|
mType |= typeAccount;
|
||||||
|
assert(mAccountID != noAccount());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currency)
|
||||||
|
{
|
||||||
|
mCurrencyID = *currency;
|
||||||
|
mType |= typeCurrency;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (issuer)
|
||||||
|
{
|
||||||
|
mIssuerID = *issuer;
|
||||||
|
mType |= typeIssuer;
|
||||||
|
assert(mIssuerID != noAccount());
|
||||||
|
}
|
||||||
|
|
||||||
|
hash_value_ = get_hash (*this);
|
||||||
|
}
|
||||||
|
|
||||||
STPathElement (
|
STPathElement (
|
||||||
AccountID const& account, Currency const& currency,
|
AccountID const& account, Currency const& currency,
|
||||||
AccountID const& issuer, bool forceCurrency = false)
|
AccountID const& issuer, bool forceCurrency = false)
|
||||||
|
|||||||
Reference in New Issue
Block a user