summaryrefslogtreecommitdiff
path: root/libraries/ESP_Async_WebServer/src/ChunkPrint.cpp
diff options
context:
space:
mode:
authorschererleander <leander@schererleander.de>2026-01-20 08:34:54 +0100
committerschererleander <leander@schererleander.de>2026-01-20 08:34:54 +0100
commit85ea4e995a75abe061f6fc375ea0481084dddd43 (patch)
tree7eb5d57653ecd8f041aeac4e68d7d554c1168681 /libraries/ESP_Async_WebServer/src/ChunkPrint.cpp
initial commitHEADmain
Diffstat (limited to 'libraries/ESP_Async_WebServer/src/ChunkPrint.cpp')
-rw-r--r--libraries/ESP_Async_WebServer/src/ChunkPrint.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/libraries/ESP_Async_WebServer/src/ChunkPrint.cpp b/libraries/ESP_Async_WebServer/src/ChunkPrint.cpp
new file mode 100644
index 0000000..4617d34
--- /dev/null
+++ b/libraries/ESP_Async_WebServer/src/ChunkPrint.cpp
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+// Copyright 2016-2025 Hristo Gochkov, Mathieu Carbou, Emil Muratov
+
+#include <ChunkPrint.h>
+
+ChunkPrint::ChunkPrint(uint8_t *destination, size_t from, size_t len) : _destination(destination), _to_skip(from), _to_write(len), _pos{0} {}
+
+size_t ChunkPrint::write(uint8_t c) {
+ if (_to_skip > 0) {
+ _to_skip--;
+ return 1;
+ } else if (_to_write > 0) {
+ _to_write--;
+ _destination[_pos++] = c;
+ return 1;
+ }
+ return 0;
+}