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
188a2d6f
Commit
188a2d6f
authored
Oct 02, 2014
by
Brian Duff
Committed by
Gerrit Code Review
Oct 02, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Change reftypes_primitive_enums to reftypes_compat_mode."
parents
517591b8
7fbf6540
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
12 deletions
+31
-12
javanano_generator.cc
src/google/protobuf/compiler/javanano/javanano_generator.cc
+5
-2
javanano_message.cc
src/google/protobuf/compiler/javanano/javanano_message.cc
+16
-9
javanano_params.h
src/google/protobuf/compiler/javanano/javanano_params.h
+10
-1
No files found.
src/google/protobuf/compiler/javanano/javanano_generator.cc
View file @
188a2d6f
...
...
@@ -140,9 +140,12 @@ bool JavaNanoGenerator::Generate(const FileDescriptor* file,
}
else
if
(
option_name
==
"optional_field_style"
)
{
params
.
set_optional_field_accessors
(
option_value
==
"accessors"
);
params
.
set_use_reference_types_for_primitives
(
option_value
==
"reftypes"
||
option_value
==
"reftypes_
primitive_enums
"
);
||
option_value
==
"reftypes_
compat_mode
"
);
params
.
set_reftypes_primitive_enums
(
option_value
==
"reftypes_primitive_enums"
);
option_value
==
"reftypes_compat_mode"
);
if
(
option_value
==
"reftypes_compat_mode"
)
{
params
.
set_generate_clear
(
false
);
}
}
else
if
(
option_name
==
"generate_equals"
)
{
params
.
set_generate_equals
(
option_value
==
"true"
);
}
else
if
(
option_name
==
"ignore_services"
)
{
...
...
src/google/protobuf/compiler/javanano/javanano_message.cc
View file @
188a2d6f
...
...
@@ -245,16 +245,20 @@ void MessageGenerator::Generate(io::Printer* printer) {
" _classInitialized = true;
\n
"
" }
\n
"
" }
\n
"
" }
\n
"
" clear();
\n
"
"}
\n
"
);
" }
\n
"
);
if
(
params_
.
generate_clear
())
{
printer
->
Print
(
" clear();
\n
"
);
}
printer
->
Print
(
"}
\n
"
);
}
else
{
printer
->
Print
(
"
\n
"
"public $classname$() {
\n
"
" clear();
\n
"
"}
\n
"
,
"classname"
,
descriptor_
->
name
());
if
(
params_
.
generate_clear
())
{
printer
->
Print
(
"
\n
"
"public $classname$() {
\n
"
" clear();
\n
"
"}
\n
"
,
"classname"
,
descriptor_
->
name
());
}
}
// Other methods in this class
...
...
@@ -440,6 +444,9 @@ void MessageGenerator::GenerateSerializeOneField(
}
void
MessageGenerator
::
GenerateClear
(
io
::
Printer
*
printer
)
{
if
(
!
params_
.
generate_clear
())
{
return
;
}
printer
->
Print
(
"
\n
"
"public $classname$ clear() {
\n
"
,
...
...
src/google/protobuf/compiler/javanano/javanano_params.h
View file @
188a2d6f
...
...
@@ -65,6 +65,7 @@ class Params {
bool
ignore_services_
;
bool
parcelable_messages_
;
bool
reftypes_primitive_enums_
;
bool
generate_clear_
;
public
:
Params
(
const
string
&
base_name
)
:
...
...
@@ -79,7 +80,8 @@ class Params {
generate_equals_
(
false
),
ignore_services_
(
false
),
parcelable_messages_
(
false
),
reftypes_primitive_enums_
(
false
)
{
reftypes_primitive_enums_
(
false
),
generate_clear_
(
true
)
{
}
const
string
&
base_name
()
const
{
...
...
@@ -222,6 +224,13 @@ class Params {
bool
reftypes_primitive_enums
()
const
{
return
reftypes_primitive_enums_
;
}
void
set_generate_clear
(
bool
value
)
{
generate_clear_
=
value
;
}
bool
generate_clear
()
const
{
return
generate_clear_
;
}
};
}
// namespace javanano
...
...
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