Add getRaw for vector and addZeros to Serializer.

This commit is contained in:
Arthur Britto
2012-05-19 18:15:12 -07:00
parent a823aa950e
commit 230ee34b24
2 changed files with 22 additions and 0 deletions

View File

@@ -4,6 +4,16 @@
#include <openssl/ripemd.h>
#include <openssl/sha.h>
int Serializer::addZeros(size_t uBytes)
{
int ret = mData.size();
while (uBytes--)
mData.push_back(0);
return ret;
}
int Serializer::add16(uint16 i)
{
int ret = mData.size();
@@ -574,4 +584,13 @@ std::vector<TaggedListItem> SerializerIterator::getTaggedList()
mPos += length;
return tl;
}
std::vector<unsigned char> SerializerIterator::getRaw(int iLength)
{
int iPos = mPos;
mPos += iLength;
return mSerializer.getRaw(iPos, iLength);
}
// vim:ts=4

View File

@@ -36,6 +36,7 @@ class Serializer
int addRaw(const std::vector<unsigned char> &vector);
int addRaw(const void *ptr, int len);
int addRaw(const Serializer& s);
int addZeros(size_t uBytes);
int addVL(const std::vector<unsigned char> &vector);
int addVL(const void *ptr, int len);
@@ -136,6 +137,8 @@ public:
uint160 get160();
uint256 get256();
std::vector<unsigned char> getRaw(int iLength);
std::vector<unsigned char> getVL();
std::vector<TaggedListItem> getTaggedList();
};