summaryrefslogtreecommitdiff
path: root/sax/inc/sax_processor.hh
diff options
context:
space:
mode:
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;