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
752d1a37
Commit
752d1a37
authored
Oct 05, 2011
by
csharptest
Committed by
rogerk
Oct 05, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added option generate_private_ctor to disable private ctor generation
parent
4a6ed749
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
1 deletion
+7
-1
csharp_options.proto
protos/google/protobuf/csharp_options.proto
+3
-0
MessageGenerator.cs
src/ProtoGen/MessageGenerator.cs
+4
-1
CSharpOptions.cs
src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
+0
-0
No files found.
protos/google/protobuf/csharp_options.proto
View file @
752d1a37
...
...
@@ -42,6 +42,9 @@ message CSharpFileOptions {
// Generate messages/builders with the [Serializable] attribute
optional
bool
add_serializable
=
9
[
default
=
false
];
// Generates a private ctor for Message types
optional
bool
generate_private_ctor
=
10
[
default
=
true
];
// The extension that should be appended to the umbrella_classname when creating files.
optional
string
file_extension
=
221
[
default
=
".cs"
];
...
...
src/ProtoGen/MessageGenerator.cs
View file @
752d1a37
...
...
@@ -181,8 +181,11 @@ namespace Google.ProtocolBuffers.ProtoGen
Descriptor
.
Proto
.
ExtensionRangeCount
>
0
?
"Extendable"
:
"Generated"
,
RuntimeSuffix
);
writer
.
Indent
();
if
(
Descriptor
.
File
.
CSharpOptions
.
GeneratePrivateCtor
)
{
writer
.
WriteLine
(
"private {0}() {{ }}"
,
ClassName
);
// Must call BuildPartial() to make sure all lists are made read-only
}
// Must call MakeReadOnly() to make sure all lists are made read-only
writer
.
WriteLine
(
"private static readonly {0} defaultInstance = new {0}().MakeReadOnly();"
,
ClassName
);
if
(
OptimizeSpeed
)
...
...
src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
View file @
752d1a37
This diff is collapsed.
Click to expand it.
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