userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
value_conv.cpp
1
#
include
<
userver
/
proto
-
structs
/
io
/
userver
/
formats
/
json
/
value_conv
.
hpp
>
2
3
#
include
<
google
/
protobuf
/
struct
.
pb
.
h
>
4
5
#
include
<
userver
/
proto
-
structs
/
io
/
context
.
hpp
>
6
#
include
<
userver
/
protobuf
/
json
/
convert
.
hpp
>
7
8
USERVER_NAMESPACE_BEGIN
9
10
namespace
proto_structs::
io
{
11
12
formats::json::Value ReadProtoStruct(ReadContext& ctx, To<formats::json::Value>,
const
::google::protobuf::Value& msg) {
13
try
{
14
return
protobuf::json::MessageToJson(msg, protobuf::json::PrintOptions{});
15
}
catch
(
const
protobuf::json::PrintError& e) {
16
ctx.AddError(e.what());
17
return
formats::json::Value{};
18
}
19
}
20
21
void
WriteProtoStruct(WriteContext&,
const
formats::json::Value& obj, ::google::protobuf::Value& msg) {
22
protobuf::json::JsonToMessage(obj, msg, protobuf::json::ParseOptions{});
23
}
24
25
}
// namespace proto_structs::io
26
27
USERVER_NAMESPACE_END
proto-structs
src
proto-structs
io
userver
formats
json
value_conv.cpp
Generated on
for userver by
Doxygen
1.17.0