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
e81a9d7c
Commit
e81a9d7c
authored
Feb 24, 2009
by
Jon Skeet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ToBuilder and WeakToBuilder
parent
25a28580
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
120 additions
and
4 deletions
+120
-4
AddressBookProtos.cs
src/AddressBook/AddressBookProtos.cs
+3
-0
BenchmarkProtoFile.cs
src/ProtoBench/BenchmarkProtoFile.cs
+5
-0
BenchmarkSpeedProtoFile.cs
src/ProtoBench/BenchmarkSpeedProtoFile.cs
+5
-0
MessageGenerator.cs
src/ProtoGen/MessageGenerator.cs
+1
-0
AbstractMessageTest.cs
src/ProtocolBuffers.Test/AbstractMessageTest.cs
+4
-0
DynamicMessageTest.cs
src/ProtocolBuffers.Test/DynamicMessageTest.cs
+22
-0
GeneratedMessageTest.cs
src/ProtocolBuffers.Test/GeneratedMessageTest.cs
+8
-0
UnitTestCustomOptionsProtoFile.cs
...Buffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs
+17
-0
UnitTestEmbedOptimizeForProtoFile.cs
...fers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs
+1
-0
UnitTestImportProtoFile.cs
...rotocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs
+1
-0
UnitTestMessageSetProtoFile.cs
...colBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs
+6
-0
UnitTestOptimizeForProtoFile.cs
...olBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs
+3
-0
UnitTestProtoFile.cs
src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs
+0
-0
AbstractMessage.cs
src/ProtocolBuffers/AbstractMessage.cs
+5
-0
CSharpOptions.cs
src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
+2
-0
DescriptorProtoFile.cs
src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs
+18
-0
DynamicMessage.cs
src/ProtocolBuffers/DynamicMessage.cs
+4
-1
FieldSet.cs
src/ProtocolBuffers/FieldSet.cs
+1
-2
IMessage.cs
src/ProtocolBuffers/IMessage.cs
+14
-1
No files found.
src/AddressBook/AddressBookProtos.cs
View file @
e81a9d7c
...
...
@@ -179,6 +179,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
PhoneNumber
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -435,6 +436,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
Person
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -732,6 +734,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
AddressBook
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
src/ProtoBench/BenchmarkProtoFile.cs
View file @
e81a9d7c
...
...
@@ -525,6 +525,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
Message1
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -1568,6 +1569,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
Message2
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -2194,6 +2196,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
Group1
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -2886,6 +2889,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
Message3
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -3670,6 +3674,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
Message4
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
src/ProtoBench/BenchmarkSpeedProtoFile.cs
View file @
e81a9d7c
...
...
@@ -803,6 +803,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
SpeedMessage1
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -2320,6 +2321,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
SpeedMessage2
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -3267,6 +3269,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
Group1
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -4339,6 +4342,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
SpeedMessage3
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -5463,6 +5467,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
SpeedMessage4
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
src/ProtoGen/MessageGenerator.cs
View file @
e81a9d7c
...
...
@@ -267,6 +267,7 @@ namespace Google.ProtocolBuffers.ProtoGen {
private
void
GenerateBuilder
(
TextGenerator
writer
)
{
writer
.
WriteLine
(
"public static Builder CreateBuilder() { return new Builder(); }"
);
writer
.
WriteLine
(
"public override Builder ToBuilder() { return CreateBuilder(this); }"
);
writer
.
WriteLine
(
"public override Builder CreateBuilderForType() { return new Builder(); }"
);
writer
.
WriteLine
(
"public static Builder CreateBuilder({0} prototype) {{"
,
ClassName
);
writer
.
WriteLine
(
" return (Builder) new Builder().MergeFrom(prototype);"
);
...
...
src/ProtocolBuffers.Test/AbstractMessageTest.cs
View file @
e81a9d7c
...
...
@@ -297,6 +297,10 @@ namespace Google.ProtocolBuffers {
return
new
Builder
(
wrappedMessage
.
WeakCreateBuilderForType
());
}
public
override
Builder
ToBuilder
()
{
return
new
Builder
(
wrappedMessage
.
WeakToBuilder
());
}
internal
class
Builder
:
AbstractBuilder
<
AbstractMessageWrapper
,
Builder
>
{
private
readonly
IBuilder
wrappedBuilder
;
...
...
src/ProtocolBuffers.Test/DynamicMessageTest.cs
View file @
e81a9d7c
using
System.Collections.Generic
;
using
Google.ProtocolBuffers.TestProtos
;
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
...
...
@@ -173,5 +174,26 @@ namespace Google.ProtocolBuffers {
DynamicMessage
copy
=
DynamicMessage
.
CreateBuilder
(
message
).
Build
();
reflectionTester
.
AssertAllFieldsSetViaReflection
(
copy
);
}
[
Test
]
public
void
ToBuilder
()
{
DynamicMessage
.
Builder
builder
=
DynamicMessage
.
CreateBuilder
(
TestAllTypes
.
Descriptor
);
reflectionTester
.
SetAllFieldsViaReflection
(
builder
);
int
unknownFieldNum
=
9
;
ulong
unknownFieldVal
=
90
;
builder
.
SetUnknownFields
(
UnknownFieldSet
.
CreateBuilder
()
.
AddField
(
unknownFieldNum
,
UnknownField
.
CreateBuilder
().
AddVarint
(
unknownFieldVal
).
Build
())
.
Build
());
DynamicMessage
message
=
builder
.
Build
();
DynamicMessage
derived
=
message
.
ToBuilder
().
Build
();
reflectionTester
.
AssertAllFieldsSetViaReflection
(
derived
);
IList
<
ulong
>
values
=
derived
.
UnknownFields
.
FieldDictionary
[
unknownFieldNum
].
VarintList
;
Assert
.
AreEqual
(
1
,
values
.
Count
);
Assert
.
AreEqual
(
unknownFieldVal
,
values
[
0
]);
}
}
}
src/ProtocolBuffers.Test/GeneratedMessageTest.cs
View file @
e81a9d7c
...
...
@@ -385,5 +385,13 @@ namespace Google.ProtocolBuffers {
Assert
.
IsTrue
(
builder
.
IsInitialized
);
Assert
.
IsTrue
(
builder
.
BuildPartial
().
IsInitialized
);
}
[
Test
]
public
void
ToBuilder
()
{
TestAllTypes
.
Builder
builder
=
TestAllTypes
.
CreateBuilder
();
TestUtil
.
SetAllFields
(
builder
);
TestAllTypes
message
=
builder
.
Build
();
TestUtil
.
AssertAllFieldsSet
(
message
.
ToBuilder
().
Build
());
}
}
}
src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs
View file @
e81a9d7c
...
...
@@ -344,6 +344,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
TestMessageWithCustomOptions
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -453,6 +454,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
CustomOptionFooRequest
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -543,6 +545,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
CustomOptionFooResponse
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -643,6 +646,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
DummyMessageContainingEnum
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -733,6 +737,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
DummyMessageInvalidAsOptionType
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -823,6 +828,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
CustomOptionMinIntegerValues
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -913,6 +919,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
CustomOptionMaxIntegerValues
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -1003,6 +1010,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
CustomOptionOtherValues
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -1093,6 +1101,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
SettingRealsFromPositiveInts
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -1183,6 +1192,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
SettingRealsFromNegativeInts
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -1282,6 +1292,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
ComplexOptionType1
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -1425,6 +1436,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
ComplexOptionType4
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -1541,6 +1553,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
ComplexOptionType2
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -1754,6 +1767,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
ComplexOptionType5
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -1861,6 +1875,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
ComplexOptionType3
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -2014,6 +2029,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
ComplexOpt6
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -2122,6 +2138,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
VariousComplexOptions
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs
View file @
e81a9d7c
...
...
@@ -146,6 +146,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
TestEmbedOptimizedForSize
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs
View file @
e81a9d7c
...
...
@@ -129,6 +129,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
ImportMessage
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs
View file @
e81a9d7c
...
...
@@ -143,6 +143,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
TestMessageSet
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -311,6 +312,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
TestMessageSetContainer
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -528,6 +530,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
TestMessageSetExtension1
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -722,6 +725,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
TestMessageSetExtension2
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -956,6 +960,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
Item
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -1157,6 +1162,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
RawMessageSet
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs
View file @
e81a9d7c
...
...
@@ -122,6 +122,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
TestOptimizedForSize
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -275,6 +276,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
TestRequiredOptimizedForSize
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -392,6 +394,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
TestOptionalOptimizedForSize
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs
View file @
e81a9d7c
This diff is collapsed.
Click to expand it.
src/ProtocolBuffers/AbstractMessage.cs
View file @
e81a9d7c
...
...
@@ -58,12 +58,17 @@ namespace Google.ProtocolBuffers {
public
abstract
UnknownFieldSet
UnknownFields
{
get
;
}
public
abstract
TMessage
DefaultInstanceForType
{
get
;
}
public
abstract
TBuilder
CreateBuilderForType
();
public
abstract
TBuilder
ToBuilder
();
#
endregion
public
IBuilder
WeakCreateBuilderForType
()
{
return
CreateBuilderForType
();
}
public
IBuilder
WeakToBuilder
()
{
return
ToBuilder
();
}
public
IMessage
WeakDefaultInstanceForType
{
get
{
return
DefaultInstanceForType
;
}
}
...
...
src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
View file @
e81a9d7c
...
...
@@ -143,6 +143,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
CSharpFileOptions
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -334,6 +335,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
CSharpFieldOptions
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs
View file @
e81a9d7c
...
...
@@ -279,6 +279,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
FileDescriptorSet
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -631,6 +632,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
FileDescriptorProto
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -1165,6 +1167,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
ExtensionRange
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -1478,6 +1481,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
DescriptorProto
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -2099,6 +2103,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
FieldDescriptorProto
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -2541,6 +2546,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
EnumDescriptorProto
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -2863,6 +2869,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
EnumValueDescriptorProto
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -3167,6 +3174,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
ServiceDescriptorProto
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -3504,6 +3512,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
MethodDescriptorProto
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -3876,6 +3885,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
FileOptions
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -4223,6 +4233,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
MessageOptions
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -4528,6 +4539,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
FieldOptions
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -4834,6 +4846,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
EnumOptions
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -5059,6 +5072,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
EnumValueOptions
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -5284,6 +5298,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
ServiceOptions
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -5509,6 +5524,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
MethodOptions
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -5766,6 +5782,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
NamePart
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
@@ -6045,6 +6062,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
UninterpretedOption
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
...
...
src/ProtocolBuffers/DynamicMessage.cs
View file @
e81a9d7c
...
...
@@ -74,7 +74,6 @@ namespace Google.ProtocolBuffers {
Builder
builder
=
CreateBuilder
(
type
);
Builder
dynamicBuilder
=
builder
.
MergeFrom
(
input
);
return
dynamicBuilder
.
BuildParsed
();
}
/// <summary>
...
...
@@ -247,6 +246,10 @@ namespace Google.ProtocolBuffers {
return
new
Builder
(
type
);
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilderForType
().
MergeFrom
(
this
);
}
/// <summary>
/// Verifies that the field is a field of this message.
/// </summary>
...
...
src/ProtocolBuffers/FieldSet.cs
View file @
e81a9d7c
...
...
@@ -326,8 +326,7 @@ namespace Google.ProtocolBuffers {
}
}
else
if
(
field
.
MappedType
==
MappedType
.
Message
&&
existingValue
!=
null
)
{
IMessage
existingMessage
=
(
IMessage
)
existingValue
;
IMessage
merged
=
existingMessage
.
WeakCreateBuilderForType
()
.
WeakMergeFrom
(
existingMessage
)
IMessage
merged
=
existingMessage
.
WeakToBuilder
()
.
WeakMergeFrom
((
IMessage
)
entry
.
Value
)
.
WeakBuild
();
this
[
field
]
=
merged
;
...
...
src/ProtocolBuffers/IMessage.cs
View file @
e81a9d7c
...
...
@@ -168,11 +168,18 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Creates a builder for the type, but in a weakly typed manner. This
/// is typically implemented by strongly typed
builder
s by just returning
/// is typically implemented by strongly typed
message
s by just returning
/// the result of CreateBuilderForType.
/// </summary>
IBuilder
WeakCreateBuilderForType
();
/// <summary>
/// Creates a builder with the same contents as this message. This
/// is typically implemented by strongly typed messages by just returning
/// the result of ToBuilder.
/// </summary>
IBuilder
WeakToBuilder
();
IMessage
WeakDefaultInstanceForType
{
get
;
}
}
...
...
@@ -198,6 +205,12 @@ namespace Google.ProtocolBuffers {
/// Constructs a new builder for a message of the same type as this message.
/// </summary>
TBuilder
CreateBuilderForType
();
/// <summary>
/// Creates a builder with the same contents as this current instance.
/// This is typically implemented by strongly typed messages by just
/// returning the result of ToBuilder().
/// </summary>
TBuilder
ToBuilder
();
#
endregion
}
}
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