From 7dd49c6293172b494c78918507242cdb55d35137 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Sun, 21 Jan 2024 12:31:30 +0100 Subject: WIP --- sax/inc/sax_processor.hh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'sax/inc/sax_processor.hh') 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 +#include namespace modxml { namespace sax { @@ -23,6 +24,23 @@ class Processor { */ static std::unique_ptr create(std::shared_ptr delegate); + /** + * Process (consume) input data. + * Returns bytes consumed, can be zero. + */ + virtual std::size_t process(std::span 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; -- cgit v1.2.3-70-g09d2