Replace LEDGER_JSON_ macros with an enum.

This commit is contained in:
Tom Ritchford
2015-02-24 11:31:15 -05:00
parent fc661c83ef
commit ac228deeda
4 changed files with 11 additions and 14 deletions

View File

@@ -928,7 +928,7 @@ Ledger::pointer Ledger::getSQL (std::string const& sql)
{
WriteLog (lsERROR, Ledger) << "Failed on ledger";
Json::Value p;
addJson (p, {*ret, LEDGER_JSON_FULL});
addJson (p, {*ret, LedgerFill::full});
WriteLog (lsERROR, Ledger) << p;
}

View File

@@ -49,11 +49,6 @@ enum LedgerStateParms
lepERROR = 32, // error
};
#define LEDGER_JSON_DUMP_TXRP 0x1
#define LEDGER_JSON_DUMP_STATE 0x2
#define LEDGER_JSON_EXPAND 0x4
#define LEDGER_JSON_FULL 0x8
class SqliteStatement;
// VFALCO TODO figure out exactly how this thing works.

View File

@@ -43,6 +43,8 @@ struct LedgerFill
{
}
enum Options {dumpTxrp = 1, dumpState = 2, expand = 4, full = 8};
Ledger const& ledger;
int options;
RPC::Yield yield;
@@ -71,8 +73,8 @@ void fillJson (Object& json, LedgerFill const& fill)
{
auto const& ledger = fill.ledger;
bool const bFull (fill.options & LEDGER_JSON_FULL);
bool const bExpand (fill.options & LEDGER_JSON_EXPAND);
bool const bFull (fill.options & LedgerFill::full);
bool const bExpand (fill.options & LedgerFill::expand);
// DEPRECATED
json[jss::seqNum] = to_string (ledger.getLedgerSeq());
@@ -114,7 +116,7 @@ void fillJson (Object& json, LedgerFill const& fill)
}
auto &transactionMap = ledger.peekTransactionMap();
if (transactionMap && (bFull || fill.options & LEDGER_JSON_DUMP_TXRP))
if (transactionMap && (bFull || fill.options & LedgerFill::dumpTxrp))
{
auto&& txns = RPC::addArray (json, jss::transactions);
SHAMapTreeNode::TNType type;
@@ -159,7 +161,7 @@ void fillJson (Object& json, LedgerFill const& fill)
}
auto& accountStateMap = ledger.peekAccountStateMap();
if (accountStateMap && (bFull || fill.options & LEDGER_JSON_DUMP_STATE))
if (accountStateMap && (bFull || fill.options & LedgerFill::dumpState))
{
auto&& array = RPC::addArray (json, jss::accountState);
RPC::CountedYield count (

View File

@@ -49,10 +49,10 @@ Status LedgerHandler::check ()
bool bAccounts = params[jss::accounts].asBool();
bool bExpand = params[jss::expand].asBool();
options_ = (bFull ? LEDGER_JSON_FULL : 0)
| (bExpand ? LEDGER_JSON_EXPAND : 0)
| (bTransactions ? LEDGER_JSON_DUMP_TXRP : 0)
| (bAccounts ? LEDGER_JSON_DUMP_STATE : 0);
options_ = (bFull ? LedgerFill::full : 0)
| (bExpand ? LedgerFill::expand : 0)
| (bTransactions ? LedgerFill::dumpTxrp : 0)
| (bAccounts ? LedgerFill::dumpState : 0);
if (bFull || bAccounts)
{