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
cabd06d1
Commit
cabd06d1
authored
Aug 14, 2008
by
Jon Skeet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More tests, and implementation of UninitializedMessageException description.
parent
794409b3
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
1086 additions
and
261 deletions
+1086
-261
AbstractMessageTest.cs
csharp/ProtocolBuffers.Test/AbstractMessageTest.cs
+11
-11
GeneratedMessageTest.cs
csharp/ProtocolBuffers.Test/GeneratedMessageTest.cs
+19
-26
MessageTest.cs
csharp/ProtocolBuffers.Test/MessageTest.cs
+286
-0
ProtocolBuffers.Test.csproj
csharp/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj
+5
-0
EnumWithNoOuter.cs
csharp/ProtocolBuffers.Test/TestProtos/EnumWithNoOuter.cs
+16
-0
MessageWithNoOuter.cs
csharp/ProtocolBuffers.Test/TestProtos/MessageWithNoOuter.cs
+395
-0
MultiFileProto.cs
csharp/ProtocolBuffers.Test/TestProtos/MultiFileProto.cs
+85
-0
ServiceWithNoOuter.cs
csharp/ProtocolBuffers.Test/TestProtos/ServiceWithNoOuter.cs
+103
-0
UnitTestEmbedOptimizeForProtoFile.cs
...fers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs
+1
-4
UnitTestImportProtoFile.cs
...rotocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs
+1
-4
UnitTestMessageSetProtoFile.cs
...colBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs
+6
-24
UnitTestOptimizeForProtoFile.cs
...olBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs
+1
-4
UnitTestProtoFile.cs
csharp/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs
+29
-116
AbstractBuilder.cs
csharp/ProtocolBuffers/AbstractBuilder.cs
+2
-2
DescriptorProtoFile.cs
...p/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs
+15
-60
DynamicMessage.cs
csharp/ProtocolBuffers/DynamicMessage.cs
+9
-4
GeneratedBuilder.cs
csharp/ProtocolBuffers/GeneratedBuilder.cs
+3
-3
IBuilder.cs
csharp/ProtocolBuffers/IBuilder.cs
+2
-2
UninitializedMessageException.cs
csharp/ProtocolBuffers/UninitializedMessageException.cs
+97
-1
No files found.
csharp/ProtocolBuffers.Test/AbstractMessageTest.cs
View file @
cabd06d1
...
...
@@ -63,13 +63,13 @@ namespace Google.ProtocolBuffers {
TestRequired
.
Builder
builder
=
TestRequired
.
CreateBuilder
();
AbstractMessageWrapper
.
Builder
abstractBuilder
=
new
AbstractMessageWrapper
.
Builder
(
builder
);
Assert
.
IsFalse
(
abstractBuilder
.
Initialized
);
Assert
.
IsFalse
(
abstractBuilder
.
I
sI
nitialized
);
builder
.
A
=
1
;
Assert
.
IsFalse
(
abstractBuilder
.
Initialized
);
Assert
.
IsFalse
(
abstractBuilder
.
I
sI
nitialized
);
builder
.
B
=
1
;
Assert
.
IsFalse
(
abstractBuilder
.
Initialized
);
Assert
.
IsFalse
(
abstractBuilder
.
I
sI
nitialized
);
builder
.
C
=
1
;
Assert
.
IsTrue
(
abstractBuilder
.
Initialized
);
Assert
.
IsTrue
(
abstractBuilder
.
I
sI
nitialized
);
}
[
Test
]
...
...
@@ -77,19 +77,19 @@ namespace Google.ProtocolBuffers {
TestRequiredForeign
.
Builder
builder
=
TestRequiredForeign
.
CreateBuilder
();
AbstractMessageWrapper
.
Builder
abstractBuilder
=
new
AbstractMessageWrapper
.
Builder
(
builder
);
Assert
.
IsTrue
(
abstractBuilder
.
Initialized
);
Assert
.
IsTrue
(
abstractBuilder
.
I
sI
nitialized
);
builder
.
SetOptionalMessage
(
TestRequiredUninitialized
);
Assert
.
IsFalse
(
abstractBuilder
.
Initialized
);
Assert
.
IsFalse
(
abstractBuilder
.
I
sI
nitialized
);
builder
.
SetOptionalMessage
(
TestRequiredInitialized
);
Assert
.
IsTrue
(
abstractBuilder
.
Initialized
);
Assert
.
IsTrue
(
abstractBuilder
.
I
sI
nitialized
);
builder
.
AddRepeatedMessage
(
TestRequiredUninitialized
);
Assert
.
IsFalse
(
abstractBuilder
.
Initialized
);
Assert
.
IsFalse
(
abstractBuilder
.
I
sI
nitialized
);
builder
.
SetRepeatedMessage
(
0
,
TestRequiredInitialized
);
Assert
.
IsTrue
(
abstractBuilder
.
Initialized
);
Assert
.
IsTrue
(
abstractBuilder
.
I
sI
nitialized
);
}
// -----------------------------------------------------------------
...
...
@@ -261,8 +261,8 @@ namespace Google.ProtocolBuffers {
this
.
wrappedBuilder
=
wrappedBuilder
;
}
public
override
bool
Initialized
{
get
{
return
wrappedBuilder
.
Initialized
;
}
public
override
bool
I
sI
nitialized
{
get
{
return
wrappedBuilder
.
I
sI
nitialized
;
}
}
public
override
IDictionary
<
FieldDescriptor
,
object
>
AllFields
{
...
...
csharp/ProtocolBuffers.Test/GeneratedMessageTest.cs
View file @
cabd06d1
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Google.ProtocolBuffers.Descriptors
;
using
NUnit.Framework
;
using
Google.ProtocolBuffers.TestProtos
;
...
...
@@ -176,49 +177,41 @@ namespace Google.ProtocolBuffers {
public
void
ExtensionReflectionDefaults
()
{
extensionsReflectionTester
.
AssertClearViaReflection
(
TestAllExtensions
.
DefaultInstance
);
extensionsReflectionTester
.
AssertClearViaReflection
(
TestAllExtensions
.
CreateBuilder
().
Build
());
}
public
void
testClearExtension
()
{
// clearExtension() is not actually used in TestUtil, so try it manually.
}
[
Test
]
public
void
ClearExtension
()
{
// ClearExtension() is not actually used in TestUtil, so try it manually.
Assert
.
IsFalse
(
TestAllExtensions
.
CreateBuilder
()
.
SetExtension
(
UnitTestProtoFile
.
OptionalInt32Extension
,
1
)
.
ClearExtension
(
UnitTestProtoFile
.
OptionalInt32Extension
)
.
HasExtension
(
UnitTestProtoFile
.
OptionalInt32Extension
));
Assert
.
AreEqual
(
0
,
TestAllExtensions
.
CreateBuilder
()
Assert
.
AreEqual
(
0
,
TestAllExtensions
.
CreateBuilder
()
.
AddExtension
(
UnitTestProtoFile
.
RepeatedInt32Extension
,
1
)
.
ClearExtension
(
UnitTestProtoFile
.
RepeatedInt32Extension
)
.
GetExtensionCount
(
UnitTestProtoFile
.
RepeatedInt32Extension
));
}
// =================================================================
// multiple_files_test
/* FIXME: Find this proto!
[
Test
]
public
void
MultipleFilesOption
()
{
// We mostly just want to check that things compile.
MessageWithNoOuter
message
=
MessageWithNoOuter
.
CreateBuilder
()
.
setNested(MessageWithNoOuter.NestedMessage.CreateBuilder().s
etI(1))
.
addForeign(TestAllTypes.CreateBuilder().s
etOptionalInt32(1))
.
setNestedEnum(MessageWithNoOuter
.NestedEnum.BAZ)
.
s
etForeignEnum(EnumWithNoOuter.BAR)
.
SetNested
(
MessageWithNoOuter
.
Types
.
NestedMessage
.
CreateBuilder
().
S
etI
(
1
))
.
AddForeign
(
TestAllTypes
.
CreateBuilder
().
S
etOptionalInt32
(
1
))
.
SetNestedEnum
(
MessageWithNoOuter
.
Types
.
NestedEnum
.
BAZ
)
.
S
etForeignEnum
(
EnumWithNoOuter
.
BAR
)
.
Build
();
Assert.AreEqual(message, MessageWithNoOuter.
parseFrom(message.t
oByteString()));
Assert
.
AreEqual
(
message
,
MessageWithNoOuter
.
ParseFrom
(
message
.
T
oByteString
()));
Assert.AreEqual(MultipleFilesTestProto.getDescriptor(),
MessageWithNoOuter.getDescriptor().getFile());
Assert
.
AreEqual
(
MultiFileProto
.
Descriptor
,
MessageWithNoOuter
.
Descriptor
.
File
);
Descriptors.FieldDescriptor field =
MessageWithNoOuter.getDescriptor().findFieldByName("foreign_enum");
Assert.AreEqual(EnumWithNoOuter.BAR.getValueDescriptor(),
message.getField(field));
FieldDescriptor
field
=
MessageWithNoOuter
.
Descriptor
.
FindDescriptor
<
FieldDescriptor
>(
"foreign_enum"
);
Assert
.
AreEqual
(
MultiFileProto
.
Descriptor
.
FindTypeByName
<
EnumDescriptor
>(
"EnumWithNoOuter"
)
.
FindValueByNumber
((
int
)
EnumWithNoOuter
.
BAR
),
message
[
field
]);
Assert.AreEqual(MultipleFilesTestProto.getDescriptor(),
ServiceWithNoOuter.getDescriptor().getFile());
Assert
.
AreEqual
(
MultiFileProto
.
Descriptor
,
ServiceWithNoOuter
.
Descriptor
.
File
);
assertFalse(
TestAllExtensions.getDefaultInstance().hasExtension(
MultipleFilesTestProto.extensionWithOuter));
Assert
.
IsFalse
(
TestAllExtensions
.
DefaultInstance
.
HasExtension
(
MultiFileProto
.
ExtensionWithOuter
));
}
*/
}
}
csharp/ProtocolBuffers.Test/MessageTest.cs
0 → 100644
View file @
cabd06d1
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Google.ProtocolBuffers.Descriptors
;
using
Google.ProtocolBuffers.TestProtos
;
using
NUnit.Framework
;
namespace
Google.ProtocolBuffers
{
/// <summary>
/// Miscellaneous tests for message operations that apply to both
/// generated and dynamic messages.
/// </summary>
[
TestFixture
]
public
class
MessageTest
{
// =================================================================
// Message-merging tests.
private
static
readonly
TestAllTypes
MergeSource
=
new
TestAllTypes
.
Builder
{
OptionalInt32
=
1
,
OptionalString
=
"foo"
,
OptionalForeignMessage
=
ForeignMessage
.
DefaultInstance
,
}.
AddRepeatedString
(
"bar"
).
Build
();
private
static
readonly
TestAllTypes
MergeDest
=
new
TestAllTypes
.
Builder
{
OptionalInt64
=
2
,
OptionalString
=
"baz"
,
OptionalForeignMessage
=
new
ForeignMessage
.
Builder
{
C
=
3
}.
Build
(),
}.
AddRepeatedString
(
"qux"
).
Build
();
private
const
string
MergeResultText
=
"optional_int32: 1\n"
+
"optional_int64: 2\n"
+
"optional_string: \"foo\"\n"
+
"optional_foreign_message {\n"
+
" c: 3\n"
+
"}\n"
+
"repeated_string: \"qux\"\n"
+
"repeated_string: \"bar\"\n"
;
[
Test
]
public
void
MergeFrom
()
{
TestAllTypes
result
=
TestAllTypes
.
CreateBuilder
(
MergeDest
).
MergeFrom
(
MergeSource
).
Build
();
Assert
.
AreEqual
(
MergeResultText
,
result
.
ToString
());
}
/// <summary>
/// Test merging a DynamicMessage into a GeneratedMessage.
/// As long as they have the same descriptor, this should work, but it is an
/// entirely different code path.
/// </summary>
[
Test
]
public
void
MergeFromDynamic
()
{
TestAllTypes
result
=
(
TestAllTypes
)
TestAllTypes
.
CreateBuilder
(
MergeDest
)
.
MergeFrom
(
DynamicMessage
.
CreateBuilder
(
MergeSource
).
Build
())
.
Build
();
Assert
.
AreEqual
(
MergeResultText
,
result
.
ToString
());
}
/** Test merging two DynamicMessages. */
public
void
testDynamicMergeFrom
()
{
DynamicMessage
result
=
(
DynamicMessage
)
DynamicMessage
.
CreateBuilder
(
MergeDest
)
.
MergeFrom
((
DynamicMessage
)
DynamicMessage
.
CreateBuilder
(
MergeSource
).
Build
())
.
Build
();
Assert
.
AreEqual
(
MergeResultText
,
result
.
ToString
());
}
// =================================================================
// Required-field-related tests.
private
static
readonly
TestRequired
TestRequiredUninitialized
=
TestRequired
.
DefaultInstance
;
private
static
readonly
TestRequired
TestRequiredInitialized
=
new
TestRequired
.
Builder
{
A
=
1
,
B
=
2
,
C
=
3
}.
Build
();
[
Test
]
public
void
Initialization
()
{
TestRequired
.
Builder
builder
=
TestRequired
.
CreateBuilder
();
Assert
.
IsFalse
(
builder
.
IsInitialized
);
builder
.
A
=
1
;
Assert
.
IsFalse
(
builder
.
IsInitialized
);
builder
.
B
=
1
;
Assert
.
IsFalse
(
builder
.
IsInitialized
);
builder
.
C
=
1
;
Assert
.
IsTrue
(
builder
.
IsInitialized
);
}
[
Test
]
public
void
RequiredForeign
()
{
TestRequiredForeign
.
Builder
builder
=
TestRequiredForeign
.
CreateBuilder
();
Assert
.
IsTrue
(
builder
.
IsInitialized
);
builder
.
SetOptionalMessage
(
TestRequiredUninitialized
);
Assert
.
IsFalse
(
builder
.
IsInitialized
);
builder
.
SetOptionalMessage
(
TestRequiredInitialized
);
Assert
.
IsTrue
(
builder
.
IsInitialized
);
builder
.
AddRepeatedMessage
(
TestRequiredUninitialized
);
Assert
.
IsFalse
(
builder
.
IsInitialized
);
builder
.
SetRepeatedMessage
(
0
,
TestRequiredInitialized
);
Assert
.
IsTrue
(
builder
.
IsInitialized
);
}
[
Test
]
public
void
RequiredExtension
()
{
TestAllExtensions
.
Builder
builder
=
TestAllExtensions
.
CreateBuilder
();
Assert
.
IsTrue
(
builder
.
IsInitialized
);
builder
.
SetExtension
(
TestRequired
.
Types
.
Single
,
TestRequiredUninitialized
);
Assert
.
IsFalse
(
builder
.
IsInitialized
);
builder
.
SetExtension
(
TestRequired
.
Types
.
Single
,
TestRequiredInitialized
);
Assert
.
IsTrue
(
builder
.
IsInitialized
);
builder
.
AddExtension
(
TestRequired
.
Types
.
Multi
,
TestRequiredUninitialized
);
Assert
.
IsFalse
(
builder
.
IsInitialized
);
builder
.
SetExtension
(
TestRequired
.
Types
.
Multi
,
0
,
TestRequiredInitialized
);
Assert
.
IsTrue
(
builder
.
IsInitialized
);
}
[
Test
]
public
void
RequiredDynamic
()
{
MessageDescriptor
descriptor
=
TestRequired
.
Descriptor
;
DynamicMessage
.
Builder
builder
=
DynamicMessage
.
CreateBuilder
(
descriptor
);
Assert
.
IsFalse
(
builder
.
IsInitialized
);
builder
[
descriptor
.
FindDescriptor
<
FieldDescriptor
>(
"a"
)]
=
1
;
Assert
.
IsFalse
(
builder
.
IsInitialized
);
builder
[
descriptor
.
FindDescriptor
<
FieldDescriptor
>(
"b"
)]
=
1
;
Assert
.
IsFalse
(
builder
.
IsInitialized
);
builder
[
descriptor
.
FindDescriptor
<
FieldDescriptor
>(
"c"
)]
=
1
;
Assert
.
IsTrue
(
builder
.
IsInitialized
);
}
[
Test
]
public
void
RequiredDynamicForeign
()
{
MessageDescriptor
descriptor
=
TestRequiredForeign
.
Descriptor
;
DynamicMessage
.
Builder
builder
=
DynamicMessage
.
CreateBuilder
(
descriptor
);
Assert
.
IsTrue
(
builder
.
IsInitialized
);
builder
[
descriptor
.
FindDescriptor
<
FieldDescriptor
>(
"optional_message"
)]
=
TestRequiredUninitialized
;
Assert
.
IsFalse
(
builder
.
IsInitialized
);
builder
[
descriptor
.
FindDescriptor
<
FieldDescriptor
>(
"optional_message"
)]
=
TestRequiredInitialized
;
Assert
.
IsTrue
(
builder
.
IsInitialized
);
// TODO(jonskeet): Remove this nastiness by making IBuilder always generic.
((
IBuilder
)
builder
).
AddRepeatedField
(
descriptor
.
FindDescriptor
<
FieldDescriptor
>(
"repeated_message"
),
TestRequiredUninitialized
);
Assert
.
IsFalse
(
builder
.
IsInitialized
);
builder
.
SetRepeatedField
(
descriptor
.
FindDescriptor
<
FieldDescriptor
>(
"repeated_message"
),
0
,
TestRequiredInitialized
);
Assert
.
IsTrue
(
builder
.
IsInitialized
);
}
[
Test
]
public
void
UninitializedException
()
{
try
{
TestRequired
.
CreateBuilder
().
Build
();
Assert
.
Fail
(
"Should have thrown an exception."
);
}
catch
(
UninitializedMessageException
e
)
{
Assert
.
AreEqual
(
"Message missing required fields: a, b, c"
,
e
.
Message
);
}
}
[
Test
]
public
void
BuildPartial
()
{
// We're mostly testing that no exception is thrown.
TestRequired
message
=
TestRequired
.
CreateBuilder
().
BuildPartial
();
Assert
.
IsFalse
(
message
.
IsInitialized
);
}
[
Test
]
public
void
NestedUninitializedException
()
{
try
{
TestRequiredForeign
.
CreateBuilder
()
.
SetOptionalMessage
(
TestRequiredUninitialized
)
.
AddRepeatedMessage
(
TestRequiredUninitialized
)
.
AddRepeatedMessage
(
TestRequiredUninitialized
)
.
Build
();
Assert
.
Fail
(
"Should have thrown an exception."
);
}
catch
(
UninitializedMessageException
e
)
{
Assert
.
AreEqual
(
"Message missing required fields: "
+
"optional_message.a, "
+
"optional_message.b, "
+
"optional_message.c, "
+
"repeated_message[0].a, "
+
"repeated_message[0].b, "
+
"repeated_message[0].c, "
+
"repeated_message[1].a, "
+
"repeated_message[1].b, "
+
"repeated_message[1].c"
,
e
.
Message
);
}
}
[
Test
]
public
void
BuildNestedPartial
()
{
// We're mostly testing that no exception is thrown.
TestRequiredForeign
message
=
TestRequiredForeign
.
CreateBuilder
()
.
SetOptionalMessage
(
TestRequiredUninitialized
)
.
AddRepeatedMessage
(
TestRequiredUninitialized
)
.
AddRepeatedMessage
(
TestRequiredUninitialized
)
.
BuildPartial
();
Assert
.
IsFalse
(
message
.
IsInitialized
);
}
[
Test
]
public
void
ParseUnititialized
()
{
try
{
TestRequired
.
ParseFrom
(
ByteString
.
Empty
);
Assert
.
Fail
(
"Should have thrown an exception."
);
}
catch
(
InvalidProtocolBufferException
e
)
{
Assert
.
AreEqual
(
"Message missing required fields: a, b, c"
,
e
.
Message
);
}
}
[
Test
]
public
void
ParseNestedUnititialized
()
{
ByteString
data
=
TestRequiredForeign
.
CreateBuilder
()
.
SetOptionalMessage
(
TestRequiredUninitialized
)
.
AddRepeatedMessage
(
TestRequiredUninitialized
)
.
AddRepeatedMessage
(
TestRequiredUninitialized
)
.
BuildPartial
().
ToByteString
();
try
{
TestRequiredForeign
.
ParseFrom
(
data
);
Assert
.
Fail
(
"Should have thrown an exception."
);
}
catch
(
InvalidProtocolBufferException
e
)
{
Assert
.
AreEqual
(
"Message missing required fields: "
+
"optional_message.a, "
+
"optional_message.b, "
+
"optional_message.c, "
+
"repeated_message[0].a, "
+
"repeated_message[0].b, "
+
"repeated_message[0].c, "
+
"repeated_message[1].a, "
+
"repeated_message[1].b, "
+
"repeated_message[1].c"
,
e
.
Message
);
}
}
[
Test
]
public
void
DynamicUninitializedException
()
{
try
{
DynamicMessage
.
CreateBuilder
(
TestRequired
.
Descriptor
).
Build
();
Assert
.
Fail
(
"Should have thrown an exception."
);
}
catch
(
UninitializedMessageException
e
)
{
Assert
.
AreEqual
(
"Message missing required fields: a, b, c"
,
e
.
Message
);
}
}
[
Test
]
public
void
DynamicBuildPartial
()
{
// We're mostly testing that no exception is thrown.
// TODO(jonskeet): Fix this ghastly casting mess
DynamicMessage
message
=
(
DynamicMessage
)
((
IBuilder
)
DynamicMessage
.
CreateBuilder
(
TestRequired
.
Descriptor
)).
BuildPartial
();
Assert
.
IsFalse
(
message
.
Initialized
);
}
[
Test
]
public
void
DynamicParseUnititialized
()
{
try
{
MessageDescriptor
descriptor
=
TestRequired
.
Descriptor
;
DynamicMessage
.
ParseFrom
(
descriptor
,
ByteString
.
Empty
);
Assert
.
Fail
(
"Should have thrown an exception."
);
}
catch
(
InvalidProtocolBufferException
e
)
{
Assert
.
AreEqual
(
"Message missing required fields: a, b, c"
,
e
.
Message
);
}
}
}
}
csharp/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj
View file @
cabd06d1
...
...
@@ -51,8 +51,13 @@
<Compile
Include=
"DescriptorsTest.cs"
/>
<Compile
Include=
"DynamicMessageTest.cs"
/>
<Compile
Include=
"GeneratedMessageTest.cs"
/>
<Compile
Include=
"MessageTest.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"ReflectionTester.cs"
/>
<Compile
Include=
"TestProtos\EnumWithNoOuter.cs"
/>
<Compile
Include=
"TestProtos\MessageWithNoOuter.cs"
/>
<Compile
Include=
"TestProtos\MultiFileProto.cs"
/>
<Compile
Include=
"TestProtos\ServiceWithNoOuter.cs"
/>
<Compile
Include=
"TestProtos\UnitTestEmbedOptimizeForProtoFile.cs"
/>
<Compile
Include=
"TestProtos\UnitTestImportProtoFile.cs"
/>
<Compile
Include=
"TestProtos\UnitTestMessageSetProtoFile.cs"
/>
...
...
csharp/ProtocolBuffers.Test/TestProtos/EnumWithNoOuter.cs
0 → 100644
View file @
cabd06d1
// Generated by the protocol buffer compiler. DO NOT EDIT!
using
pb
=
global
::
Google
.
ProtocolBuffers
;
using
pbc
=
global
::
Google
.
ProtocolBuffers
.
Collections
;
using
pbd
=
global
::
Google
.
ProtocolBuffers
.
Descriptors
;
using
scg
=
global
::
System
.
Collections
.
Generic
;
using
self
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
;
namespace
Google.ProtocolBuffers.TestProtos
{
public
enum
EnumWithNoOuter
{
FOO
=
1
,
BAR
=
2
,
}
}
csharp/ProtocolBuffers.Test/TestProtos/MessageWithNoOuter.cs
0 → 100644
View file @
cabd06d1
// Generated by the protocol buffer compiler. DO NOT EDIT!
using
pb
=
global
::
Google
.
ProtocolBuffers
;
using
pbc
=
global
::
Google
.
ProtocolBuffers
.
Collections
;
using
pbd
=
global
::
Google
.
ProtocolBuffers
.
Descriptors
;
using
scg
=
global
::
System
.
Collections
.
Generic
;
using
self
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
;
namespace
Google.ProtocolBuffers.TestProtos
{
public
sealed
partial
class
MessageWithNoOuter
:
pb
::
GeneratedMessage
<
MessageWithNoOuter
,
MessageWithNoOuter
.
Builder
>
{
private
static
readonly
MessageWithNoOuter
defaultInstance
=
new
MessageWithNoOuter
();
public
static
MessageWithNoOuter
DefaultInstance
{
get
{
return
defaultInstance
;
}
}
public
override
MessageWithNoOuter
DefaultInstanceForType
{
get
{
return
defaultInstance
;
}
}
public
static
pbd
::
MessageDescriptor
Descriptor
{
get
{
return
self
::
MultiFileProto
.
internal__static_protobuf_unittest_MessageWithNoOuter__Descriptor
;
}
}
protected
override
pb
::
FieldAccess
.
FieldAccessorTable
InternalFieldAccessors
{
get
{
return
self
::
MultiFileProto
.
internal__static_protobuf_unittest_MessageWithNoOuter__FieldAccessorTable
;
}
}
#
region
Nested
types
public
static
class
Types
{
public
enum
NestedEnum
{
BAZ
=
3
,
}
public
sealed
partial
class
NestedMessage
:
pb
::
GeneratedMessage
<
NestedMessage
,
NestedMessage
.
Builder
>
{
private
static
readonly
NestedMessage
defaultInstance
=
new
NestedMessage
();
public
static
NestedMessage
DefaultInstance
{
get
{
return
defaultInstance
;
}
}
public
override
NestedMessage
DefaultInstanceForType
{
get
{
return
defaultInstance
;
}
}
public
static
pbd
::
MessageDescriptor
Descriptor
{
get
{
return
self
::
MultiFileProto
.
internal__static_protobuf_unittest_MessageWithNoOuter_NestedMessage__Descriptor
;
}
}
protected
override
pb
::
FieldAccess
.
FieldAccessorTable
InternalFieldAccessors
{
get
{
return
self
::
MultiFileProto
.
internal__static_protobuf_unittest_MessageWithNoOuter_NestedMessage__FieldAccessorTable
;
}
}
// optional int32 i = 1;
private
bool
hasI
;
private
int
i_
=
0
;
public
bool
HasI
{
get
{
return
hasI
;
}
}
public
int
I
{
get
{
return
i_
;
}
}
public
static
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
ParseFrom
(
pb
::
ByteString
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
ParseFrom
(
pb
::
ByteString
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
}
public
static
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
ParseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
}
public
static
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
ParseFrom
(
global
::
System
.
IO
.
Stream
input
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
)).
BuildParsed
();
}
public
static
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
ParseFrom
(
global
::
System
.
IO
.
Stream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
))
.
BuildParsed
();
}
public
static
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
ParseFrom
(
pb
::
CodedInputStream
input
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
)).
BuildParsed
();
}
public
static
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
ParseFrom
(
pb
::
CodedInputStream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
))
.
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
IBuilder
<
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
>
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
}
public
sealed
partial
class
Builder
:
pb
::
GeneratedBuilder
<
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
,
Builder
>
{
// Construct using self::MessageWithNoOuter.Types.NestedMessage.CreateBuilder()
internal
Builder
()
{}
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
result
=
new
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
();
protected
override
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
MessageBeingBuilt
{
get
{
return
result
;
}
}
public
override
IBuilder
<
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
>
Clear
()
{
result
=
new
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
();
return
this
;
}
public
override
IBuilder
<
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
>
Clone
()
{
return
new
Builder
().
MergeFrom
(
result
);
}
public
override
pbd
::
MessageDescriptor
DescriptorForType
{
get
{
return
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
.
Descriptor
;
}
}
public
override
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
DefaultInstanceForType
{
get
{
return
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
.
DefaultInstance
;
}
}
public
override
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
BuildPartial
()
{
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
returnMe
=
result
;
result
=
null
;
return
returnMe
;
}
// optional int32 i = 1;
public
bool
HasI
{
get
{
return
result
.
HasI
;
}
}
public
int
I
{
get
{
return
result
.
I
;
}
set
{
SetI
(
value
);
}
}
public
Builder
SetI
(
int
value
)
{
result
.
hasI
=
true
;
result
.
i_
=
value
;
return
this
;
}
public
Builder
ClearI
()
{
result
.
hasI
=
false
;
result
.
i_
=
0
;
return
this
;
}
}
}
}
#
endregion
// optional .protobuf_unittest.MessageWithNoOuter.NestedMessage nested = 1;
private
bool
hasNested
;
private
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
nested_
=
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
.
DefaultInstance
;
public
bool
HasNested
{
get
{
return
hasNested
;
}
}
public
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
Nested
{
get
{
return
nested_
;
}
}
// repeated .protobuf_unittest.TestAllTypes foreign = 2;
private
scg
::
IList
<
self
::
TestAllTypes
>
foreign_
=
pbc
::
Lists
<
self
::
TestAllTypes
>.
Empty
;
public
scg
::
IList
<
self
::
TestAllTypes
>
ForeignList
{
get
{
return
foreign_
;
}
}
public
int
ForeignCount
{
get
{
return
foreign_
.
Count
;
}
}
public
self
::
TestAllTypes
GetForeign
(
int
index
)
{
return
foreign_
[
index
];
}
// optional .protobuf_unittest.MessageWithNoOuter.NestedEnum nested_enum = 3;
private
bool
hasNestedEnum
;
private
self
::
MessageWithNoOuter
.
Types
.
NestedEnum
nestedEnum_
=
self
::
MessageWithNoOuter
.
Types
.
NestedEnum
.
BAZ
;
public
bool
HasNestedEnum
{
get
{
return
hasNestedEnum
;
}
}
public
self
::
MessageWithNoOuter
.
Types
.
NestedEnum
NestedEnum
{
get
{
return
nestedEnum_
;
}}
// optional .protobuf_unittest.EnumWithNoOuter foreign_enum = 4;
private
bool
hasForeignEnum
;
private
self
::
EnumWithNoOuter
foreignEnum_
=
self
::
EnumWithNoOuter
.
FOO
;
public
bool
HasForeignEnum
{
get
{
return
hasForeignEnum
;
}
}
public
self
::
EnumWithNoOuter
ForeignEnum
{
get
{
return
foreignEnum_
;
}}
public
static
self
::
MessageWithNoOuter
ParseFrom
(
pb
::
ByteString
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
MessageWithNoOuter
ParseFrom
(
pb
::
ByteString
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
}
public
static
self
::
MessageWithNoOuter
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
MessageWithNoOuter
ParseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
}
public
static
self
::
MessageWithNoOuter
ParseFrom
(
global
::
System
.
IO
.
Stream
input
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
)).
BuildParsed
();
}
public
static
self
::
MessageWithNoOuter
ParseFrom
(
global
::
System
.
IO
.
Stream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
))
.
BuildParsed
();
}
public
static
self
::
MessageWithNoOuter
ParseFrom
(
pb
::
CodedInputStream
input
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
)).
BuildParsed
();
}
public
static
self
::
MessageWithNoOuter
ParseFrom
(
pb
::
CodedInputStream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
))
.
BuildParsed
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
IBuilder
<
self
::
MessageWithNoOuter
>
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
self
::
MessageWithNoOuter
prototype
)
{
return
(
Builder
)
new
Builder
().
MergeFrom
(
prototype
);
}
public
sealed
partial
class
Builder
:
pb
::
GeneratedBuilder
<
self
::
MessageWithNoOuter
,
Builder
>
{
// Construct using self::MessageWithNoOuter.CreateBuilder()
internal
Builder
()
{}
self
::
MessageWithNoOuter
result
=
new
self
::
MessageWithNoOuter
();
protected
override
self
::
MessageWithNoOuter
MessageBeingBuilt
{
get
{
return
result
;
}
}
public
override
IBuilder
<
self
::
MessageWithNoOuter
>
Clear
()
{
result
=
new
self
::
MessageWithNoOuter
();
return
this
;
}
public
override
IBuilder
<
self
::
MessageWithNoOuter
>
Clone
()
{
return
new
Builder
().
MergeFrom
(
result
);
}
public
override
pbd
::
MessageDescriptor
DescriptorForType
{
get
{
return
self
::
MessageWithNoOuter
.
Descriptor
;
}
}
public
override
self
::
MessageWithNoOuter
DefaultInstanceForType
{
get
{
return
self
::
MessageWithNoOuter
.
DefaultInstance
;
}
}
public
override
self
::
MessageWithNoOuter
BuildPartial
()
{
if
(
result
.
foreign_
!=
pbc
::
Lists
<
self
::
TestAllTypes
>.
Empty
)
{
result
.
foreign_
=
pbc
::
Lists
<
self
::
TestAllTypes
>.
AsReadOnly
(
result
.
foreign_
);
}
self
::
MessageWithNoOuter
returnMe
=
result
;
result
=
null
;
return
returnMe
;
}
// optional .protobuf_unittest.MessageWithNoOuter.NestedMessage nested = 1;
public
bool
HasNested
{
get
{
return
result
.
HasNested
;
}
}
public
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
Nested
{
get
{
return
result
.
Nested
;
}
set
{
SetNested
(
value
);
}
}
public
Builder
SetNested
(
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
value
)
{
result
.
hasNested
=
true
;
result
.
nested_
=
value
;
return
this
;
}
public
Builder
SetNested
(
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
.
Builder
builderForValue
)
{
result
.
hasNested
=
true
;
result
.
nested_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeNested
(
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
value
)
{
if
(
result
.
HasNested
&&
result
.
nested_
!=
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
.
DefaultInstance
)
{
result
.
nested_
=
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
.
CreateBuilder
(
result
.
nested_
).
MergeFrom
(
value
).
BuildPartial
();
}
else
{
result
.
nested_
=
value
;
}
result
.
hasNested
=
true
;
return
this
;
}
public
Builder
ClearNested
()
{
result
.
hasNested
=
false
;
result
.
nested_
=
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
.
DefaultInstance
;
return
this
;
}
// repeated .protobuf_unittest.TestAllTypes foreign = 2;
public
scg
::
IList
<
self
::
TestAllTypes
>
ForeignList
{
get
{
return
pbc
::
Lists
.
AsReadOnly
(
result
.
foreign_
);
}
}
public
int
ForeignCount
{
get
{
return
result
.
ForeignCount
;
}
}
public
self
::
TestAllTypes
GetForeign
(
int
index
)
{
return
result
.
GetForeign
(
index
);
}
public
Builder
SetForeign
(
int
index
,
self
::
TestAllTypes
value
)
{
result
.
foreign_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetForeign
(
int
index
,
self
::
TestAllTypes
.
Builder
builderForValue
)
{
result
.
foreign_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddForeign
(
self
::
TestAllTypes
value
)
{
if
(
result
.
foreign_
==
pbc
::
Lists
<
self
::
TestAllTypes
>.
Empty
)
{
result
.
foreign_
=
new
scg
::
List
<
self
::
TestAllTypes
>();
}
result
.
foreign_
.
Add
(
value
);
return
this
;
}
public
Builder
AddForeign
(
self
::
TestAllTypes
.
Builder
builderForValue
)
{
if
(
result
.
foreign_
==
pbc
::
Lists
<
self
::
TestAllTypes
>.
Empty
)
{
result
.
foreign_
=
new
scg
::
List
<
self
::
TestAllTypes
>();
}
result
.
foreign_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
public
Builder
AddRangeForeign
(
scg
::
IEnumerable
<
self
::
TestAllTypes
>
values
)
{
if
(
result
.
foreign_
==
pbc
::
Lists
<
self
::
TestAllTypes
>.
Empty
)
{
result
.
foreign_
=
new
scg
::
List
<
self
::
TestAllTypes
>();
}
base
.
AddRange
(
values
,
result
.
foreign_
);
return
this
;
}
public
Builder
ClearForeign
()
{
result
.
foreign_
=
pbc
::
Lists
<
self
::
TestAllTypes
>.
Empty
;
return
this
;
}
// optional .protobuf_unittest.MessageWithNoOuter.NestedEnum nested_enum = 3;
public
bool
HasNestedEnum
{
get
{
return
result
.
HasNestedEnum
;
}
}
public
self
::
MessageWithNoOuter
.
Types
.
NestedEnum
NestedEnum
{
get
{
return
result
.
NestedEnum
;
}
set
{
SetNestedEnum
(
value
);
}
}
public
Builder
SetNestedEnum
(
self
::
MessageWithNoOuter
.
Types
.
NestedEnum
value
)
{
result
.
hasNestedEnum
=
true
;
result
.
nestedEnum_
=
value
;
return
this
;
}
public
Builder
ClearNestedEnum
()
{
result
.
hasNestedEnum
=
false
;
result
.
nestedEnum_
=
self
::
MessageWithNoOuter
.
Types
.
NestedEnum
.
BAZ
;
return
this
;
}
// optional .protobuf_unittest.EnumWithNoOuter foreign_enum = 4;
public
bool
HasForeignEnum
{
get
{
return
result
.
HasForeignEnum
;
}
}
public
self
::
EnumWithNoOuter
ForeignEnum
{
get
{
return
result
.
ForeignEnum
;
}
set
{
SetForeignEnum
(
value
);
}
}
public
Builder
SetForeignEnum
(
self
::
EnumWithNoOuter
value
)
{
result
.
hasForeignEnum
=
true
;
result
.
foreignEnum_
=
value
;
return
this
;
}
public
Builder
ClearForeignEnum
()
{
result
.
hasForeignEnum
=
false
;
result
.
foreignEnum_
=
self
::
EnumWithNoOuter
.
FOO
;
return
this
;
}
}
}
}
csharp/ProtocolBuffers.Test/TestProtos/MultiFileProto.cs
0 → 100644
View file @
cabd06d1
// Generated by the protocol buffer compiler. DO NOT EDIT!
using
pb
=
global
::
Google
.
ProtocolBuffers
;
using
pbc
=
global
::
Google
.
ProtocolBuffers
.
Collections
;
using
pbd
=
global
::
Google
.
ProtocolBuffers
.
Descriptors
;
using
scg
=
global
::
System
.
Collections
.
Generic
;
using
self
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
;
namespace
Google.ProtocolBuffers.TestProtos
{
public
static
partial
class
MultiFileProto
{
#
region
Descriptor
public
static
pbd
::
FileDescriptor
Descriptor
{
get
{
return
descriptor
;
}
}
private
static
readonly
pbd
::
FileDescriptor
descriptor
=
pbd
::
FileDescriptor
.
InternalBuildGeneratedFileFrom
(
new
byte
[]
{
0x0a
,
0x3b
,
0x73
,
0x72
,
0x63
,
0x2f
,
0x74
,
0x65
,
0x73
,
0x74
,
0x2f
,
0x6a
,
0x61
,
0x76
,
0x61
,
0x2f
,
0x63
,
0x6f
,
0x6d
,
0x2f
,
0x67
,
0x6f
,
0x6f
,
0x67
,
0x6c
,
0x65
,
0x2f
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x62
,
0x75
,
0x66
,
0x2f
,
0x6d
,
0x75
,
0x6c
,
0x74
,
0x69
,
0x70
,
0x6c
,
0x65
,
0x5f
,
0x66
,
0x69
,
0x6c
,
0x65
,
0x73
,
0x5f
,
0x74
,
0x65
,
0x73
,
0x74
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x12
,
0x11
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x62
,
0x75
,
0x66
,
0x5f
,
0x75
,
0x6e
,
0x69
,
0x74
,
0x74
,
0x65
,
0x73
,
0x74
,
0x1a
,
0x1e
,
0x67
,
0x6f
,
0x6f
,
0x67
,
0x6c
,
0x65
,
0x2f
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x62
,
0x75
,
0x66
,
0x2f
,
0x75
,
0x6e
,
0x69
,
0x74
,
0x74
,
0x65
,
0x73
,
0x74
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x22
,
0xbf
,
0x02
,
0x0a
,
0x12
,
0x4d
,
0x65
,
0x73
,
0x73
,
0x61
,
0x67
,
0x65
,
0x57
,
0x69
,
0x74
,
0x68
,
0x4e
,
0x6f
,
0x4f
,
0x75
,
0x74
,
0x65
,
0x72
,
0x12
,
0x43
,
0x0a
,
0x06
,
0x6e
,
0x65
,
0x73
,
0x74
,
0x65
,
0x64
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x0b
,
0x32
,
0x33
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x62
,
0x75
,
0x66
,
0x5f
,
0x75
,
0x6e
,
0x69
,
0x74
,
0x74
,
0x65
,
0x73
,
0x74
,
0x2e
,
0x4d
,
0x65
,
0x73
,
0x73
,
0x61
,
0x67
,
0x65
,
0x57
,
0x69
,
0x74
,
0x68
,
0x4e
,
0x6f
,
0x4f
,
0x75
,
0x74
,
0x65
,
0x72
,
0x2e
,
0x4e
,
0x65
,
0x73
,
0x74
,
0x65
,
0x64
,
0x4d
,
0x65
,
0x73
,
0x73
,
0x61
,
0x67
,
0x65
,
0x12
,
0x30
,
0x0a
,
0x07
,
0x66
,
0x6f
,
0x72
,
0x65
,
0x69
,
0x67
,
0x6e
,
0x18
,
0x02
,
0x20
,
0x03
,
0x28
,
0x0b
,
0x32
,
0x1f
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x62
,
0x75
,
0x66
,
0x5f
,
0x75
,
0x6e
,
0x69
,
0x74
,
0x74
,
0x65
,
0x73
,
0x74
,
0x2e
,
0x54
,
0x65
,
0x73
,
0x74
,
0x41
,
0x6c
,
0x6c
,
0x54
,
0x79
,
0x70
,
0x65
,
0x73
,
0x12
,
0x45
,
0x0a
,
0x0b
,
0x6e
,
0x65
,
0x73
,
0x74
,
0x65
,
0x64
,
0x5f
,
0x65
,
0x6e
,
0x75
,
0x6d
,
0x18
,
0x03
,
0x20
,
0x01
,
0x28
,
0x0e
,
0x32
,
0x30
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x62
,
0x75
,
0x66
,
0x5f
,
0x75
,
0x6e
,
0x69
,
0x74
,
0x74
,
0x65
,
0x73
,
0x74
,
0x2e
,
0x4d
,
0x65
,
0x73
,
0x73
,
0x61
,
0x67
,
0x65
,
0x57
,
0x69
,
0x74
,
0x68
,
0x4e
,
0x6f
,
0x4f
,
0x75
,
0x74
,
0x65
,
0x72
,
0x2e
,
0x4e
,
0x65
,
0x73
,
0x74
,
0x65
,
0x64
,
0x45
,
0x6e
,
0x75
,
0x6d
,
0x12
,
0x38
,
0x0a
,
0x0c
,
0x66
,
0x6f
,
0x72
,
0x65
,
0x69
,
0x67
,
0x6e
,
0x5f
,
0x65
,
0x6e
,
0x75
,
0x6d
,
0x18
,
0x04
,
0x20
,
0x01
,
0x28
,
0x0e
,
0x32
,
0x22
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x62
,
0x75
,
0x66
,
0x5f
,
0x75
,
0x6e
,
0x69
,
0x74
,
0x74
,
0x65
,
0x73
,
0x74
,
0x2e
,
0x45
,
0x6e
,
0x75
,
0x6d
,
0x57
,
0x69
,
0x74
,
0x68
,
0x4e
,
0x6f
,
0x4f
,
0x75
,
0x74
,
0x65
,
0x72
,
0x1a
,
0x1a
,
0x0a
,
0x0d
,
0x4e
,
0x65
,
0x73
,
0x74
,
0x65
,
0x64
,
0x4d
,
0x65
,
0x73
,
0x73
,
0x61
,
0x67
,
0x65
,
0x12
,
0x09
,
0x0a
,
0x01
,
0x69
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x05
,
0x22
,
0x15
,
0x0a
,
0x0a
,
0x4e
,
0x65
,
0x73
,
0x74
,
0x65
,
0x64
,
0x45
,
0x6e
,
0x75
,
0x6d
,
0x12
,
0x07
,
0x0a
,
0x03
,
0x42
,
0x41
,
0x5a
,
0x10
,
0x03
,
0x2a
,
0x23
,
0x0a
,
0x0f
,
0x45
,
0x6e
,
0x75
,
0x6d
,
0x57
,
0x69
,
0x74
,
0x68
,
0x4e
,
0x6f
,
0x4f
,
0x75
,
0x74
,
0x65
,
0x72
,
0x12
,
0x07
,
0x0a
,
0x03
,
0x46
,
0x4f
,
0x4f
,
0x10
,
0x01
,
0x12
,
0x07
,
0x0a
,
0x03
,
0x42
,
0x41
,
0x52
,
0x10
,
0x02
,
0x32
,
0x63
,
0x0a
,
0x12
,
0x53
,
0x65
,
0x72
,
0x76
,
0x69
,
0x63
,
0x65
,
0x57
,
0x69
,
0x74
,
0x68
,
0x4e
,
0x6f
,
0x4f
,
0x75
,
0x74
,
0x65
,
0x72
,
0x12
,
0x4d
,
0x0a
,
0x03
,
0x46
,
0x6f
,
0x6f
,
0x12
,
0x25
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x62
,
0x75
,
0x66
,
0x5f
,
0x75
,
0x6e
,
0x69
,
0x74
,
0x74
,
0x65
,
0x73
,
0x74
,
0x2e
,
0x4d
,
0x65
,
0x73
,
0x73
,
0x61
,
0x67
,
0x65
,
0x57
,
0x69
,
0x74
,
0x68
,
0x4e
,
0x6f
,
0x4f
,
0x75
,
0x74
,
0x65
,
0x72
,
0x1a
,
0x1f
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x62
,
0x75
,
0x66
,
0x5f
,
0x75
,
0x6e
,
0x69
,
0x74
,
0x74
,
0x65
,
0x73
,
0x74
,
0x2e
,
0x54
,
0x65
,
0x73
,
0x74
,
0x41
,
0x6c
,
0x6c
,
0x54
,
0x79
,
0x70
,
0x65
,
0x73
,
0x3a
,
0x44
,
0x0a
,
0x14
,
0x65
,
0x78
,
0x74
,
0x65
,
0x6e
,
0x73
,
0x69
,
0x6f
,
0x6e
,
0x5f
,
0x77
,
0x69
,
0x74
,
0x68
,
0x5f
,
0x6f
,
0x75
,
0x74
,
0x65
,
0x72
,
0x12
,
0x24
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x62
,
0x75
,
0x66
,
0x5f
,
0x75
,
0x6e
,
0x69
,
0x74
,
0x74
,
0x65
,
0x73
,
0x74
,
0x2e
,
0x54
,
0x65
,
0x73
,
0x74
,
0x41
,
0x6c
,
0x6c
,
0x45
,
0x78
,
0x74
,
0x65
,
0x6e
,
0x73
,
0x69
,
0x6f
,
0x6e
,
0x73
,
0x18
,
0x87
,
0xad
,
0x4b
,
0x20
,
0x01
,
0x28
,
0x05
,
0x42
,
0x58
,
0x42
,
0x16
,
0x4d
,
0x75
,
0x6c
,
0x74
,
0x69
,
0x70
,
0x6c
,
0x65
,
0x46
,
0x69
,
0x6c
,
0x65
,
0x73
,
0x54
,
0x65
,
0x73
,
0x74
,
0x50
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x50
,
0x01
,
0xc2
,
0x3e
,
0x21
,
0x47
,
0x6f
,
0x6f
,
0x67
,
0x6c
,
0x65
,
0x2e
,
0x50
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x63
,
0x6f
,
0x6c
,
0x42
,
0x75
,
0x66
,
0x66
,
0x65
,
0x72
,
0x73
,
0x2e
,
0x54
,
0x65
,
0x73
,
0x74
,
0x50
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x73
,
0xca
,
0x3e
,
0x0e
,
0x4d
,
0x75
,
0x6c
,
0x74
,
0x69
,
0x46
,
0x69
,
0x6c
,
0x65
,
0x50
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0xd0
,
0x3e
,
0x01
,
0xd8
,
0x3e
,
0x00
,
0xe0
,
0x3e
,
0x01
,
},
new
pbd
::
FileDescriptor
[]
{
self
::
UnitTestProtoFile
.
Descriptor
,
});
#
endregion
#
region
Extensions
public
static
readonly
pb
::
GeneratedExtensionBase
<
self
::
TestAllExtensions
,
int
>
ExtensionWithOuter
=
pb
::
GeneratedSingleExtension
<
self
::
TestAllExtensions
,
int
>.
CreateInstance
(
Descriptor
.
Extensions
[
0
]);
#
endregion
#
region
Static
variables
internal
static
readonly
pbd
::
MessageDescriptor
internal__static_protobuf_unittest_MessageWithNoOuter__Descriptor
=
Descriptor
.
MessageTypes
[
0
];
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
internal__static_protobuf_unittest_MessageWithNoOuter__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
(
internal__static_protobuf_unittest_MessageWithNoOuter__Descriptor
,
new
string
[]
{
"Nested"
,
"Foreign"
,
"NestedEnum"
,
"ForeignEnum"
,
},
typeof
(
self
::
MessageWithNoOuter
),
typeof
(
self
::
MessageWithNoOuter
.
Builder
));
internal
static
readonly
pbd
::
MessageDescriptor
internal__static_protobuf_unittest_MessageWithNoOuter_NestedMessage__Descriptor
=
internal__static_protobuf_unittest_MessageWithNoOuter__Descriptor
.
NestedTypes
[
0
];
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
internal__static_protobuf_unittest_MessageWithNoOuter_NestedMessage__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
(
internal__static_protobuf_unittest_MessageWithNoOuter_NestedMessage__Descriptor
,
new
string
[]
{
"I"
,
},
typeof
(
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
),
typeof
(
self
::
MessageWithNoOuter
.
Types
.
NestedMessage
.
Builder
));
#
endregion
}
}
csharp/ProtocolBuffers.Test/TestProtos/ServiceWithNoOuter.cs
0 → 100644
View file @
cabd06d1
// Generated by the protocol buffer compiler. DO NOT EDIT!
using
pb
=
global
::
Google
.
ProtocolBuffers
;
using
pbc
=
global
::
Google
.
ProtocolBuffers
.
Collections
;
using
pbd
=
global
::
Google
.
ProtocolBuffers
.
Descriptors
;
using
scg
=
global
::
System
.
Collections
.
Generic
;
using
self
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
;
namespace
Google.ProtocolBuffers.TestProtos
{
public
abstract
class
ServiceWithNoOuter
:
pb
::
IService
{
public
abstract
void
Foo
(
pb
::
IRpcController
controller
,
self
::
MessageWithNoOuter
request
,
global
::
System
.
Action
<
self
::
TestAllTypes
>
done
);
public
static
pbd
::
ServiceDescriptor
Descriptor
{
get
{
return
self
::
MultiFileProto
.
Descriptor
.
Services
[
0
];
}
}
public
pbd
::
ServiceDescriptor
DescriptorForType
{
get
{
return
Descriptor
;
}
}
public
void
CallMethod
(
pbd
::
MethodDescriptor
method
,
pb
::
IRpcController
controller
,
pb
::
IMessage
request
,
global
::
System
.
Action
<
pb
::
IMessage
>
done
)
{
if
(
method
.
Service
!=
Descriptor
)
{
throw
new
global
::
System
.
ArgumentException
(
"Service.CallMethod() given method descriptor for wrong "
+
"service type."
);
}
switch
(
method
.
Index
)
{
case
0
:
this
.
Foo
(
controller
,
(
self
::
MessageWithNoOuter
)
request
,
pb
::
RpcUtil
.
SpecializeCallback
<
self
::
TestAllTypes
>(
done
));
return
;
default
:
throw
new
global
::
System
.
InvalidOperationException
(
"Can't get here."
);
}
}
public
pb
::
IMessage
GetRequestPrototype
(
pbd
::
MethodDescriptor
method
)
{
if
(
method
.
Service
!=
Descriptor
)
{
throw
new
global
::
System
.
ArgumentException
(
"Service.GetRequestPrototype() given method "
+
"descriptor for wrong service type."
);
}
switch
(
method
.
Index
)
{
case
0
:
return
self
::
MessageWithNoOuter
.
DefaultInstance
;
default
:
throw
new
global
::
System
.
ArgumentException
(
"Can't get here."
);
}
}
public
pb
::
IMessage
GetResponsePrototype
(
pbd
::
MethodDescriptor
method
)
{
if
(
method
.
Service
!=
Descriptor
)
{
throw
new
global
::
System
.
ArgumentException
(
"Service.GetResponsePrototype() given method "
+
"descriptor for wrong service type."
);
}
switch
(
method
.
Index
)
{
case
0
:
return
self
::
TestAllTypes
.
DefaultInstance
;
default
:
throw
new
global
::
System
.
ArgumentException
(
"Can't get here."
);
}
}
public
static
Stub
CreateStub
(
pb
::
IRpcChannel
channel
)
{
return
new
Stub
(
channel
);
}
public
class
Stub
:
self
::
ServiceWithNoOuter
{
internal
Stub
(
pb
::
IRpcChannel
channel
)
{
this
.
channel
=
channel
;
}
private
readonly
pb
::
IRpcChannel
channel
;
public
pb
::
IRpcChannel
Channel
{
get
{
return
channel
;
}
}
public
override
void
Foo
(
pb
::
IRpcController
controller
,
self
::
MessageWithNoOuter
request
,
global
::
System
.
Action
<
self
::
TestAllTypes
>
done
)
{
channel
.
CallMethod
(
Descriptor
.
Methods
[
0
],
controller
,
request
,
self
::
TestAllTypes
.
DefaultInstance
,
pb
::
RpcUtil
.
GeneralizeCallback
(
done
,
self
::
TestAllTypes
.
DefaultInstance
));
}
}
}
}
csharp/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs
View file @
cabd06d1
...
...
@@ -59,9 +59,6 @@ namespace Google.ProtocolBuffers.TestProtos {
#
region
Messages
public
sealed
partial
class
TestEmbedOptimizedForSize
:
pb
::
GeneratedMessage
<
TestEmbedOptimizedForSize
,
TestEmbedOptimizedForSize
.
Builder
>
{
// Use TestEmbedOptimizedForSize.CreateBuilder() to construct.
private
TestEmbedOptimizedForSize
()
{}
private
static
readonly
TestEmbedOptimizedForSize
defaultInstance
=
new
TestEmbedOptimizedForSize
();
public
static
TestEmbedOptimizedForSize
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -153,7 +150,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestEmbedOptimizedForSize
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestEmbedOptimizedForSize
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestEmbedOptimizedForSize
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
csharp/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs
View file @
cabd06d1
...
...
@@ -59,9 +59,6 @@ namespace Google.ProtocolBuffers.TestProtos {
#
region
Messages
public
sealed
partial
class
ImportMessage
:
pb
::
GeneratedMessage
<
ImportMessage
,
ImportMessage
.
Builder
>
{
// Use ImportMessage.CreateBuilder() to construct.
private
ImportMessage
()
{}
private
static
readonly
ImportMessage
defaultInstance
=
new
ImportMessage
();
public
static
ImportMessage
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -129,7 +126,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
ImportMessage
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
ImportMessage
p
arseFrom
(
byte
[]
data
,
public
static
self
::
ImportMessage
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
csharp/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs
View file @
cabd06d1
...
...
@@ -109,9 +109,6 @@ namespace Google.ProtocolBuffers.TestProtos {
#
region
Messages
public
sealed
partial
class
TestMessageSet
:
pb
::
ExtendableMessage
<
TestMessageSet
,
TestMessageSet
.
Builder
>
{
// Use TestMessageSet.CreateBuilder() to construct.
private
TestMessageSet
()
{}
private
static
readonly
TestMessageSet
defaultInstance
=
new
TestMessageSet
();
public
static
TestMessageSet
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -167,7 +164,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestMessageSet
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestMessageSet
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestMessageSet
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -277,9 +274,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
TestMessageSetContainer
:
pb
::
GeneratedMessage
<
TestMessageSetContainer
,
TestMessageSetContainer
.
Builder
>
{
// Use TestMessageSetContainer.CreateBuilder() to construct.
private
TestMessageSetContainer
()
{}
private
static
readonly
TestMessageSetContainer
defaultInstance
=
new
TestMessageSetContainer
();
public
static
TestMessageSetContainer
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -350,7 +344,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestMessageSetContainer
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestMessageSetContainer
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestMessageSetContainer
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -507,9 +501,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
TestMessageSetExtension1
:
pb
::
GeneratedMessage
<
TestMessageSetExtension1
,
TestMessageSetExtension1
.
Builder
>
{
// Use TestMessageSetExtension1.CreateBuilder() to construct.
private
TestMessageSetExtension1
()
{}
private
static
readonly
TestMessageSetExtension1
defaultInstance
=
new
TestMessageSetExtension1
();
public
static
TestMessageSetExtension1
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -584,7 +575,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestMessageSetExtension1
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestMessageSetExtension1
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestMessageSetExtension1
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -720,9 +711,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
TestMessageSetExtension2
:
pb
::
GeneratedMessage
<
TestMessageSetExtension2
,
TestMessageSetExtension2
.
Builder
>
{
// Use TestMessageSetExtension2.CreateBuilder() to construct.
private
TestMessageSetExtension2
()
{}
private
static
readonly
TestMessageSetExtension2
defaultInstance
=
new
TestMessageSetExtension2
();
public
static
TestMessageSetExtension2
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -797,7 +785,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestMessageSetExtension2
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestMessageSetExtension2
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestMessageSetExtension2
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -933,9 +921,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
RawMessageSet
:
pb
::
GeneratedMessage
<
RawMessageSet
,
RawMessageSet
.
Builder
>
{
// Use RawMessageSet.CreateBuilder() to construct.
private
RawMessageSet
()
{}
private
static
readonly
RawMessageSet
defaultInstance
=
new
RawMessageSet
();
public
static
RawMessageSet
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -956,9 +941,6 @@ namespace Google.ProtocolBuffers.TestProtos {
#
region
Nested
types
public
static
class
Types
{
public
sealed
partial
class
Item
:
pb
::
GeneratedMessage
<
Item
,
Item
.
Builder
>
{
// Use Item.CreateBuilder() to construct.
private
Item
()
{}
private
static
readonly
Item
defaultInstance
=
new
Item
();
public
static
Item
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -1044,7 +1026,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
RawMessageSet
.
Types
.
Item
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
RawMessageSet
.
Types
.
Item
p
arseFrom
(
byte
[]
data
,
public
static
self
::
RawMessageSet
.
Types
.
Item
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -1263,7 +1245,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
RawMessageSet
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
RawMessageSet
p
arseFrom
(
byte
[]
data
,
public
static
self
::
RawMessageSet
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
csharp/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs
View file @
cabd06d1
...
...
@@ -58,9 +58,6 @@ namespace Google.ProtocolBuffers.TestProtos {
#
region
Messages
public
sealed
partial
class
TestOptimizedForSize
:
pb
::
ExtendableMessage
<
TestOptimizedForSize
,
TestOptimizedForSize
.
Builder
>
{
// Use TestOptimizedForSize.CreateBuilder() to construct.
private
TestOptimizedForSize
()
{}
private
static
readonly
TestOptimizedForSize
defaultInstance
=
new
TestOptimizedForSize
();
public
static
TestOptimizedForSize
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -116,7 +113,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestOptimizedForSize
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestOptimizedForSize
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestOptimizedForSize
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
csharp/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs
View file @
cabd06d1
...
...
@@ -1033,9 +1033,6 @@ namespace Google.ProtocolBuffers.TestProtos {
#
region
Messages
public
sealed
partial
class
TestAllTypes
:
pb
::
GeneratedMessage
<
TestAllTypes
,
TestAllTypes
.
Builder
>
{
// Use TestAllTypes.CreateBuilder() to construct.
private
TestAllTypes
()
{}
private
static
readonly
TestAllTypes
defaultInstance
=
new
TestAllTypes
();
public
static
TestAllTypes
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -1062,9 +1059,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
NestedMessage
:
pb
::
GeneratedMessage
<
NestedMessage
,
NestedMessage
.
Builder
>
{
// Use NestedMessage.CreateBuilder() to construct.
private
NestedMessage
()
{}
private
static
readonly
NestedMessage
defaultInstance
=
new
NestedMessage
();
public
static
NestedMessage
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -1132,7 +1126,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestAllTypes
.
Types
.
NestedMessage
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestAllTypes
.
Types
.
NestedMessage
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestAllTypes
.
Types
.
NestedMessage
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -1268,9 +1262,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
OptionalGroup
:
pb
::
GeneratedMessage
<
OptionalGroup
,
OptionalGroup
.
Builder
>
{
// Use OptionalGroup.CreateBuilder() to construct.
private
OptionalGroup
()
{}
private
static
readonly
OptionalGroup
defaultInstance
=
new
OptionalGroup
();
public
static
OptionalGroup
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -1338,7 +1329,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestAllTypes
.
Types
.
OptionalGroup
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestAllTypes
.
Types
.
OptionalGroup
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestAllTypes
.
Types
.
OptionalGroup
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -1474,9 +1465,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
RepeatedGroup
:
pb
::
GeneratedMessage
<
RepeatedGroup
,
RepeatedGroup
.
Builder
>
{
// Use RepeatedGroup.CreateBuilder() to construct.
private
RepeatedGroup
()
{}
private
static
readonly
RepeatedGroup
defaultInstance
=
new
RepeatedGroup
();
public
static
RepeatedGroup
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -1544,7 +1532,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestAllTypes
.
Types
.
RepeatedGroup
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestAllTypes
.
Types
.
RepeatedGroup
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestAllTypes
.
Types
.
RepeatedGroup
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -2866,7 +2854,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestAllTypes
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestAllTypes
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestAllTypes
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -5368,9 +5356,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
ForeignMessage
:
pb
::
GeneratedMessage
<
ForeignMessage
,
ForeignMessage
.
Builder
>
{
// Use ForeignMessage.CreateBuilder() to construct.
private
ForeignMessage
()
{}
private
static
readonly
ForeignMessage
defaultInstance
=
new
ForeignMessage
();
public
static
ForeignMessage
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -5438,7 +5423,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
ForeignMessage
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
ForeignMessage
p
arseFrom
(
byte
[]
data
,
public
static
self
::
ForeignMessage
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -5574,9 +5559,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
TestAllExtensions
:
pb
::
ExtendableMessage
<
TestAllExtensions
,
TestAllExtensions
.
Builder
>
{
// Use TestAllExtensions.CreateBuilder() to construct.
private
TestAllExtensions
()
{}
private
static
readonly
TestAllExtensions
defaultInstance
=
new
TestAllExtensions
();
public
static
TestAllExtensions
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -5632,7 +5614,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestAllExtensions
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestAllExtensions
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestAllExtensions
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -5742,9 +5724,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
OptionalGroup_extension
:
pb
::
GeneratedMessage
<
OptionalGroup_extension
,
OptionalGroup_extension
.
Builder
>
{
// Use OptionalGroup_extension.CreateBuilder() to construct.
private
OptionalGroup_extension
()
{}
private
static
readonly
OptionalGroup_extension
defaultInstance
=
new
OptionalGroup_extension
();
public
static
OptionalGroup_extension
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -5812,7 +5791,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
OptionalGroup_extension
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
OptionalGroup_extension
p
arseFrom
(
byte
[]
data
,
public
static
self
::
OptionalGroup_extension
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -5948,9 +5927,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
RepeatedGroup_extension
:
pb
::
GeneratedMessage
<
RepeatedGroup_extension
,
RepeatedGroup_extension
.
Builder
>
{
// Use RepeatedGroup_extension.CreateBuilder() to construct.
private
RepeatedGroup_extension
()
{}
private
static
readonly
RepeatedGroup_extension
defaultInstance
=
new
RepeatedGroup_extension
();
public
static
RepeatedGroup_extension
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -6018,7 +5994,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
RepeatedGroup_extension
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
RepeatedGroup_extension
p
arseFrom
(
byte
[]
data
,
public
static
self
::
RepeatedGroup_extension
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -6154,9 +6130,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
TestRequired
:
pb
::
GeneratedMessage
<
TestRequired
,
TestRequired
.
Builder
>
{
// Use TestRequired.CreateBuilder() to construct.
private
TestRequired
()
{}
private
static
readonly
TestRequired
defaultInstance
=
new
TestRequired
();
public
static
TestRequired
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -6749,7 +6722,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestRequired
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestRequired
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestRequired
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -7717,9 +7690,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
TestRequiredForeign
:
pb
::
GeneratedMessage
<
TestRequiredForeign
,
TestRequiredForeign
.
Builder
>
{
// Use TestRequiredForeign.CreateBuilder() to construct.
private
TestRequiredForeign
()
{}
private
static
readonly
TestRequiredForeign
defaultInstance
=
new
TestRequiredForeign
();
public
static
TestRequiredForeign
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -7827,7 +7797,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestRequiredForeign
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestRequiredForeign
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestRequiredForeign
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -8069,9 +8039,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
TestForeignNested
:
pb
::
GeneratedMessage
<
TestForeignNested
,
TestForeignNested
.
Builder
>
{
// Use TestForeignNested.CreateBuilder() to construct.
private
TestForeignNested
()
{}
private
static
readonly
TestForeignNested
defaultInstance
=
new
TestForeignNested
();
public
static
TestForeignNested
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -8139,7 +8106,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestForeignNested
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestForeignNested
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestForeignNested
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -8296,9 +8263,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
TestEmptyMessage
:
pb
::
GeneratedMessage
<
TestEmptyMessage
,
TestEmptyMessage
.
Builder
>
{
// Use TestEmptyMessage.CreateBuilder() to construct.
private
TestEmptyMessage
()
{}
private
static
readonly
TestEmptyMessage
defaultInstance
=
new
TestEmptyMessage
();
public
static
TestEmptyMessage
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -8350,7 +8314,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestEmptyMessage
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestEmptyMessage
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestEmptyMessage
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -8460,9 +8424,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
TestEmptyMessageWithExtensions
:
pb
::
ExtendableMessage
<
TestEmptyMessageWithExtensions
,
TestEmptyMessageWithExtensions
.
Builder
>
{
// Use TestEmptyMessageWithExtensions.CreateBuilder() to construct.
private
TestEmptyMessageWithExtensions
()
{}
private
static
readonly
TestEmptyMessageWithExtensions
defaultInstance
=
new
TestEmptyMessageWithExtensions
();
public
static
TestEmptyMessageWithExtensions
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -8518,7 +8479,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestEmptyMessageWithExtensions
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestEmptyMessageWithExtensions
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestEmptyMessageWithExtensions
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -8628,9 +8589,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
TestReallyLargeTagNumber
:
pb
::
GeneratedMessage
<
TestReallyLargeTagNumber
,
TestReallyLargeTagNumber
.
Builder
>
{
// Use TestReallyLargeTagNumber.CreateBuilder() to construct.
private
TestReallyLargeTagNumber
()
{}
private
static
readonly
TestReallyLargeTagNumber
defaultInstance
=
new
TestReallyLargeTagNumber
();
public
static
TestReallyLargeTagNumber
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -8714,7 +8672,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestReallyLargeTagNumber
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestReallyLargeTagNumber
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestReallyLargeTagNumber
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -8876,9 +8834,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
TestRecursiveMessage
:
pb
::
GeneratedMessage
<
TestRecursiveMessage
,
TestRecursiveMessage
.
Builder
>
{
// Use TestRecursiveMessage.CreateBuilder() to construct.
private
TestRecursiveMessage
()
{}
private
static
readonly
TestRecursiveMessage
defaultInstance
=
new
TestRecursiveMessage
();
public
static
TestRecursiveMessage
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -8962,7 +8917,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestRecursiveMessage
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestRecursiveMessage
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestRecursiveMessage
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -9145,9 +9100,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
TestMutualRecursionA
:
pb
::
GeneratedMessage
<
TestMutualRecursionA
,
TestMutualRecursionA
.
Builder
>
{
// Use TestMutualRecursionA.CreateBuilder() to construct.
private
TestMutualRecursionA
()
{}
private
static
readonly
TestMutualRecursionA
defaultInstance
=
new
TestMutualRecursionA
();
public
static
TestMutualRecursionA
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -9215,7 +9167,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestMutualRecursionA
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestMutualRecursionA
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestMutualRecursionA
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -9372,9 +9324,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
TestMutualRecursionB
:
pb
::
GeneratedMessage
<
TestMutualRecursionB
,
TestMutualRecursionB
.
Builder
>
{
// Use TestMutualRecursionB.CreateBuilder() to construct.
private
TestMutualRecursionB
()
{}
private
static
readonly
TestMutualRecursionB
defaultInstance
=
new
TestMutualRecursionB
();
public
static
TestMutualRecursionB
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -9458,7 +9407,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestMutualRecursionB
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestMutualRecursionB
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestMutualRecursionB
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -9641,9 +9590,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
TestDupFieldNumber
:
pb
::
GeneratedMessage
<
TestDupFieldNumber
,
TestDupFieldNumber
.
Builder
>
{
// Use TestDupFieldNumber.CreateBuilder() to construct.
private
TestDupFieldNumber
()
{}
private
static
readonly
TestDupFieldNumber
defaultInstance
=
new
TestDupFieldNumber
();
public
static
TestDupFieldNumber
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -9664,9 +9610,6 @@ namespace Google.ProtocolBuffers.TestProtos {
#
region
Nested
types
public
static
class
Types
{
public
sealed
partial
class
Foo
:
pb
::
GeneratedMessage
<
Foo
,
Foo
.
Builder
>
{
// Use Foo.CreateBuilder() to construct.
private
Foo
()
{}
private
static
readonly
Foo
defaultInstance
=
new
Foo
();
public
static
Foo
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -9734,7 +9677,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestDupFieldNumber
.
Types
.
Foo
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestDupFieldNumber
.
Types
.
Foo
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestDupFieldNumber
.
Types
.
Foo
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -9870,9 +9813,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
Bar
:
pb
::
GeneratedMessage
<
Bar
,
Bar
.
Builder
>
{
// Use Bar.CreateBuilder() to construct.
private
Bar
()
{}
private
static
readonly
Bar
defaultInstance
=
new
Bar
();
public
static
Bar
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -9940,7 +9880,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestDupFieldNumber
.
Types
.
Bar
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestDupFieldNumber
.
Types
.
Bar
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestDupFieldNumber
.
Types
.
Bar
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -10160,7 +10100,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestDupFieldNumber
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestDupFieldNumber
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestDupFieldNumber
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -10390,9 +10330,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
TestNestedMessageHasBits
:
pb
::
GeneratedMessage
<
TestNestedMessageHasBits
,
TestNestedMessageHasBits
.
Builder
>
{
// Use TestNestedMessageHasBits.CreateBuilder() to construct.
private
TestNestedMessageHasBits
()
{}
private
static
readonly
TestNestedMessageHasBits
defaultInstance
=
new
TestNestedMessageHasBits
();
public
static
TestNestedMessageHasBits
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -10413,9 +10350,6 @@ namespace Google.ProtocolBuffers.TestProtos {
#
region
Nested
types
public
static
class
Types
{
public
sealed
partial
class
NestedMessage
:
pb
::
GeneratedMessage
<
NestedMessage
,
NestedMessage
.
Builder
>
{
// Use NestedMessage.CreateBuilder() to construct.
private
NestedMessage
()
{}
private
static
readonly
NestedMessage
defaultInstance
=
new
NestedMessage
();
public
static
NestedMessage
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -10504,7 +10438,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestNestedMessageHasBits
.
Types
.
NestedMessage
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestNestedMessageHasBits
.
Types
.
NestedMessage
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestNestedMessageHasBits
.
Types
.
NestedMessage
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -10769,7 +10703,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestNestedMessageHasBits
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestNestedMessageHasBits
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestNestedMessageHasBits
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -10926,9 +10860,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
TestCamelCaseFieldNames
:
pb
::
GeneratedMessage
<
TestCamelCaseFieldNames
,
TestCamelCaseFieldNames
.
Builder
>
{
// Use TestCamelCaseFieldNames.CreateBuilder() to construct.
private
TestCamelCaseFieldNames
()
{}
private
static
readonly
TestCamelCaseFieldNames
defaultInstance
=
new
TestCamelCaseFieldNames
();
public
static
TestCamelCaseFieldNames
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -11188,7 +11119,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestCamelCaseFieldNames
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestCamelCaseFieldNames
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestCamelCaseFieldNames
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -11765,9 +11696,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
TestFieldOrderings
:
pb
::
ExtendableMessage
<
TestFieldOrderings
,
TestFieldOrderings
.
Builder
>
{
// Use TestFieldOrderings.CreateBuilder() to construct.
private
TestFieldOrderings
()
{}
private
static
readonly
TestFieldOrderings
defaultInstance
=
new
TestFieldOrderings
();
public
static
TestFieldOrderings
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -11872,7 +11800,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestFieldOrderings
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestFieldOrderings
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestFieldOrderings
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -12060,9 +11988,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
TestExtremeDefaultValues
:
pb
::
GeneratedMessage
<
TestExtremeDefaultValues
,
TestExtremeDefaultValues
.
Builder
>
{
// Use TestExtremeDefaultValues.CreateBuilder() to construct.
private
TestExtremeDefaultValues
()
{}
private
static
readonly
TestExtremeDefaultValues
defaultInstance
=
new
TestExtremeDefaultValues
();
public
static
TestExtremeDefaultValues
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -12210,7 +12135,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
TestExtremeDefaultValues
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
TestExtremeDefaultValues
p
arseFrom
(
byte
[]
data
,
public
static
self
::
TestExtremeDefaultValues
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -12476,9 +12401,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
FooRequest
:
pb
::
GeneratedMessage
<
FooRequest
,
FooRequest
.
Builder
>
{
// Use FooRequest.CreateBuilder() to construct.
private
FooRequest
()
{}
private
static
readonly
FooRequest
defaultInstance
=
new
FooRequest
();
public
static
FooRequest
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -12530,7 +12452,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
FooRequest
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
FooRequest
p
arseFrom
(
byte
[]
data
,
public
static
self
::
FooRequest
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -12640,9 +12562,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
FooResponse
:
pb
::
GeneratedMessage
<
FooResponse
,
FooResponse
.
Builder
>
{
// Use FooResponse.CreateBuilder() to construct.
private
FooResponse
()
{}
private
static
readonly
FooResponse
defaultInstance
=
new
FooResponse
();
public
static
FooResponse
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -12694,7 +12613,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
FooResponse
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
FooResponse
p
arseFrom
(
byte
[]
data
,
public
static
self
::
FooResponse
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -12804,9 +12723,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
BarRequest
:
pb
::
GeneratedMessage
<
BarRequest
,
BarRequest
.
Builder
>
{
// Use BarRequest.CreateBuilder() to construct.
private
BarRequest
()
{}
private
static
readonly
BarRequest
defaultInstance
=
new
BarRequest
();
public
static
BarRequest
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -12858,7 +12774,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
BarRequest
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
BarRequest
p
arseFrom
(
byte
[]
data
,
public
static
self
::
BarRequest
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -12968,9 +12884,6 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public
sealed
partial
class
BarResponse
:
pb
::
GeneratedMessage
<
BarResponse
,
BarResponse
.
Builder
>
{
// Use BarResponse.CreateBuilder() to construct.
private
BarResponse
()
{}
private
static
readonly
BarResponse
defaultInstance
=
new
BarResponse
();
public
static
BarResponse
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -13022,7 +12935,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public
static
self
::
BarResponse
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
BarResponse
p
arseFrom
(
byte
[]
data
,
public
static
self
::
BarResponse
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
csharp/ProtocolBuffers/AbstractBuilder.cs
View file @
cabd06d1
...
...
@@ -12,7 +12,7 @@ namespace Google.ProtocolBuffers {
/// </summary>
public
abstract
class
AbstractBuilder
:
IBuilder
{
#
region
Unimplemented
members
of
IBuilder
public
abstract
bool
Initialized
{
get
;
}
public
abstract
bool
I
sI
nitialized
{
get
;
}
public
abstract
IDictionary
<
FieldDescriptor
,
object
>
AllFields
{
get
;
}
public
abstract
object
this
[
FieldDescriptor
field
]
{
get
;
set
;
}
public
abstract
MessageDescriptor
DescriptorForType
{
get
;
}
...
...
@@ -78,7 +78,7 @@ namespace Google.ProtocolBuffers {
// implementations).
// TODO(jonskeet): Provide a function somewhere called makeDeepCopy()
// which allows people to make secure deep copies of messages.
foreach
(
KeyValuePair
<
FieldDescriptor
,
object
>
entry
in
AllFields
)
{
foreach
(
KeyValuePair
<
FieldDescriptor
,
object
>
entry
in
other
.
AllFields
)
{
FieldDescriptor
field
=
entry
.
Key
;
if
(
field
.
IsRepeated
)
{
// Concatenate repeated fields
...
...
csharp/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs
View file @
cabd06d1
...
...
@@ -278,9 +278,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
#
region
Messages
public
sealed
partial
class
FileDescriptorProto
:
pb
::
GeneratedMessage
<
FileDescriptorProto
,
FileDescriptorProto
.
Builder
>
{
// Use FileDescriptorProto.CreateBuilder() to construct.
private
FileDescriptorProto
()
{}
private
static
readonly
FileDescriptorProto
defaultInstance
=
new
FileDescriptorProto
();
public
static
FileDescriptorProto
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -471,7 +468,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public
static
self
::
FileDescriptorProto
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
FileDescriptorProto
p
arseFrom
(
byte
[]
data
,
public
static
self
::
FileDescriptorProto
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -960,9 +957,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
}
public
sealed
partial
class
DescriptorProto
:
pb
::
GeneratedMessage
<
DescriptorProto
,
DescriptorProto
.
Builder
>
{
// Use DescriptorProto.CreateBuilder() to construct.
private
DescriptorProto
()
{}
private
static
readonly
DescriptorProto
defaultInstance
=
new
DescriptorProto
();
public
static
DescriptorProto
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -983,9 +977,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
#
region
Nested
types
public
static
class
Types
{
public
sealed
partial
class
ExtensionRange
:
pb
::
GeneratedMessage
<
ExtensionRange
,
ExtensionRange
.
Builder
>
{
// Use ExtensionRange.CreateBuilder() to construct.
private
ExtensionRange
()
{}
private
static
readonly
ExtensionRange
defaultInstance
=
new
ExtensionRange
();
public
static
ExtensionRange
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -1069,7 +1060,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public
static
self
::
DescriptorProto
.
Types
.
ExtensionRange
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
DescriptorProto
.
Types
.
ExtensionRange
p
arseFrom
(
byte
[]
data
,
public
static
self
::
DescriptorProto
.
Types
.
ExtensionRange
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -1389,7 +1380,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public
static
self
::
DescriptorProto
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
DescriptorProto
p
arseFrom
(
byte
[]
data
,
public
static
self
::
DescriptorProto
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -1867,9 +1858,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
}
public
sealed
partial
class
FieldDescriptorProto
:
pb
::
GeneratedMessage
<
FieldDescriptorProto
,
FieldDescriptorProto
.
Builder
>
{
// Use FieldDescriptorProto.CreateBuilder() to construct.
private
FieldDescriptorProto
()
{}
private
static
readonly
FieldDescriptorProto
defaultInstance
=
new
FieldDescriptorProto
();
public
static
FieldDescriptorProto
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -2079,7 +2067,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public
static
self
::
FieldDescriptorProto
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
FieldDescriptorProto
p
arseFrom
(
byte
[]
data
,
public
static
self
::
FieldDescriptorProto
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -2428,9 +2416,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
}
public
sealed
partial
class
EnumDescriptorProto
:
pb
::
GeneratedMessage
<
EnumDescriptorProto
,
EnumDescriptorProto
.
Builder
>
{
// Use EnumDescriptorProto.CreateBuilder() to construct.
private
EnumDescriptorProto
()
{}
private
static
readonly
EnumDescriptorProto
defaultInstance
=
new
EnumDescriptorProto
();
public
static
EnumDescriptorProto
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -2532,7 +2517,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public
static
self
::
EnumDescriptorProto
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
EnumDescriptorProto
p
arseFrom
(
byte
[]
data
,
public
static
self
::
EnumDescriptorProto
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -2774,9 +2759,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
}
public
sealed
partial
class
EnumValueDescriptorProto
:
pb
::
GeneratedMessage
<
EnumValueDescriptorProto
,
EnumValueDescriptorProto
.
Builder
>
{
// Use EnumValueDescriptorProto.CreateBuilder() to construct.
private
EnumValueDescriptorProto
()
{}
private
static
readonly
EnumValueDescriptorProto
defaultInstance
=
new
EnumValueDescriptorProto
();
public
static
EnumValueDescriptorProto
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -2876,7 +2858,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public
static
self
::
EnumValueDescriptorProto
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
EnumValueDescriptorProto
p
arseFrom
(
byte
[]
data
,
public
static
self
::
EnumValueDescriptorProto
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -3085,9 +3067,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
}
public
sealed
partial
class
ServiceDescriptorProto
:
pb
::
GeneratedMessage
<
ServiceDescriptorProto
,
ServiceDescriptorProto
.
Builder
>
{
// Use ServiceDescriptorProto.CreateBuilder() to construct.
private
ServiceDescriptorProto
()
{}
private
static
readonly
ServiceDescriptorProto
defaultInstance
=
new
ServiceDescriptorProto
();
public
static
ServiceDescriptorProto
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -3189,7 +3168,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public
static
self
::
ServiceDescriptorProto
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
ServiceDescriptorProto
p
arseFrom
(
byte
[]
data
,
public
static
self
::
ServiceDescriptorProto
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -3431,9 +3410,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
}
public
sealed
partial
class
MethodDescriptorProto
:
pb
::
GeneratedMessage
<
MethodDescriptorProto
,
MethodDescriptorProto
.
Builder
>
{
// Use MethodDescriptorProto.CreateBuilder() to construct.
private
MethodDescriptorProto
()
{}
private
static
readonly
MethodDescriptorProto
defaultInstance
=
new
MethodDescriptorProto
();
public
static
MethodDescriptorProto
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -3549,7 +3525,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public
static
self
::
MethodDescriptorProto
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
MethodDescriptorProto
p
arseFrom
(
byte
[]
data
,
public
static
self
::
MethodDescriptorProto
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -3784,9 +3760,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
}
public
sealed
partial
class
FileOptions
:
pb
::
GeneratedMessage
<
FileOptions
,
FileOptions
.
Builder
>
{
// Use FileOptions.CreateBuilder() to construct.
private
FileOptions
()
{}
private
static
readonly
FileOptions
defaultInstance
=
new
FileOptions
();
public
static
FileOptions
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -3991,7 +3964,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public
static
self
::
FileOptions
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
FileOptions
p
arseFrom
(
byte
[]
data
,
public
static
self
::
FileOptions
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -4340,9 +4313,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
}
public
sealed
partial
class
MessageOptions
:
pb
::
GeneratedMessage
<
MessageOptions
,
MessageOptions
.
Builder
>
{
// Use MessageOptions.CreateBuilder() to construct.
private
MessageOptions
()
{}
private
static
readonly
MessageOptions
defaultInstance
=
new
MessageOptions
();
public
static
MessageOptions
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -4410,7 +4380,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public
static
self
::
MessageOptions
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
MessageOptions
p
arseFrom
(
byte
[]
data
,
public
static
self
::
MessageOptions
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -4546,9 +4516,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
}
public
sealed
partial
class
FieldOptions
:
pb
::
GeneratedMessage
<
FieldOptions
,
FieldOptions
.
Builder
>
{
// Use FieldOptions.CreateBuilder() to construct.
private
FieldOptions
()
{}
private
static
readonly
FieldOptions
defaultInstance
=
new
FieldOptions
();
public
static
FieldOptions
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -4641,7 +4608,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public
static
self
::
FieldOptions
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
FieldOptions
p
arseFrom
(
byte
[]
data
,
public
static
self
::
FieldOptions
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -4808,9 +4775,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
}
public
sealed
partial
class
EnumOptions
:
pb
::
GeneratedMessage
<
EnumOptions
,
EnumOptions
.
Builder
>
{
// Use EnumOptions.CreateBuilder() to construct.
private
EnumOptions
()
{}
private
static
readonly
EnumOptions
defaultInstance
=
new
EnumOptions
();
public
static
EnumOptions
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -4862,7 +4826,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public
static
self
::
EnumOptions
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
EnumOptions
p
arseFrom
(
byte
[]
data
,
public
static
self
::
EnumOptions
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -4972,9 +4936,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
}
public
sealed
partial
class
EnumValueOptions
:
pb
::
GeneratedMessage
<
EnumValueOptions
,
EnumValueOptions
.
Builder
>
{
// Use EnumValueOptions.CreateBuilder() to construct.
private
EnumValueOptions
()
{}
private
static
readonly
EnumValueOptions
defaultInstance
=
new
EnumValueOptions
();
public
static
EnumValueOptions
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -5026,7 +4987,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public
static
self
::
EnumValueOptions
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
EnumValueOptions
p
arseFrom
(
byte
[]
data
,
public
static
self
::
EnumValueOptions
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -5136,9 +5097,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
}
public
sealed
partial
class
ServiceOptions
:
pb
::
GeneratedMessage
<
ServiceOptions
,
ServiceOptions
.
Builder
>
{
// Use ServiceOptions.CreateBuilder() to construct.
private
ServiceOptions
()
{}
private
static
readonly
ServiceOptions
defaultInstance
=
new
ServiceOptions
();
public
static
ServiceOptions
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -5190,7 +5148,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public
static
self
::
ServiceOptions
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
ServiceOptions
p
arseFrom
(
byte
[]
data
,
public
static
self
::
ServiceOptions
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
@@ -5300,9 +5258,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
}
public
sealed
partial
class
MethodOptions
:
pb
::
GeneratedMessage
<
MethodOptions
,
MethodOptions
.
Builder
>
{
// Use MethodOptions.CreateBuilder() to construct.
private
MethodOptions
()
{}
private
static
readonly
MethodOptions
defaultInstance
=
new
MethodOptions
();
public
static
MethodOptions
DefaultInstance
{
get
{
return
defaultInstance
;
}
...
...
@@ -5354,7 +5309,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public
static
self
::
MethodOptions
ParseFrom
(
byte
[]
data
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
public
static
self
::
MethodOptions
p
arseFrom
(
byte
[]
data
,
public
static
self
::
MethodOptions
P
arseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
))
.
BuildParsed
();
...
...
csharp/ProtocolBuffers/DynamicMessage.cs
View file @
cabd06d1
...
...
@@ -5,6 +5,11 @@ using System.Text;
using
Google.ProtocolBuffers.Descriptors
;
namespace
Google.ProtocolBuffers
{
/// <summary>
/// An implementation of IMessage that can represent arbitrary types, given a MessageaDescriptor.
/// TODO: Implement appropriate generics.
/// </summary>
public
class
DynamicMessage
:
AbstractMessage
{
private
readonly
MessageDescriptor
type
;
...
...
@@ -242,7 +247,7 @@ namespace Google.ProtocolBuffers {
return
this
;
}
public
override
IBuilder
MergeFrom
(
IMessage
other
)
{
public
override
IBuilder
MergeFrom
(
IMessage
other
)
{
if
(
other
.
DescriptorForType
!=
type
)
{
throw
new
ArgumentException
(
"MergeFrom(IMessage) can only merge messages of the same type."
);
}
...
...
@@ -251,7 +256,7 @@ namespace Google.ProtocolBuffers {
}
protected
override
IMessage
BuildImpl
()
{
if
(!
Initialized
)
{
if
(!
I
sI
nitialized
)
{
throw
new
UninitializedMessageException
(
new
DynamicMessage
(
type
,
fields
,
unknownFields
));
}
return
BuildPartialImpl
();
...
...
@@ -263,7 +268,7 @@ namespace Google.ProtocolBuffers {
/// </summary>
/// <returns></returns>
internal
DynamicMessage
BuildParsed
()
{
if
(!
Initialized
)
{
if
(!
I
sI
nitialized
)
{
throw
new
UninitializedMessageException
(
new
DynamicMessage
(
type
,
fields
,
unknownFields
)).
AsInvalidProtocolBufferException
();
}
return
(
DynamicMessage
)
BuildPartialImpl
();
...
...
@@ -283,7 +288,7 @@ namespace Google.ProtocolBuffers {
return
result
;
}
public
override
bool
Initialized
{
public
override
bool
I
sI
nitialized
{
get
{
return
fields
.
IsInitializedWithRespectTo
(
type
);
}
}
...
...
csharp/ProtocolBuffers/GeneratedBuilder.cs
View file @
cabd06d1
...
...
@@ -26,7 +26,7 @@ namespace Google.ProtocolBuffers {
get
{
return
MessageBeingBuilt
.
FieldAccesseorsFromBuilder
;
}
}
public
override
bool
Initialized
{
public
override
bool
I
sI
nitialized
{
get
{
return
MessageBeingBuilt
.
IsInitialized
;
}
}
...
...
@@ -212,7 +212,7 @@ namespace Google.ProtocolBuffers {
/// TODO(jonskeet): This used to be generated for each class. Find out why.
/// </summary>
public
TMessage
BuildParsed
()
{
if
(!
Initialized
)
{
if
(!
I
sI
nitialized
)
{
throw
new
UninitializedMessageException
(
MessageBeingBuilt
).
AsInvalidProtocolBufferException
();
}
return
BuildPartial
();
...
...
@@ -223,7 +223,7 @@ namespace Google.ProtocolBuffers {
/// TODO(jonskeet): This used to be generated for each class. Find out why.
/// </summary>
public
TMessage
Build
()
{
if
(!
Initialized
)
{
if
(!
I
sI
nitialized
)
{
throw
new
UninitializedMessageException
(
MessageBeingBuilt
);
}
return
BuildPartial
();
...
...
csharp/ProtocolBuffers/IBuilder.cs
View file @
cabd06d1
...
...
@@ -33,7 +33,7 @@ namespace Google.ProtocolBuffers {
/// Returns true iff all required fields in the message and all
/// embedded messages are set.
/// </summary>
bool
Initialized
{
get
;
}
bool
I
sI
nitialized
{
get
;
}
/// <summary>
/// Behaves like the equivalent property in IMessage<T>.
...
...
@@ -172,7 +172,7 @@ namespace Google.ProtocolBuffers {
/// required fields, it will throw an UninitializedMessageException.
/// There are a few good ways to deal with this:
/// <list>
/// <item>Call Initialized to verify to verify that all required fields are
/// <item>Call I
sI
nitialized to verify to verify that all required fields are
/// set before building.</item>
/// <item>Parse the message separately using one of the static ParseFrom
/// methods, then use MergeFrom(IMessage<T>) to merge it with
...
...
csharp/ProtocolBuffers/UninitializedMessageException.cs
View file @
cabd06d1
...
...
@@ -14,15 +14,111 @@
// See the License for the specific language governing permissions and
// limitations under the License.
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Text
;
using
Google.ProtocolBuffers.Collections
;
using
Google.ProtocolBuffers.Descriptors
;
namespace
Google.ProtocolBuffers
{
public
class
UninitializedMessageException
:
Exception
{
public
UninitializedMessageException
(
IMessage
message
)
{
private
readonly
IList
<
string
>
missingFields
;
public
UninitializedMessageException
(
IMessage
message
)
:
this
(
FindMissingFields
(
message
))
{
}
private
UninitializedMessageException
(
IList
<
string
>
missingFields
)
:
base
(
BuildDescription
(
missingFields
))
{
this
.
missingFields
=
Lists
.
AsReadOnly
(
missingFields
);
}
/// <summary>
/// Converts this exception into an InvalidProtocolBufferException.
/// When a parsed message is missing required fields, this should be thrown
/// instead of UninitializedMessageException.
/// </summary>
public
InvalidProtocolBufferException
AsInvalidProtocolBufferException
()
{
return
new
InvalidProtocolBufferException
(
Message
);
}
/// <summary>
/// Constructs the description string for a given list of missing fields.
/// </summary>
private
static
string
BuildDescription
(
IEnumerable
<
string
>
missingFields
)
{
StringBuilder
description
=
new
StringBuilder
(
"Message missing required fields: "
);
bool
first
=
true
;
foreach
(
string
field
in
missingFields
)
{
if
(
first
)
{
first
=
false
;
}
else
{
description
.
Append
(
", "
);
}
description
.
Append
(
field
);
}
return
description
.
ToString
();
}
/// <summary>
/// Returns a list of the full "paths" of missing required
/// fields in the specified message.
/// </summary>
private
static
IList
<
String
>
FindMissingFields
(
IMessage
message
)
{
List
<
String
>
results
=
new
List
<
String
>();
FindMissingFields
(
message
,
""
,
results
);
return
results
;
}
/// <summary>
/// Recursive helper implementing FindMissingFields.
/// </summary>
private
static
void
FindMissingFields
(
IMessage
message
,
String
prefix
,
List
<
String
>
results
)
{
foreach
(
FieldDescriptor
field
in
message
.
DescriptorForType
.
Fields
)
{
if
(
field
.
IsRequired
&&
!
message
.
HasField
(
field
))
{
results
.
Add
(
prefix
+
field
.
Name
);
}
}
foreach
(
KeyValuePair
<
FieldDescriptor
,
object
>
entry
in
message
.
AllFields
)
{
FieldDescriptor
field
=
entry
.
Key
;
object
value
=
entry
.
Value
;
if
(
field
.
MappedType
==
MappedType
.
Message
)
{
if
(
field
.
IsRepeated
)
{
int
i
=
0
;
foreach
(
object
element
in
(
IEnumerable
)
value
)
{
FindMissingFields
((
IMessage
)
element
,
SubMessagePrefix
(
prefix
,
field
,
i
++),
results
);
}
}
else
{
if
(
message
.
HasField
(
field
))
{
FindMissingFields
((
IMessage
)
value
,
SubMessagePrefix
(
prefix
,
field
,
-
1
),
results
);
}
}
}
}
}
private
static
String
SubMessagePrefix
(
String
prefix
,
FieldDescriptor
field
,
int
index
)
{
StringBuilder
result
=
new
StringBuilder
(
prefix
);
if
(
field
.
IsExtension
)
{
result
.
Append
(
'('
)
.
Append
(
field
.
FullName
)
.
Append
(
')'
);
}
else
{
result
.
Append
(
field
.
Name
);
}
if
(
index
!=
-
1
)
{
result
.
Append
(
'['
)
.
Append
(
index
)
.
Append
(
']'
);
}
result
.
Append
(
'.'
);
return
result
.
ToString
();
}
}
}
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