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
7794a98f
Commit
7794a98f
authored
Feb 18, 2015
by
Jisi Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial check-in for message oneof.
parent
33222b5a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
javanano_field.cc
src/google/protobuf/compiler/javanano/javanano_field.cc
+1
-0
javanano_message_field.cc
...ogle/protobuf/compiler/javanano/javanano_message_field.cc
+13
-3
javanano_message_field.h
...oogle/protobuf/compiler/javanano/javanano_message_field.h
+14
-0
No files found.
src/google/protobuf/compiler/javanano/javanano_field.cc
View file @
7794a98f
...
@@ -111,6 +111,7 @@ FieldGenerator* FieldGeneratorMap::MakeGenerator(const FieldDescriptor* field,
...
@@ -111,6 +111,7 @@ FieldGenerator* FieldGeneratorMap::MakeGenerator(const FieldDescriptor* field,
}
else
if
(
field
->
containing_oneof
())
{
}
else
if
(
field
->
containing_oneof
())
{
switch
(
java_type
)
{
switch
(
java_type
)
{
case
JAVATYPE_MESSAGE
:
case
JAVATYPE_MESSAGE
:
return
new
MessageOneofFieldGenerator
(
field
,
params
);
case
JAVATYPE_ENUM
:
case
JAVATYPE_ENUM
:
default
:
default
:
return
new
PrimitiveOneofFieldGenerator
(
field
,
params
);
return
new
PrimitiveOneofFieldGenerator
(
field
,
params
);
...
...
src/google/protobuf/compiler/javanano/javanano_message_field.cc
View file @
7794a98f
...
@@ -146,12 +146,22 @@ GenerateHashCodeCode(io::Printer* printer) const {
...
@@ -146,12 +146,22 @@ GenerateHashCodeCode(io::Printer* printer) const {
"result = 31 * result +
\n
"
"result = 31 * result +
\n
"
" (this.$name$ == null ? 0 : this.$name$.hashCode());
\n
"
);
" (this.$name$ == null ? 0 : this.$name$.hashCode());
\n
"
);
}
}
// ===================================================================
MessageOneofFieldGenerator
::
MessageOneofFieldGenerator
(
const
FieldDescriptor
*
descriptor
,
const
Params
&
params
)
:
FieldGenerator
(
params
),
descriptor_
(
descriptor
)
{
SetMessageVariables
(
params
,
descriptor
,
&
variables_
);
SetCommonOneofVariables
(
descriptor
,
&
variables_
);
}
MessageOneofFieldGenerator
::~
MessageOneofFieldGenerator
()
{}
// ===================================================================
// ===================================================================
RepeatedMessageFieldGenerator
::
RepeatedMessageFieldGenerator
::
RepeatedMessageFieldGenerator
(
RepeatedMessageFieldGenerator
(
const
FieldDescriptor
*
descriptor
,
const
Params
&
params
)
const
FieldDescriptor
*
descriptor
,
const
Params
&
params
)
:
FieldGenerator
(
params
),
descriptor_
(
descriptor
)
{
:
FieldGenerator
(
params
),
descriptor_
(
descriptor
)
{
SetMessageVariables
(
params
,
descriptor
,
&
variables_
);
SetMessageVariables
(
params
,
descriptor
,
&
variables_
);
}
}
...
...
src/google/protobuf/compiler/javanano/javanano_message_field.h
View file @
7794a98f
...
@@ -66,6 +66,20 @@ class MessageFieldGenerator : public FieldGenerator {
...
@@ -66,6 +66,20 @@ class MessageFieldGenerator : public FieldGenerator {
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS
(
MessageFieldGenerator
);
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS
(
MessageFieldGenerator
);
};
};
class
MessageOneofFieldGenerator
:
public
FieldGenerator
{
public
:
explicit
MessageOneofFieldGenerator
(
const
FieldDescriptor
*
descriptor
,
const
Params
&
params
);
~
MessageOneofFieldGenerator
();
// implements FieldGenerator ---------------------------------------
private
:
const
FieldDescriptor
*
descriptor_
;
map
<
string
,
string
>
variables_
;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS
(
MessageOneofFieldGenerator
);
};
class
RepeatedMessageFieldGenerator
:
public
FieldGenerator
{
class
RepeatedMessageFieldGenerator
:
public
FieldGenerator
{
public
:
public
:
explicit
RepeatedMessageFieldGenerator
(
const
FieldDescriptor
*
descriptor
,
explicit
RepeatedMessageFieldGenerator
(
const
FieldDescriptor
*
descriptor
,
...
...
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