mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
STUObject->STObject
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
|
|
||||||
#include "SerializedObject.h"
|
#include "SerializedObject.h"
|
||||||
|
|
||||||
STUObject::STUObject(SOElement* elem, const char *name) : SerializedType(name)
|
STObject::STObject(SOElement* elem, const char *name) : SerializedType(name)
|
||||||
{
|
{
|
||||||
while(elem->e_id!=STI_DONE)
|
while(elem->e_id!=STI_DONE)
|
||||||
{
|
{
|
||||||
type.push_back(elem);
|
type.push_back(elem);
|
||||||
if( (elem->e_type==SOE_IFFLAG) || (elem->e_type==SOE_IFNFLAG) )
|
if( (elem->e_type==SOE_IFFLAG) || (elem->e_type==SOE_IFNFLAG) )
|
||||||
giveObject(new STUObject(elem->e_name));
|
giveObject(new STObject(elem->e_name));
|
||||||
else switch(elem->e_id)
|
else switch(elem->e_id)
|
||||||
{
|
{
|
||||||
case STI_UINT16:
|
case STI_UINT16:
|
||||||
@@ -42,7 +42,7 @@ STUObject::STUObject(SOElement* elem, const char *name) : SerializedType(name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
STUObject::STUObject(SOElement* elem, SerializerIterator& sit, const char *name) : SerializedType(name)
|
STObject::STObject(SOElement* elem, SerializerIterator& sit, const char *name) : SerializedType(name)
|
||||||
{
|
{
|
||||||
int flags=-1;
|
int flags=-1;
|
||||||
while(elem->e_id!=STI_DONE)
|
while(elem->e_id!=STI_DONE)
|
||||||
@@ -103,7 +103,7 @@ STUObject::STUObject(SOElement* elem, SerializerIterator& sit, const char *name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string STUObject::getFullText() const
|
std::string STObject::getFullText() const
|
||||||
{
|
{
|
||||||
std::string ret;
|
std::string ret;
|
||||||
if(name!=NULL)
|
if(name!=NULL)
|
||||||
@@ -118,7 +118,7 @@ std::string STUObject::getFullText() const
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int STUObject::getLength() const
|
int STObject::getLength() const
|
||||||
{
|
{
|
||||||
int ret=0;
|
int ret=0;
|
||||||
for(boost::ptr_vector<SerializedType>::const_iterator it=data.begin(), end=data.end(); it!=end; ++it)
|
for(boost::ptr_vector<SerializedType>::const_iterator it=data.begin(), end=data.end(); it!=end; ++it)
|
||||||
@@ -126,13 +126,13 @@ int STUObject::getLength() const
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void STUObject::add(Serializer& s) const
|
void STObject::add(Serializer& s) const
|
||||||
{
|
{
|
||||||
for(boost::ptr_vector<SerializedType>::const_iterator it=data.begin(), end=data.end(); it!=end; ++it)
|
for(boost::ptr_vector<SerializedType>::const_iterator it=data.begin(), end=data.end(); it!=end; ++it)
|
||||||
it->add(s);
|
it->add(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string STUObject::getText() const
|
std::string STObject::getText() const
|
||||||
{
|
{
|
||||||
std::string ret="{";
|
std::string ret="{";
|
||||||
bool first=false;
|
bool first=false;
|
||||||
|
|||||||
@@ -20,21 +20,21 @@ struct SOElement
|
|||||||
int e_flags;
|
int e_flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
class STUObject : public SerializedType
|
class STObject : public SerializedType
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
boost::ptr_vector<SerializedType> data;
|
boost::ptr_vector<SerializedType> data;
|
||||||
std::vector<SOElement*> type;
|
std::vector<SOElement*> type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
STUObject(const char *n=NULL) : SerializedType(n) { ; }
|
STObject(const char *n=NULL) : SerializedType(n) { ; }
|
||||||
STUObject(SOElement *t, const char *n=NULL);
|
STObject(SOElement *t, const char *n=NULL);
|
||||||
STUObject(SOElement *t, SerializerIterator& u, const char *n=NULL);
|
STObject(SOElement *t, SerializerIterator& u, const char *n=NULL);
|
||||||
virtual ~STUObject() { ; }
|
virtual ~STObject() { ; }
|
||||||
|
|
||||||
int getLength() const;
|
int getLength() const;
|
||||||
SerializedTypeID getType() const { return STI_OBJECT; }
|
SerializedTypeID getType() const { return STI_OBJECT; }
|
||||||
STUObject* duplicate() const { return new STUObject(*this); }
|
STObject* duplicate() const { return new STObject(*this); }
|
||||||
|
|
||||||
void add(Serializer& s) const;
|
void add(Serializer& s) const;
|
||||||
std::string getFullText() const;
|
std::string getFullText() const;
|
||||||
@@ -48,6 +48,8 @@ public:
|
|||||||
int getCount() const { return data.size(); }
|
int getCount() const { return data.size(); }
|
||||||
const SerializedType& peekAt(int offset) const { return data[offset]; }
|
const SerializedType& peekAt(int offset) const { return data[offset]; }
|
||||||
SerializedType& getAt(int offset) { return data[offset]; }
|
SerializedType& getAt(int offset) { return data[offset]; }
|
||||||
|
const SerializedType* peekAtP(int offset) const { return &(data[offset]); }
|
||||||
|
SerializedType* getAtP(int offset) { return &(data[offset]); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,25 +7,25 @@
|
|||||||
#include "SerializedObject.h"
|
#include "SerializedObject.h"
|
||||||
#include "TransactionFormats.h"
|
#include "TransactionFormats.h"
|
||||||
|
|
||||||
class SerializedTransaction : public STUObject
|
class SerializedTransaction : public STObject
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
TransactionType type;
|
TransactionType type;
|
||||||
STVariableLength mSignature;
|
STVariableLength mSignature;
|
||||||
STUObject mMiddleTxn, mInnerTxn;
|
STObject mMiddleTxn, mInnerTxn;
|
||||||
TransactionFormat* mFormat;
|
TransactionFormat* mFormat;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SerializedTransaction(SerializerIterator&, int length);
|
SerializedTransaction(SerializerIterator&, int length);
|
||||||
SerializedTransaction(TransactionType type);
|
SerializedTransaction(TransactionType type);
|
||||||
|
|
||||||
// STUObject functions
|
// STObject functions
|
||||||
int getLength() const;
|
int getLength() const;
|
||||||
SerializedTypeID getType() const { return STI_TRANSACTION; }
|
SerializedTypeID getType() const { return STI_TRANSACTION; }
|
||||||
SerializedTransaction* duplicate() const { return new SerializedTransaction(*this); }
|
SerializedTransaction* duplicate() const { return new SerializedTransaction(*this); }
|
||||||
std::string getFullText() const;
|
std::string getFullText() const;
|
||||||
std::string getText() const;
|
std::string getText() const;
|
||||||
void add(Serializer& s) const;
|
void add(Serializer& s) const { getTransaction(s, true); }
|
||||||
|
|
||||||
// outer transaction functions / signature functions
|
// outer transaction functions / signature functions
|
||||||
std::vector<unsigned char> getSignature() const;
|
std::vector<unsigned char> getSignature() const;
|
||||||
@@ -57,7 +57,8 @@ public:
|
|||||||
void makeITFieldPresent(int index);
|
void makeITFieldPresent(int index);
|
||||||
|
|
||||||
// whole transaction functions
|
// whole transaction functions
|
||||||
int getTransaction(Serializer& s, bool include_length);
|
int getTransaction(Serializer& s, bool include_length) const;
|
||||||
|
uint256 getTransactionID() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user