userver
C++ Async Framework
Toggle main menu visibility
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
<
string_view
>
7
8
#
include
<
boost
/
uuid
/
uuid
.
hpp
>
9
10
#
include
<
fmt
/
core
.
h
>
11
#
include
<
userver
/
utils
/
fmt_compat
.
hpp
>
12
13
USERVER_NAMESPACE_BEGIN
14
15
namespace
utils {
16
17
/// @brief Generators, including UUID and random string/id generators.
18
namespace
generators
{
19
20
/// Generates UUIDv4
21
boost::
uuids
::uuid
GenerateBoostUuid
();
22
23
}
// namespace generators
24
25
/// Parse string into boost::uuids::uuid
26
boost::
uuids
::uuid
BoostUuidFromString
(std::string_view str);
27
28
/// Serialize boost::uuids::uuid to string
29
std
::
string
ToString
(
const
boost
::
uuids
::
uuid
&);
30
31
}
// namespace utils
32
33
USERVER_NAMESPACE_END
34
35
template
<>
36
struct
fmt::formatter<boost::uuids::uuid> {
37
constexpr
static
auto
parse(format_parse_context& ctx) ->
decltype
(ctx.begin()) {
return
ctx.begin(); }
38
39
template
<
typename
FormatContext>
40
auto
format(
const
boost::uuids::uuid& uuid, FormatContext& ctx)
USERVER_FMT_CONST
{
41
return
fmt::format_to(ctx.out(),
"{}"
, USERVER_NAMESPACE::utils::ToString(uuid));
42
}
43
};
userver
utils
boost_uuid4.hpp
Generated on
for userver by
Doxygen
1.17.0