userver
C++ Async Framework
Loading...
Searching...
No Matches
boost_uuid4.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/utils/boost_uuid4.hpp
4
/// @brief @copybrief utils::generators::GenerateBoostUuid()
5
6
#
include
<
boost
/
uuid
/
uuid
.
hpp
>
7
8
#
include
<
fmt
/
core
.
h
>
9
#
include
<
userver
/
utils
/
fmt_compat
.
hpp
>
10
11
USERVER_NAMESPACE_BEGIN
12
13
namespace
utils
{
14
15
/// Generators
16
namespace
generators
{
17
18
/// Generates UUIDv4
19
boost::uuids::uuid
GenerateBoostUuid
();
20
21
}
// namespace generators
22
23
/// Parse string into boost::uuids::uuid
24
boost::uuids::uuid
BoostUuidFromString
(std::string_view str);
25
26
/// Serialize boost::uuids::uuid to string
27
std::string
ToString
(
const
boost::uuids::uuid&);
28
29
}
// namespace utils
30
31
USERVER_NAMESPACE_END
32
33
template
<>
34
struct
fmt::formatter<boost::uuids::uuid> {
35
constexpr
static
auto
parse(format_parse_context& ctx) ->
decltype
(ctx.begin()) {
return
ctx.begin(); }
36
37
template
<
typename
FormatContext>
38
auto
format(
const
boost::uuids::uuid& uuid, FormatContext& ctx)
USERVER_FMT_CONST
{
39
return
fmt::format_to(ctx.out(),
"{}"
, USERVER_NAMESPACE::utils::ToString(uuid));
40
}
41
};
userver
utils
boost_uuid4.hpp
Generated on Tue Nov 19 2024 11:34:18 for userver by
Doxygen
1.10.0