Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
042bfaf6
Commit
042bfaf6
authored
Aug 26, 2015
by
Feng Xiao
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into beta-1
parents
11e36b1c
b00595a3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
protostream_objectwriter.cc
...google/protobuf/util/internal/protostream_objectwriter.cc
+3
-1
json_util_test.cc
src/google/protobuf/util/json_util_test.cc
+11
-0
No files found.
src/google/protobuf/util/internal/protostream_objectwriter.cc
View file @
042bfaf6
...
...
@@ -1602,8 +1602,10 @@ bool ProtoStreamObjectWriter::IsMap(const google::protobuf::Field& field) {
const
google
::
protobuf
::
Type
*
field_type
=
typeinfo_
->
GetTypeByTypeUrl
(
field
.
type_url
());
// TODO(xiaofeng): Unify option names.
return
GetBoolOptionOrDefault
(
field_type
->
options
(),
"google.protobuf.MessageOptions.map_entry"
,
false
);
"google.protobuf.MessageOptions.map_entry"
,
false
)
||
GetBoolOptionOrDefault
(
field_type
->
options
(),
"map_entry"
,
false
);
}
void
ProtoStreamObjectWriter
::
WriteTag
(
const
google
::
protobuf
::
Field
&
field
)
{
...
...
src/google/protobuf/util/json_util_test.cc
View file @
042bfaf6
...
...
@@ -47,6 +47,7 @@ namespace {
using
proto3
::
FOO
;
using
proto3
::
BAR
;
using
proto3
::
TestMessage
;
using
proto3
::
TestMap
;
static
const
char
kTypeUrlPrefix
[]
=
"type.googleapis.com"
;
...
...
@@ -147,6 +148,16 @@ TEST_F(JsonUtilTest, ParseMessage) {
EXPECT_EQ
(
96
,
m
.
repeated_message_value
(
1
).
value
());
}
TEST_F
(
JsonUtilTest
,
ParseMap
)
{
TestMap
message
;
(
*
message
.
mutable_string_map
())[
"hello"
]
=
1234
;
JsonOptions
options
;
EXPECT_EQ
(
"{
\"
stringMap
\"
:{
\"
hello
\"
:1234}}"
,
ToJson
(
message
,
options
));
TestMap
other
;
ASSERT_TRUE
(
FromJson
(
ToJson
(
message
,
options
),
&
other
));
EXPECT_EQ
(
message
.
DebugString
(),
other
.
DebugString
());
}
typedef
pair
<
char
*
,
int
>
Segment
;
// A ZeroCopyOutputStream that writes to multiple buffers.
class
SegmentedZeroCopyOutputStream
:
public
io
::
ZeroCopyOutputStream
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment