summaryrefslogtreecommitdiff
path: root/sax/inc/sax_processor.hh
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2024-01-21 12:31:30 +0100
committerJoel Klinghed <the_jk@spawned.biz>2024-01-21 12:31:30 +0100
commit7dd49c6293172b494c78918507242cdb55d35137 (patch)
tree9c8ab822ab9501a5ea2f937e609144e00ea091c4 /sax/inc/sax_processor.hh
parentfc4547b412e28164af1bf8981234c6af959ccc0b (diff)
WIP
Diffstat (limited to 'sax/inc/sax_processor.hh')
-rw-r--r--sax/inc/sax_processor.hh18
1 files changed, 18 insertions, 0 deletions
diff --git a/sax/inc/sax_processor.hh b/sax/inc/sax_processor.hh
index 7ca32f7..cf53807 100644
--- a/sax/inc/sax_processor.hh
+++ b/sax/inc/sax_processor.hh
@@ -2,6 +2,7 @@
#define MODXML_SAX_PROCESSOR_HH
#include <memory>
+#include <span>
namespace modxml {
namespace sax {
@@ -23,6 +24,23 @@ class Processor {
*/
static std::unique_ptr<Processor> create(std::shared_ptr<Delegate> delegate);
+ /**
+ * Process (consume) input data.
+ * Returns bytes consumed, can be zero.
+ */
+ virtual std::size_t process(std::span<uint8_t const> data,
+ std::size_t offset = 0) = 0;
+
+ /**
+ * When called from delegate, points to the start of the element that
+ * triggered the callback.
+ * When called otherwise, points to the last element that was processed.
+ * Lines start at 1.
+ * Columns start at 0.
+ */
+ virtual uint64_t line() const = 0;
+ virtual uint64_t column() const = 0;
+
protected:
Processor() = default;