* Implement 'Clear' function on StateRecorderImpl. Allows for clearing the state and re-recording on the same string iostream with same underlying buffer.
@@ -18,6 +18,12 @@ void StateRecorderImpl::Rewind()
mStream.seekg(0, std::stringstream::beg);
}
+void StateRecorderImpl::Clear()
+{
+ mStream.clear();
+ mStream.str({});
+}
+
void StateRecorderImpl::ReadBytes(void *outData, size_t inNumBytes)
{
if (IsValidating())
@@ -22,6 +22,9 @@ public:
/// Rewind the stream for reading
void Rewind();
+ /// Clear the stream for reuse
+ void Clear();
/// Read a string of bytes from the binary stream
virtual void ReadBytes(void *outData, size_t inNumBytes) override;