本文整理汇总了C++中json::value::append方法的典型用法代码示例。如果您正苦于以下问题:C++ value::append方法的具体用法?C++ value::append怎么用?C++ value::append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类json::value
的用法示例。
在下文中一共展示了value::append方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addline
void addline (json::value& jsonlines, ripplestate const& line, ledger::pointer ledger)
{
stamount sabalance (line.getbalance ());
stamount const& salimit (line.getlimit ());
stamount const& salimitpeer (line.getlimitpeer ());
json::value& jpeer (jsonlines.append (json::objectvalue));
jpeer[jss::account] = to_string (line.getaccountidpeer ());
if (assetcurrency() == sabalance.getcurrency()) {
// calculate released & reserved balance for asset.
auto lpledger = std::make_shared<ledger> (std::ref (*ledger), false);
ledgerentryset les(lpledger, tapnone);
auto sleripplestate = les.entrycache(ltripple_state, getripplestateindex(line.getaccountid(), line.getaccountidpeer(), assetcurrency()));
les.assetrelease(line.getaccountid(), line.getaccountidpeer(), assetcurrency(), sleripplestate);
stamount reserve = sleripplestate->getfieldamount(sfreserve);
stamount balance = sleripplestate->getfieldamount(sfbalance);
if (line.getaccountid() == sleripplestate->getfieldamount(sfhighlimit).getissuer()) {
reserve.negate();
balance.negate();
}
jpeer[jss::reserve] = reserve.gettext();
jpeer[jss::balance] = balance.gettext();
} else {
// amount reported is positive if current account holds other
// account's ious.
//
// amount reported is negative if other account holds current
// account's ious.
jpeer[jss::balance] = sabalance.gettext();
}
jpeer[jss::currency] = sabalance.gethumancurrency ();
jpeer[jss::limit] = salimit.gettext ();
jpeer[jss::limit_peer] = salimitpeer.gettext ();
jpeer[jss::quality_in]
= static_cast<json::uint> (line.getqualityin ());
jpeer[jss::quality_out]
= static_cast<json::uint> (line.getqualityout ());
if (line.getauth ())
jpeer[jss::authorized] = true;
if (line.getauthpeer ())
jpeer[jss::peer_authorized] = true;
if (line.getnoripple ())
jpeer[jss::no_ripple] = true;
if (line.getnoripplepeer ())
jpeer[jss::no_ripple_peer] = true;
if (line.getfreeze ())
jpeer[jss::freeze] = true;
if (line.getfreezepeer ())
jpeer[jss::freeze_peer] = true;
}