Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core/StarBuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/core/StarBuffer.cpp')
-rw-r--r--source/core/StarBuffer.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/core/StarBuffer.cpp b/source/core/StarBuffer.cpp
index 5b5b2e4..e8184e3 100644
--- a/source/core/StarBuffer.cpp
+++ b/source/core/StarBuffer.cpp
@@ -2,6 +2,7 @@
#include "StarMathCommon.hpp"
#include "StarIODevice.hpp"
#include "StarFormat.hpp"
+#include "StarLogging.hpp"
namespace Star {
@@ -273,6 +274,18 @@ void ExternalBuffer::reset(char const* externalData, size_t len) {
m_size = len;
}
+IODevicePtr Buffer::clone() {
+ auto cloned = make_shared<Buffer>(*this);
+ // Reset position to 0 while preserving mode and data
+ cloned->seek(0);
+ return cloned;
+}
+
+IODevicePtr ExternalBuffer::clone() {
+ Logger::info("Cloning ExternalBuffer from position {}");
+ return make_shared<ExternalBuffer>(*this);
+}
+
size_t ExternalBuffer::doRead(size_t pos, char* data, size_t len) {
if (len == 0)
return 0;