From 1842878c401da2c1a3a93fa22578d82d719b1135 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Thu, 27 Aug 2015 09:23:09 -0700 Subject: [PATCH] Tidy up STPathElement constructor --- src/ripple/protocol/STPathSet.h | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/ripple/protocol/STPathSet.h b/src/ripple/protocol/STPathSet.h index c1d3c1c9e..82d4f3197 100644 --- a/src/ripple/protocol/STPathSet.h +++ b/src/ripple/protocol/STPathSet.h @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include namespace ripple { @@ -48,6 +50,40 @@ private: get_hash (STPathElement const& element); public: + STPathElement( + boost::optional const& account, + boost::optional const& currency, + boost::optional 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 ( AccountID const& account, Currency const& currency, AccountID const& issuer, bool forceCurrency = false)