Add a `format_as` that lets {fmt} format variables of type
`bt2::MessageType` directly. Re-use `bt_common_message_type_string` to
avoid duplicating that code.
Change-Id: I81152a152284b156535813fd8fa5d61a3dd7219f
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
cpp-common/bt2c/dummy.cpp \
cpp-common/bt2c/endian.hpp \
cpp-common/bt2c/exc.hpp \
+ cpp-common/bt2c/fmt.hpp \
cpp-common/bt2c/glib-up.hpp \
cpp-common/bt2c/libc-up.hpp \
cpp-common/bt2c/logging.hpp \
--- /dev/null
+/*
+ * Copyright (c) 2024 EfficiOS, inc.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include "common/common.h"
+#include "cpp-common/bt2/message.hpp"
+#include "cpp-common/vendor/fmt/format.h" /* IWYU pragma: keep */
+
+namespace bt2 {
+
+inline const char *format_as(const MessageType type)
+{
+ return bt_common_message_type_string(static_cast<bt_message_type>(type));
+}
+
+} /* namespace bt2 */