mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
More ledger work:
Ledger::getAccountRoot LedgerStateParms SerializedLedgerEntry(const Serialier&..
This commit is contained in:
@@ -4,49 +4,62 @@
|
||||
SerializedLedgerEntry::SerializedLedgerEntry(SerializerIterator& sit, const uint256& index)
|
||||
: STObject("LedgerEntry"), mIndex(index)
|
||||
{
|
||||
uint16 type=sit.get16();
|
||||
mFormat=getLgrFormat(static_cast<LedgerEntryType>(type));
|
||||
if(mFormat==NULL) throw std::runtime_error("invalid ledger entry type");
|
||||
mType=mFormat->t_type;
|
||||
uint16 type = sit.get16();
|
||||
mFormat = getLgrFormat(static_cast<LedgerEntryType>(type));
|
||||
if (mFormat == NULL) throw std::runtime_error("invalid ledger entry type");
|
||||
mType = mFormat->t_type;
|
||||
mVersion.setValue(type);
|
||||
mObject=STObject(mFormat->elements, sit, "Entry");
|
||||
mObject = STObject(mFormat->elements, sit, "Entry");
|
||||
}
|
||||
|
||||
SerializedLedgerEntry::SerializedLedgerEntry(const Serializer& s, const uint256& index)
|
||||
: STObject("LedgerEntry"), mIndex(index)
|
||||
{
|
||||
SerializerIterator sit(s);
|
||||
|
||||
uint16 type = sit.get16();
|
||||
mFormat = getLgrFormat(static_cast<LedgerEntryType>(type));
|
||||
if (mFormat == NULL) throw std::runtime_error("invalid ledger entry type");
|
||||
mType = mFormat->t_type;
|
||||
mVersion.setValue(type);
|
||||
mObject = STObject(mFormat->elements, sit, "Entry");
|
||||
}
|
||||
|
||||
SerializedLedgerEntry::SerializedLedgerEntry(LedgerEntryType type) : STObject("LedgerEntry"), mType(type)
|
||||
{
|
||||
mFormat=getLgrFormat(type);
|
||||
if(mFormat==NULL) throw std::runtime_error("invalid ledger entry type");
|
||||
mFormat = getLgrFormat(type);
|
||||
if (mFormat == NULL) throw std::runtime_error("invalid ledger entry type");
|
||||
mVersion.setValue(static_cast<uint16>(mFormat->t_type));
|
||||
mObject=STObject(mFormat->elements, "Entry");
|
||||
mObject = STObject(mFormat->elements, "Entry");
|
||||
}
|
||||
|
||||
std::string SerializedLedgerEntry::getFullText() const
|
||||
{
|
||||
std::string ret="\"";
|
||||
ret+=mIndex.GetHex();
|
||||
ret+="\" = { ";
|
||||
ret+=mFormat->t_name;
|
||||
ret+=", ";
|
||||
ret+=mObject.getFullText();
|
||||
ret+="}";
|
||||
std::string ret = "\"";
|
||||
ret += mIndex.GetHex();
|
||||
ret += "\" = { ";
|
||||
ret += mFormat->t_name;
|
||||
ret += ", ";
|
||||
ret += mObject.getFullText();
|
||||
ret += "}";
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string SerializedLedgerEntry::getText() const
|
||||
{
|
||||
std::string ret="{";
|
||||
ret+=mIndex.GetHex();
|
||||
ret+=mVersion.getText();
|
||||
ret+=mObject.getText();
|
||||
ret+="}";
|
||||
std::string ret = "{";
|
||||
ret += mIndex.GetHex();
|
||||
ret += mVersion.getText();
|
||||
ret += mObject.getText();
|
||||
ret += "}";
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool SerializedLedgerEntry::isEquivalent(const SerializedType& t) const
|
||||
{ // locators are not compared
|
||||
const SerializedLedgerEntry* v=dynamic_cast<const SerializedLedgerEntry*>(&t);
|
||||
if(!v) return false;
|
||||
if(mType != v->mType) return false;
|
||||
if(mObject != v->mObject) return false;
|
||||
const SerializedLedgerEntry* v = dynamic_cast<const SerializedLedgerEntry*>(&t);
|
||||
if (!v) return false;
|
||||
if (mType != v->mType) return false;
|
||||
if (mObject != v->mObject) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user