src/cpp-common: add bt2c::parseJson() functions (value mode)
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sun, 10 Dec 2023 05:18:46 +0000 (05:18 +0000)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 4 Sep 2024 19:05:14 +0000 (15:05 -0400)
commit572c38b700928d0b27c8bc9cfef105d736ba8c34
tree2d2b36e9ca75d7471b50292c6e451f22417da351
parent27e686d896e77a466b56c43c2a8efb7e6b2bdd43
src/cpp-common: add bt2c::parseJson() functions (value mode)

This patch adds two new versions of bt2c::parseJson() which accept the
same parameters as the current "listener mode" versions, except for a
missing listener, and return some resulting
JSON value (`bt2c::JsonVal`).

This is part of an effort to support CTF2‑SPEC‑2.0 [1]. It will be
easier to convert CTF 2 metadata stream fragments using JSON value
objects than using the listener mode version of bt2c::parseJson()
directly.

`baseOffset` is also added to the offset of a text location when
creating the text location of any JSON value object to create. This will
be needed when parsing a CTF 2 fragment: the line and column numbers are
local to the fragment, but the offset is from the beginning of the whole
metadata stream. Kind of confusing, but I wouldn't know what an RS byte
means in terms of lines/columns anyway (different text editor could
interpret it in different ways).

[1]: https://diamon.org/ctf/CTF2-SPEC-2.0.html

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I3e9662f6632d10f11c08c178342785886f664797
Reviewed-on: https://review.lttng.org/c/babeltrace/+/7480
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12684
src/Makefile.am
src/cpp-common/bt2c/parse-json-as-val.cpp [new file with mode: 0644]
src/cpp-common/bt2c/parse-json-as-val.hpp [new file with mode: 0644]
This page took 0.02458 seconds and 4 git commands to generate.