Make this code easier to debug.

This commit is contained in:
JoelKatz
2013-03-06 03:52:56 -08:00
parent 7e6e42e9d3
commit aa2503081e
6 changed files with 29 additions and 0 deletions

View File

@@ -49,4 +49,12 @@ void AccountItems::fillItems(const uint160& accountID, Ledger::ref ledger)
}
}
Json::Value AccountItems::getJson(int v)
{
Json::Value ret(Json::arrayValue);
BOOST_FOREACH(AccountItem::ref ai, mItems)
ret.append(ai->getJson(v));
return ret;
}
// vim:ts=4

View File

@@ -20,6 +20,7 @@ public:
virtual ~AccountItem() { ; }
virtual AccountItem::pointer makeItem(const uint160& accountID, SerializedLedgerEntry::ref ledgerEntry)=0;
virtual LedgerEntryType getType()=0;
virtual Json::Value getJson(int)=0;
SerializedLedgerEntry::pointer getSLE() { return mLedgerEntry; }
const SerializedLedgerEntry& peekSLE() const { return *mLedgerEntry; }
@@ -41,6 +42,7 @@ public:
AccountItems(const uint160& accountID, Ledger::ref ledger, AccountItem::pointer ofType);
std::vector<AccountItem::pointer>& getItems() { return(mItems); }
Json::Value getJson(int);
};
#endif

View File

@@ -15,4 +15,13 @@ Offer::Offer(SerializedLedgerEntry::pointer ledgerEntry) : AccountItem(ledgerEnt
mSeq = mLedgerEntry->getFieldU32(sfSequence);
}
Json::Value Offer::getJson(int)
{
Json::Value ret(Json::objectValue);
ret["account"] = mAccount.humanAccountID();
ret["taker_gets"] = getTakerGets().getFullText();
ret["taker_pays"] = getTakerPays().getFullText();
return ret;
}
// vim:ts=4

View File

@@ -19,6 +19,7 @@ public:
STAmount getTakerGets(){ return(mTakerGets); }
RippleAddress getAccount(){ return(mAccount); }
int getSeq(){ return(mSeq); }
Json::Value getJson(int);
};

View File

@@ -44,4 +44,12 @@ void RippleState::setViewAccount(const uint160& accountID)
}
}
Json::Value RippleState::getJson(int)
{
Json::Value ret(Json::objectValue);
ret["low_id"] = mLowID.GetHex();
ret["high_id"] = mHighID.GetHex();
return ret;
}
// vim:ts=4

View File

@@ -63,6 +63,7 @@ public:
SerializedLedgerEntry::pointer getSLE() { return mLedgerEntry; }
const SerializedLedgerEntry& peekSLE() const { return *mLedgerEntry; }
SerializedLedgerEntry& peekSLE() { return *mLedgerEntry; }
Json::Value getJson(int);
std::vector<unsigned char> getRaw() const;
};