aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/ProtocolBuffers/DescriptorProtos/PartialClasses.cs
diff options
context:
space:
mode:
authorJon Skeet <jonskeet@google.com>2015-07-01 17:19:48 +0100
committerJon Skeet <jonskeet@google.com>2015-07-09 08:26:06 +0100
commitaf259b77bf04fcfb68609776cb27f04d289a2c39 (patch)
tree3e5434199a9c59b8556e9267fb9eb7b73211f8c5 /csharp/src/ProtocolBuffers/DescriptorProtos/PartialClasses.cs
parent5350822b0a923287bc23375a10c2f3cb07cff5fb (diff)
downloadprotobuf-af259b77bf04fcfb68609776cb27f04d289a2c39.tar.gz
protobuf-af259b77bf04fcfb68609776cb27f04d289a2c39.tar.bz2
protobuf-af259b77bf04fcfb68609776cb27f04d289a2c39.zip
Fix descriptor reflection in various ways
- The protos are no longer publicly exposed at all - Oneof detection now works (as we default to -1, not 0) - OneofDescriptor exposes the fields in the oneof - Removed unnecessary code for replacing protos - remnant of extensions - There's now just the non-generic form of IDescriptor
Diffstat (limited to 'csharp/src/ProtocolBuffers/DescriptorProtos/PartialClasses.cs')
-rw-r--r--csharp/src/ProtocolBuffers/DescriptorProtos/PartialClasses.cs38
1 files changed, 10 insertions, 28 deletions
diff --git a/csharp/src/ProtocolBuffers/DescriptorProtos/PartialClasses.cs b/csharp/src/ProtocolBuffers/DescriptorProtos/PartialClasses.cs
index 15f339ba..dc19cdad 100644
--- a/csharp/src/ProtocolBuffers/DescriptorProtos/PartialClasses.cs
+++ b/csharp/src/ProtocolBuffers/DescriptorProtos/PartialClasses.cs
@@ -30,36 +30,18 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
-// This file just contains partial classes for each of the
-// autogenerated classes, so that they implement
-// IDescriptorProto
+// This file just contains partial classes for any autogenerated classes that need additional support.
namespace Google.Protobuf.DescriptorProtos
{
- public partial class DescriptorProto : IDescriptorProto<MessageOptions>
- {
- }
-
- public partial class EnumDescriptorProto : IDescriptorProto<EnumOptions>
- {
- }
-
- public partial class EnumValueDescriptorProto : IDescriptorProto<EnumValueOptions>
- {
- }
-
- public partial class FieldDescriptorProto : IDescriptorProto<FieldOptions>
- {
- }
-
- public partial class FileDescriptorProto : IDescriptorProto<FileOptions>
- {
- }
-
- public partial class MethodDescriptorProto : IDescriptorProto<MethodOptions>
- {
- }
-
- public partial class ServiceDescriptorProto : IDescriptorProto<ServiceOptions>
+ internal partial class FieldDescriptorProto
{
+ // We can't tell the difference between "explicitly set to 0" and "not set"
+ // in proto3, but we need to tell the difference for OneofIndex. descriptor.proto
+ // is really a proto2 file, but the runtime doesn't know about proto2 semantics...
+ // We fake it by defaulting to -1.
+ partial void OnConstruction()
+ {
+ OneofIndex = -1;
+ }
}
} \ No newline at end of file