cpp-common/bt2c: add `UnicodeConv` class
Add the `UnicodeConv` class, which currently implements conversion
from (UTF-16, UTF-32) × (BE, LE) to UTF-8.
The `UnicodeConv` class uses `g_iconv` from GLib internally to make
the conversions. It has a vector member that is used as an output
buffer. Public conversion methods accept a span of
`const std::uint8_t`, and return a span `std::uint8_t` which is a view
on that internal vector.
Add a test which:
✤ Converts some hardcoded UTF-16 and UTF-32 strings to UTF-8 and
verifies the result against a reference UTF-8 string.
✤ Feeds the UTF-16 and UTF-32 conversion methods with truncated strings
and verifies that they throw and append specific causes to the error
of the current thread.
Change-Id: I962bd49261a3d9779ed6a24a26c7800a24beb719
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12715
This page took 0.024549 seconds and 4 git commands to generate.