Esempio n. 1
0
void addLine (Json::Value& jsonLines, RippleState const& line)
{
    STAmount const& 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 ());
    // 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] = to_string (saBalance.issue ().currency);
    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;
}