20#include <xrpl/basics/Log.h>
21#include <xrpl/basics/StringUtilities.h>
22#include <xrpl/basics/contract.h>
23#include <xrpl/basics/strHex.h>
24#include <xrpl/protocol/STPathSet.h>
25#include <xrpl/protocol/jss.h>
41 hash_account += (hash_account * 257) ^ x;
44 hash_currency += (hash_currency * 509) ^ x;
47 hash_issuer += (hash_issuer * 911) ^ x;
49 return (hash_account ^ hash_currency ^ hash_issuer);
57 int iType = sit.
get8();
64 JLOG(
debugLog().error()) <<
"Empty path in pathset";
65 Throw<std::runtime_error>(
"empty path");
77 <<
"Bad path element " << iType <<
" in pathset";
78 Throw<std::runtime_error>(
"bad path element");
99 path.emplace_back(account, currency, issuer, hasCurrency);
113 return emplace(n, buf, std::move(*
this));
119 value.push_back(base);
126 while (++it !=
value.rend())
147 return value.empty();
156 for (
auto& p :
mPath)
158 if (p.getAccountID() == account && p.getCurrency() == currency &&
159 p.getIssuerID() == issuer)
171 for (
auto it :
mPath)
174 auto const iType = it.getNodeType();
176 elem[jss::type] = iType;
179 elem[jss::account] =
to_string(it.getAccountID());
182 elem[jss::currency] =
to_string(it.getCurrency());
185 elem[jss::issuer] =
to_string(it.getIssuerID());
197 for (
auto it :
value)
198 ret.
append(it.getJson(options));
213 getFName().isBinary(),
"ripple::STPathSet::add : field is binary");
215 getFName().fieldType == STI_PATHSET,
216 "ripple::STPathSet::add : valid field type");
219 for (
auto const& spPath :
value)
224 for (
auto const& speElement : spPath)
226 int iType = speElement.getNodeType();
Value & append(const Value &value)
Append value to array at the end.
A type which can be exported to a well known binary format.
SField const & getFName() const
static STBase * emplace(std::size_t n, void *buf, T &&val)
Currency const & getCurrency() const
static std::size_t get_hash(STPathElement const &element)
AccountID const & getAccountID() const
AccountID const & getIssuerID() const
STBase * move(std::size_t n, void *buf) override
bool isDefault() const override
std::vector< STPath > value
STBase * copy(std::size_t n, void *buf) const override
void push_back(STPath const &e)
bool assembleAdd(STPath const &base, STPathElement const &tail)
Json::Value getJson(JsonOptions) const override
bool isEquivalent(const STBase &t) const override
SerializedTypeID getSType() const override
void add(Serializer &s) const override
std::vector< STPathElement > mPath
Json::Value getJson(JsonOptions) const
void push_back(STPathElement const &e)
bool hasSeen(AccountID const &account, Currency const ¤cy, AccountID const &issuer) const
int addBitString(base_uint< Bits, Tag > const &v)
int add8(unsigned char i)
@ arrayValue
array value (ordered list)
@ objectValue
object value (collection of name/value pairs).
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
beast::Journal debugLog()
Returns a debug journal.
std::string to_string(base_uint< Bits, Tag > const &a)
Note, should be treated as flags that can be | and &.