A better fix so that every type doesn't have to have its own operator=.

This fixes it in one place and allows many such helpers to be removed.
This commit is contained in:
JoelKatz
2012-08-19 22:47:59 -07:00
parent 6f5eb015bf
commit aa1f923306
3 changed files with 2 additions and 31 deletions

View File

@@ -491,18 +491,6 @@ STAmount STAmount::operator-(void) const
return STAmount(name, mCurrency, mValue, mOffset, mIsNative, !mIsNegative);
}
STAmount& STAmount::operator=(const STAmount& a)
{
mValue = a.mValue;
mOffset = a.mOffset;
mIssuer = a.mIssuer;
mCurrency = a.mCurrency;
mIsNative = a.mIsNative;
mIsNegative = a.mIsNegative;
return *this;
}
STAmount& STAmount::operator=(uint64 v)
{ // does not copy name, does not change currency type
mOffset = 0;

View File

@@ -463,14 +463,6 @@ std::string STPathSet::getText() const
}
#endif
STPathSet& STPathSet::operator=(const STPathSet& p)
{
if (name == NULL)
name = p.name;
value = p.value;
return *this;
}
void STPathSet::add(Serializer& s) const
{
bool bFirst = true;

View File

@@ -91,6 +91,8 @@ public:
virtual bool isEquivalent(const SerializedType& t) const
{ assert(getSType() == STI_NOTPRESENT); return t.getSType() == STI_NOTPRESENT; }
SerializedType& operator=(const SerializedType& t)
{ name = (name == NULL) ? t.name : name; return *this; }
bool operator==(const SerializedType& t) const
{ return (getSType() == t.getSType()) && isEquivalent(t); }
bool operator!=(const SerializedType& t) const
@@ -124,7 +126,6 @@ public:
void setValue(unsigned char v) { value=v; }
operator unsigned char() const { return value; }
STUInt8& operator=(unsigned char v) { value=v; return *this; }
virtual bool isEquivalent(const SerializedType& t) const;
};
@@ -152,7 +153,6 @@ public:
void setValue(uint16 v) { value=v; }
operator uint16() const { return value; }
STUInt16& operator=(uint16 v) { value=v; return *this; }
virtual bool isEquivalent(const SerializedType& t) const;
};
@@ -180,7 +180,6 @@ public:
void setValue(uint32 v) { value=v; }
operator uint32() const { return value; }
STUInt32& operator=(uint32 v) { value=v; return *this; }
virtual bool isEquivalent(const SerializedType& t) const;
};
@@ -208,7 +207,6 @@ public:
void setValue(uint64 v) { value=v; }
operator uint64() const { return value; }
STUInt64& operator=(uint64 v) { value=v; return *this; }
virtual bool isEquivalent(const SerializedType& t) const;
};
@@ -334,7 +332,6 @@ public:
STAmount& operator+=(const STAmount&);
STAmount& operator-=(const STAmount&);
STAmount& operator=(const STAmount&);
STAmount& operator+=(uint64);
STAmount& operator-=(uint64);
STAmount& operator=(uint64);
@@ -401,7 +398,6 @@ public:
void setValue(const uint128& v) { value=v; }
operator uint128() const { return value; }
STHash128& operator=(const uint128& v) { value=v; return *this; }
virtual bool isEquivalent(const SerializedType& t) const;
};
@@ -431,7 +427,6 @@ public:
void setValue(const uint160& v) { value=v; }
operator uint160() const { return value; }
STHash160& operator=(const uint160& v) { value=v; return *this; }
virtual bool isEquivalent(const SerializedType& t) const;
};
@@ -461,7 +456,6 @@ public:
void setValue(const uint256& v) { value=v; }
operator uint256() const { return value; }
STHash256& operator=(const uint256& v) { value=v; return *this; }
virtual bool isEquivalent(const SerializedType& t) const;
};
@@ -494,7 +488,6 @@ public:
void setValue(const std::vector<unsigned char>& v) { value=v; }
operator std::vector<unsigned char>() const { return value; }
STVariableLength& operator=(const std::vector<unsigned char>& v) { value=v; return *this; }
virtual bool isEquivalent(const SerializedType& t) const;
};
@@ -668,7 +661,6 @@ public:
void addPath(const STPath& e) { value.push_back(e); }
virtual bool isEquivalent(const SerializedType& t) const;
STPathSet& operator=(const STPathSet&);
std::vector<STPath>::iterator begin() { return value.begin(); }
std::vector<STPath>::iterator end() { return value.end(); }
@@ -747,7 +739,6 @@ public:
void addItem(const TaggedListItem& v) { value.push_back(v); }
operator std::vector<TaggedListItem>() const { return value; }
STTaggedList& operator=(const std::vector<TaggedListItem>& v) { value=v; return *this; }
virtual bool isEquivalent(const SerializedType& t) const;
};