mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Make accounts there own type
so we can add new functionality and so they can display properly. Cleanups and missing helper function.
This commit is contained in:
@@ -17,7 +17,7 @@ enum SerializedTypeID
|
||||
STI_HASH160=6, STI_HASH256=7, STI_VL=8, STI_TL=9,
|
||||
|
||||
// high level types
|
||||
STI_TRANSACTION=10
|
||||
STI_ACCOUNT=10, STI_TRANSACTION=10
|
||||
};
|
||||
|
||||
class SerializedType
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
|
||||
int getLength() const { return 1; }
|
||||
SerializedTypeID getType() const { return STI_UINT8; }
|
||||
STUInt8 *duplicate() const { return new STUInt8(name, value); }
|
||||
STUInt8* duplicate() const { return new STUInt8(name, value); }
|
||||
std::string getText() const;
|
||||
void add(Serializer& s) const { s.add8(value); }
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
|
||||
int getLength() const { return 2; }
|
||||
SerializedTypeID getType() const { return STI_UINT16; }
|
||||
STUInt16 *duplicate() const { return new STUInt16(name, value); }
|
||||
STUInt16* duplicate() const { return new STUInt16(name, value); }
|
||||
std::string getText() const;
|
||||
void add(Serializer& s) const { s.add16(value); }
|
||||
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
|
||||
int getLength() const { return 4; }
|
||||
SerializedTypeID getType() const { return STI_UINT32; }
|
||||
STUInt32 *duplicate() const { return new STUInt32(name, value); }
|
||||
STUInt32* duplicate() const { return new STUInt32(name, value); }
|
||||
std::string getText() const;
|
||||
void add(Serializer& s) const { s.add32(value); }
|
||||
|
||||
@@ -133,7 +133,7 @@ public:
|
||||
|
||||
int getLength() const { return 8; }
|
||||
SerializedTypeID getType() const { return STI_UINT64; }
|
||||
STUInt64 *duplicate() const { return new STUInt64(name, value); }
|
||||
STUInt64* duplicate() const { return new STUInt64(name, value); }
|
||||
std::string getText() const;
|
||||
void add(Serializer& s) const { s.add64(value); }
|
||||
|
||||
@@ -158,8 +158,8 @@ public:
|
||||
|
||||
int getLength() const { return 20; }
|
||||
SerializedTypeID getType() const { return STI_HASH160; }
|
||||
STHash160 *duplicate() const { return new STHash160(name, value); }
|
||||
std::string getText() const;
|
||||
STHash160* duplicate() const { return new STHash160(name, value); }
|
||||
virtual std::string getText() const;
|
||||
void add(Serializer& s) const { s.add160(value); }
|
||||
|
||||
const uint160& getValue() const { return value; }
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
|
||||
int getLength() const { return 32; }
|
||||
SerializedTypeID getType() const { return STI_HASH256; }
|
||||
STHash256 *duplicate() const { return new STHash256(name, value); }
|
||||
STHash256* duplicate() const { return new STHash256(name, value); }
|
||||
std::string getText() const;
|
||||
void add(Serializer& s) const { s.add256(value); }
|
||||
|
||||
@@ -208,9 +208,9 @@ public:
|
||||
static STVariableLength* construct(SerializerIterator&, const char *name=NULL);
|
||||
|
||||
int getLength() const;
|
||||
SerializedTypeID getType() const { return STI_VL; }
|
||||
STVariableLength *duplicate() const { return new STVariableLength(name, value); }
|
||||
std::string getText() const;
|
||||
virtual SerializedTypeID getType() const { return STI_VL; }
|
||||
virtual STVariableLength* duplicate() const { return new STVariableLength(name, value); }
|
||||
virtual std::string getText() const;
|
||||
void add(Serializer& s) const { s.addVL(value); }
|
||||
|
||||
const std::vector<unsigned char>& peekValue() const { return value; }
|
||||
@@ -222,6 +222,25 @@ public:
|
||||
STVariableLength& operator=(const std::vector<unsigned char>& v) { value=v; return *this; }
|
||||
};
|
||||
|
||||
class STAccount : public STVariableLength
|
||||
{
|
||||
public:
|
||||
|
||||
STAccount(const std::vector<unsigned char>& v) : STVariableLength(v) { ; }
|
||||
STAccount(const char *n, const std::vector<unsigned char>& v) : STVariableLength(n, v) { ; }
|
||||
STAccount(const char *n) : STVariableLength(n) { ; }
|
||||
STAccount() { ; }
|
||||
static STAccount* construct(SerializerIterator&, const char *name=NULL);
|
||||
|
||||
SerializedTypeID getType() const { return STI_ACCOUNT; }
|
||||
virtual STAccount* duplicate() const { return new STAccount(name, value); }
|
||||
std::string getText() const;
|
||||
|
||||
void setValueH160(const uint160& v);
|
||||
bool getValueH160(uint160&) const;
|
||||
bool isValueH160() const;
|
||||
};
|
||||
|
||||
class STTaggedList : public SerializedType
|
||||
{
|
||||
protected:
|
||||
@@ -237,7 +256,7 @@ public:
|
||||
|
||||
int getLength() const;
|
||||
SerializedTypeID getType() const { return STI_TL; }
|
||||
STTaggedList *duplicate() const { return new STTaggedList(name, value); }
|
||||
STTaggedList* duplicate() const { return new STTaggedList(name, value); }
|
||||
std::string getText() const;
|
||||
void add(Serializer& s) const { if(s.addTaggedList(value)<0) throw(0); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user