mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Ability to compare serialized types.
This commit is contained in:
@@ -31,6 +31,12 @@ std::string STUInt8::getText() const
|
||||
return boost::lexical_cast<std::string>(value);
|
||||
}
|
||||
|
||||
bool STUInt8::isEquivalent(const SerializedType& t) const
|
||||
{
|
||||
const STUInt8* v=dynamic_cast<const STUInt8*>(&t);
|
||||
return v && (value==v->value);
|
||||
}
|
||||
|
||||
STUInt16* STUInt16::construct(SerializerIterator& u, const char *name)
|
||||
{
|
||||
return new STUInt16(name, u.get16());
|
||||
@@ -41,8 +47,14 @@ std::string STUInt16::getText() const
|
||||
return boost::lexical_cast<std::string>(value);
|
||||
}
|
||||
|
||||
STUInt32* STUInt32::construct(SerializerIterator& u, const char *name)
|
||||
bool STUInt16::isEquivalent(const SerializedType& t) const
|
||||
{
|
||||
const STUInt16* v=dynamic_cast<const STUInt16*>(&t);
|
||||
return v && (value==v->value);
|
||||
}
|
||||
|
||||
STUInt32* STUInt32::construct(SerializerIterator& u, const char *name)
|
||||
{
|
||||
return new STUInt32(name, u.get32());
|
||||
}
|
||||
|
||||
@@ -51,6 +63,12 @@ std::string STUInt32::getText() const
|
||||
return boost::lexical_cast<std::string>(value);
|
||||
}
|
||||
|
||||
bool STUInt32::isEquivalent(const SerializedType& t) const
|
||||
{
|
||||
const STUInt32* v=dynamic_cast<const STUInt32*>(&t);
|
||||
return v && (value==v->value);
|
||||
}
|
||||
|
||||
STUInt64* STUInt64::construct(SerializerIterator& u, const char *name)
|
||||
{
|
||||
return new STUInt64(name, u.get64());
|
||||
@@ -61,6 +79,12 @@ std::string STUInt64::getText() const
|
||||
return boost::lexical_cast<std::string>(value);
|
||||
}
|
||||
|
||||
bool STUInt64::isEquivalent(const SerializedType& t) const
|
||||
{
|
||||
const STUInt64* v=dynamic_cast<const STUInt64*>(&t);
|
||||
return v && (value==v->value);
|
||||
}
|
||||
|
||||
STHash128* STHash128::construct(SerializerIterator& u, const char *name)
|
||||
{
|
||||
return new STHash128(name, u.get128());
|
||||
@@ -71,6 +95,12 @@ std::string STHash128::getText() const
|
||||
return value.GetHex();
|
||||
}
|
||||
|
||||
bool STHash128::isEquivalent(const SerializedType& t) const
|
||||
{
|
||||
const STHash128* v=dynamic_cast<const STHash128*>(&t);
|
||||
return v && (value==v->value);
|
||||
}
|
||||
|
||||
STHash160* STHash160::construct(SerializerIterator& u, const char *name)
|
||||
{
|
||||
return new STHash160(name, u.get160());
|
||||
@@ -81,6 +111,12 @@ std::string STHash160::getText() const
|
||||
return value.GetHex();
|
||||
}
|
||||
|
||||
bool STHash160::isEquivalent(const SerializedType& t) const
|
||||
{
|
||||
const STHash160* v=dynamic_cast<const STHash160*>(&t);
|
||||
return v && (value==v->value);
|
||||
}
|
||||
|
||||
STHash256* STHash256::construct(SerializerIterator& u, const char *name)
|
||||
{
|
||||
return new STHash256(name, u.get256());
|
||||
@@ -91,6 +127,12 @@ std::string STHash256::getText() const
|
||||
return value.GetHex();
|
||||
}
|
||||
|
||||
bool STHash256::isEquivalent(const SerializedType& t) const
|
||||
{
|
||||
const STHash256* v=dynamic_cast<const STHash256*>(&t);
|
||||
return v && (value==v->value);
|
||||
}
|
||||
|
||||
static std::string hex(const std::vector<unsigned char>& value)
|
||||
{
|
||||
int dlen=value.size(), i=0;
|
||||
@@ -115,6 +157,12 @@ int STVariableLength::getLength() const
|
||||
return Serializer::encodeLengthLength(value.size()) + value.size();
|
||||
}
|
||||
|
||||
bool STVariableLength::isEquivalent(const SerializedType& t) const
|
||||
{
|
||||
const STVariableLength* v=dynamic_cast<const STVariableLength*>(&t);
|
||||
return v && (value==v->value);
|
||||
}
|
||||
|
||||
std::string STAccount::getText() const
|
||||
{
|
||||
uint160 u;
|
||||
@@ -177,4 +225,8 @@ int STTaggedList::getLength() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool STTaggedList::isEquivalent(const SerializedType& t) const
|
||||
{
|
||||
const STTaggedList* v=dynamic_cast<const STTaggedList*>(&t);
|
||||
return v && (value==v->value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user