More tweaks to base-writer

This commit is contained in:
2023-07-25 16:22:51 -04:00
parent a38f40e388
commit b9c64fcffb
4 changed files with 40 additions and 38 deletions

View File

@@ -241,8 +241,10 @@ public:
virtual char const *what() const { return "Stream contained invalid data"; }
};
class StreamBuffer : public eng::nevernew, public BaseReader<StreamBuffer, eng::string>, public BaseWriter<StreamBuffer> {
class StreamBuffer : public eng::nevernew, public BaseReader<StreamBuffer>, public BaseWriter<StreamBuffer> {
public:
using read_string_type = eng::string;
// Construct an empty buffer.
StreamBuffer();
@@ -290,10 +292,6 @@ public:
void write_bytes(const char *bytes, int64_t len);
void write_bytes(std::string_view s);
// Copy bytes from the StreamBuffer into an external buffer.
//
void read_bytes_into(char *target, int64_t len);
// Read a block of bytes from the buffer.
//
// Caution: the pointer returned is a pointer to the stream's buffer. It is
@@ -302,6 +300,10 @@ public:
//
const char *read_bytes(int64_t bytes);
// Copy bytes from the StreamBuffer into an external buffer.
//
void read_bytes_into(char *target, int64_t len);
// Read and write larger types.
//
// Throws StreamEof if the specified number of bytes aren't present.