mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Type json improvements
This commit is contained in:
@@ -86,13 +86,18 @@ LedgerEntryFormat LedgerFormats[]=
|
||||
{ NULL, ltINVALID }
|
||||
};
|
||||
|
||||
|
||||
LedgerEntryFormat* getLgrFormat(LedgerEntryType t)
|
||||
{
|
||||
return getLgrFormat(t);
|
||||
}
|
||||
|
||||
LedgerEntryFormat* getLgrFormat(int t)
|
||||
{
|
||||
LedgerEntryFormat* f = LedgerFormats;
|
||||
while (f->t_name != NULL)
|
||||
{
|
||||
if (f->t_type == t) return f;
|
||||
if (f->t_type == t)
|
||||
return f;
|
||||
++f;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
@@ -48,5 +48,6 @@ struct LedgerEntryFormat
|
||||
|
||||
extern LedgerEntryFormat LedgerFormats[];
|
||||
extern LedgerEntryFormat* getLgrFormat(LedgerEntryType t);
|
||||
extern LedgerEntryFormat* getLgrFormat(int t);
|
||||
#endif
|
||||
// vim:ts=4
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "SerializedTypes.h"
|
||||
#include "SerializedObject.h"
|
||||
#include "TransactionFormats.h"
|
||||
#include "LedgerFormats.h"
|
||||
#include "FieldNames.h"
|
||||
#include "Log.h"
|
||||
#include "NewcoinAddress.h"
|
||||
#include "utils.h"
|
||||
@@ -50,6 +52,18 @@ STUInt16* STUInt16::construct(SerializerIterator& u, SField::ref name)
|
||||
|
||||
std::string STUInt16::getText() const
|
||||
{
|
||||
if (getFName() == sfLedgerEntryType)
|
||||
{
|
||||
LedgerEntryFormat *f = getLgrFormat(value);
|
||||
if (f != NULL)
|
||||
return f->t_name;
|
||||
}
|
||||
if (getFName() == sfTransactionType)
|
||||
{
|
||||
TransactionFormat *f = getTxnFormat(value);
|
||||
if (f != NULL)
|
||||
return f->t_name;
|
||||
}
|
||||
return boost::lexical_cast<std::string>(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -100,14 +100,20 @@ TransactionFormat InnerTxnFormats[]=
|
||||
{ NULL, ttINVALID }
|
||||
};
|
||||
|
||||
TransactionFormat* getTxnFormat(TransactionType t)
|
||||
TransactionFormat* getTxnFormat(TransactionType t)
|
||||
{
|
||||
TransactionFormat* f = InnerTxnFormats;
|
||||
while (f->t_name != NULL)
|
||||
return getTxnFormat(t);
|
||||
}
|
||||
|
||||
TransactionFormat* getTxnFormat(int t)
|
||||
{
|
||||
TransactionFormat* f = InnerTxnFormats;
|
||||
while (f->t_name != NULL)
|
||||
{
|
||||
if (f->t_type == t) return f;
|
||||
if (f->t_type == t)
|
||||
return f;
|
||||
++f;
|
||||
}
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
// vim:ts=4
|
||||
|
||||
@@ -46,5 +46,6 @@ const uint32 tfNoRippleDirect = 0x00080000;
|
||||
|
||||
extern TransactionFormat InnerTxnFormats[];
|
||||
extern TransactionFormat* getTxnFormat(TransactionType t);
|
||||
extern TransactionFormat* getTxnFormat(int t);
|
||||
#endif
|
||||
// vim:ts=4
|
||||
|
||||
Reference in New Issue
Block a user