]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
common/Formatter: introduce helpers for formatting container types.
authorRonen Friedman <rfriedma@redhat.com>
Tue, 18 Mar 2025 09:03:39 +0000 (04:03 -0500)
committerRonen Friedman <rfriedma@redhat.com>
Mon, 31 Mar 2025 15:23:18 +0000 (10:23 -0500)
commitdff8360855fd9fae30f9f8749bf70282c89c1a3f
treea553d215086250c767daeb511a01399c256bff22
parent72f4cc558a30a8bdd1dadee0ab2ef3edbc311267
common/Formatter: introduce helpers for formatting container types.

Specifically:

- with_array_sections() creates a Formmater::ArraySection, then
  formats every element in the container using the provided
  callable.
  Special handling for std::map: the callable is called with
  both the key and the value.

- with_obj_array_section() dumps containers of objects:
  First - an ArraySection is created; then - for each object
  in the container, the object is formatted within an ObjectSection,
  using the provided callable.
  If the container is an std::map, the callable is called with both
  the key and the object itself.

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/common/Formatter.h