summaryrefslogtreecommitdiffhomepage
path: root/FoundationEx/src/reader/buffer.inl.h
diff options
context:
space:
mode:
Diffstat (limited to 'FoundationEx/src/reader/buffer.inl.h')
-rw-r--r--FoundationEx/src/reader/buffer.inl.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/FoundationEx/src/reader/buffer.inl.h b/FoundationEx/src/reader/buffer.inl.h
index 3b739e4..c452878 100644
--- a/FoundationEx/src/reader/buffer.inl.h
+++ b/FoundationEx/src/reader/buffer.inl.h
@@ -8,8 +8,9 @@
#include <cstring>
#include <memory>
#include <utility>
+#include <vector>
-#include <starshatter/foundation/reader.h>
+#include <Text.h>
namespace starshatter
@@ -124,16 +125,21 @@ Count
BufferReader<Source>::peek(char* dest, Count bytes) const
{
bytes = std::min(bytes, available());
- std::copy(data(), data() + bytes, dest);
+ std::copy(at(buffer) + position, at(buffer) + position + bytes, dest);
return bytes;
}
template <typename Source>
-const char*
-BufferReader<Source>::data() const
+Text
+BufferReader<Source>::more()
{
- return at(buffer) + position;
+ const auto size = available();
+ if (size < 1)
+ return Text();
+ std::vector<char> tmp(size);
+ read(tmp.data(), size);
+ return Text(tmp.data(), size);
}