Skip to content

Commit b8c1dda

Browse files
committed
streams update: get rid of nType and nVersion.
Plus support deserializing into temporaries
1 parent 3eaa273 commit b8c1dda

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/streams.h

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,31 @@ class OverrideStream
3838
OverrideStream<Stream>& operator<<(const T& obj)
3939
{
4040
// Serialize to this stream
41-
::Serialize(*this->stream, obj, nType, nVersion);
41+
::Serialize(*this, obj);
4242
return (*this);
4343
}
4444

4545
template<typename T>
4646
OverrideStream<Stream>& operator>>(T&& obj)
4747
{
4848
// Unserialize from this stream
49-
::Unserialize(*this->stream, obj, nType, nVersion);
49+
::Unserialize(*this, obj);
5050
return (*this);
5151
}
52+
53+
void write(const char* pch, size_t nSize)
54+
{
55+
stream->write(pch, nSize);
56+
}
57+
58+
void read(char* pch, size_t nSize)
59+
{
60+
stream->read(pch, nSize);
61+
}
62+
63+
int GetVersion() const { return nVersion; }
64+
int GetType() const { return nType; }
65+
size_t size() const { return stream->size(); }
5266
};
5367

5468
/** Double ended buffer combining vector and stream-like interfaces.
@@ -594,6 +608,9 @@ class CBufferedFile
594608
fclose();
595609
}
596610

611+
int GetVersion() const { return nVersion; }
612+
int GetType() const { return nType; }
613+
597614
// Disallow copies
598615
CBufferedFile(const CBufferedFile&) = delete;
599616
CBufferedFile& operator=(const CBufferedFile&) = delete;

0 commit comments

Comments
 (0)