FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
msgpack/example/custom.cc at java-0.5.1 · WanderWalker/msgpack · GitHub
WanderWalker
msgpack
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
msgpack
/
example
/
custom.cc
Copy path
More file actions
More file actions
Latest commit
History
History
History
58 lines (41 loc) · 919 Bytes
Breadcrumbs
msgpack
/
example
/
custom.cc
Copy path
File metadata and controls
58 lines (41 loc) · 919 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#
include
<
msgpack.hpp
>
#
include
<
string
>
#
include
<
iostream
>
class
old_class
{
public:
old_class
() : value(
"
default
"
) { }
std::string value;
MSGPACK_DEFINE
(value);
};
class
new_class
{
public:
new_class
() : value(
"
default
"
), flag(-
1
) { }
std::string value;
int
flag;
MSGPACK_DEFINE
(value, flag);
};
int
main
(
void
)
{
{
old_class oc;
new_class nc;
msgpack::sbuffer sbuf;
msgpack::pack
(sbuf, oc);
msgpack::zone zone;
msgpack::object obj;
msgpack::unpack
(sbuf.
data
(), sbuf.
size
(),
NULL
, &zone, &obj);
obj.
convert
(&nc);
std::cout << obj <<
"
value=
"
<< nc.
value
<<
"
flag=
"
<< nc.
flag
<< std::endl;
}
{
new_class nc;
old_class oc;
msgpack::sbuffer sbuf;
msgpack::pack
(sbuf, nc);
msgpack::zone zone;
msgpack::object obj;
msgpack::unpack
(sbuf.
data
(), sbuf.
size
(),
NULL
, &zone, &obj);
obj.
convert
(&oc);
std::cout << obj <<
"
value=
"
<< oc.
value
<< std::endl;
}
}
Back
|
FazBrowse Home
|
New Git URL