userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
struct_simple.cpp
1
#
include
"struct_simple.hpp"
2
3
#
include
<
gtest
/
gtest
.
h
>
4
5
#
include
<
userver
/
proto
-
structs
/
io
/
impl
/
read
.
hpp
>
6
#
include
<
userver
/
proto
-
structs
/
io
/
impl
/
write
.
hpp
>
7
#
include
<
userver
/
proto
-
structs
/
io
/
std
/
int32_t_conv
.
hpp
>
8
9
#
include
"messages.pb.h"
10
11
namespace
structs {
12
13
Empty ReadProtoStruct(ups::io::ReadContext&, ups::io::To<Empty>,
const
messages::Empty&) {
return
{}; }
14
15
void
WriteProtoStruct(ups::io::WriteContext&,
const
Empty&, messages::Empty&) {}
16
17
Simple ReadProtoStruct(ups::io::ReadContext& ctx, ups::io::To<Simple>,
const
messages::Simple& msg) {
18
return
{
19
.f1 = ups::io::impl::ReadField<std::int32_t>(
20
ctx,
21
ups::io::impl::CreateFieldGetter(msg, messages::Simple::kF1FieldNumber, &messages::Simple::f1)
22
)
23
};
24
}
25
26
void
WriteProtoStruct(ups::io::WriteContext& ctx,
const
Simple& obj, messages::Simple& msg) {
27
ups::io::impl::WriteField(
28
ctx,
29
obj.f1,
30
ups::io::impl::CreateFieldSetter(
31
msg,
32
messages::Simple::kF1FieldNumber,
33
&messages::Simple::set_f1,
34
&messages::Simple::clear_f1
35
)
36
);
37
}
38
39
void
CheckSimpleEqual(
const
Simple& obj,
const
messages::Simple& msg) { EXPECT_EQ(obj.f1, msg.f1()); }
40
41
}
// namespace structs
proto-structs
tests
struct_simple.cpp
Generated on
for userver by
Doxygen
1.17.0