mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Restrict access to the virtual functions move and copy
* These are meant to be used by detail::STVar only and are otherwise error-prone to call.
This commit is contained in:
committed by
Nik Bougalis
parent
74e6ed1af3
commit
0c13676d5f
@@ -46,11 +46,6 @@ public:
|
|||||||
STAccount(SerialIter& sit, SField const& name);
|
STAccount(SerialIter& sit, SField const& name);
|
||||||
STAccount(SField const& n, AccountID const& v);
|
STAccount(SField const& n, AccountID const& v);
|
||||||
|
|
||||||
STBase*
|
|
||||||
copy(std::size_t n, void* buf) const override;
|
|
||||||
STBase*
|
|
||||||
move(std::size_t n, void* buf) override;
|
|
||||||
|
|
||||||
SerializedTypeID
|
SerializedTypeID
|
||||||
getSType() const override;
|
getSType() const override;
|
||||||
|
|
||||||
@@ -74,6 +69,14 @@ public:
|
|||||||
|
|
||||||
void
|
void
|
||||||
setValue(AccountID const& v);
|
setValue(AccountID const& v);
|
||||||
|
|
||||||
|
private:
|
||||||
|
STBase*
|
||||||
|
copy(std::size_t n, void* buf) const override;
|
||||||
|
STBase*
|
||||||
|
move(std::size_t n, void* buf) override;
|
||||||
|
|
||||||
|
friend class detail::STVar;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline STAccount&
|
inline STAccount&
|
||||||
|
|||||||
@@ -144,11 +144,6 @@ public:
|
|||||||
STAmount(IOUAmount const& amount, Issue const& issue);
|
STAmount(IOUAmount const& amount, Issue const& issue);
|
||||||
STAmount(XRPAmount const& amount);
|
STAmount(XRPAmount const& amount);
|
||||||
|
|
||||||
STBase*
|
|
||||||
copy(std::size_t n, void* buf) const override;
|
|
||||||
STBase*
|
|
||||||
move(std::size_t n, void* buf) override;
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Observers
|
// Observers
|
||||||
@@ -273,6 +268,13 @@ private:
|
|||||||
set(std::int64_t v);
|
set(std::int64_t v);
|
||||||
void
|
void
|
||||||
canonicalize();
|
canonicalize();
|
||||||
|
|
||||||
|
STBase*
|
||||||
|
copy(std::size_t n, void* buf) const override;
|
||||||
|
STBase*
|
||||||
|
move(std::size_t n, void* buf) override;
|
||||||
|
|
||||||
|
friend class detail::STVar;
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -50,12 +50,6 @@ public:
|
|||||||
explicit STArray(int n);
|
explicit STArray(int n);
|
||||||
explicit STArray(SField const& f);
|
explicit STArray(SField const& f);
|
||||||
|
|
||||||
STBase*
|
|
||||||
copy(std::size_t n, void* buf) const override;
|
|
||||||
|
|
||||||
STBase*
|
|
||||||
move(std::size_t n, void* buf) override;
|
|
||||||
|
|
||||||
STObject&
|
STObject&
|
||||||
operator[](std::size_t j);
|
operator[](std::size_t j);
|
||||||
|
|
||||||
@@ -134,6 +128,14 @@ public:
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
isDefault() const override;
|
isDefault() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
STBase*
|
||||||
|
copy(std::size_t n, void* buf) const override;
|
||||||
|
STBase*
|
||||||
|
move(std::size_t n, void* buf) override;
|
||||||
|
|
||||||
|
friend class detail::STVar;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline STObject&
|
inline STObject&
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ namespace ripple {
|
|||||||
|
|
||||||
enum class JsonOptions { none = 0, include_date = 1 };
|
enum class JsonOptions { none = 0, include_date = 1 };
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
class STVar;
|
||||||
|
}
|
||||||
|
|
||||||
// VFALCO TODO fix this restriction on copy assignment.
|
// VFALCO TODO fix this restriction on copy assignment.
|
||||||
//
|
//
|
||||||
// CAUTION: Do not create a vector (or similar container) of any object derived
|
// CAUTION: Do not create a vector (or similar container) of any object derived
|
||||||
@@ -77,11 +81,6 @@ public:
|
|||||||
bool
|
bool
|
||||||
operator!=(const STBase& t) const;
|
operator!=(const STBase& t) const;
|
||||||
|
|
||||||
virtual STBase*
|
|
||||||
copy(std::size_t n, void* buf) const;
|
|
||||||
virtual STBase*
|
|
||||||
move(std::size_t n, void* buf);
|
|
||||||
|
|
||||||
template <class D>
|
template <class D>
|
||||||
D&
|
D&
|
||||||
downcast();
|
downcast();
|
||||||
@@ -126,6 +125,14 @@ protected:
|
|||||||
template <class T>
|
template <class T>
|
||||||
static STBase*
|
static STBase*
|
||||||
emplace(std::size_t n, void* buf, T&& val);
|
emplace(std::size_t n, void* buf, T&& val);
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual STBase*
|
||||||
|
copy(std::size_t n, void* buf) const;
|
||||||
|
virtual STBase*
|
||||||
|
move(std::size_t n, void* buf);
|
||||||
|
|
||||||
|
friend class detail::STVar;
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -42,12 +42,6 @@ public:
|
|||||||
STBitString(SField const& n, const value_type& v);
|
STBitString(SField const& n, const value_type& v);
|
||||||
STBitString(SerialIter& sit, SField const& name);
|
STBitString(SerialIter& sit, SField const& name);
|
||||||
|
|
||||||
STBase*
|
|
||||||
copy(std::size_t n, void* buf) const override;
|
|
||||||
|
|
||||||
STBase*
|
|
||||||
move(std::size_t n, void* buf) override;
|
|
||||||
|
|
||||||
SerializedTypeID
|
SerializedTypeID
|
||||||
getSType() const override;
|
getSType() const override;
|
||||||
|
|
||||||
@@ -71,6 +65,14 @@ public:
|
|||||||
value() const;
|
value() const;
|
||||||
|
|
||||||
operator value_type() const;
|
operator value_type() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
STBase*
|
||||||
|
copy(std::size_t n, void* buf) const override;
|
||||||
|
STBase*
|
||||||
|
move(std::size_t n, void* buf) override;
|
||||||
|
|
||||||
|
friend class detail::STVar;
|
||||||
};
|
};
|
||||||
|
|
||||||
using STHash128 = STBitString<128>;
|
using STHash128 = STBitString<128>;
|
||||||
|
|||||||
@@ -45,12 +45,6 @@ public:
|
|||||||
STBlob(SField const& n);
|
STBlob(SField const& n);
|
||||||
STBlob(SerialIter&, SField const& name = sfGeneric);
|
STBlob(SerialIter&, SField const& name = sfGeneric);
|
||||||
|
|
||||||
STBase*
|
|
||||||
copy(std::size_t n, void* buf) const override;
|
|
||||||
|
|
||||||
STBase*
|
|
||||||
move(std::size_t n, void* buf) override;
|
|
||||||
|
|
||||||
std::size_t
|
std::size_t
|
||||||
size() const;
|
size() const;
|
||||||
|
|
||||||
@@ -83,6 +77,14 @@ public:
|
|||||||
|
|
||||||
void
|
void
|
||||||
setValue(Buffer&& b);
|
setValue(Buffer&& b);
|
||||||
|
|
||||||
|
private:
|
||||||
|
STBase*
|
||||||
|
copy(std::size_t n, void* buf) const override;
|
||||||
|
STBase*
|
||||||
|
move(std::size_t n, void* buf) override;
|
||||||
|
|
||||||
|
friend class detail::STVar;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline STBlob::STBlob(STBlob const& rhs)
|
inline STBlob::STBlob(STBlob const& rhs)
|
||||||
|
|||||||
@@ -38,12 +38,6 @@ public:
|
|||||||
STInteger(SField const& n, Integer v = 0);
|
STInteger(SField const& n, Integer v = 0);
|
||||||
STInteger(SerialIter& sit, SField const& name);
|
STInteger(SerialIter& sit, SField const& name);
|
||||||
|
|
||||||
STBase*
|
|
||||||
copy(std::size_t n, void* buf) const override;
|
|
||||||
|
|
||||||
STBase*
|
|
||||||
move(std::size_t n, void* buf) override;
|
|
||||||
|
|
||||||
SerializedTypeID
|
SerializedTypeID
|
||||||
getSType() const override;
|
getSType() const override;
|
||||||
|
|
||||||
@@ -71,6 +65,14 @@ public:
|
|||||||
setValue(Integer v);
|
setValue(Integer v);
|
||||||
|
|
||||||
operator Integer() const;
|
operator Integer() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
STBase*
|
||||||
|
copy(std::size_t n, void* buf) const override;
|
||||||
|
STBase*
|
||||||
|
move(std::size_t n, void* buf) override;
|
||||||
|
|
||||||
|
friend class detail::STVar;
|
||||||
};
|
};
|
||||||
|
|
||||||
using STUInt8 = STInteger<unsigned char>;
|
using STUInt8 = STInteger<unsigned char>;
|
||||||
|
|||||||
@@ -43,12 +43,6 @@ public:
|
|||||||
STLedgerEntry(SerialIter&& sit, uint256 const& index);
|
STLedgerEntry(SerialIter&& sit, uint256 const& index);
|
||||||
STLedgerEntry(STObject const& object, uint256 const& index);
|
STLedgerEntry(STObject const& object, uint256 const& index);
|
||||||
|
|
||||||
STBase*
|
|
||||||
copy(std::size_t n, void* buf) const override;
|
|
||||||
|
|
||||||
STBase*
|
|
||||||
move(std::size_t n, void* buf) override;
|
|
||||||
|
|
||||||
SerializedTypeID
|
SerializedTypeID
|
||||||
getSType() const override;
|
getSType() const override;
|
||||||
|
|
||||||
@@ -90,6 +84,13 @@ private:
|
|||||||
setSLEType();
|
setSLEType();
|
||||||
|
|
||||||
friend Invariants_test; // this test wants access to the private type_
|
friend Invariants_test; // this test wants access to the private type_
|
||||||
|
|
||||||
|
STBase*
|
||||||
|
copy(std::size_t n, void* buf) const override;
|
||||||
|
STBase*
|
||||||
|
move(std::size_t n, void* buf) override;
|
||||||
|
|
||||||
|
friend class detail::STVar;
|
||||||
};
|
};
|
||||||
|
|
||||||
using SLE = STLedgerEntry;
|
using SLE = STLedgerEntry;
|
||||||
|
|||||||
@@ -92,12 +92,6 @@ public:
|
|||||||
STObject(SerialIter&& sit, SField const& name);
|
STObject(SerialIter&& sit, SField const& name);
|
||||||
explicit STObject(SField const& name);
|
explicit STObject(SField const& name);
|
||||||
|
|
||||||
STBase*
|
|
||||||
copy(std::size_t n, void* buf) const override;
|
|
||||||
|
|
||||||
STBase*
|
|
||||||
move(std::size_t n, void* buf) override;
|
|
||||||
|
|
||||||
iterator
|
iterator
|
||||||
begin() const;
|
begin() const;
|
||||||
|
|
||||||
@@ -448,6 +442,13 @@ private:
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
T&
|
T&
|
||||||
peekField(SField const& field);
|
peekField(SField const& field);
|
||||||
|
|
||||||
|
STBase*
|
||||||
|
copy(std::size_t n, void* buf) const override;
|
||||||
|
STBase*
|
||||||
|
move(std::size_t n, void* buf) override;
|
||||||
|
|
||||||
|
friend class detail::STVar;
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -182,12 +182,6 @@ public:
|
|||||||
STPathSet(SField const& n);
|
STPathSet(SField const& n);
|
||||||
STPathSet(SerialIter& sit, SField const& name);
|
STPathSet(SerialIter& sit, SField const& name);
|
||||||
|
|
||||||
STBase*
|
|
||||||
copy(std::size_t n, void* buf) const override;
|
|
||||||
|
|
||||||
STBase*
|
|
||||||
move(std::size_t n, void* buf) override;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
add(Serializer& s) const override;
|
add(Serializer& s) const override;
|
||||||
|
|
||||||
@@ -230,6 +224,14 @@ public:
|
|||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
void
|
void
|
||||||
emplace_back(Args&&... args);
|
emplace_back(Args&&... args);
|
||||||
|
|
||||||
|
private:
|
||||||
|
STBase*
|
||||||
|
copy(std::size_t n, void* buf) const override;
|
||||||
|
STBase*
|
||||||
|
move(std::size_t n, void* buf) override;
|
||||||
|
|
||||||
|
friend class detail::STVar;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ------------ STPathElement ------------
|
// ------------ STPathElement ------------
|
||||||
|
|||||||
@@ -66,12 +66,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
STTx(TxType type, std::function<void(STObject&)> assembler);
|
STTx(TxType type, std::function<void(STObject&)> assembler);
|
||||||
|
|
||||||
STBase*
|
|
||||||
copy(std::size_t n, void* buf) const override;
|
|
||||||
|
|
||||||
STBase*
|
|
||||||
move(std::size_t n, void* buf) override;
|
|
||||||
|
|
||||||
// STObject functions.
|
// STObject functions.
|
||||||
SerializedTypeID
|
SerializedTypeID
|
||||||
getSType() const override;
|
getSType() const override;
|
||||||
@@ -137,6 +131,13 @@ private:
|
|||||||
|
|
||||||
Expected<void, std::string>
|
Expected<void, std::string>
|
||||||
checkMultiSign(RequireFullyCanonicalSig requireCanonicalSig) const;
|
checkMultiSign(RequireFullyCanonicalSig requireCanonicalSig) const;
|
||||||
|
|
||||||
|
STBase*
|
||||||
|
copy(std::size_t n, void* buf) const override;
|
||||||
|
STBase*
|
||||||
|
move(std::size_t n, void* buf) override;
|
||||||
|
|
||||||
|
friend class detail::STVar;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|||||||
@@ -94,12 +94,6 @@ public:
|
|||||||
NodeID const& nodeID,
|
NodeID const& nodeID,
|
||||||
F&& f);
|
F&& f);
|
||||||
|
|
||||||
STBase*
|
|
||||||
copy(std::size_t n, void* buf) const override;
|
|
||||||
|
|
||||||
STBase*
|
|
||||||
move(std::size_t n, void* buf) override;
|
|
||||||
|
|
||||||
// Hash of the validated ledger
|
// Hash of the validated ledger
|
||||||
uint256
|
uint256
|
||||||
getLedgerHash() const;
|
getLedgerHash() const;
|
||||||
@@ -150,6 +144,13 @@ public:
|
|||||||
private:
|
private:
|
||||||
static SOTemplate const&
|
static SOTemplate const&
|
||||||
validationFormat();
|
validationFormat();
|
||||||
|
|
||||||
|
STBase*
|
||||||
|
copy(std::size_t n, void* buf) const override;
|
||||||
|
STBase*
|
||||||
|
move(std::size_t n, void* buf) override;
|
||||||
|
|
||||||
|
friend class detail::STVar;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class LookupNodeID>
|
template <class LookupNodeID>
|
||||||
|
|||||||
@@ -40,12 +40,6 @@ public:
|
|||||||
STVector256(SField const& n, std::vector<uint256> const& vector);
|
STVector256(SField const& n, std::vector<uint256> const& vector);
|
||||||
STVector256(SerialIter& sit, SField const& name);
|
STVector256(SerialIter& sit, SField const& name);
|
||||||
|
|
||||||
STBase*
|
|
||||||
copy(std::size_t n, void* buf) const override;
|
|
||||||
|
|
||||||
STBase*
|
|
||||||
move(std::size_t n, void* buf) override;
|
|
||||||
|
|
||||||
SerializedTypeID
|
SerializedTypeID
|
||||||
getSType() const override;
|
getSType() const override;
|
||||||
|
|
||||||
@@ -116,6 +110,14 @@ public:
|
|||||||
|
|
||||||
void
|
void
|
||||||
clear() noexcept;
|
clear() noexcept;
|
||||||
|
|
||||||
|
private:
|
||||||
|
STBase*
|
||||||
|
copy(std::size_t n, void* buf) const override;
|
||||||
|
STBase*
|
||||||
|
move(std::size_t n, void* buf) override;
|
||||||
|
|
||||||
|
friend class detail::STVar;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline STVector256::STVector256(SField const& n) : STBase(n)
|
inline STVector256::STVector256(SField const& n) : STBase(n)
|
||||||
|
|||||||
Reference in New Issue
Block a user