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
e53dd993
Commit
e53dd993
authored
Jan 12, 2017
by
Adam Cozzette
Committed by
GitHub
Jan 12, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2529 from wackoisgod/master
Class deprecation support
parents
228d242c
75ac3973
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
+15
-2
csharp_field_base.cc
src/google/protobuf/compiler/csharp/csharp_field_base.cc
+4
-2
csharp_message.cc
src/google/protobuf/compiler/csharp/csharp_message.cc
+9
-0
csharp_message.h
src/google/protobuf/compiler/csharp/csharp_message.h
+2
-0
No files found.
src/google/protobuf/compiler/csharp/csharp_field_base.cc
View file @
e53dd993
...
...
@@ -122,8 +122,10 @@ void FieldGeneratorBase::GenerateCodecCode(io::Printer* printer) {
}
void
FieldGeneratorBase
::
AddDeprecatedFlag
(
io
::
Printer
*
printer
)
{
if
(
descriptor_
->
options
().
deprecated
())
{
if
(
descriptor_
->
options
().
deprecated
())
{
printer
->
Print
(
"[global::System.ObsoleteAttribute]
\n
"
);
}
else
if
(
descriptor_
->
type
()
==
FieldDescriptor
::
TYPE_MESSAGE
&&
descriptor_
->
message_type
()
->
options
().
deprecated
())
{
printer
->
Print
(
"[global::System.ObsoleteAttribute]
\n
"
);
}
}
...
...
src/google/protobuf/compiler/csharp/csharp_message.cc
View file @
e53dd993
...
...
@@ -98,12 +98,20 @@ const std::vector<const FieldDescriptor*>& MessageGenerator::fields_by_number()
return
fields_by_number_
;
}
void
MessageGenerator
::
AddDeprecatedFlag
(
io
::
Printer
*
printer
)
{
if
(
descriptor_
->
options
().
deprecated
())
{
printer
->
Print
(
"[global::System.ObsoleteAttribute]
\n
"
);
}
}
void
MessageGenerator
::
Generate
(
io
::
Printer
*
printer
)
{
map
<
string
,
string
>
vars
;
vars
[
"class_name"
]
=
class_name
();
vars
[
"access_level"
]
=
class_access_level
();
WriteMessageDocComment
(
printer
,
descriptor_
);
AddDeprecatedFlag
(
printer
);
printer
->
Print
(
vars
,
"$access_level$ sealed partial class $class_name$ : pb::IMessage<$class_name$> {
\n
"
);
...
...
@@ -115,6 +123,7 @@ void MessageGenerator::Generate(io::Printer* printer) {
"private static readonly pb::MessageParser<$class_name$> _parser = new pb::MessageParser<$class_name$>(() => new $class_name$());
\n
"
);
WriteGeneratedCodeAttributes
(
printer
);
printer
->
Print
(
vars
,
"public static pb::MessageParser<$class_name$> Parser { get { return _parser; } }
\n\n
"
);
...
...
src/google/protobuf/compiler/csharp/csharp_message.h
View file @
e53dd993
...
...
@@ -69,6 +69,8 @@ class MessageGenerator : public SourceGeneratorBase {
bool
HasNestedGeneratedTypes
();
void
AddDeprecatedFlag
(
io
::
Printer
*
printer
);
std
::
string
class_name
();
std
::
string
full_class_name
();
...
...
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