mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Remove dead code.
Use the protocol file to generate the STI_* constants.
This commit is contained in:
@@ -42,9 +42,6 @@ std::auto_ptr<SerializedType> STObject::makeDefaultObject(SerializedTypeID id, c
|
|||||||
case STI_VL:
|
case STI_VL:
|
||||||
return std::auto_ptr<SerializedType>(new STVariableLength(name));
|
return std::auto_ptr<SerializedType>(new STVariableLength(name));
|
||||||
|
|
||||||
case STI_TL:
|
|
||||||
return std::auto_ptr<SerializedType>(new STTaggedList(name));
|
|
||||||
|
|
||||||
case STI_ACCOUNT:
|
case STI_ACCOUNT:
|
||||||
return std::auto_ptr<SerializedType>(new STAccount(name));
|
return std::auto_ptr<SerializedType>(new STAccount(name));
|
||||||
|
|
||||||
@@ -91,9 +88,6 @@ std::auto_ptr<SerializedType> STObject::makeDeserializedObject(SerializedTypeID
|
|||||||
case STI_VL:
|
case STI_VL:
|
||||||
return STVariableLength::deserialize(sit, name);
|
return STVariableLength::deserialize(sit, name);
|
||||||
|
|
||||||
case STI_TL:
|
|
||||||
return STTaggedList::deserialize(sit, name);
|
|
||||||
|
|
||||||
case STI_ACCOUNT:
|
case STI_ACCOUNT:
|
||||||
return STAccount::deserialize(sit, name);
|
return STAccount::deserialize(sit, name);
|
||||||
|
|
||||||
@@ -476,17 +470,6 @@ std::vector<unsigned char> STObject::getValueFieldVL(SOE_Field field) const
|
|||||||
return cf->getValue();
|
return cf->getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<TaggedListItem> STObject::getValueFieldTL(SOE_Field field) const
|
|
||||||
{
|
|
||||||
const SerializedType* rf = peekAtPField(field);
|
|
||||||
if (!rf) throw std::runtime_error("Field not found");
|
|
||||||
SerializedTypeID id = rf->getSType();
|
|
||||||
if (id == STI_NOTPRESENT) return std::vector<TaggedListItem>(); // optional field not present
|
|
||||||
const STTaggedList *cf = dynamic_cast<const STTaggedList *>(rf);
|
|
||||||
if (!cf) throw std::runtime_error("Wrong field type");
|
|
||||||
return cf->getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
STAmount STObject::getValueFieldAmount(SOE_Field field) const
|
STAmount STObject::getValueFieldAmount(SOE_Field field) const
|
||||||
{
|
{
|
||||||
const SerializedType* rf = peekAtPField(field);
|
const SerializedType* rf = peekAtPField(field);
|
||||||
@@ -620,16 +603,6 @@ void STObject::setValueFieldVL(SOE_Field field, const std::vector<unsigned char>
|
|||||||
cf->setValue(v);
|
cf->setValue(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void STObject::setValueFieldTL(SOE_Field field, const std::vector<TaggedListItem>& v)
|
|
||||||
{
|
|
||||||
SerializedType* rf = getPField(field);
|
|
||||||
if (!rf) throw std::runtime_error("Field not found");
|
|
||||||
if (rf->getSType() == STI_NOTPRESENT) rf = makeFieldPresent(field);
|
|
||||||
STTaggedList* cf = dynamic_cast<STTaggedList*>(rf);
|
|
||||||
if (!cf) throw std::runtime_error("Wrong field type");
|
|
||||||
cf->setValue(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
void STObject::setValueFieldAmount(SOE_Field field, const STAmount &v)
|
void STObject::setValueFieldAmount(SOE_Field field, const STAmount &v)
|
||||||
{
|
{
|
||||||
SerializedType* rf = getPField(field);
|
SerializedType* rf = getPField(field);
|
||||||
|
|||||||
@@ -255,51 +255,6 @@ void STAccount::setValueNCA(const NewcoinAddress& nca)
|
|||||||
setValueH160(nca.getAccountID());
|
setValueH160(nca.getAccountID());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string STTaggedList::getText() const
|
|
||||||
{
|
|
||||||
std::string ret;
|
|
||||||
for (std::vector<TaggedListItem>::const_iterator it=value.begin(); it!=value.end(); ++it)
|
|
||||||
{
|
|
||||||
ret += boost::lexical_cast<std::string>(it->first);
|
|
||||||
ret += ",";
|
|
||||||
ret += strHex(it->second);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
Json::Value STTaggedList::getJson(int) const
|
|
||||||
{
|
|
||||||
Json::Value ret(Json::arrayValue);
|
|
||||||
|
|
||||||
for (std::vector<TaggedListItem>::const_iterator it=value.begin(); it!=value.end(); ++it)
|
|
||||||
{
|
|
||||||
Json::Value elem(Json::arrayValue);
|
|
||||||
elem.append(it->first);
|
|
||||||
elem.append(strHex(it->second));
|
|
||||||
ret.append(elem);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
STTaggedList* STTaggedList::construct(SerializerIterator& u, const char *name)
|
|
||||||
{
|
|
||||||
return new STTaggedList(name, u.getTaggedList());
|
|
||||||
}
|
|
||||||
|
|
||||||
int STTaggedList::getLength() const
|
|
||||||
{
|
|
||||||
int ret = Serializer::getTaggedListLength(value);
|
|
||||||
if (ret<0) throw std::overflow_error("bad TL length");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool STTaggedList::isEquivalent(const SerializedType& t) const
|
|
||||||
{
|
|
||||||
const STTaggedList* v = dynamic_cast<const STTaggedList*>(&t);
|
|
||||||
return v && (value == v->value);
|
|
||||||
}
|
|
||||||
|
|
||||||
STPathSet* STPathSet::construct(SerializerIterator& s, const char *name)
|
STPathSet* STPathSet::construct(SerializerIterator& s, const char *name)
|
||||||
{
|
{
|
||||||
std::vector<STPath> paths;
|
std::vector<STPath> paths;
|
||||||
|
|||||||
@@ -15,24 +15,11 @@ enum SerializedTypeID
|
|||||||
STI_DONE = -1,
|
STI_DONE = -1,
|
||||||
STI_NOTPRESENT = 0,
|
STI_NOTPRESENT = 0,
|
||||||
|
|
||||||
// common types
|
#define TYPE(name, field, value) STI_##field = value,
|
||||||
STI_UINT32 = 1,
|
#define FIELD(name, field, value)
|
||||||
STI_UINT64 = 2,
|
#include "SerializeProto.h"
|
||||||
STI_HASH128 = 3,
|
#undef TYPE
|
||||||
STI_HASH256 = 4,
|
#undef FIELD
|
||||||
STI_TL = 5,
|
|
||||||
STI_AMOUNT = 6,
|
|
||||||
STI_VL = 7,
|
|
||||||
STI_ACCOUNT = 8,
|
|
||||||
STI_OBJECT = 14,
|
|
||||||
STI_ARRAY = 15,
|
|
||||||
|
|
||||||
// uncommon types
|
|
||||||
STI_UINT8 = 16,
|
|
||||||
STI_UINT16 = 17,
|
|
||||||
STI_HASH160 = 18,
|
|
||||||
STI_PATHSET = 19,
|
|
||||||
STI_VECTOR256 = 20,
|
|
||||||
|
|
||||||
// high level types
|
// high level types
|
||||||
STI_TRANSACTION = 100001,
|
STI_TRANSACTION = 100001,
|
||||||
@@ -730,45 +717,6 @@ namespace boost
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
class STTaggedList : public SerializedType
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
std::vector<TaggedListItem> value;
|
|
||||||
|
|
||||||
STTaggedList* duplicate() const { return new STTaggedList(name, value); }
|
|
||||||
static STTaggedList* construct(SerializerIterator&, const char* name = NULL);
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
STTaggedList() { ; }
|
|
||||||
STTaggedList(const char* n) : SerializedType(n) { ; }
|
|
||||||
STTaggedList(const std::vector<TaggedListItem>& v) : value(v) { ; }
|
|
||||||
STTaggedList(const char* n, const std::vector<TaggedListItem>& v) : SerializedType(n), value(v) { ; }
|
|
||||||
static std::auto_ptr<SerializedType> deserialize(SerializerIterator& sit, const char* name)
|
|
||||||
{ return std::auto_ptr<SerializedType>(construct(sit, name)); }
|
|
||||||
|
|
||||||
int getLength() const;
|
|
||||||
SerializedTypeID getSType() const { return STI_TL; }
|
|
||||||
std::string getText() const;
|
|
||||||
void add(Serializer& s) const { if (s.addTaggedList(value) < 0) throw(0); }
|
|
||||||
|
|
||||||
const std::vector<TaggedListItem>& peekValue() const { return value; }
|
|
||||||
std::vector<TaggedListItem>& peekValue() { return value; }
|
|
||||||
std::vector<TaggedListItem> getValue() const { return value; }
|
|
||||||
virtual Json::Value getJson(int) const;
|
|
||||||
|
|
||||||
void setValue(const std::vector<TaggedListItem>& v) { value=v; }
|
|
||||||
|
|
||||||
int getItemCount() const { return value.size(); }
|
|
||||||
bool isEmpty() const { return value.empty(); }
|
|
||||||
|
|
||||||
void clear() { value.erase(value.begin(), value.end()); }
|
|
||||||
void addItem(const TaggedListItem& v) { value.push_back(v); }
|
|
||||||
|
|
||||||
operator std::vector<TaggedListItem>() const { return value; }
|
|
||||||
virtual bool isEquivalent(const SerializedType& t) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
class STVector256 : public SerializedType
|
class STVector256 : public SerializedType
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
Reference in New Issue
Block a user