⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
userver
C++ Async Framework v2.0
Documentation
API Groups
Namespaces
Reference
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
w
y
Variables
k
n
r
u
w
Typedefs
c
d
h
m
n
o
p
s
t
u
v
Enumerations
a
b
c
d
f
h
i
l
o
p
r
s
t
u
v
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
Enumerations
Enumerator
Related Symbols
File List
File Members
All
e
i
l
r
t
u
Functions
Macros
e
i
l
r
t
u
Examples
Toggle main menu visibility
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
All results
boost_uuid.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/formats/parse/boost_uuid.hpp
4
/// @brief boost::uuids::uuid parser for any format
5
/// @ingroup userver_universal userver_formats_parse
6
7
#
include
<
optional
>
8
#
include
<
string
>
9
10
#
include
<
boost
/
uuid
/
uuid
.
hpp
>
11
12
#
include
<
userver
/
formats
/
common
/
meta
.
hpp
>
13
#
include
<
userver
/
formats
/
parse
/
to
.
hpp
>
14
#
include
<
userver
/
utils
/
boost_uuid4
.
hpp
>
15
16
USERVER_NAMESPACE_BEGIN
17
18
namespace
formats::
parse
{
19
20
/**
21
* Valid uuid strings:
22
* 0123456789abcdef0123456789abcdef
23
* 01234567-89ab-cdef-0123-456789abcdef
24
* {01234567-89ab-cdef-0123-456789abcdef}
25
* {0123456789abcdef0123456789abcdef}
26
*/
27
template
<
typename
Value>
28
std
::
enable_if_t
<
common
::
kIsFormatValue
<
Value
>,
boost
::
uuids
::
uuid
>
Parse
(
29
const
Value
&
value
,
To
<
boost
::
uuids
::
uuid
>) {
30
std::optional<std::string> str;
31
try
{
32
str = value.
template
As<std::string>();
33
return
utils::BoostUuidFromString(*str);
34
}
catch
(
const
std::exception& e) {
35
if
(!!str) {
36
throw
typename
Value::ParseException(
37
"'"
+ *str +
"' cannot be parsed to `boost::uuids::uuid`"
);
38
}
else
{
39
throw
typename
Value::ParseException(
40
"Only strings can be parsed as boost uuid"
);
41
}
42
}
43
}
44
45
}
// namespace formats::parse
46
47
USERVER_NAMESPACE_END
Docs version:
v1.0
,
v2.0
,
trunk/develop
userver
formats
parse
boost_uuid.hpp
Generated on Wed May 15 2024 22:32:58 for userver by
Doxygen
1.10.0