本文整理汇总了C++中sle::pointer::add方法的典型用法代码示例。如果您正苦于以下问题:C++ pointer::add方法的具体用法?C++ pointer::add怎么用?C++ pointer::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sle::pointer
的用法示例。
在下文中一共展示了pointer::add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doLedgerEntry
//.........这里部分代码省略.........
na0Public.setAccountPublic (naGenerator, 0);
uNodeIndex = Ledger::getGeneratorIndex (na0Public.getAccountID ());
}
}
else if (params.isMember ("offer"))
{
RippleAddress naAccountID;
if (!params["offer"].isObject ())
{
uNodeIndex.SetHex (params["offer"].asString ());
}
else if (!params["offer"].isMember ("account")
|| !params["offer"].isMember ("seq")
|| !params["offer"]["seq"].isIntegral ())
{
jvResult["error"] = "malformedRequest";
}
else if (!naAccountID.setAccountID (params["offer"]["account"].asString ()))
{
jvResult["error"] = "malformedAddress";
}
else
{
std::uint32_t uSequence = params["offer"]["seq"].asUInt ();
uNodeIndex = Ledger::getOfferIndex (naAccountID.getAccountID (), uSequence);
}
}
else if (params.isMember ("ripple_state"))
{
RippleAddress naA;
RippleAddress naB;
uint160 uCurrency;
Json::Value jvRippleState = params["ripple_state"];
if (!jvRippleState.isObject ()
|| !jvRippleState.isMember ("currency")
|| !jvRippleState.isMember ("accounts")
|| !jvRippleState["accounts"].isArray ()
|| 2 != jvRippleState["accounts"].size ()
|| !jvRippleState["accounts"][0u].isString ()
|| !jvRippleState["accounts"][1u].isString ()
|| jvRippleState["accounts"][0u].asString () == jvRippleState["accounts"][1u].asString ()
)
{
jvResult["error"] = "malformedRequest";
}
else if (!naA.setAccountID (jvRippleState["accounts"][0u].asString ())
|| !naB.setAccountID (jvRippleState["accounts"][1u].asString ()))
{
jvResult["error"] = "malformedAddress";
}
else if (!STAmount::currencyFromString (uCurrency, jvRippleState["currency"].asString ()))
{
jvResult["error"] = "malformedCurrency";
}
else
{
uNodeIndex = Ledger::getRippleStateIndex (naA, naB, uCurrency);
}
}
else
{
jvResult["error"] = "unknownOption";
}
if (uNodeIndex.isNonZero ())
{
SLE::pointer sleNode = mNetOps->getSLEi (lpLedger, uNodeIndex);
if (params.isMember("binary"))
bNodeBinary = params["binary"].asBool();
if (!sleNode)
{
// Not found.
// XXX Should also provide proof.
jvResult["error"] = "entryNotFound";
}
else if (bNodeBinary)
{
// XXX Should also provide proof.
Serializer s;
sleNode->add (s);
jvResult["node_binary"] = strHex (s.peekData ());
jvResult["index"] = uNodeIndex.ToString ();
}
else
{
jvResult["node"] = sleNode->getJson (0);
jvResult["index"] = uNodeIndex.ToString ();
}
}
return jvResult;
}