test-field.sh: make sure bt_run_in_py_env() and bt_cli() succeed
[babeltrace.git] / src / cpp-common / bt2c / fmt.hpp
CommitLineData
7cf8258b
SM
1/*
2 * Copyright (c) 2024 EfficiOS, inc.
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
7cf8258b 7#include "cpp-common/vendor/fmt/format.h" /* IWYU pragma: keep */
91730cec 8#include "cpp-common/vendor/wise-enum/wise_enum.h"
7cf8258b 9
8f7f6134
SM
10#include "uuid.hpp"
11
91730cec
SM
12namespace internal {
13
14template <typename T>
15using EnableIfIsWiseEnum =
e6a82b00 16 typename std::enable_if<wise_enum::is_wise_enum<T>::value, wise_enum::string_type>::type;
91730cec
SM
17
18} /* namespace internal */
19
7cf8258b
SM
20namespace bt2 {
21
91730cec
SM
22template <typename T>
23::internal::EnableIfIsWiseEnum<T> format_as(const T val) noexcept
24{
25 return wise_enum::to_string<T>(val);
26}
27
7cf8258b 28} /* namespace bt2 */
e05975eb
SM
29
30namespace bt2c {
31
91730cec
SM
32template <typename T>
33::internal::EnableIfIsWiseEnum<T> format_as(const T val) noexcept
34{
35 return wise_enum::to_string<T>(val);
36}
37
e05975eb
SM
38inline std::string format_as(const UuidView uuid)
39{
40 return uuid.str();
41}
42
43} /* namespace bt2c */
This page took 0.028951 seconds and 4 git commands to generate.