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
ff37edcd
Commit
ff37edcd
authored
Nov 19, 2015
by
Jon Skeet
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #974 from jskeet/parser
Parser property in MessageDescriptor
parents
c581acb5
360feda5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
192 additions
and
70 deletions
+192
-70
Addressbook.cs
csharp/src/AddressBook/Addressbook.cs
+2
-2
Conformance.cs
csharp/src/Google.Protobuf.Conformance/Conformance.cs
+4
-4
DescriptorsTest.cs
...rp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
+3
-1
MapUnittestProto3.cs
.../src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
+7
-7
UnittestImportProto3.cs
...c/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs
+1
-1
UnittestImportPublicProto3.cs
...le.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs
+1
-1
UnittestIssues.cs
csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
+7
-7
UnittestProto3.cs
csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
+0
-0
UnittestWellKnownTypes.cs
...Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs
+4
-4
JsonParser.cs
csharp/src/Google.Protobuf/JsonParser.cs
+1
-5
MessageParser.cs
csharp/src/Google.Protobuf/MessageParser.cs
+116
-9
Descriptor.cs
csharp/src/Google.Protobuf/Reflection/Descriptor.cs
+0
-0
GeneratedCodeInfo.cs
csharp/src/Google.Protobuf/Reflection/GeneratedCodeInfo.cs
+8
-2
MessageDescriptor.cs
csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs
+11
-0
Any.cs
csharp/src/Google.Protobuf/WellKnownTypes/Any.cs
+1
-1
Api.cs
csharp/src/Google.Protobuf/WellKnownTypes/Api.cs
+3
-3
Duration.cs
csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
+1
-1
Empty.cs
csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs
+1
-1
FieldMask.cs
csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs
+1
-1
SourceContext.cs
csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs
+1
-1
Struct.cs
csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
+3
-3
Timestamp.cs
csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs
+1
-1
Type.cs
csharp/src/Google.Protobuf/WellKnownTypes/Type.cs
+5
-5
Wrappers.cs
csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs
+9
-9
csharp_umbrella_class.cc
src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc
+1
-1
No files found.
csharp/src/AddressBook/Addressbook.cs
View file @
ff37edcd
...
...
@@ -35,8 +35,8 @@ namespace Google.Protobuf.Examples.AddressBook {
descriptor
=
pbr
::
FileDescriptor
.
InternalBuildGeneratedFileFrom
(
descriptorData
,
new
pbr
::
FileDescriptor
[]
{
},
new
pbr
::
GeneratedCodeInfo
(
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
Examples
.
AddressBook
.
Person
),
new
[]{
"Name"
,
"Id"
,
"Email"
,
"Phones"
},
null
,
new
[]{
typeof
(
global
::
Google
.
Protobuf
.
Examples
.
AddressBook
.
Person
.
Types
.
PhoneType
)
},
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
Examples
.
AddressBook
.
Person
.
Types
.
PhoneNumber
)
,
new
[]{
"Number"
,
"Type"
},
null
,
null
,
null
)}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
Examples
.
AddressBook
.
AddressBook
),
new
[]{
"People"
},
null
,
null
,
null
)
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
Examples
.
AddressBook
.
Person
),
global
::
Google
.
Protobuf
.
Examples
.
AddressBook
.
Person
.
Parser
,
new
[]{
"Name"
,
"Id"
,
"Email"
,
"Phones"
},
null
,
new
[]{
typeof
(
global
::
Google
.
Protobuf
.
Examples
.
AddressBook
.
Person
.
Types
.
PhoneType
)
},
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
Examples
.
AddressBook
.
Person
.
Types
.
PhoneNumber
),
global
::
Google
.
Protobuf
.
Examples
.
AddressBook
.
Person
.
Types
.
PhoneNumber
.
Parser
,
new
[]{
"Number"
,
"Type"
},
null
,
null
,
null
)}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
Examples
.
AddressBook
.
AddressBook
),
global
::
Google
.
Protobuf
.
Examples
.
AddressBook
.
AddressBook
.
Parser
,
new
[]{
"People"
},
null
,
null
,
null
)
}));
}
#
endregion
...
...
csharp/src/Google.Protobuf.Conformance/Conformance.cs
View file @
ff37edcd
...
...
@@ -137,11 +137,11 @@ namespace Conformance {
descriptor
=
pbr
::
FileDescriptor
.
InternalBuildGeneratedFileFrom
(
descriptorData
,
new
pbr
::
FileDescriptor
[]
{
},
new
pbr
::
GeneratedCodeInfo
(
new
[]
{
typeof
(
global
::
Conformance
.
WireFormat
),
typeof
(
global
::
Conformance
.
ForeignEnum
),
},
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Conformance
.
ConformanceRequest
),
new
[]{
"ProtobufPayload"
,
"JsonPayload"
,
"RequestedOutputFormat"
},
new
[]{
"Payload"
},
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Conformance
.
ConformanceResponse
),
new
[]{
"ParseError"
,
"RuntimeError"
,
"ProtobufPayload"
,
"JsonPayload"
,
"Skipped"
},
new
[]{
"Result"
},
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Conformance
.
TestAllTypes
),
new
[]{
"OptionalInt32"
,
"OptionalInt64"
,
"OptionalUint32"
,
"OptionalUint64"
,
"OptionalSint32"
,
"OptionalSint64"
,
"OptionalFixed32"
,
"OptionalFixed64"
,
"OptionalSfixed32"
,
"OptionalSfixed64"
,
"OptionalFloat"
,
"OptionalDouble"
,
"OptionalBool"
,
"OptionalString"
,
"OptionalBytes"
,
"OptionalNestedMessage"
,
"OptionalForeignMessage"
,
"OptionalNestedEnum"
,
"OptionalForeignEnum"
,
"OptionalStringPiece"
,
"OptionalCord"
,
"RecursiveMessage"
,
"RepeatedInt32"
,
"RepeatedInt64"
,
"RepeatedUint32"
,
"RepeatedUint64"
,
"RepeatedSint32"
,
"RepeatedSint64"
,
"RepeatedFixed32"
,
"RepeatedFixed64"
,
"RepeatedSfixed32"
,
"RepeatedSfixed64"
,
"RepeatedFloat"
,
"RepeatedDouble"
,
"RepeatedBool"
,
"RepeatedString"
,
"RepeatedBytes"
,
"RepeatedNestedMessage"
,
"RepeatedForeignMessage"
,
"RepeatedNestedEnum"
,
"RepeatedForeignEnum"
,
"RepeatedStringPiece"
,
"RepeatedCord"
,
"MapInt32Int32"
,
"MapInt64Int64"
,
"MapUint32Uint32"
,
"MapUint64Uint64"
,
"MapSint32Sint32"
,
"MapSint64Sint64"
,
"MapFixed32Fixed32"
,
"MapFixed64Fixed64"
,
"MapSfixed32Sfixed32"
,
"MapSfixed64Sfixed64"
,
"MapInt32Float"
,
"MapInt32Double"
,
"MapBoolBool"
,
"MapStringString"
,
"MapStringBytes"
,
"MapStringNestedMessage"
,
"MapStringForeignMessage"
,
"MapStringNestedEnum"
,
"MapStringForeignEnum"
,
"OneofUint32"
,
"OneofNestedMessage"
,
"OneofString"
,
"OneofBytes"
},
new
[]{
"OneofField"
},
new
[]{
typeof
(
global
::
Conformance
.
TestAllTypes
.
Types
.
NestedEnum
)
},
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Conformance
.
TestAllTypes
.
Types
.
NestedMessage
)
,
new
[]{
"A"
,
"Corecursive"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Conformance
.
ConformanceRequest
),
global
::
Conformance
.
ConformanceRequest
.
Parser
,
new
[]{
"ProtobufPayload"
,
"JsonPayload"
,
"RequestedOutputFormat"
},
new
[]{
"Payload"
},
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Conformance
.
ConformanceResponse
),
global
::
Conformance
.
ConformanceResponse
.
Parser
,
new
[]{
"ParseError"
,
"RuntimeError"
,
"ProtobufPayload"
,
"JsonPayload"
,
"Skipped"
},
new
[]{
"Result"
},
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Conformance
.
TestAllTypes
),
global
::
Conformance
.
TestAllTypes
.
Parser
,
new
[]{
"OptionalInt32"
,
"OptionalInt64"
,
"OptionalUint32"
,
"OptionalUint64"
,
"OptionalSint32"
,
"OptionalSint64"
,
"OptionalFixed32"
,
"OptionalFixed64"
,
"OptionalSfixed32"
,
"OptionalSfixed64"
,
"OptionalFloat"
,
"OptionalDouble"
,
"OptionalBool"
,
"OptionalString"
,
"OptionalBytes"
,
"OptionalNestedMessage"
,
"OptionalForeignMessage"
,
"OptionalNestedEnum"
,
"OptionalForeignEnum"
,
"OptionalStringPiece"
,
"OptionalCord"
,
"RecursiveMessage"
,
"RepeatedInt32"
,
"RepeatedInt64"
,
"RepeatedUint32"
,
"RepeatedUint64"
,
"RepeatedSint32"
,
"RepeatedSint64"
,
"RepeatedFixed32"
,
"RepeatedFixed64"
,
"RepeatedSfixed32"
,
"RepeatedSfixed64"
,
"RepeatedFloat"
,
"RepeatedDouble"
,
"RepeatedBool"
,
"RepeatedString"
,
"RepeatedBytes"
,
"RepeatedNestedMessage"
,
"RepeatedForeignMessage"
,
"RepeatedNestedEnum"
,
"RepeatedForeignEnum"
,
"RepeatedStringPiece"
,
"RepeatedCord"
,
"MapInt32Int32"
,
"MapInt64Int64"
,
"MapUint32Uint32"
,
"MapUint64Uint64"
,
"MapSint32Sint32"
,
"MapSint64Sint64"
,
"MapFixed32Fixed32"
,
"MapFixed64Fixed64"
,
"MapSfixed32Sfixed32"
,
"MapSfixed64Sfixed64"
,
"MapInt32Float"
,
"MapInt32Double"
,
"MapBoolBool"
,
"MapStringString"
,
"MapStringBytes"
,
"MapStringNestedMessage"
,
"MapStringForeignMessage"
,
"MapStringNestedEnum"
,
"MapStringForeignEnum"
,
"OneofUint32"
,
"OneofNestedMessage"
,
"OneofString"
,
"OneofBytes"
},
new
[]{
"OneofField"
},
new
[]{
typeof
(
global
::
Conformance
.
TestAllTypes
.
Types
.
NestedEnum
)
},
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Conformance
.
TestAllTypes
.
Types
.
NestedMessage
),
global
::
Conformance
.
TestAllTypes
.
Types
.
NestedMessage
.
Parser
,
new
[]{
"A"
,
"Corecursive"
},
null
,
null
,
null
),
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Conformance
.
ForeignMessage
),
new
[]{
"C"
},
null
,
null
,
null
)
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Conformance
.
ForeignMessage
),
global
::
Conformance
.
ForeignMessage
.
Parser
,
new
[]{
"C"
},
null
,
null
,
null
)
}));
}
#
endregion
...
...
csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
View file @
ff37edcd
...
...
@@ -64,6 +64,7 @@ namespace Google.Protobuf.Reflection
MessageDescriptor
messageType
=
TestAllTypes
.
Descriptor
;
Assert
.
AreSame
(
typeof
(
TestAllTypes
),
messageType
.
GeneratedType
);
Assert
.
AreSame
(
TestAllTypes
.
Parser
,
messageType
.
Parser
);
Assert
.
AreEqual
(
messageType
,
file
.
MessageTypes
[
0
]);
Assert
.
AreEqual
(
messageType
,
file
.
FindTypeByName
<
MessageDescriptor
>(
"TestAllTypes"
));
Assert
.
Null
(
file
.
FindTypeByName
<
MessageDescriptor
>(
"NoSuchType"
));
...
...
@@ -234,9 +235,10 @@ namespace Google.Protobuf.Reflection
// We should still be able to get at a field...
var
messageDescriptor
=
newDescriptor
.
FindTypeByName
<
MessageDescriptor
>(
"ItemField"
);
var
fieldDescriptor
=
messageDescriptor
.
FindFieldByName
(
"item"
);
// But there shouldn't be an accessor (or a generated type for the message)
// But there shouldn't be an accessor (or a generated type for the message
, or parser
)
Assert
.
IsNull
(
fieldDescriptor
.
Accessor
);
Assert
.
IsNull
(
messageDescriptor
.
GeneratedType
);
Assert
.
IsNull
(
messageDescriptor
.
Parser
);
}
// From TestFieldOrdering:
...
...
csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
View file @
ff37edcd
...
...
@@ -150,13 +150,13 @@ namespace Google.Protobuf.TestProtos {
descriptor
=
pbr
::
FileDescriptor
.
InternalBuildGeneratedFileFrom
(
descriptorData
,
new
pbr
::
FileDescriptor
[]
{
global
::
Google
.
Protobuf
.
TestProtos
.
UnittestProto3Reflection
.
Descriptor
,
},
new
pbr
::
GeneratedCodeInfo
(
new
[]
{
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
MapEnum
),
},
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
TestMap
),
new
[]{
"MapInt32Int32"
,
"MapInt64Int64"
,
"MapUint32Uint32"
,
"MapUint64Uint64"
,
"MapSint32Sint32"
,
"MapSint64Sint64"
,
"MapFixed32Fixed32"
,
"MapFixed64Fixed64"
,
"MapSfixed32Sfixed32"
,
"MapSfixed64Sfixed64"
,
"MapInt32Float"
,
"MapInt32Double"
,
"MapBoolBool"
,
"MapStringString"
,
"MapInt32Bytes"
,
"MapInt32Enum"
,
"MapInt32ForeignMessage"
},
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
TestMapSubmessage
),
new
[]{
"TestMap"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
TestMessageMap
),
new
[]{
"MapInt32Message"
},
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
null
,
}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
TestSameTypeMap
),
new
[]{
"Map1"
,
"Map2"
},
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
null
,
null
,
}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
TestArenaMap
),
new
[]{
"MapInt32Int32"
,
"MapInt64Int64"
,
"MapUint32Uint32"
,
"MapUint64Uint64"
,
"MapSint32Sint32"
,
"MapSint64Sint64"
,
"MapFixed32Fixed32"
,
"MapFixed64Fixed64"
,
"MapSfixed32Sfixed32"
,
"MapSfixed64Sfixed64"
,
"MapInt32Float"
,
"MapInt32Double"
,
"MapBoolBool"
,
"MapInt32Enum"
,
"MapInt32ForeignMessage"
},
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
MessageContainingEnumCalledType
),
new
[]{
"Type"
},
null
,
new
[]{
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
MessageContainingEnumCalledType
.
Types
.
Type
)
},
new
pbr
::
GeneratedCodeInfo
[]
{
null
,
}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
MessageContainingMapCalledEntry
),
new
[]{
"Entry"
},
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
null
,
})
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
TestMap
),
global
::
Google
.
Protobuf
.
TestProtos
.
TestMap
.
Parser
,
new
[]{
"MapInt32Int32"
,
"MapInt64Int64"
,
"MapUint32Uint32"
,
"MapUint64Uint64"
,
"MapSint32Sint32"
,
"MapSint64Sint64"
,
"MapFixed32Fixed32"
,
"MapFixed64Fixed64"
,
"MapSfixed32Sfixed32"
,
"MapSfixed64Sfixed64"
,
"MapInt32Float"
,
"MapInt32Double"
,
"MapBoolBool"
,
"MapStringString"
,
"MapInt32Bytes"
,
"MapInt32Enum"
,
"MapInt32ForeignMessage"
},
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
TestMapSubmessage
),
global
::
Google
.
Protobuf
.
TestProtos
.
TestMapSubmessage
.
Parser
,
new
[]{
"TestMap"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
TestMessageMap
),
global
::
Google
.
Protobuf
.
TestProtos
.
TestMessageMap
.
Parser
,
new
[]{
"MapInt32Message"
},
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
null
,
}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
TestSameTypeMap
),
global
::
Google
.
Protobuf
.
TestProtos
.
TestSameTypeMap
.
Parser
,
new
[]{
"Map1"
,
"Map2"
},
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
null
,
null
,
}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
TestArenaMap
),
global
::
Google
.
Protobuf
.
TestProtos
.
TestArenaMap
.
Parser
,
new
[]{
"MapInt32Int32"
,
"MapInt64Int64"
,
"MapUint32Uint32"
,
"MapUint64Uint64"
,
"MapSint32Sint32"
,
"MapSint64Sint64"
,
"MapFixed32Fixed32"
,
"MapFixed64Fixed64"
,
"MapSfixed32Sfixed32"
,
"MapSfixed64Sfixed64"
,
"MapInt32Float"
,
"MapInt32Double"
,
"MapBoolBool"
,
"MapInt32Enum"
,
"MapInt32ForeignMessage"
},
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
MessageContainingEnumCalledType
),
global
::
Google
.
Protobuf
.
TestProtos
.
MessageContainingEnumCalledType
.
Parser
,
new
[]{
"Type"
},
null
,
new
[]{
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
MessageContainingEnumCalledType
.
Types
.
Type
)
},
new
pbr
::
GeneratedCodeInfo
[]
{
null
,
}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
MessageContainingMapCalledEntry
),
global
::
Google
.
Protobuf
.
TestProtos
.
MessageContainingMapCalledEntry
.
Parser
,
new
[]{
"Entry"
},
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
null
,
})
}));
}
#
endregion
...
...
csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs
View file @
ff37edcd
...
...
@@ -34,7 +34,7 @@ namespace Google.Protobuf.TestProtos {
descriptor
=
pbr
::
FileDescriptor
.
InternalBuildGeneratedFileFrom
(
descriptorData
,
new
pbr
::
FileDescriptor
[]
{
global
::
Google
.
Protobuf
.
TestProtos
.
UnittestImportPublicProto3Reflection
.
Descriptor
,
},
new
pbr
::
GeneratedCodeInfo
(
new
[]
{
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
ImportEnum
),
},
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
ImportMessage
),
new
[]{
"D"
},
null
,
null
,
null
)
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
ImportMessage
),
global
::
Google
.
Protobuf
.
TestProtos
.
ImportMessage
.
Parser
,
new
[]{
"D"
},
null
,
null
,
null
)
}));
}
#
endregion
...
...
csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs
View file @
ff37edcd
...
...
@@ -30,7 +30,7 @@ namespace Google.Protobuf.TestProtos {
descriptor
=
pbr
::
FileDescriptor
.
InternalBuildGeneratedFileFrom
(
descriptorData
,
new
pbr
::
FileDescriptor
[]
{
},
new
pbr
::
GeneratedCodeInfo
(
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
PublicImportMessage
),
new
[]{
"E"
},
null
,
null
,
null
)
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
PublicImportMessage
),
global
::
Google
.
Protobuf
.
TestProtos
.
PublicImportMessage
.
Parser
,
new
[]{
"E"
},
null
,
null
,
null
)
}));
}
#
endregion
...
...
csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
View file @
ff37edcd
...
...
@@ -49,13 +49,13 @@ namespace UnitTest.Issues.TestProtos {
descriptor
=
pbr
::
FileDescriptor
.
InternalBuildGeneratedFileFrom
(
descriptorData
,
new
pbr
::
FileDescriptor
[]
{
},
new
pbr
::
GeneratedCodeInfo
(
new
[]
{
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
NegativeEnum
),
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
DeprecatedEnum
),
},
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
Issue307
),
null
,
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
Issue307
.
Types
.
NestedOnce
),
null
,
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
Issue307
.
Types
.
NestedOnce
.
Types
.
NestedTwice
)
,
null
,
null
,
null
,
null
)})}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
NegativeEnumMessage
),
new
[]{
"Value"
,
"Values"
,
"PackedValues"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
DeprecatedChild
),
null
,
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
DeprecatedFieldsMessage
),
new
[]{
"PrimitiveValue"
,
"PrimitiveArray"
,
"MessageValue"
,
"MessageArray"
,
"EnumValue"
,
"EnumArray"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
ItemField
),
new
[]{
"Item"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
ReservedNames
),
new
[]{
"Types_"
,
"Descriptor_"
},
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
ReservedNames
.
Types
.
SomeNestedType
)
,
null
,
null
,
null
,
null
)}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
TestJsonFieldOrdering
),
new
[]{
"PlainInt32"
,
"O1String"
,
"O1Int32"
,
"PlainString"
,
"O2Int32"
,
"O2String"
},
new
[]{
"O1"
,
"O2"
},
null
,
null
)
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
Issue307
),
global
::
UnitTest
.
Issues
.
TestProtos
.
Issue307
.
Parser
,
null
,
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
Issue307
.
Types
.
NestedOnce
),
global
::
UnitTest
.
Issues
.
TestProtos
.
Issue307
.
Types
.
NestedOnce
.
Parser
,
null
,
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
Issue307
.
Types
.
NestedOnce
.
Types
.
NestedTwice
),
global
::
UnitTest
.
Issues
.
TestProtos
.
Issue307
.
Types
.
NestedOnce
.
Types
.
NestedTwice
.
Parser
,
null
,
null
,
null
,
null
)})}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
NegativeEnumMessage
),
global
::
UnitTest
.
Issues
.
TestProtos
.
NegativeEnumMessage
.
Parser
,
new
[]{
"Value"
,
"Values"
,
"PackedValues"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
DeprecatedChild
),
global
::
UnitTest
.
Issues
.
TestProtos
.
DeprecatedChild
.
Parser
,
null
,
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
DeprecatedFieldsMessage
),
global
::
UnitTest
.
Issues
.
TestProtos
.
DeprecatedFieldsMessage
.
Parser
,
new
[]{
"PrimitiveValue"
,
"PrimitiveArray"
,
"MessageValue"
,
"MessageArray"
,
"EnumValue"
,
"EnumArray"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
ItemField
),
global
::
UnitTest
.
Issues
.
TestProtos
.
ItemField
.
Parser
,
new
[]{
"Item"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
ReservedNames
),
global
::
UnitTest
.
Issues
.
TestProtos
.
ReservedNames
.
Parser
,
new
[]{
"Types_"
,
"Descriptor_"
},
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
ReservedNames
.
Types
.
SomeNestedType
),
global
::
UnitTest
.
Issues
.
TestProtos
.
ReservedNames
.
Types
.
SomeNestedType
.
Parser
,
null
,
null
,
null
,
null
)}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
UnitTest
.
Issues
.
TestProtos
.
TestJsonFieldOrdering
),
global
::
UnitTest
.
Issues
.
TestProtos
.
TestJsonFieldOrdering
.
Parser
,
new
[]{
"PlainInt32"
,
"O1String"
,
"O1Int32"
,
"PlainString"
,
"O2Int32"
,
"O2String"
},
new
[]{
"O1"
,
"O2"
},
null
,
null
)
}));
}
#
endregion
...
...
csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
View file @
ff37edcd
This diff is collapsed.
Click to expand it.
csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs
View file @
ff37edcd
...
...
@@ -162,10 +162,10 @@ namespace Google.Protobuf.TestProtos {
descriptor
=
pbr
::
FileDescriptor
.
InternalBuildGeneratedFileFrom
(
descriptorData
,
new
pbr
::
FileDescriptor
[]
{
global
::
Google
.
Protobuf
.
WellKnownTypes
.
AnyReflection
.
Descriptor
,
global
::
Google
.
Protobuf
.
WellKnownTypes
.
ApiReflection
.
Descriptor
,
global
::
Google
.
Protobuf
.
WellKnownTypes
.
DurationReflection
.
Descriptor
,
global
::
Google
.
Protobuf
.
WellKnownTypes
.
EmptyReflection
.
Descriptor
,
global
::
Google
.
Protobuf
.
WellKnownTypes
.
FieldMaskReflection
.
Descriptor
,
global
::
Google
.
Protobuf
.
WellKnownTypes
.
SourceContextReflection
.
Descriptor
,
global
::
Google
.
Protobuf
.
WellKnownTypes
.
StructReflection
.
Descriptor
,
global
::
Google
.
Protobuf
.
WellKnownTypes
.
TimestampReflection
.
Descriptor
,
global
::
Google
.
Protobuf
.
WellKnownTypes
.
TypeReflection
.
Descriptor
,
global
::
Google
.
Protobuf
.
WellKnownTypes
.
WrappersReflection
.
Descriptor
,
},
new
pbr
::
GeneratedCodeInfo
(
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
TestWellKnownTypes
),
new
[]{
"AnyField"
,
"ApiField"
,
"DurationField"
,
"EmptyField"
,
"FieldMaskField"
,
"SourceContextField"
,
"StructField"
,
"TimestampField"
,
"TypeField"
,
"DoubleField"
,
"FloatField"
,
"Int64Field"
,
"Uint64Field"
,
"Int32Field"
,
"Uint32Field"
,
"BoolField"
,
"StringField"
,
"BytesField"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
RepeatedWellKnownTypes
),
new
[]{
"AnyField"
,
"ApiField"
,
"DurationField"
,
"EmptyField"
,
"FieldMaskField"
,
"SourceContextField"
,
"StructField"
,
"TimestampField"
,
"TypeField"
,
"DoubleField"
,
"FloatField"
,
"Int64Field"
,
"Uint64Field"
,
"Int32Field"
,
"Uint32Field"
,
"BoolField"
,
"StringField"
,
"BytesField"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
OneofWellKnownTypes
),
new
[]{
"AnyField"
,
"ApiField"
,
"DurationField"
,
"EmptyField"
,
"FieldMaskField"
,
"SourceContextField"
,
"StructField"
,
"TimestampField"
,
"TypeField"
,
"DoubleField"
,
"FloatField"
,
"Int64Field"
,
"Uint64Field"
,
"Int32Field"
,
"Uint32Field"
,
"BoolField"
,
"StringField"
,
"BytesField"
},
new
[]{
"OneofField"
},
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
MapWellKnownTypes
),
new
[]{
"AnyField"
,
"ApiField"
,
"DurationField"
,
"EmptyField"
,
"FieldMaskField"
,
"SourceContextField"
,
"StructField"
,
"TimestampField"
,
"TypeField"
,
"DoubleField"
,
"FloatField"
,
"Int64Field"
,
"Uint64Field"
,
"Int32Field"
,
"Uint32Field"
,
"BoolField"
,
"StringField"
,
"BytesField"
},
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
})
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
TestWellKnownTypes
),
global
::
Google
.
Protobuf
.
TestProtos
.
TestWellKnownTypes
.
Parser
,
new
[]{
"AnyField"
,
"ApiField"
,
"DurationField"
,
"EmptyField"
,
"FieldMaskField"
,
"SourceContextField"
,
"StructField"
,
"TimestampField"
,
"TypeField"
,
"DoubleField"
,
"FloatField"
,
"Int64Field"
,
"Uint64Field"
,
"Int32Field"
,
"Uint32Field"
,
"BoolField"
,
"StringField"
,
"BytesField"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
RepeatedWellKnownTypes
),
global
::
Google
.
Protobuf
.
TestProtos
.
RepeatedWellKnownTypes
.
Parser
,
new
[]{
"AnyField"
,
"ApiField"
,
"DurationField"
,
"EmptyField"
,
"FieldMaskField"
,
"SourceContextField"
,
"StructField"
,
"TimestampField"
,
"TypeField"
,
"DoubleField"
,
"FloatField"
,
"Int64Field"
,
"Uint64Field"
,
"Int32Field"
,
"Uint32Field"
,
"BoolField"
,
"StringField"
,
"BytesField"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
OneofWellKnownTypes
),
global
::
Google
.
Protobuf
.
TestProtos
.
OneofWellKnownTypes
.
Parser
,
new
[]{
"AnyField"
,
"ApiField"
,
"DurationField"
,
"EmptyField"
,
"FieldMaskField"
,
"SourceContextField"
,
"StructField"
,
"TimestampField"
,
"TypeField"
,
"DoubleField"
,
"FloatField"
,
"Int64Field"
,
"Uint64Field"
,
"Int32Field"
,
"Uint32Field"
,
"BoolField"
,
"StringField"
,
"BytesField"
},
new
[]{
"OneofField"
},
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
TestProtos
.
MapWellKnownTypes
),
global
::
Google
.
Protobuf
.
TestProtos
.
MapWellKnownTypes
.
Parser
,
new
[]{
"AnyField"
,
"ApiField"
,
"DurationField"
,
"EmptyField"
,
"FieldMaskField"
,
"SourceContextField"
,
"StructField"
,
"TimestampField"
,
"TypeField"
,
"DoubleField"
,
"FloatField"
,
"Int64Field"
,
"Uint64Field"
,
"Int32Field"
,
"Uint32Field"
,
"BoolField"
,
"StringField"
,
"BytesField"
},
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
})
}));
}
#
endregion
...
...
csharp/src/Google.Protobuf/JsonParser.cs
View file @
ff37edcd
...
...
@@ -555,14 +555,10 @@ namespace Google.Protobuf
/// <summary>
/// Creates a new instance of the message type for the given field.
/// This method is mostly extracted so we can replace it in one go when we work out
/// what we want to do instead of Activator.CreateInstance.
/// </summary>
private
static
IMessage
NewMessageForField
(
FieldDescriptor
field
)
{
// TODO: Create an instance in a better way ?
// (We could potentially add a Parser property to MessageDescriptor... see issue 806.)
return
(
IMessage
)
Activator
.
CreateInstance
(
field
.
MessageType
.
GeneratedType
);
return
field
.
MessageType
.
Parser
.
CreateTemplate
();
}
private
static
T
ParseNumericString
<
T
>(
string
text
,
Func
<
string
,
NumberStyles
,
IFormatProvider
,
T
>
parser
,
bool
floatingPoint
)
...
...
csharp/src/Google.Protobuf/MessageParser.cs
View file @
ff37edcd
...
...
@@ -35,6 +35,109 @@ using System.IO;
namespace
Google.Protobuf
{
/// <summary>
/// A general message parser, typically used by reflection-based code as all the methods
/// return simple <see cref="IMessage"/>.
/// </summary>
public
class
MessageParser
{
private
Func
<
IMessage
>
factory
;
internal
MessageParser
(
Func
<
IMessage
>
factory
)
{
this
.
factory
=
factory
;
}
/// <summary>
/// Creates a template instance ready for population.
/// </summary>
/// <returns>An empty message.</returns>
internal
IMessage
CreateTemplate
()
{
return
factory
();
}
/// <summary>
/// Parses a message from a byte array.
/// </summary>
/// <param name="data">The byte array containing the message. Must not be null.</param>
/// <returns>The newly parsed message.</returns>
public
IMessage
ParseFrom
(
byte
[]
data
)
{
Preconditions
.
CheckNotNull
(
data
,
"data"
);
IMessage
message
=
factory
();
message
.
MergeFrom
(
data
);
return
message
;
}
/// <summary>
/// Parses a message from the given byte string.
/// </summary>
/// <param name="data">The data to parse.</param>
/// <returns>The parsed message.</returns>
public
IMessage
ParseFrom
(
ByteString
data
)
{
Preconditions
.
CheckNotNull
(
data
,
"data"
);
IMessage
message
=
factory
();
message
.
MergeFrom
(
data
);
return
message
;
}
/// <summary>
/// Parses a message from the given stream.
/// </summary>
/// <param name="input">The stream to parse.</param>
/// <returns>The parsed message.</returns>
public
IMessage
ParseFrom
(
Stream
input
)
{
IMessage
message
=
factory
();
message
.
MergeFrom
(
input
);
return
message
;
}
/// <summary>
/// Parses a length-delimited message from the given stream.
/// </summary>
/// <remarks>
/// The stream is expected to contain a length and then the data. Only the amount of data
/// specified by the length will be consumed.
/// </remarks>
/// <param name="input">The stream to parse.</param>
/// <returns>The parsed message.</returns>
public
IMessage
ParseDelimitedFrom
(
Stream
input
)
{
IMessage
message
=
factory
();
message
.
MergeDelimitedFrom
(
input
);
return
message
;
}
/// <summary>
/// Parses a message from the given coded input stream.
/// </summary>
/// <param name="input">The stream to parse.</param>
/// <returns>The parsed message.</returns>
public
IMessage
ParseFrom
(
CodedInputStream
input
)
{
IMessage
message
=
factory
();
message
.
MergeFrom
(
input
);
return
message
;
}
/// <summary>
/// Parses a message from the given JSON.
/// </summary>
/// <param name="json">The JSON to parse.</param>
/// <returns>The parsed message.</returns>
/// <exception cref="InvalidJsonException">The JSON does not comply with RFC 7159</exception>
/// <exception cref="InvalidProtocolBufferException">The JSON does not represent a Protocol Buffers message correctly</exception>
public
IMessage
ParseJson
(
string
json
)
{
IMessage
message
=
factory
();
JsonParser
.
Default
.
Merge
(
message
,
json
);
return
message
;
}
}
/// <summary>
/// A parser for a specific message type.
/// </summary>
...
...
@@ -51,8 +154,12 @@ namespace Google.Protobuf
/// </p>
/// </remarks>
/// <typeparam name="T">The type of message to be parsed.</typeparam>
public
sealed
class
MessageParser
<
T
>
where
T
:
IMessage
<
T
>
public
sealed
class
MessageParser
<
T
>
:
MessageParser
where
T
:
IMessage
<
T
>
{
// Implementation note: all the methods here *could* just delegate up to the base class and cast the result.
// The current implementation avoids a virtual method call and a cast, which *may* be significant in some cases.
// Benchmarking work is required to measure the significance - but it's only a few lines of code in any case.
// The API wouldn't change anyway - just the implementation - so this work can be deferred.
private
readonly
Func
<
T
>
factory
;
/// <summary>
...
...
@@ -63,7 +170,7 @@ namespace Google.Protobuf
/// to require a parameterless constructor: delegates are significantly faster to execute.
/// </remarks>
/// <param name="factory">Function to invoke when a new, empty message is required.</param>
public
MessageParser
(
Func
<
T
>
factory
)
public
MessageParser
(
Func
<
T
>
factory
)
:
base
(()
=>
factory
())
{
this
.
factory
=
factory
;
}
...
...
@@ -72,7 +179,7 @@ namespace Google.Protobuf
/// Creates a template instance ready for population.
/// </summary>
/// <returns>An empty message.</returns>
internal
T
CreateTemplate
()
internal
new
T
CreateTemplate
()
{
return
factory
();
}
...
...
@@ -82,7 +189,7 @@ namespace Google.Protobuf
/// </summary>
/// <param name="data">The byte array containing the message. Must not be null.</param>
/// <returns>The newly parsed message.</returns>
public
T
ParseFrom
(
byte
[]
data
)
public
new
T
ParseFrom
(
byte
[]
data
)
{
Preconditions
.
CheckNotNull
(
data
,
"data"
);
T
message
=
factory
();
...
...
@@ -95,7 +202,7 @@ namespace Google.Protobuf
/// </summary>
/// <param name="data">The data to parse.</param>
/// <returns>The parsed message.</returns>
public
T
ParseFrom
(
ByteString
data
)
public
new
T
ParseFrom
(
ByteString
data
)
{
Preconditions
.
CheckNotNull
(
data
,
"data"
);
T
message
=
factory
();
...
...
@@ -108,7 +215,7 @@ namespace Google.Protobuf
/// </summary>
/// <param name="input">The stream to parse.</param>
/// <returns>The parsed message.</returns>
public
T
ParseFrom
(
Stream
input
)
public
new
T
ParseFrom
(
Stream
input
)
{
T
message
=
factory
();
message
.
MergeFrom
(
input
);
...
...
@@ -124,7 +231,7 @@ namespace Google.Protobuf
/// </remarks>
/// <param name="input">The stream to parse.</param>
/// <returns>The parsed message.</returns>
public
T
ParseDelimitedFrom
(
Stream
input
)
public
new
T
ParseDelimitedFrom
(
Stream
input
)
{
T
message
=
factory
();
message
.
MergeDelimitedFrom
(
input
);
...
...
@@ -136,7 +243,7 @@ namespace Google.Protobuf
/// </summary>
/// <param name="input">The stream to parse.</param>
/// <returns>The parsed message.</returns>
public
T
ParseFrom
(
CodedInputStream
input
)
public
new
T
ParseFrom
(
CodedInputStream
input
)
{
T
message
=
factory
();
message
.
MergeFrom
(
input
);
...
...
@@ -150,7 +257,7 @@ namespace Google.Protobuf
/// <returns>The parsed message.</returns>
/// <exception cref="InvalidJsonException">The JSON does not comply with RFC 7159</exception>
/// <exception cref="InvalidProtocolBufferException">The JSON does not represent a Protocol Buffers message correctly</exception>
public
T
ParseJson
(
string
json
)
public
new
T
ParseJson
(
string
json
)
{
T
message
=
factory
();
JsonParser
.
Default
.
Merge
(
message
,
json
);
...
...
csharp/src/Google.Protobuf/Reflection/Descriptor.cs
View file @
ff37edcd
This diff is collapsed.
Click to expand it.
csharp/src/Google.Protobuf/Reflection/GeneratedCodeInfo.cs
View file @
ff37edcd
...
...
@@ -17,6 +17,11 @@ namespace Google.Protobuf.Reflection
/// </summary>
public
Type
ClrType
{
get
;
private
set
;
}
/// <summary>
/// Irrelevant for file descriptors; the parser for message descriptors.
/// </summary>
public
MessageParser
Parser
{
get
;
private
set
;
}
/// <summary>
/// Irrelevant for file descriptors; the CLR property names (in message descriptor field order)
/// for fields in the message for message descriptors.
...
...
@@ -46,11 +51,12 @@ namespace Google.Protobuf.Reflection
/// Each array parameter may be null, to indicate a lack of values.
/// The parameter order is designed to make it feasible to format the generated code readably.
/// </summary>
public
GeneratedCodeInfo
(
Type
clrType
,
string
[]
propertyNames
,
string
[]
oneofNames
,
Type
[]
nestedEnums
,
GeneratedCodeInfo
[]
nestedTypes
)
public
GeneratedCodeInfo
(
Type
clrType
,
MessageParser
parser
,
string
[]
propertyNames
,
string
[]
oneofNames
,
Type
[]
nestedEnums
,
GeneratedCodeInfo
[]
nestedTypes
)
{
NestedTypes
=
nestedTypes
??
EmptyCodeInfo
;
NestedEnums
=
nestedEnums
??
ReflectionUtil
.
EmptyTypes
;
ClrType
=
clrType
;
Parser
=
parser
;
PropertyNames
=
propertyNames
??
EmptyNames
;
OneofNames
=
oneofNames
??
EmptyNames
;
}
...
...
@@ -59,7 +65,7 @@ namespace Google.Protobuf.Reflection
/// Creates a GeneratedCodeInfo for a file descriptor, with only types and enums.
/// </summary>
public
GeneratedCodeInfo
(
Type
[]
nestedEnums
,
GeneratedCodeInfo
[]
nestedTypes
)
:
this
(
null
,
null
,
null
,
nestedEnums
,
nestedTypes
)
:
this
(
null
,
null
,
null
,
n
ull
,
n
estedEnums
,
nestedTypes
)
{
}
}
...
...
csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs
View file @
ff37edcd
...
...
@@ -67,11 +67,13 @@ namespace Google.Protobuf.Reflection
private
readonly
IList
<
OneofDescriptor
>
oneofs
;
// CLR representation of the type described by this descriptor, if any.
private
readonly
Type
generatedType
;
private
readonly
MessageParser
parser
;
internal
MessageDescriptor
(
DescriptorProto
proto
,
FileDescriptor
file
,
MessageDescriptor
parent
,
int
typeIndex
,
GeneratedCodeInfo
generatedCodeInfo
)
:
base
(
file
,
file
.
ComputeFullName
(
parent
,
proto
.
Name
),
typeIndex
)
{
this
.
proto
=
proto
;
parser
=
generatedCodeInfo
==
null
?
null
:
generatedCodeInfo
.
Parser
;
generatedType
=
generatedCodeInfo
==
null
?
null
:
generatedCodeInfo
.
ClrType
;
containingType
=
parent
;
...
...
@@ -122,6 +124,15 @@ namespace Google.Protobuf.Reflection
/// </summary>
public
Type
GeneratedType
{
get
{
return
generatedType
;
}
}
/// <summary>
/// A parser for this message type.
/// </summary>
/// <remarks>
/// As <see cref="MessageDescriptor"/> is not generic, this cannot be statically
/// typed to the relevant type, but if <see cref="GeneratedType"/> returns a non-null value, the parser returned
/// </remarks>
public
MessageParser
Parser
{
get
{
return
parser
;
}
}
/// <summary>
/// Returns whether this message is one of the "well known types" which may have runtime/protoc support.
/// </summary>
...
...
csharp/src/Google.Protobuf/WellKnownTypes/Any.cs
View file @
ff37edcd
...
...
@@ -30,7 +30,7 @@ namespace Google.Protobuf.WellKnownTypes {
descriptor
=
pbr
::
FileDescriptor
.
InternalBuildGeneratedFileFrom
(
descriptorData
,
new
pbr
::
FileDescriptor
[]
{
},
new
pbr
::
GeneratedCodeInfo
(
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Any
),
new
[]{
"TypeUrl"
,
"Value"
},
null
,
null
,
null
)
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Any
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Any
.
Parser
,
new
[]{
"TypeUrl"
,
"Value"
},
null
,
null
,
null
)
}));
}
#
endregion
...
...
csharp/src/Google.Protobuf/WellKnownTypes/Api.cs
View file @
ff37edcd
...
...
@@ -42,9 +42,9 @@ namespace Google.Protobuf.WellKnownTypes {
descriptor
=
pbr
::
FileDescriptor
.
InternalBuildGeneratedFileFrom
(
descriptorData
,
new
pbr
::
FileDescriptor
[]
{
global
::
Google
.
Protobuf
.
WellKnownTypes
.
SourceContextReflection
.
Descriptor
,
global
::
Google
.
Protobuf
.
WellKnownTypes
.
TypeReflection
.
Descriptor
,
},
new
pbr
::
GeneratedCodeInfo
(
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Api
),
new
[]{
"Name"
,
"Methods"
,
"Options"
,
"Version"
,
"SourceContext"
,
"Mixins"
,
"Syntax"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Method
),
new
[]{
"Name"
,
"RequestTypeUrl"
,
"RequestStreaming"
,
"ResponseTypeUrl"
,
"ResponseStreaming"
,
"Options"
,
"Syntax"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Mixin
),
new
[]{
"Name"
,
"Root"
},
null
,
null
,
null
)
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Api
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Api
.
Parser
,
new
[]{
"Name"
,
"Methods"
,
"Options"
,
"Version"
,
"SourceContext"
,
"Mixins"
,
"Syntax"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Method
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Method
.
Parser
,
new
[]{
"Name"
,
"RequestTypeUrl"
,
"RequestStreaming"
,
"ResponseTypeUrl"
,
"ResponseStreaming"
,
"Options"
,
"Syntax"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Mixin
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Mixin
.
Parser
,
new
[]{
"Name"
,
"Root"
},
null
,
null
,
null
)
}));
}
#
endregion
...
...
csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
View file @
ff37edcd
...
...
@@ -31,7 +31,7 @@ namespace Google.Protobuf.WellKnownTypes {
descriptor
=
pbr
::
FileDescriptor
.
InternalBuildGeneratedFileFrom
(
descriptorData
,
new
pbr
::
FileDescriptor
[]
{
},
new
pbr
::
GeneratedCodeInfo
(
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Duration
),
new
[]{
"Seconds"
,
"Nanos"
},
null
,
null
,
null
)
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Duration
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Duration
.
Parser
,
new
[]{
"Seconds"
,
"Nanos"
},
null
,
null
,
null
)
}));
}
#
endregion
...
...
csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs
View file @
ff37edcd
...
...
@@ -30,7 +30,7 @@ namespace Google.Protobuf.WellKnownTypes {
descriptor
=
pbr
::
FileDescriptor
.
InternalBuildGeneratedFileFrom
(
descriptorData
,
new
pbr
::
FileDescriptor
[]
{
},
new
pbr
::
GeneratedCodeInfo
(
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Empty
),
null
,
null
,
null
,
null
)
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Empty
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Empty
.
Parser
,
null
,
null
,
null
,
null
)
}));
}
#
endregion
...
...
csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs
View file @
ff37edcd
...
...
@@ -30,7 +30,7 @@ namespace Google.Protobuf.WellKnownTypes {
descriptor
=
pbr
::
FileDescriptor
.
InternalBuildGeneratedFileFrom
(
descriptorData
,
new
pbr
::
FileDescriptor
[]
{
},
new
pbr
::
GeneratedCodeInfo
(
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
FieldMask
),
new
[]{
"Paths"
},
null
,
null
,
null
)
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
FieldMask
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
FieldMask
.
Parser
,
new
[]{
"Paths"
},
null
,
null
,
null
)
}));
}
#
endregion
...
...
csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs
View file @
ff37edcd
...
...
@@ -31,7 +31,7 @@ namespace Google.Protobuf.WellKnownTypes {
descriptor
=
pbr
::
FileDescriptor
.
InternalBuildGeneratedFileFrom
(
descriptorData
,
new
pbr
::
FileDescriptor
[]
{
},
new
pbr
::
GeneratedCodeInfo
(
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
SourceContext
),
new
[]{
"FileName"
},
null
,
null
,
null
)
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
SourceContext
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
SourceContext
.
Parser
,
new
[]{
"FileName"
},
null
,
null
,
null
)
}));
}
#
endregion
...
...
csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
View file @
ff37edcd
...
...
@@ -40,9 +40,9 @@ namespace Google.Protobuf.WellKnownTypes {
descriptor
=
pbr
::
FileDescriptor
.
InternalBuildGeneratedFileFrom
(
descriptorData
,
new
pbr
::
FileDescriptor
[]
{
},
new
pbr
::
GeneratedCodeInfo
(
new
[]
{
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
NullValue
),
},
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Struct
),
new
[]{
"Fields"
},
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
null
,
}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Value
),
new
[]{
"NullValue"
,
"NumberValue"
,
"StringValue"
,
"BoolValue"
,
"StructValue"
,
"ListValue"
},
new
[]{
"Kind"
},
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
ListValue
),
new
[]{
"Values"
},
null
,
null
,
null
)
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Struct
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Struct
.
Parser
,
new
[]{
"Fields"
},
null
,
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
null
,
}),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Value
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Value
.
Parser
,
new
[]{
"NullValue"
,
"NumberValue"
,
"StringValue"
,
"BoolValue"
,
"StructValue"
,
"ListValue"
},
new
[]{
"Kind"
},
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
ListValue
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
ListValue
.
Parser
,
new
[]{
"Values"
},
null
,
null
,
null
)
}));
}
#
endregion
...
...
csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs
View file @
ff37edcd
...
...
@@ -31,7 +31,7 @@ namespace Google.Protobuf.WellKnownTypes {
descriptor
=
pbr
::
FileDescriptor
.
InternalBuildGeneratedFileFrom
(
descriptorData
,
new
pbr
::
FileDescriptor
[]
{
},
new
pbr
::
GeneratedCodeInfo
(
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Timestamp
),
new
[]{
"Seconds"
,
"Nanos"
},
null
,
null
,
null
)
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Timestamp
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Timestamp
.
Parser
,
new
[]{
"Seconds"
,
"Nanos"
},
null
,
null
,
null
)
}));
}
#
endregion
...
...
csharp/src/Google.Protobuf/WellKnownTypes/Type.cs
View file @
ff37edcd
...
...
@@ -60,11 +60,11 @@ namespace Google.Protobuf.WellKnownTypes {
descriptor
=
pbr
::
FileDescriptor
.
InternalBuildGeneratedFileFrom
(
descriptorData
,
new
pbr
::
FileDescriptor
[]
{
global
::
Google
.
Protobuf
.
WellKnownTypes
.
AnyReflection
.
Descriptor
,
global
::
Google
.
Protobuf
.
WellKnownTypes
.
SourceContextReflection
.
Descriptor
,
},
new
pbr
::
GeneratedCodeInfo
(
new
[]
{
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Syntax
),
},
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Type
),
new
[]{
"Name"
,
"Fields"
,
"Oneofs"
,
"Options"
,
"SourceContext"
,
"Syntax"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Field
),
new
[]{
"Kind"
,
"Cardinality"
,
"Number"
,
"Name"
,
"TypeUrl"
,
"OneofIndex"
,
"Packed"
,
"Options"
,
"JsonName"
},
null
,
new
[]{
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Field
.
Types
.
Kind
),
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Field
.
Types
.
Cardinality
)
},
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Enum
),
new
[]{
"Name"
,
"Enumvalue"
,
"Options"
,
"SourceContext"
,
"Syntax"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
EnumValue
),
new
[]{
"Name"
,
"Number"
,
"Options"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Option
),
new
[]{
"Name"
,
"Value"
},
null
,
null
,
null
)
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Type
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Type
.
Parser
,
new
[]{
"Name"
,
"Fields"
,
"Oneofs"
,
"Options"
,
"SourceContext"
,
"Syntax"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Field
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Field
.
Parser
,
new
[]{
"Kind"
,
"Cardinality"
,
"Number"
,
"Name"
,
"TypeUrl"
,
"OneofIndex"
,
"Packed"
,
"Options"
,
"JsonName"
},
null
,
new
[]{
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Field
.
Types
.
Kind
),
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Field
.
Types
.
Cardinality
)
},
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Enum
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Enum
.
Parser
,
new
[]{
"Name"
,
"Enumvalue"
,
"Options"
,
"SourceContext"
,
"Syntax"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
EnumValue
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
EnumValue
.
Parser
,
new
[]{
"Name"
,
"Number"
,
"Options"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Option
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Option
.
Parser
,
new
[]{
"Name"
,
"Value"
},
null
,
null
,
null
)
}));
}
#
endregion
...
...
csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs
View file @
ff37edcd
...
...
@@ -35,15 +35,15 @@ namespace Google.Protobuf.WellKnownTypes {
descriptor
=
pbr
::
FileDescriptor
.
InternalBuildGeneratedFileFrom
(
descriptorData
,
new
pbr
::
FileDescriptor
[]
{
},
new
pbr
::
GeneratedCodeInfo
(
null
,
new
pbr
::
GeneratedCodeInfo
[]
{
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
DoubleValue
),
new
[]{
"Value"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
FloatValue
),
new
[]{
"Value"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Int64Value
),
new
[]{
"Value"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
UInt64Value
),
new
[]{
"Value"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Int32Value
),
new
[]{
"Value"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
UInt32Value
),
new
[]{
"Value"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
BoolValue
),
new
[]{
"Value"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
StringValue
),
new
[]{
"Value"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
BytesValue
),
new
[]{
"Value"
},
null
,
null
,
null
)
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
DoubleValue
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
DoubleValue
.
Parser
,
new
[]{
"Value"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
FloatValue
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
FloatValue
.
Parser
,
new
[]{
"Value"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Int64Value
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Int64Value
.
Parser
,
new
[]{
"Value"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
UInt64Value
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
UInt64Value
.
Parser
,
new
[]{
"Value"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Int32Value
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
Int32Value
.
Parser
,
new
[]{
"Value"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
UInt32Value
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
UInt32Value
.
Parser
,
new
[]{
"Value"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
BoolValue
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
BoolValue
.
Parser
,
new
[]{
"Value"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
StringValue
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
StringValue
.
Parser
,
new
[]{
"Value"
},
null
,
null
,
null
),
new
pbr
::
GeneratedCodeInfo
(
typeof
(
global
::
Google
.
Protobuf
.
WellKnownTypes
.
BytesValue
),
global
::
Google
.
Protobuf
.
WellKnownTypes
.
BytesValue
.
Parser
,
new
[]{
"Value"
},
null
,
null
,
null
)
}));
}
#
endregion
...
...
src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc
View file @
ff37edcd
...
...
@@ -232,7 +232,7 @@ void UmbrellaClassGenerator::WriteGeneratedCodeInfo(const Descriptor* descriptor
return
;
}
// Generated message type
printer
->
Print
(
"new pbr::GeneratedCodeInfo(typeof($type_name$), "
,
"type_name"
,
GetClassName
(
descriptor
));
printer
->
Print
(
"new pbr::GeneratedCodeInfo(typeof($type_name$),
$type_name$.Parser,
"
,
"type_name"
,
GetClassName
(
descriptor
));
// Fields
if
(
descriptor
->
field_count
()
>
0
)
{
...
...
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