From 228b36d734179367721b657545561ae7bfd07403 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Thu, 22 Mar 2012 15:45:22 -0700 Subject: [PATCH] STUObject->STObject --- src/SerializedObject.cpp | 14 +++++++------- src/SerializedObject.h | 14 ++++++++------ src/SerializedTransaction.h | 11 ++++++----- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/SerializedObject.cpp b/src/SerializedObject.cpp index e9805ed832..e6f88cffc0 100644 --- a/src/SerializedObject.cpp +++ b/src/SerializedObject.cpp @@ -1,13 +1,13 @@ #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) { type.push_back(elem); 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) { 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; 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; if(name!=NULL) @@ -118,7 +118,7 @@ std::string STUObject::getFullText() const return ret; } -int STUObject::getLength() const +int STObject::getLength() const { int ret=0; for(boost::ptr_vector::const_iterator it=data.begin(), end=data.end(); it!=end; ++it) @@ -126,13 +126,13 @@ int STUObject::getLength() const return ret; } -void STUObject::add(Serializer& s) const +void STObject::add(Serializer& s) const { for(boost::ptr_vector::const_iterator it=data.begin(), end=data.end(); it!=end; ++it) it->add(s); } -std::string STUObject::getText() const +std::string STObject::getText() const { std::string ret="{"; bool first=false; diff --git a/src/SerializedObject.h b/src/SerializedObject.h index a0f8c3413e..8480fe7750 100644 --- a/src/SerializedObject.h +++ b/src/SerializedObject.h @@ -20,21 +20,21 @@ struct SOElement int e_flags; }; -class STUObject : public SerializedType +class STObject : public SerializedType { protected: boost::ptr_vector data; std::vector type; public: - STUObject(const char *n=NULL) : SerializedType(n) { ; } - STUObject(SOElement *t, const char *n=NULL); - STUObject(SOElement *t, SerializerIterator& u, const char *n=NULL); - virtual ~STUObject() { ; } + STObject(const char *n=NULL) : SerializedType(n) { ; } + STObject(SOElement *t, const char *n=NULL); + STObject(SOElement *t, SerializerIterator& u, const char *n=NULL); + virtual ~STObject() { ; } int getLength() const; 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; std::string getFullText() const; @@ -48,6 +48,8 @@ public: int getCount() const { return data.size(); } const SerializedType& peekAt(int offset) const { 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]); } }; diff --git a/src/SerializedTransaction.h b/src/SerializedTransaction.h index d5cc95e2be..b971d82aea 100644 --- a/src/SerializedTransaction.h +++ b/src/SerializedTransaction.h @@ -7,25 +7,25 @@ #include "SerializedObject.h" #include "TransactionFormats.h" -class SerializedTransaction : public STUObject +class SerializedTransaction : public STObject { protected: TransactionType type; STVariableLength mSignature; - STUObject mMiddleTxn, mInnerTxn; + STObject mMiddleTxn, mInnerTxn; TransactionFormat* mFormat; public: SerializedTransaction(SerializerIterator&, int length); SerializedTransaction(TransactionType type); - // STUObject functions + // STObject functions int getLength() const; SerializedTypeID getType() const { return STI_TRANSACTION; } SerializedTransaction* duplicate() const { return new SerializedTransaction(*this); } std::string getFullText() const; std::string getText() const; - void add(Serializer& s) const; + void add(Serializer& s) const { getTransaction(s, true); } // outer transaction functions / signature functions std::vector getSignature() const; @@ -57,7 +57,8 @@ public: void makeITFieldPresent(int index); // whole transaction functions - int getTransaction(Serializer& s, bool include_length); + int getTransaction(Serializer& s, bool include_length) const; + uint256 getTransactionID() const; }; #endif