danielaparker / jsoncons

A C++, header-only library for constructing JSON and JSON-like data formats, with JSON Pointer, JSON Patch, JSON Schema, JSONPath, JMESPath, CSV, MessagePack, CBOR, BSON, UBJSON
https://danielaparker.github.io/jsoncons
Other
700 stars 158 forks source link

Add ser_context::end() function #395

Closed wbangna closed 1 year ago

wbangna commented 1 year ago

This PR extends the usage of the function ser_context::position() to be usable for other elements reported to the visitor (e.g. start_array, end_array etc.). It also introduces the function ser_context::end() which reports the end position of the currently parsed element.

To test the new functionality use the following test program: https://gist.github.com/wbangna/03bc656af36c50d6479f166f34981682

I did not change the documentation yet as I am not sure if the functionality changes of ser_context::position() will be accepted.

danielaparker commented 1 year ago

Thanks for contributing. Could you rename end() to end_position()? Otherwise I'm fine with this request.

wbangna commented 1 year ago

Great! I just renamed the end() function and added the documentation for ser_context. Thank you!