diff options
-rwxr-xr-x | csharp/generate_protos.sh | 2 | ||||
-rw-r--r-- | csharp/src/AddressBook/Addressbook.cs | 34 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers.Test/IssuesTest.cs | 2 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj | 2 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers.Test/Reflection/DescriptorsTest.cs (renamed from csharp/src/ProtocolBuffers.Test/DescriptorsTest.cs) | 446 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers.Test/TestProtos/MapUnittestProto3.cs | 362 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportProto3.cs | 18 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs | 18 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers.Test/TestProtos/UnittestIssues.cs | 66 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers.Test/TestProtos/UnittestProto3.cs | 290 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/IMessage.cs | 2 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/JsonFormatter.cs | 3 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/ProtocolBuffers.csproj | 51 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/DescriptorBase.cs (renamed from csharp/src/ProtocolBuffers/Descriptors/DescriptorBase.cs) | 164 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/DescriptorPool.cs (renamed from csharp/src/ProtocolBuffers/Descriptors/DescriptorPool.cs) | 728 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/DescriptorProtoFile.cs (renamed from csharp/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs) | 600 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/DescriptorUtil.cs (renamed from csharp/src/ProtocolBuffers/Descriptors/DescriptorUtil.cs) | 128 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/DescriptorValidationException.cs (renamed from csharp/src/ProtocolBuffers/Descriptors/DescriptorValidationException.cs) | 158 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/EnumDescriptor.cs (renamed from csharp/src/ProtocolBuffers/Descriptors/EnumDescriptor.cs) | 215 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/EnumValueDescriptor.cs (renamed from csharp/src/ProtocolBuffers/Descriptors/EnumValueDescriptor.cs) | 122 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/FieldAccessorBase.cs (renamed from csharp/src/ProtocolBuffers/FieldAccess/FieldAccessorBase.cs) | 3 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/FieldAccessorTable.cs (renamed from csharp/src/ProtocolBuffers/FieldAccess/FieldAccessorTable.cs) | 193 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/FieldDescriptor.cs (renamed from csharp/src/ProtocolBuffers/Descriptors/FieldDescriptor.cs) | 583 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/FieldType.cs (renamed from csharp/src/ProtocolBuffers/Descriptors/FieldType.cs) | 118 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/FileDescriptor.cs (renamed from csharp/src/ProtocolBuffers/Descriptors/FileDescriptor.cs) | 704 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/IDescriptor.cs (renamed from csharp/src/ProtocolBuffers/Descriptors/IDescriptor.cs) | 86 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/IFieldAccessor.cs (renamed from csharp/src/ProtocolBuffers/FieldAccess/IFieldAccessor.cs) | 140 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/MapFieldAccessor.cs (renamed from csharp/src/ProtocolBuffers/FieldAccess/MapFieldAccessor.cs) | 3 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/MessageDescriptor.cs (renamed from csharp/src/ProtocolBuffers/Descriptors/MessageDescriptor.cs) | 343 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/MethodDescriptor.cs (renamed from csharp/src/ProtocolBuffers/Descriptors/MethodDescriptor.cs) | 186 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/OneofAccessor.cs (renamed from csharp/src/ProtocolBuffers/FieldAccess/OneofAccessor.cs) | 171 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/OneofDescriptor.cs (renamed from csharp/src/ProtocolBuffers/Descriptors/OneofDescriptor.cs) | 157 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/PackageDescriptor.cs (renamed from csharp/src/ProtocolBuffers/Descriptors/PackageDescriptor.cs) | 134 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/PartialClasses.cs (renamed from csharp/src/ProtocolBuffers/DescriptorProtos/PartialClasses.cs) | 2 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/ReflectionUtil.cs (renamed from csharp/src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs) | 210 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/RepeatedFieldAccessor.cs (renamed from csharp/src/ProtocolBuffers/FieldAccess/RepeatedFieldAccessor.cs) | 3 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/ServiceDescriptor.cs (renamed from csharp/src/ProtocolBuffers/Descriptors/ServiceDescriptor.cs) | 177 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/Reflection/SingleFieldAccessor.cs (renamed from csharp/src/ProtocolBuffers/FieldAccess/SingleFieldAccessor.cs) | 5 | ||||
-rw-r--r-- | csharp/src/ProtocolBuffers/WireFormat.cs | 2 | ||||
-rw-r--r-- | src/google/protobuf/any.pb.cc | 5 | ||||
-rw-r--r-- | src/google/protobuf/compiler/csharp/csharp_message.cc | 8 | ||||
-rw-r--r-- | src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc | 10 | ||||
-rw-r--r-- | src/google/protobuf/descriptor.pb.cc | 4 | ||||
-rw-r--r-- | src/google/protobuf/descriptor.proto | 2 | ||||
-rw-r--r-- | src/google/protobuf/duration.pb.cc | 6 | ||||
-rw-r--r-- | src/google/protobuf/field_mask.pb.cc | 4 | ||||
-rw-r--r-- | src/google/protobuf/struct.pb.cc | 6 | ||||
-rw-r--r-- | src/google/protobuf/timestamp.pb.cc | 6 | ||||
-rw-r--r-- | src/google/protobuf/wrappers.pb.cc | 4 |
49 files changed, 3331 insertions, 3355 deletions
diff --git a/csharp/generate_protos.sh b/csharp/generate_protos.sh index e861f16f..8ec103cd 100755 --- a/csharp/generate_protos.sh +++ b/csharp/generate_protos.sh @@ -38,7 +38,7 @@ fi # Descriptor proto # TODO(jonskeet): Remove fixup cp src/google/protobuf/descriptor.proto src/google/protobuf/descriptor_proto_file.proto -$PROTOC -Isrc --csharp_out=csharp/src/ProtocolBuffers/DescriptorProtos \ +$PROTOC -Isrc --csharp_out=csharp/src/ProtocolBuffers/Reflection \ src/google/protobuf/descriptor_proto_file.proto rm src/google/protobuf/descriptor_proto_file.proto diff --git a/csharp/src/AddressBook/Addressbook.cs b/csharp/src/AddressBook/Addressbook.cs index afdb1728..d358f5a6 100644 --- a/csharp/src/AddressBook/Addressbook.cs +++ b/csharp/src/AddressBook/Addressbook.cs @@ -5,7 +5,7 @@ using pb = global::Google.Protobuf; using pbc = global::Google.Protobuf.Collections; -using pbd = global::Google.Protobuf.Descriptors; +using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace Google.Protobuf.Examples.AddressBook { @@ -13,15 +13,15 @@ namespace Google.Protobuf.Examples.AddressBook { public static partial class Addressbook { #region Static variables - internal static pb::FieldAccess.FieldAccessorTable internal__static_tutorial_Person__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_tutorial_AddressBook__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_tutorial_Person__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_tutorial_AddressBook__FieldAccessorTable; #endregion #region Descriptor - public static pbd::FileDescriptor Descriptor { + public static pbr::FileDescriptor Descriptor { get { return descriptor; } } - private static pbd::FileDescriptor descriptor; + private static pbr::FileDescriptor descriptor; static Addressbook() { byte[] descriptorData = global::System.Convert.FromBase64String( @@ -35,17 +35,17 @@ namespace Google.Protobuf.Examples.AddressBook { "ASADKAsyEC50dXRvcmlhbC5QZXJzb25CUAoUY29tLmV4YW1wbGUudHV0b3Jp", "YWxCEUFkZHJlc3NCb29rUHJvdG9zqgIkR29vZ2xlLlByb3RvYnVmLkV4YW1w", "bGVzLkFkZHJlc3NCb29rYgZwcm90bzM=")); - descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, - new pbd::FileDescriptor[] { + descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbr::FileDescriptor[] { }); internal__static_tutorial_Person__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.Examples.AddressBook.Person), descriptor.MessageTypes[0], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Examples.AddressBook.Person), descriptor.MessageTypes[0], new string[] { "Name", "Id", "Email", "Phone", }, new string[] { }); internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber), descriptor.MessageTypes[0].NestedTypes[0], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber), descriptor.MessageTypes[0].NestedTypes[0], new string[] { "Number", "Type", }, new string[] { }); internal__static_tutorial_AddressBook__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.Examples.AddressBook.AddressBook), descriptor.MessageTypes[1], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Examples.AddressBook.AddressBook), descriptor.MessageTypes[1], new string[] { "Person", }, new string[] { }); } #endregion @@ -59,11 +59,11 @@ namespace Google.Protobuf.Examples.AddressBook { private static readonly string[] _fieldNames = new string[] { "email", "id", "name", "phone" }; private static readonly uint[] _fieldTags = new uint[] { 26, 16, 10, 34 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Examples.AddressBook.Addressbook.Descriptor.MessageTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.Examples.AddressBook.Addressbook.internal__static_tutorial_Person__FieldAccessorTable; } } @@ -258,11 +258,11 @@ namespace Google.Protobuf.Examples.AddressBook { private static readonly string[] _fieldNames = new string[] { "number", "type" }; private static readonly uint[] _fieldTags = new uint[] { 10, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Examples.AddressBook.Person.Descriptor.NestedTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.Examples.AddressBook.Addressbook.internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable; } } @@ -409,11 +409,11 @@ namespace Google.Protobuf.Examples.AddressBook { private static readonly string[] _fieldNames = new string[] { "person" }; private static readonly uint[] _fieldTags = new uint[] { 10 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Examples.AddressBook.Addressbook.Descriptor.MessageTypes[1]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.Examples.AddressBook.Addressbook.internal__static_tutorial_AddressBook__FieldAccessorTable; } } diff --git a/csharp/src/ProtocolBuffers.Test/IssuesTest.cs b/csharp/src/ProtocolBuffers.Test/IssuesTest.cs index d2248158..b5ad34ae 100644 --- a/csharp/src/ProtocolBuffers.Test/IssuesTest.cs +++ b/csharp/src/ProtocolBuffers.Test/IssuesTest.cs @@ -30,7 +30,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
-using Google.Protobuf.Descriptors;
+using Google.Protobuf.Reflection;
using UnitTest.Issues.TestProtos;
using NUnit.Framework;
diff --git a/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj index 269961c7..45c75bae 100644 --- a/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj +++ b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj @@ -81,6 +81,7 @@ <Compile Include="Collections\MapFieldTest.cs" />
<Compile Include="Collections\RepeatedFieldTest.cs" />
<Compile Include="JsonFormatterTest.cs" />
+ <Compile Include="Reflection\DescriptorsTest.cs" />
<Compile Include="SampleEnum.cs" />
<Compile Include="SampleMessages.cs" />
<Compile Include="TestProtos\MapUnittestProto3.cs" />
@@ -89,7 +90,6 @@ <Compile Include="TestProtos\UnittestIssues.cs" />
<Compile Include="TestProtos\UnittestProto3.cs" />
<Compile Include="DeprecatedMemberTest.cs" />
- <Compile Include="DescriptorsTest.cs" />
<Compile Include="IssuesTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestCornerCases.cs" />
diff --git a/csharp/src/ProtocolBuffers.Test/DescriptorsTest.cs b/csharp/src/ProtocolBuffers.Test/Reflection/DescriptorsTest.cs index d5c622bc..0db01a5e 100644 --- a/csharp/src/ProtocolBuffers.Test/DescriptorsTest.cs +++ b/csharp/src/ProtocolBuffers.Test/Reflection/DescriptorsTest.cs @@ -1,225 +1,223 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-using System.Linq;
-using Google.Protobuf.DescriptorProtos;
-using Google.Protobuf.Descriptors;
-using Google.Protobuf.TestProtos;
-using NUnit.Framework;
-
-namespace Google.Protobuf
-{
- /// <summary>
- /// Tests for descriptors. (Not in its own namespace or broken up into individual classes as the
- /// size doesn't warrant it. On the other hand, this makes me feel a bit dirty...)
- /// </summary>
- public class DescriptorsTest
- {
- [Test]
- public void FileDescriptor()
- {
- FileDescriptor file = UnittestProto3.Descriptor;
-
- Assert.AreEqual("google/protobuf/unittest_proto3.proto", file.Name);
- Assert.AreEqual("protobuf_unittest", file.Package);
-
- Assert.AreEqual("UnittestProto", file.Proto.Options.JavaOuterClassname);
- Assert.AreEqual("google/protobuf/unittest_proto3.proto", file.Proto.Name);
-
- // unittest.proto doesn't have any public imports, but unittest_import.proto does.
- Assert.AreEqual(0, file.PublicDependencies.Count);
- Assert.AreEqual(1, UnittestImportProto3.Descriptor.PublicDependencies.Count);
- Assert.AreEqual(UnittestImportPublicProto3.Descriptor, UnittestImportProto3.Descriptor.PublicDependencies[0]);
-
- Assert.AreEqual(1, file.Dependencies.Count);
- Assert.AreEqual(UnittestImportProto3.Descriptor, file.Dependencies[0]);
-
- MessageDescriptor messageType = TestAllTypes.Descriptor;
- Assert.AreEqual(messageType, file.MessageTypes[0]);
- Assert.AreEqual(messageType, file.FindTypeByName<MessageDescriptor>("TestAllTypes"));
- Assert.Null(file.FindTypeByName<MessageDescriptor>("NoSuchType"));
- Assert.Null(file.FindTypeByName<MessageDescriptor>("protobuf_unittest.TestAllTypes"));
- for (int i = 0; i < file.MessageTypes.Count; i++)
- {
- Assert.AreEqual(i, file.MessageTypes[i].Index);
- }
-
- Assert.AreEqual(file.EnumTypes[0], file.FindTypeByName<EnumDescriptor>("ForeignEnum"));
- Assert.Null(file.FindTypeByName<EnumDescriptor>("NoSuchType"));
- Assert.Null(file.FindTypeByName<EnumDescriptor>("protobuf_unittest.ForeignEnum"));
- Assert.AreEqual(1, UnittestImportProto3.Descriptor.EnumTypes.Count);
- Assert.AreEqual("ImportEnum", UnittestImportProto3.Descriptor.EnumTypes[0].Name);
- for (int i = 0; i < file.EnumTypes.Count; i++)
- {
- Assert.AreEqual(i, file.EnumTypes[i].Index);
- }
- }
-
- [Test]
- public void MessageDescriptor()
- {
- MessageDescriptor messageType = TestAllTypes.Descriptor;
- MessageDescriptor nestedType = TestAllTypes.Types.NestedMessage.Descriptor;
-
- Assert.AreEqual("TestAllTypes", messageType.Name);
- Assert.AreEqual("protobuf_unittest.TestAllTypes", messageType.FullName);
- Assert.AreEqual(UnittestProto3.Descriptor, messageType.File);
- Assert.IsNull(messageType.ContainingType);
- Assert.IsNull(messageType.Proto.Options);
-
- Assert.AreEqual("TestAllTypes", messageType.Name);
-
- Assert.AreEqual("NestedMessage", nestedType.Name);
- Assert.AreEqual("protobuf_unittest.TestAllTypes.NestedMessage", nestedType.FullName);
- Assert.AreEqual(UnittestProto3.Descriptor, nestedType.File);
- Assert.AreEqual(messageType, nestedType.ContainingType);
-
- FieldDescriptor field = messageType.Fields[0];
- Assert.AreEqual("single_int32", field.Name);
- Assert.AreEqual(field, messageType.FindDescriptor<FieldDescriptor>("single_int32"));
- Assert.Null(messageType.FindDescriptor<FieldDescriptor>("no_such_field"));
- Assert.AreEqual(field, messageType.FindFieldByNumber(1));
- Assert.Null(messageType.FindFieldByNumber(571283));
- for (int i = 0; i < messageType.Fields.Count; i++)
- {
- Assert.AreEqual(i, messageType.Fields[i].Index);
- }
-
- Assert.AreEqual(nestedType, messageType.NestedTypes[0]);
- Assert.AreEqual(nestedType, messageType.FindDescriptor<MessageDescriptor>("NestedMessage"));
- Assert.Null(messageType.FindDescriptor<MessageDescriptor>("NoSuchType"));
- for (int i = 0; i < messageType.NestedTypes.Count; i++)
- {
- Assert.AreEqual(i, messageType.NestedTypes[i].Index);
- }
-
- Assert.AreEqual(messageType.EnumTypes[0], messageType.FindDescriptor<EnumDescriptor>("NestedEnum"));
- Assert.Null(messageType.FindDescriptor<EnumDescriptor>("NoSuchType"));
- for (int i = 0; i < messageType.EnumTypes.Count; i++)
- {
- Assert.AreEqual(i, messageType.EnumTypes[i].Index);
- }
- }
-
- [Test]
- public void FieldDescriptor()
- {
- MessageDescriptor messageType = TestAllTypes.Descriptor;
- FieldDescriptor primitiveField = messageType.FindDescriptor<FieldDescriptor>("single_int32");
- FieldDescriptor enumField = messageType.FindDescriptor<FieldDescriptor>("single_nested_enum");
- FieldDescriptor messageField = messageType.FindDescriptor<FieldDescriptor>("single_foreign_message");
-
- Assert.AreEqual("single_int32", primitiveField.Name);
- Assert.AreEqual("protobuf_unittest.TestAllTypes.single_int32",
- primitiveField.FullName);
- Assert.AreEqual(1, primitiveField.FieldNumber);
- Assert.AreEqual(messageType, primitiveField.ContainingType);
- Assert.AreEqual(UnittestProto3.Descriptor, primitiveField.File);
- Assert.AreEqual(FieldType.Int32, primitiveField.FieldType);
- Assert.IsNull(primitiveField.Proto.Options);
-
- Assert.AreEqual("single_nested_enum", enumField.Name);
- Assert.AreEqual(FieldType.Enum, enumField.FieldType);
- // Assert.AreEqual(TestAllTypes.Types.NestedEnum.DescriptorProtoFile, enumField.EnumType);
-
- Assert.AreEqual("single_foreign_message", messageField.Name);
- Assert.AreEqual(FieldType.Message, messageField.FieldType);
- Assert.AreEqual(ForeignMessage.Descriptor, messageField.MessageType);
- }
-
- [Test]
- public void FieldDescriptorLabel()
- {
- FieldDescriptor singleField =
- TestAllTypes.Descriptor.FindDescriptor<FieldDescriptor>("single_int32");
- FieldDescriptor repeatedField =
- TestAllTypes.Descriptor.FindDescriptor<FieldDescriptor>("repeated_int32");
-
- Assert.IsFalse(singleField.IsRepeated);
- Assert.IsTrue(repeatedField.IsRepeated);
- }
-
- [Test]
- public void EnumDescriptor()
- {
- // Note: this test is a bit different to the Java version because there's no static way of getting to the descriptor
- EnumDescriptor enumType = UnittestProto3.Descriptor.FindTypeByName<EnumDescriptor>("ForeignEnum");
- EnumDescriptor nestedType = TestAllTypes.Descriptor.FindDescriptor<EnumDescriptor>("NestedEnum");
-
- Assert.AreEqual("ForeignEnum", enumType.Name);
- Assert.AreEqual("protobuf_unittest.ForeignEnum", enumType.FullName);
- Assert.AreEqual(UnittestProto3.Descriptor, enumType.File);
- Assert.Null(enumType.ContainingType);
- Assert.Null(enumType.Proto.Options);
-
- Assert.AreEqual("NestedEnum", nestedType.Name);
- Assert.AreEqual("protobuf_unittest.TestAllTypes.NestedEnum",
- nestedType.FullName);
- Assert.AreEqual(UnittestProto3.Descriptor, nestedType.File);
- Assert.AreEqual(TestAllTypes.Descriptor, nestedType.ContainingType);
-
- EnumValueDescriptor value = enumType.FindValueByName("FOREIGN_FOO");
- Assert.AreEqual(value, enumType.Values[1]);
- Assert.AreEqual("FOREIGN_FOO", value.Name);
- Assert.AreEqual(4, value.Number);
- Assert.AreEqual((int) ForeignEnum.FOREIGN_FOO, value.Number);
- Assert.AreEqual(value, enumType.FindValueByNumber(4));
- Assert.Null(enumType.FindValueByName("NO_SUCH_VALUE"));
- for (int i = 0; i < enumType.Values.Count; i++)
- {
- Assert.AreEqual(i, enumType.Values[i].Index);
- }
- }
-
- [Test]
- public void OneofDescriptor()
- {
- OneofDescriptor descriptor = TestAllTypes.Descriptor.FindDescriptor<OneofDescriptor>("oneof_field");
- Assert.AreEqual("oneof_field", descriptor.Name);
- Assert.AreEqual("protobuf_unittest.TestAllTypes.oneof_field", descriptor.FullName);
-
- var expectedFields = new[] {
- TestAllTypes.OneofBytesFieldNumber,
- TestAllTypes.OneofNestedMessageFieldNumber,
- TestAllTypes.OneofStringFieldNumber,
- TestAllTypes.OneofUint32FieldNumber }
- .Select(fieldNumber => TestAllTypes.Descriptor.FindFieldByNumber(fieldNumber))
- .ToList();
- foreach (var field in expectedFields)
- {
- Assert.AreSame(descriptor, field.ContainingOneof);
- }
-
- CollectionAssert.AreEquivalent(expectedFields, descriptor.Fields);
- }
- }
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System.Linq; +using Google.Protobuf.TestProtos; +using NUnit.Framework; + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// Tests for descriptors. (Not in its own namespace or broken up into individual classes as the + /// size doesn't warrant it. On the other hand, this makes me feel a bit dirty...) + /// </summary> + public class DescriptorsTest + { + [Test] + public void FileDescriptor() + { + FileDescriptor file = UnittestProto3.Descriptor; + + Assert.AreEqual("google/protobuf/unittest_proto3.proto", file.Name); + Assert.AreEqual("protobuf_unittest", file.Package); + + Assert.AreEqual("UnittestProto", file.Proto.Options.JavaOuterClassname); + Assert.AreEqual("google/protobuf/unittest_proto3.proto", file.Proto.Name); + + // unittest.proto doesn't have any public imports, but unittest_import.proto does. + Assert.AreEqual(0, file.PublicDependencies.Count); + Assert.AreEqual(1, UnittestImportProto3.Descriptor.PublicDependencies.Count); + Assert.AreEqual(UnittestImportPublicProto3.Descriptor, UnittestImportProto3.Descriptor.PublicDependencies[0]); + + Assert.AreEqual(1, file.Dependencies.Count); + Assert.AreEqual(UnittestImportProto3.Descriptor, file.Dependencies[0]); + + MessageDescriptor messageType = TestAllTypes.Descriptor; + Assert.AreEqual(messageType, file.MessageTypes[0]); + Assert.AreEqual(messageType, file.FindTypeByName<MessageDescriptor>("TestAllTypes")); + Assert.Null(file.FindTypeByName<MessageDescriptor>("NoSuchType")); + Assert.Null(file.FindTypeByName<MessageDescriptor>("protobuf_unittest.TestAllTypes")); + for (int i = 0; i < file.MessageTypes.Count; i++) + { + Assert.AreEqual(i, file.MessageTypes[i].Index); + } + + Assert.AreEqual(file.EnumTypes[0], file.FindTypeByName<EnumDescriptor>("ForeignEnum")); + Assert.Null(file.FindTypeByName<EnumDescriptor>("NoSuchType")); + Assert.Null(file.FindTypeByName<EnumDescriptor>("protobuf_unittest.ForeignEnum")); + Assert.AreEqual(1, UnittestImportProto3.Descriptor.EnumTypes.Count); + Assert.AreEqual("ImportEnum", UnittestImportProto3.Descriptor.EnumTypes[0].Name); + for (int i = 0; i < file.EnumTypes.Count; i++) + { + Assert.AreEqual(i, file.EnumTypes[i].Index); + } + } + + [Test] + public void MessageDescriptor() + { + MessageDescriptor messageType = TestAllTypes.Descriptor; + MessageDescriptor nestedType = TestAllTypes.Types.NestedMessage.Descriptor; + + Assert.AreEqual("TestAllTypes", messageType.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes", messageType.FullName); + Assert.AreEqual(UnittestProto3.Descriptor, messageType.File); + Assert.IsNull(messageType.ContainingType); + Assert.IsNull(messageType.Proto.Options); + + Assert.AreEqual("TestAllTypes", messageType.Name); + + Assert.AreEqual("NestedMessage", nestedType.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes.NestedMessage", nestedType.FullName); + Assert.AreEqual(UnittestProto3.Descriptor, nestedType.File); + Assert.AreEqual(messageType, nestedType.ContainingType); + + FieldDescriptor field = messageType.Fields[0]; + Assert.AreEqual("single_int32", field.Name); + Assert.AreEqual(field, messageType.FindDescriptor<FieldDescriptor>("single_int32")); + Assert.Null(messageType.FindDescriptor<FieldDescriptor>("no_such_field")); + Assert.AreEqual(field, messageType.FindFieldByNumber(1)); + Assert.Null(messageType.FindFieldByNumber(571283)); + for (int i = 0; i < messageType.Fields.Count; i++) + { + Assert.AreEqual(i, messageType.Fields[i].Index); + } + + Assert.AreEqual(nestedType, messageType.NestedTypes[0]); + Assert.AreEqual(nestedType, messageType.FindDescriptor<MessageDescriptor>("NestedMessage")); + Assert.Null(messageType.FindDescriptor<MessageDescriptor>("NoSuchType")); + for (int i = 0; i < messageType.NestedTypes.Count; i++) + { + Assert.AreEqual(i, messageType.NestedTypes[i].Index); + } + + Assert.AreEqual(messageType.EnumTypes[0], messageType.FindDescriptor<EnumDescriptor>("NestedEnum")); + Assert.Null(messageType.FindDescriptor<EnumDescriptor>("NoSuchType")); + for (int i = 0; i < messageType.EnumTypes.Count; i++) + { + Assert.AreEqual(i, messageType.EnumTypes[i].Index); + } + } + + [Test] + public void FieldDescriptor() + { + MessageDescriptor messageType = TestAllTypes.Descriptor; + FieldDescriptor primitiveField = messageType.FindDescriptor<FieldDescriptor>("single_int32"); + FieldDescriptor enumField = messageType.FindDescriptor<FieldDescriptor>("single_nested_enum"); + FieldDescriptor messageField = messageType.FindDescriptor<FieldDescriptor>("single_foreign_message"); + + Assert.AreEqual("single_int32", primitiveField.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes.single_int32", + primitiveField.FullName); + Assert.AreEqual(1, primitiveField.FieldNumber); + Assert.AreEqual(messageType, primitiveField.ContainingType); + Assert.AreEqual(UnittestProto3.Descriptor, primitiveField.File); + Assert.AreEqual(FieldType.Int32, primitiveField.FieldType); + Assert.IsNull(primitiveField.Proto.Options); + + Assert.AreEqual("single_nested_enum", enumField.Name); + Assert.AreEqual(FieldType.Enum, enumField.FieldType); + // Assert.AreEqual(TestAllTypes.Types.NestedEnum.DescriptorProtoFile, enumField.EnumType); + + Assert.AreEqual("single_foreign_message", messageField.Name); + Assert.AreEqual(FieldType.Message, messageField.FieldType); + Assert.AreEqual(ForeignMessage.Descriptor, messageField.MessageType); + } + + [Test] + public void FieldDescriptorLabel() + { + FieldDescriptor singleField = + TestAllTypes.Descriptor.FindDescriptor<FieldDescriptor>("single_int32"); + FieldDescriptor repeatedField = + TestAllTypes.Descriptor.FindDescriptor<FieldDescriptor>("repeated_int32"); + + Assert.IsFalse(singleField.IsRepeated); + Assert.IsTrue(repeatedField.IsRepeated); + } + + [Test] + public void EnumDescriptor() + { + // Note: this test is a bit different to the Java version because there's no static way of getting to the descriptor + EnumDescriptor enumType = UnittestProto3.Descriptor.FindTypeByName<EnumDescriptor>("ForeignEnum"); + EnumDescriptor nestedType = TestAllTypes.Descriptor.FindDescriptor<EnumDescriptor>("NestedEnum"); + + Assert.AreEqual("ForeignEnum", enumType.Name); + Assert.AreEqual("protobuf_unittest.ForeignEnum", enumType.FullName); + Assert.AreEqual(UnittestProto3.Descriptor, enumType.File); + Assert.Null(enumType.ContainingType); + Assert.Null(enumType.Proto.Options); + + Assert.AreEqual("NestedEnum", nestedType.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes.NestedEnum", + nestedType.FullName); + Assert.AreEqual(UnittestProto3.Descriptor, nestedType.File); + Assert.AreEqual(TestAllTypes.Descriptor, nestedType.ContainingType); + + EnumValueDescriptor value = enumType.FindValueByName("FOREIGN_FOO"); + Assert.AreEqual(value, enumType.Values[1]); + Assert.AreEqual("FOREIGN_FOO", value.Name); + Assert.AreEqual(4, value.Number); + Assert.AreEqual((int) ForeignEnum.FOREIGN_FOO, value.Number); + Assert.AreEqual(value, enumType.FindValueByNumber(4)); + Assert.Null(enumType.FindValueByName("NO_SUCH_VALUE")); + for (int i = 0; i < enumType.Values.Count; i++) + { + Assert.AreEqual(i, enumType.Values[i].Index); + } + } + + [Test] + public void OneofDescriptor() + { + OneofDescriptor descriptor = TestAllTypes.Descriptor.FindDescriptor<OneofDescriptor>("oneof_field"); + Assert.AreEqual("oneof_field", descriptor.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes.oneof_field", descriptor.FullName); + + var expectedFields = new[] { + TestAllTypes.OneofBytesFieldNumber, + TestAllTypes.OneofNestedMessageFieldNumber, + TestAllTypes.OneofStringFieldNumber, + TestAllTypes.OneofUint32FieldNumber } + .Select(fieldNumber => TestAllTypes.Descriptor.FindFieldByNumber(fieldNumber)) + .ToList(); + foreach (var field in expectedFields) + { + Assert.AreSame(descriptor, field.ContainingOneof); + } + + CollectionAssert.AreEquivalent(expectedFields, descriptor.Fields); + } + } }
\ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/MapUnittestProto3.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/MapUnittestProto3.cs index 05fe7fc4..38bb13c7 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/MapUnittestProto3.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/MapUnittestProto3.cs @@ -5,7 +5,7 @@ using pb = global::Google.Protobuf; using pbc = global::Google.Protobuf.Collections; -using pbd = global::Google.Protobuf.Descriptors; +using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace Google.Protobuf.TestProtos { @@ -13,56 +13,56 @@ namespace Google.Protobuf.TestProtos { public static partial class MapUnittestProto3 { #region Static variables - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMap__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapInt32Int32Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapInt64Int64Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapUint32Uint32Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapUint64Uint64Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapSint32Sint32Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapSint64Sint64Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapFixed32Fixed32Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapFixed64Fixed64Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapSfixed32Sfixed32Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapSfixed64Sfixed64Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapInt32FloatEntry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapInt32DoubleEntry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapBoolBoolEntry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapStringStringEntry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapInt32BytesEntry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapInt32EnumEntry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapInt32ForeignMessageEntry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMapSubmessage__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMessageMap__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMessageMap_MapInt32MessageEntry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestSameTypeMap__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestSameTypeMap_Map1Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestSameTypeMap_Map2Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapInt32Int32Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapInt64Int64Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapUint32Uint32Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapUint64Uint64Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapSint32Sint32Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapSint64Sint64Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapFixed32Fixed32Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapFixed64Fixed64Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapSfixed32Sfixed32Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapSfixed64Sfixed64Entry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapInt32FloatEntry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapInt32DoubleEntry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapBoolBoolEntry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapInt32EnumEntry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapInt32ForeignMessageEntry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_MessageContainingEnumCalledType__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_MessageContainingEnumCalledType_TypeEntry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_MessageContainingMapCalledEntry__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_MessageContainingMapCalledEntry_EntryEntry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMap__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapInt32Int32Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapInt64Int64Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapUint32Uint32Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapUint64Uint64Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapSint32Sint32Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapSint64Sint64Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapFixed32Fixed32Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapFixed64Fixed64Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapSfixed32Sfixed32Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapSfixed64Sfixed64Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapInt32FloatEntry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapInt32DoubleEntry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapBoolBoolEntry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapStringStringEntry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapInt32BytesEntry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapInt32EnumEntry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMap_MapInt32ForeignMessageEntry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMapSubmessage__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMessageMap__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMessageMap_MapInt32MessageEntry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestSameTypeMap__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestSameTypeMap_Map1Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestSameTypeMap_Map2Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapInt32Int32Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapInt64Int64Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapUint32Uint32Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapUint64Uint64Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapSint32Sint32Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapSint64Sint64Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapFixed32Fixed32Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapFixed64Fixed64Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapSfixed32Sfixed32Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapSfixed64Sfixed64Entry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapInt32FloatEntry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapInt32DoubleEntry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapBoolBoolEntry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapInt32EnumEntry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestArenaMap_MapInt32ForeignMessageEntry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_MessageContainingEnumCalledType__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_MessageContainingEnumCalledType_TypeEntry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_MessageContainingMapCalledEntry__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_MessageContainingMapCalledEntry_EntryEntry__FieldAccessorTable; #endregion #region Descriptor - public static pbd::FileDescriptor Descriptor { + public static pbr::FileDescriptor Descriptor { get { return descriptor; } } - private static pbd::FileDescriptor descriptor; + private static pbr::FileDescriptor descriptor; static MapUnittestProto3() { byte[] descriptorData = global::System.Convert.FromBase64String( @@ -191,141 +191,141 @@ namespace Google.Protobuf.TestProtos { "dmFsdWUYAiABKAU6AjgBKj8KB01hcEVudW0SEAoMTUFQX0VOVU1fRk9PEAAS", "EAoMTUFQX0VOVU1fQkFSEAESEAoMTUFQX0VOVU1fQkFaEAJCIPgBAaoCGkdv", "b2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zYgZwcm90bzM=")); - descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, - new pbd::FileDescriptor[] { + descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor, }); internal__static_protobuf_unittest_TestMap__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap), descriptor.MessageTypes[0], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap), descriptor.MessageTypes[0], new string[] { "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapStringString", "MapInt32Bytes", "MapInt32Enum", "MapInt32ForeignMessage", }, new string[] { }); internal__static_protobuf_unittest_TestMap_MapInt32Int32Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapInt32Int32Entry), descriptor.MessageTypes[0].NestedTypes[0], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapInt32Int32Entry), descriptor.MessageTypes[0].NestedTypes[0], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestMap_MapInt64Int64Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapInt64Int64Entry), descriptor.MessageTypes[0].NestedTypes[1], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapInt64Int64Entry), descriptor.MessageTypes[0].NestedTypes[1], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestMap_MapUint32Uint32Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapUint32Uint32Entry), descriptor.MessageTypes[0].NestedTypes[2], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapUint32Uint32Entry), descriptor.MessageTypes[0].NestedTypes[2], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestMap_MapUint64Uint64Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapUint64Uint64Entry), descriptor.MessageTypes[0].NestedTypes[3], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapUint64Uint64Entry), descriptor.MessageTypes[0].NestedTypes[3], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestMap_MapSint32Sint32Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapSint32Sint32Entry), descriptor.MessageTypes[0].NestedTypes[4], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapSint32Sint32Entry), descriptor.MessageTypes[0].NestedTypes[4], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestMap_MapSint64Sint64Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapSint64Sint64Entry), descriptor.MessageTypes[0].NestedTypes[5], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapSint64Sint64Entry), descriptor.MessageTypes[0].NestedTypes[5], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestMap_MapFixed32Fixed32Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapFixed32Fixed32Entry), descriptor.MessageTypes[0].NestedTypes[6], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapFixed32Fixed32Entry), descriptor.MessageTypes[0].NestedTypes[6], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestMap_MapFixed64Fixed64Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapFixed64Fixed64Entry), descriptor.MessageTypes[0].NestedTypes[7], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapFixed64Fixed64Entry), descriptor.MessageTypes[0].NestedTypes[7], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestMap_MapSfixed32Sfixed32Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapSfixed32Sfixed32Entry), descriptor.MessageTypes[0].NestedTypes[8], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapSfixed32Sfixed32Entry), descriptor.MessageTypes[0].NestedTypes[8], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestMap_MapSfixed64Sfixed64Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapSfixed64Sfixed64Entry), descriptor.MessageTypes[0].NestedTypes[9], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapSfixed64Sfixed64Entry), descriptor.MessageTypes[0].NestedTypes[9], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestMap_MapInt32FloatEntry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapInt32FloatEntry), descriptor.MessageTypes[0].NestedTypes[10], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapInt32FloatEntry), descriptor.MessageTypes[0].NestedTypes[10], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestMap_MapInt32DoubleEntry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapInt32DoubleEntry), descriptor.MessageTypes[0].NestedTypes[11], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapInt32DoubleEntry), descriptor.MessageTypes[0].NestedTypes[11], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestMap_MapBoolBoolEntry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapBoolBoolEntry), descriptor.MessageTypes[0].NestedTypes[12], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapBoolBoolEntry), descriptor.MessageTypes[0].NestedTypes[12], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestMap_MapStringStringEntry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapStringStringEntry), descriptor.MessageTypes[0].NestedTypes[13], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapStringStringEntry), descriptor.MessageTypes[0].NestedTypes[13], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestMap_MapInt32BytesEntry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapInt32BytesEntry), descriptor.MessageTypes[0].NestedTypes[14], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapInt32BytesEntry), descriptor.MessageTypes[0].NestedTypes[14], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestMap_MapInt32EnumEntry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapInt32EnumEntry), descriptor.MessageTypes[0].NestedTypes[15], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapInt32EnumEntry), descriptor.MessageTypes[0].NestedTypes[15], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestMap_MapInt32ForeignMessageEntry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapInt32ForeignMessageEntry), descriptor.MessageTypes[0].NestedTypes[16], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMap.Types.MapInt32ForeignMessageEntry), descriptor.MessageTypes[0].NestedTypes[16], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestMapSubmessage__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMapSubmessage), descriptor.MessageTypes[1], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMapSubmessage), descriptor.MessageTypes[1], new string[] { "TestMap", }, new string[] { }); internal__static_protobuf_unittest_TestMessageMap__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMessageMap), descriptor.MessageTypes[2], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMessageMap), descriptor.MessageTypes[2], new string[] { "MapInt32Message", }, new string[] { }); internal__static_protobuf_unittest_TestMessageMap_MapInt32MessageEntry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMessageMap.Types.MapInt32MessageEntry), descriptor.MessageTypes[2].NestedTypes[0], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMessageMap.Types.MapInt32MessageEntry), descriptor.MessageTypes[2].NestedTypes[0], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestSameTypeMap__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestSameTypeMap), descriptor.MessageTypes[3], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestSameTypeMap), descriptor.MessageTypes[3], new string[] { "Map1", "Map2", }, new string[] { }); internal__static_protobuf_unittest_TestSameTypeMap_Map1Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestSameTypeMap.Types.Map1Entry), descriptor.MessageTypes[3].NestedTypes[0], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestSameTypeMap.Types.Map1Entry), descriptor.MessageTypes[3].NestedTypes[0], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestSameTypeMap_Map2Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestSameTypeMap.Types.Map2Entry), descriptor.MessageTypes[3].NestedTypes[1], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestSameTypeMap.Types.Map2Entry), descriptor.MessageTypes[3].NestedTypes[1], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestArenaMap__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap), descriptor.MessageTypes[4], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap), descriptor.MessageTypes[4], new string[] { "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapInt32Enum", "MapInt32ForeignMessage", }, new string[] { }); internal__static_protobuf_unittest_TestArenaMap_MapInt32Int32Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapInt32Int32Entry), descriptor.MessageTypes[4].NestedTypes[0], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapInt32Int32Entry), descriptor.MessageTypes[4].NestedTypes[0], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestArenaMap_MapInt64Int64Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapInt64Int64Entry), descriptor.MessageTypes[4].NestedTypes[1], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapInt64Int64Entry), descriptor.MessageTypes[4].NestedTypes[1], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestArenaMap_MapUint32Uint32Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapUint32Uint32Entry), descriptor.MessageTypes[4].NestedTypes[2], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapUint32Uint32Entry), descriptor.MessageTypes[4].NestedTypes[2], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestArenaMap_MapUint64Uint64Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapUint64Uint64Entry), descriptor.MessageTypes[4].NestedTypes[3], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapUint64Uint64Entry), descriptor.MessageTypes[4].NestedTypes[3], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestArenaMap_MapSint32Sint32Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapSint32Sint32Entry), descriptor.MessageTypes[4].NestedTypes[4], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapSint32Sint32Entry), descriptor.MessageTypes[4].NestedTypes[4], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestArenaMap_MapSint64Sint64Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapSint64Sint64Entry), descriptor.MessageTypes[4].NestedTypes[5], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapSint64Sint64Entry), descriptor.MessageTypes[4].NestedTypes[5], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestArenaMap_MapFixed32Fixed32Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapFixed32Fixed32Entry), descriptor.MessageTypes[4].NestedTypes[6], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapFixed32Fixed32Entry), descriptor.MessageTypes[4].NestedTypes[6], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestArenaMap_MapFixed64Fixed64Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapFixed64Fixed64Entry), descriptor.MessageTypes[4].NestedTypes[7], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapFixed64Fixed64Entry), descriptor.MessageTypes[4].NestedTypes[7], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestArenaMap_MapSfixed32Sfixed32Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapSfixed32Sfixed32Entry), descriptor.MessageTypes[4].NestedTypes[8], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapSfixed32Sfixed32Entry), descriptor.MessageTypes[4].NestedTypes[8], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestArenaMap_MapSfixed64Sfixed64Entry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapSfixed64Sfixed64Entry), descriptor.MessageTypes[4].NestedTypes[9], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapSfixed64Sfixed64Entry), descriptor.MessageTypes[4].NestedTypes[9], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestArenaMap_MapInt32FloatEntry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapInt32FloatEntry), descriptor.MessageTypes[4].NestedTypes[10], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapInt32FloatEntry), descriptor.MessageTypes[4].NestedTypes[10], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestArenaMap_MapInt32DoubleEntry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapInt32DoubleEntry), descriptor.MessageTypes[4].NestedTypes[11], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapInt32DoubleEntry), descriptor.MessageTypes[4].NestedTypes[11], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestArenaMap_MapBoolBoolEntry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapBoolBoolEntry), descriptor.MessageTypes[4].NestedTypes[12], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapBoolBoolEntry), descriptor.MessageTypes[4].NestedTypes[12], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestArenaMap_MapInt32EnumEntry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapInt32EnumEntry), descriptor.MessageTypes[4].NestedTypes[13], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapInt32EnumEntry), descriptor.MessageTypes[4].NestedTypes[13], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_TestArenaMap_MapInt32ForeignMessageEntry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapInt32ForeignMessageEntry), descriptor.MessageTypes[4].NestedTypes[14], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestArenaMap.Types.MapInt32ForeignMessageEntry), descriptor.MessageTypes[4].NestedTypes[14], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_MessageContainingEnumCalledType__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType), descriptor.MessageTypes[5], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType), descriptor.MessageTypes[5], new string[] { "Type", }, new string[] { }); internal__static_protobuf_unittest_MessageContainingEnumCalledType_TypeEntry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType.Types.TypeEntry), descriptor.MessageTypes[5].NestedTypes[0], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType.Types.TypeEntry), descriptor.MessageTypes[5].NestedTypes[0], new string[] { "Key", "Value", }, new string[] { }); internal__static_protobuf_unittest_MessageContainingMapCalledEntry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.MessageContainingMapCalledEntry), descriptor.MessageTypes[6], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.MessageContainingMapCalledEntry), descriptor.MessageTypes[6], new string[] { "Entry", }, new string[] { }); internal__static_protobuf_unittest_MessageContainingMapCalledEntry_EntryEntry__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.MessageContainingMapCalledEntry.Types.EntryEntry), descriptor.MessageTypes[6].NestedTypes[0], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.MessageContainingMapCalledEntry.Types.EntryEntry), descriptor.MessageTypes[6].NestedTypes[0], new string[] { "Key", "Value", }, new string[] { }); } #endregion @@ -348,11 +348,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "map_bool_bool", "map_fixed32_fixed32", "map_fixed64_fixed64", "map_int32_bytes", "map_int32_double", "map_int32_enum", "map_int32_float", "map_int32_foreign_message", "map_int32_int32", "map_int64_int64", "map_sfixed32_sfixed32", "map_sfixed64_sfixed64", "map_sint32_sint32", "map_sint64_sint64", "map_string_string", "map_uint32_uint32", "map_uint64_uint64" }; private static readonly uint[] _fieldTags = new uint[] { 106, 58, 66, 122, 98, 130, 90, 138, 10, 18, 74, 82, 42, 50, 114, 26, 34 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.Descriptor.MessageTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMap__FieldAccessorTable; } } @@ -764,11 +764,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestMap.Descriptor.NestedTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMap_MapInt32Int32Entry__FieldAccessorTable; } } @@ -910,11 +910,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestMap.Descriptor.NestedTypes[1]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMap_MapInt64Int64Entry__FieldAccessorTable; } } @@ -1056,11 +1056,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestMap.Descriptor.NestedTypes[2]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMap_MapUint32Uint32Entry__FieldAccessorTable; } } @@ -1202,11 +1202,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestMap.Descriptor.NestedTypes[3]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMap_MapUint64Uint64Entry__FieldAccessorTable; } } @@ -1348,11 +1348,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestMap.Descriptor.NestedTypes[4]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMap_MapSint32Sint32Entry__FieldAccessorTable; } } @@ -1494,11 +1494,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestMap.Descriptor.NestedTypes[5]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMap_MapSint64Sint64Entry__FieldAccessorTable; } } @@ -1640,11 +1640,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 13, 21 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestMap.Descriptor.NestedTypes[6]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMap_MapFixed32Fixed32Entry__FieldAccessorTable; } } @@ -1786,11 +1786,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 9, 17 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestMap.Descriptor.NestedTypes[7]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMap_MapFixed64Fixed64Entry__FieldAccessorTable; } } @@ -1932,11 +1932,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 13, 21 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestMap.Descriptor.NestedTypes[8]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMap_MapSfixed32Sfixed32Entry__FieldAccessorTable; } } @@ -2078,11 +2078,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 9, 17 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestMap.Descriptor.NestedTypes[9]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMap_MapSfixed64Sfixed64Entry__FieldAccessorTable; } } @@ -2224,11 +2224,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 21 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestMap.Descriptor.NestedTypes[10]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMap_MapInt32FloatEntry__FieldAccessorTable; } } @@ -2370,11 +2370,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 17 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestMap.Descriptor.NestedTypes[11]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMap_MapInt32DoubleEntry__FieldAccessorTable; } } @@ -2516,11 +2516,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestMap.Descriptor.NestedTypes[12]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMap_MapBoolBoolEntry__FieldAccessorTable; } } @@ -2662,11 +2662,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 10, 18 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestMap.Descriptor.NestedTypes[13]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMap_MapStringStringEntry__FieldAccessorTable; } } @@ -2808,11 +2808,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 18 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestMap.Descriptor.NestedTypes[14]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMap_MapInt32BytesEntry__FieldAccessorTable; } } @@ -2954,11 +2954,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestMap.Descriptor.NestedTypes[15]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMap_MapInt32EnumEntry__FieldAccessorTable; } } @@ -3100,11 +3100,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 18 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestMap.Descriptor.NestedTypes[16]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMap_MapInt32ForeignMessageEntry__FieldAccessorTable; } } @@ -3258,11 +3258,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "test_map" }; private static readonly uint[] _fieldTags = new uint[] { 10 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.Descriptor.MessageTypes[1]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMapSubmessage__FieldAccessorTable; } } @@ -3384,11 +3384,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "map_int32_message" }; private static readonly uint[] _fieldTags = new uint[] { 10 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.Descriptor.MessageTypes[2]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMessageMap__FieldAccessorTable; } } @@ -3496,11 +3496,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 18 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestMessageMap.Descriptor.NestedTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestMessageMap_MapInt32MessageEntry__FieldAccessorTable; } } @@ -3654,11 +3654,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "map1", "map2" }; private static readonly uint[] _fieldTags = new uint[] { 10, 18 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.Descriptor.MessageTypes[3]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestSameTypeMap__FieldAccessorTable; } } @@ -3785,11 +3785,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestSameTypeMap.Descriptor.NestedTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestSameTypeMap_Map1Entry__FieldAccessorTable; } } @@ -3931,11 +3931,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestSameTypeMap.Descriptor.NestedTypes[1]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestSameTypeMap_Map2Entry__FieldAccessorTable; } } @@ -4082,11 +4082,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "map_bool_bool", "map_fixed32_fixed32", "map_fixed64_fixed64", "map_int32_double", "map_int32_enum", "map_int32_float", "map_int32_foreign_message", "map_int32_int32", "map_int64_int64", "map_sfixed32_sfixed32", "map_sfixed64_sfixed64", "map_sint32_sint32", "map_sint64_sint64", "map_uint32_uint32", "map_uint64_uint64" }; private static readonly uint[] _fieldTags = new uint[] { 106, 58, 66, 98, 114, 90, 122, 10, 18, 74, 82, 42, 50, 26, 34 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.Descriptor.MessageTypes[4]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestArenaMap__FieldAccessorTable; } } @@ -4460,11 +4460,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestArenaMap.Descriptor.NestedTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestArenaMap_MapInt32Int32Entry__FieldAccessorTable; } } @@ -4606,11 +4606,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestArenaMap.Descriptor.NestedTypes[1]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestArenaMap_MapInt64Int64Entry__FieldAccessorTable; } } @@ -4752,11 +4752,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestArenaMap.Descriptor.NestedTypes[2]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestArenaMap_MapUint32Uint32Entry__FieldAccessorTable; } } @@ -4898,11 +4898,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestArenaMap.Descriptor.NestedTypes[3]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestArenaMap_MapUint64Uint64Entry__FieldAccessorTable; } } @@ -5044,11 +5044,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestArenaMap.Descriptor.NestedTypes[4]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestArenaMap_MapSint32Sint32Entry__FieldAccessorTable; } } @@ -5190,11 +5190,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestArenaMap.Descriptor.NestedTypes[5]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestArenaMap_MapSint64Sint64Entry__FieldAccessorTable; } } @@ -5336,11 +5336,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 13, 21 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestArenaMap.Descriptor.NestedTypes[6]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestArenaMap_MapFixed32Fixed32Entry__FieldAccessorTable; } } @@ -5482,11 +5482,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 9, 17 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestArenaMap.Descriptor.NestedTypes[7]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestArenaMap_MapFixed64Fixed64Entry__FieldAccessorTable; } } @@ -5628,11 +5628,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 13, 21 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestArenaMap.Descriptor.NestedTypes[8]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestArenaMap_MapSfixed32Sfixed32Entry__FieldAccessorTable; } } @@ -5774,11 +5774,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 9, 17 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestArenaMap.Descriptor.NestedTypes[9]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestArenaMap_MapSfixed64Sfixed64Entry__FieldAccessorTable; } } @@ -5920,11 +5920,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 21 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestArenaMap.Descriptor.NestedTypes[10]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestArenaMap_MapInt32FloatEntry__FieldAccessorTable; } } @@ -6066,11 +6066,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 17 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestArenaMap.Descriptor.NestedTypes[11]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestArenaMap_MapInt32DoubleEntry__FieldAccessorTable; } } @@ -6212,11 +6212,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestArenaMap.Descriptor.NestedTypes[12]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestArenaMap_MapBoolBoolEntry__FieldAccessorTable; } } @@ -6358,11 +6358,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestArenaMap.Descriptor.NestedTypes[13]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestArenaMap_MapInt32EnumEntry__FieldAccessorTable; } } @@ -6504,11 +6504,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 18 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestArenaMap.Descriptor.NestedTypes[14]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_TestArenaMap_MapInt32ForeignMessageEntry__FieldAccessorTable; } } @@ -6662,11 +6662,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "type" }; private static readonly uint[] _fieldTags = new uint[] { 10 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.Descriptor.MessageTypes[5]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_MessageContainingEnumCalledType__FieldAccessorTable; } } @@ -6778,11 +6778,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 18 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType.Descriptor.NestedTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_MessageContainingEnumCalledType_TypeEntry__FieldAccessorTable; } } @@ -6936,11 +6936,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "entry" }; private static readonly uint[] _fieldTags = new uint[] { 10 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.Descriptor.MessageTypes[6]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_MessageContainingMapCalledEntry__FieldAccessorTable; } } @@ -7048,11 +7048,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "key", "value" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.MessageContainingMapCalledEntry.Descriptor.NestedTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3.internal__static_protobuf_unittest_MessageContainingMapCalledEntry_EntryEntry__FieldAccessorTable; } } diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportProto3.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportProto3.cs index 3cc5949b..3aa34047 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportProto3.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportProto3.cs @@ -5,7 +5,7 @@ using pb = global::Google.Protobuf; using pbc = global::Google.Protobuf.Collections; -using pbd = global::Google.Protobuf.Descriptors; +using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace Google.Protobuf.TestProtos { @@ -13,13 +13,13 @@ namespace Google.Protobuf.TestProtos { public static partial class UnittestImportProto3 { #region Static variables - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable; #endregion #region Descriptor - public static pbd::FileDescriptor Descriptor { + public static pbr::FileDescriptor Descriptor { get { return descriptor; } } - private static pbd::FileDescriptor descriptor; + private static pbr::FileDescriptor descriptor; static UnittestImportProto3() { byte[] descriptorData = global::System.Convert.FromBase64String( @@ -32,12 +32,12 @@ namespace Google.Protobuf.TestProtos { "UhAIEg4KCklNUE9SVF9CQVoQCUI8Chhjb20uZ29vZ2xlLnByb3RvYnVmLnRl", "c3RIAfgBAaoCGkdvb2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zUABiBnByb3Rv", "Mw==")); - descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, - new pbd::FileDescriptor[] { + descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestImportPublicProto3.Descriptor, }); internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.ImportMessage), descriptor.MessageTypes[0], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.ImportMessage), descriptor.MessageTypes[0], new string[] { "D", }, new string[] { }); } #endregion @@ -61,11 +61,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "d" }; private static readonly uint[] _fieldTags = new uint[] { 8 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestImportProto3.Descriptor.MessageTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestImportProto3.internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable; } } diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs index d3abe5d5..53657b96 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs @@ -5,7 +5,7 @@ using pb = global::Google.Protobuf; using pbc = global::Google.Protobuf.Collections; -using pbd = global::Google.Protobuf.Descriptors; +using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace Google.Protobuf.TestProtos { @@ -13,13 +13,13 @@ namespace Google.Protobuf.TestProtos { public static partial class UnittestImportPublicProto3 { #region Static variables - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_import_PublicImportMessage__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_import_PublicImportMessage__FieldAccessorTable; #endregion #region Descriptor - public static pbd::FileDescriptor Descriptor { + public static pbr::FileDescriptor Descriptor { get { return descriptor; } } - private static pbd::FileDescriptor descriptor; + private static pbr::FileDescriptor descriptor; static UnittestImportPublicProto3() { byte[] descriptorData = global::System.Convert.FromBase64String( @@ -28,11 +28,11 @@ namespace Google.Protobuf.TestProtos { "bzMucHJvdG8SGHByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydCIgChNQdWJsaWNJ", "bXBvcnRNZXNzYWdlEgkKAWUYASABKAVCNwoYY29tLmdvb2dsZS5wcm90b2J1", "Zi50ZXN0qgIaR29vZ2xlLlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3RvMw==")); - descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, - new pbd::FileDescriptor[] { + descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbr::FileDescriptor[] { }); internal__static_protobuf_unittest_import_PublicImportMessage__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.PublicImportMessage), descriptor.MessageTypes[0], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.PublicImportMessage), descriptor.MessageTypes[0], new string[] { "E", }, new string[] { }); } #endregion @@ -46,11 +46,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "e" }; private static readonly uint[] _fieldTags = new uint[] { 8 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestImportPublicProto3.Descriptor.MessageTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestImportPublicProto3.internal__static_protobuf_unittest_import_PublicImportMessage__FieldAccessorTable; } } diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestIssues.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestIssues.cs index c296cd24..5c56d180 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestIssues.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestIssues.cs @@ -5,7 +5,7 @@ using pb = global::Google.Protobuf; using pbc = global::Google.Protobuf.Collections; -using pbd = global::Google.Protobuf.Descriptors; +using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace UnitTest.Issues.TestProtos { @@ -13,19 +13,19 @@ namespace UnitTest.Issues.TestProtos { public static partial class UnittestIssues { #region Static variables - internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_Issue307__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_Issue307_NestedOnce__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_Issue307_NestedOnce_NestedTwice__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_NegativeEnumMessage__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_DeprecatedChild__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_DeprecatedFieldsMessage__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_ItemField__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_unittest_issues_Issue307__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_unittest_issues_Issue307_NestedOnce__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_unittest_issues_Issue307_NestedOnce_NestedTwice__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_unittest_issues_NegativeEnumMessage__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_unittest_issues_DeprecatedChild__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_unittest_issues_DeprecatedFieldsMessage__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_unittest_issues_ItemField__FieldAccessorTable; #endregion #region Descriptor - public static pbd::FileDescriptor Descriptor { + public static pbr::FileDescriptor Descriptor { get { return descriptor; } } - private static pbd::FileDescriptor descriptor; + private static pbr::FileDescriptor descriptor; static UnittestIssues() { byte[] descriptorData = global::System.Convert.FromBase64String( @@ -48,29 +48,29 @@ namespace UnitTest.Issues.TestProtos { "EPv//////////wESFQoITWludXNPbmUQ////////////ASouCg5EZXByZWNh", "dGVkRW51bRITCg9ERVBSRUNBVEVEX1pFUk8QABIHCgNvbmUQAUIfSAGqAhpV", "bml0VGVzdC5Jc3N1ZXMuVGVzdFByb3Rvc2IGcHJvdG8z")); - descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, - new pbd::FileDescriptor[] { + descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbr::FileDescriptor[] { }); internal__static_unittest_issues_Issue307__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::UnitTest.Issues.TestProtos.Issue307), descriptor.MessageTypes[0], + new pbr::FieldAccessorTable(typeof(global::UnitTest.Issues.TestProtos.Issue307), descriptor.MessageTypes[0], new string[] { }, new string[] { }); internal__static_unittest_issues_Issue307_NestedOnce__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce), descriptor.MessageTypes[0].NestedTypes[0], + new pbr::FieldAccessorTable(typeof(global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce), descriptor.MessageTypes[0].NestedTypes[0], new string[] { }, new string[] { }); internal__static_unittest_issues_Issue307_NestedOnce_NestedTwice__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce.Types.NestedTwice), descriptor.MessageTypes[0].NestedTypes[0].NestedTypes[0], + new pbr::FieldAccessorTable(typeof(global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce.Types.NestedTwice), descriptor.MessageTypes[0].NestedTypes[0].NestedTypes[0], new string[] { }, new string[] { }); internal__static_unittest_issues_NegativeEnumMessage__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::UnitTest.Issues.TestProtos.NegativeEnumMessage), descriptor.MessageTypes[1], + new pbr::FieldAccessorTable(typeof(global::UnitTest.Issues.TestProtos.NegativeEnumMessage), descriptor.MessageTypes[1], new string[] { "Value", "Values", "PackedValues", }, new string[] { }); internal__static_unittest_issues_DeprecatedChild__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::UnitTest.Issues.TestProtos.DeprecatedChild), descriptor.MessageTypes[2], + new pbr::FieldAccessorTable(typeof(global::UnitTest.Issues.TestProtos.DeprecatedChild), descriptor.MessageTypes[2], new string[] { }, new string[] { }); internal__static_unittest_issues_DeprecatedFieldsMessage__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage), descriptor.MessageTypes[3], + new pbr::FieldAccessorTable(typeof(global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage), descriptor.MessageTypes[3], new string[] { "PrimitiveValue", "PrimitiveArray", "MessageValue", "MessageArray", "EnumValue", "EnumArray", }, new string[] { }); internal__static_unittest_issues_ItemField__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::UnitTest.Issues.TestProtos.ItemField), descriptor.MessageTypes[4], + new pbr::FieldAccessorTable(typeof(global::UnitTest.Issues.TestProtos.ItemField), descriptor.MessageTypes[4], new string[] { "Item", }, new string[] { }); } #endregion @@ -98,11 +98,11 @@ namespace UnitTest.Issues.TestProtos { private static readonly string[] _fieldNames = new string[] { }; private static readonly uint[] _fieldTags = new uint[] { }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::UnitTest.Issues.TestProtos.UnittestIssues.Descriptor.MessageTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::UnitTest.Issues.TestProtos.UnittestIssues.internal__static_unittest_issues_Issue307__FieldAccessorTable; } } @@ -191,11 +191,11 @@ namespace UnitTest.Issues.TestProtos { private static readonly string[] _fieldNames = new string[] { }; private static readonly uint[] _fieldTags = new uint[] { }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::UnitTest.Issues.TestProtos.Issue307.Descriptor.NestedTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::UnitTest.Issues.TestProtos.UnittestIssues.internal__static_unittest_issues_Issue307_NestedOnce__FieldAccessorTable; } } @@ -284,11 +284,11 @@ namespace UnitTest.Issues.TestProtos { private static readonly string[] _fieldNames = new string[] { }; private static readonly uint[] _fieldTags = new uint[] { }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce.Descriptor.NestedTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::UnitTest.Issues.TestProtos.UnittestIssues.internal__static_unittest_issues_Issue307_NestedOnce_NestedTwice__FieldAccessorTable; } } @@ -386,11 +386,11 @@ namespace UnitTest.Issues.TestProtos { private static readonly string[] _fieldNames = new string[] { "packed_values", "value", "values" }; private static readonly uint[] _fieldTags = new uint[] { 26, 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::UnitTest.Issues.TestProtos.UnittestIssues.Descriptor.MessageTypes[1]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::UnitTest.Issues.TestProtos.UnittestIssues.internal__static_unittest_issues_NegativeEnumMessage__FieldAccessorTable; } } @@ -543,11 +543,11 @@ namespace UnitTest.Issues.TestProtos { private static readonly string[] _fieldNames = new string[] { }; private static readonly uint[] _fieldTags = new uint[] { }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::UnitTest.Issues.TestProtos.UnittestIssues.Descriptor.MessageTypes[2]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::UnitTest.Issues.TestProtos.UnittestIssues.internal__static_unittest_issues_DeprecatedChild__FieldAccessorTable; } } @@ -635,11 +635,11 @@ namespace UnitTest.Issues.TestProtos { private static readonly string[] _fieldNames = new string[] { "EnumArray", "EnumValue", "MessageArray", "MessageValue", "PrimitiveArray", "PrimitiveValue" }; private static readonly uint[] _fieldTags = new uint[] { 50, 40, 34, 26, 18, 8 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::UnitTest.Issues.TestProtos.UnittestIssues.Descriptor.MessageTypes[3]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::UnitTest.Issues.TestProtos.UnittestIssues.internal__static_unittest_issues_DeprecatedFieldsMessage__FieldAccessorTable; } } @@ -879,11 +879,11 @@ namespace UnitTest.Issues.TestProtos { private static readonly string[] _fieldNames = new string[] { "item" }; private static readonly uint[] _fieldTags = new uint[] { 8 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::UnitTest.Issues.TestProtos.UnittestIssues.Descriptor.MessageTypes[4]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::UnitTest.Issues.TestProtos.UnittestIssues.internal__static_unittest_issues_ItemField__FieldAccessorTable; } } diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestProto3.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestProto3.cs index a5e37bd6..7e43a543 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestProto3.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestProto3.cs @@ -5,7 +5,7 @@ using pb = global::Google.Protobuf; using pbc = global::Google.Protobuf.Collections; -using pbd = global::Google.Protobuf.Descriptors; +using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace Google.Protobuf.TestProtos { @@ -13,47 +13,47 @@ namespace Google.Protobuf.TestProtos { public static partial class UnittestProto3 { #region Static variables - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestAllTypes__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestAllTypes_NestedMessage__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_NestedTestAllTypes__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDeprecatedFields__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_ForeignMessage__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestReservedFields__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestForeignNested__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestReallyLargeTagNumber__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestRecursiveMessage__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMutualRecursionA__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMutualRecursionB__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestCamelCaseFieldNames__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestFieldOrderings__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestFieldOrderings_NestedMessage__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_SparseEnumMessage__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_OneString__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_MoreString__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_OneBytes__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_MoreBytes__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_Int32Message__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_Uint32Message__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_Int64Message__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_Uint64Message__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_BoolMessage__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestOneof__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestPackedTypes__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestUnpackedTypes__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestCommentInjectionMessage__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_FooRequest__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_FooResponse__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_FooClientMessage__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_FooServerMessage__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_BarRequest__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_BarResponse__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestAllTypes__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestAllTypes_NestedMessage__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_NestedTestAllTypes__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestDeprecatedFields__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_ForeignMessage__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestReservedFields__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestForeignNested__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestReallyLargeTagNumber__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestRecursiveMessage__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMutualRecursionA__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestMutualRecursionB__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestCamelCaseFieldNames__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestFieldOrderings__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestFieldOrderings_NestedMessage__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_SparseEnumMessage__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_OneString__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_MoreString__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_OneBytes__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_MoreBytes__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_Int32Message__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_Uint32Message__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_Int64Message__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_Uint64Message__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_BoolMessage__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestOneof__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestPackedTypes__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestUnpackedTypes__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_TestCommentInjectionMessage__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_FooRequest__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_FooResponse__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_FooClientMessage__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_FooServerMessage__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_BarRequest__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_protobuf_unittest_BarResponse__FieldAccessorTable; #endregion #region Descriptor - public static pbd::FileDescriptor Descriptor { + public static pbr::FileDescriptor Descriptor { get { return descriptor; } } - private static pbd::FileDescriptor descriptor; + private static pbr::FileDescriptor descriptor; static UnittestProto3() { byte[] descriptorData = global::System.Convert.FromBase64String( @@ -185,114 +185,114 @@ namespace Google.Protobuf.TestProtos { "HS5wcm90b2J1Zl91bml0dGVzdC5CYXJSZXF1ZXN0Gh4ucHJvdG9idWZfdW5p", "dHRlc3QuQmFyUmVzcG9uc2VCOkINVW5pdHRlc3RQcm90b0gBgAEBiAEBkAEB", "+AEBqgIaR29vZ2xlLlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3RvMw==")); - descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, - new pbd::FileDescriptor[] { + descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestImportProto3.Descriptor, }); internal__static_protobuf_unittest_TestAllTypes__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestAllTypes), descriptor.MessageTypes[0], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestAllTypes), descriptor.MessageTypes[0], new string[] { "SingleInt32", "SingleInt64", "SingleUint32", "SingleUint64", "SingleSint32", "SingleSint64", "SingleFixed32", "SingleFixed64", "SingleSfixed32", "SingleSfixed64", "SingleFloat", "SingleDouble", "SingleBool", "SingleString", "SingleBytes", "SingleNestedMessage", "SingleForeignMessage", "SingleImportMessage", "SingleNestedEnum", "SingleForeignEnum", "SingleImportEnum", "SinglePublicImportMessage", "RepeatedInt32", "RepeatedInt64", "RepeatedUint32", "RepeatedUint64", "RepeatedSint32", "RepeatedSint64", "RepeatedFixed32", "RepeatedFixed64", "RepeatedSfixed32", "RepeatedSfixed64", "RepeatedFloat", "RepeatedDouble", "RepeatedBool", "RepeatedString", "RepeatedBytes", "RepeatedNestedMessage", "RepeatedForeignMessage", "RepeatedImportMessage", "RepeatedNestedEnum", "RepeatedForeignEnum", "RepeatedImportEnum", "RepeatedPublicImportMessage", "OneofUint32", "OneofNestedMessage", "OneofString", "OneofBytes", }, new string[] { "OneofField", }); internal__static_protobuf_unittest_TestAllTypes_NestedMessage__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage), descriptor.MessageTypes[0].NestedTypes[0], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage), descriptor.MessageTypes[0].NestedTypes[0], new string[] { "Bb", }, new string[] { }); internal__static_protobuf_unittest_NestedTestAllTypes__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.NestedTestAllTypes), descriptor.MessageTypes[1], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.NestedTestAllTypes), descriptor.MessageTypes[1], new string[] { "Child", "Payload", "RepeatedChild", }, new string[] { }); internal__static_protobuf_unittest_TestDeprecatedFields__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestDeprecatedFields), descriptor.MessageTypes[2], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestDeprecatedFields), descriptor.MessageTypes[2], new string[] { "DeprecatedInt32", }, new string[] { }); internal__static_protobuf_unittest_ForeignMessage__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.ForeignMessage), descriptor.MessageTypes[3], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.ForeignMessage), descriptor.MessageTypes[3], new string[] { "C", }, new string[] { }); internal__static_protobuf_unittest_TestReservedFields__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestReservedFields), descriptor.MessageTypes[4], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestReservedFields), descriptor.MessageTypes[4], new string[] { }, new string[] { }); internal__static_protobuf_unittest_TestForeignNested__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestForeignNested), descriptor.MessageTypes[5], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestForeignNested), descriptor.MessageTypes[5], new string[] { "ForeignNested", }, new string[] { }); internal__static_protobuf_unittest_TestReallyLargeTagNumber__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestReallyLargeTagNumber), descriptor.MessageTypes[6], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestReallyLargeTagNumber), descriptor.MessageTypes[6], new string[] { "A", "Bb", }, new string[] { }); internal__static_protobuf_unittest_TestRecursiveMessage__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestRecursiveMessage), descriptor.MessageTypes[7], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestRecursiveMessage), descriptor.MessageTypes[7], new string[] { "A", "I", }, new string[] { }); internal__static_protobuf_unittest_TestMutualRecursionA__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMutualRecursionA), descriptor.MessageTypes[8], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMutualRecursionA), descriptor.MessageTypes[8], new string[] { "Bb", }, new string[] { }); internal__static_protobuf_unittest_TestMutualRecursionB__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMutualRecursionB), descriptor.MessageTypes[9], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestMutualRecursionB), descriptor.MessageTypes[9], new string[] { "A", "OptionalInt32", }, new string[] { }); internal__static_protobuf_unittest_TestCamelCaseFieldNames__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestCamelCaseFieldNames), descriptor.MessageTypes[10], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestCamelCaseFieldNames), descriptor.MessageTypes[10], new string[] { "PrimitiveField", "StringField", "EnumField", "MessageField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedEnumField", "RepeatedMessageField", }, new string[] { }); internal__static_protobuf_unittest_TestFieldOrderings__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestFieldOrderings), descriptor.MessageTypes[11], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestFieldOrderings), descriptor.MessageTypes[11], new string[] { "MyString", "MyInt", "MyFloat", "SingleNestedMessage", }, new string[] { }); internal__static_protobuf_unittest_TestFieldOrderings_NestedMessage__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage), descriptor.MessageTypes[11].NestedTypes[0], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage), descriptor.MessageTypes[11].NestedTypes[0], new string[] { "Oo", "Bb", }, new string[] { }); internal__static_protobuf_unittest_SparseEnumMessage__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.SparseEnumMessage), descriptor.MessageTypes[12], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.SparseEnumMessage), descriptor.MessageTypes[12], new string[] { "SparseEnum", }, new string[] { }); internal__static_protobuf_unittest_OneString__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.OneString), descriptor.MessageTypes[13], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.OneString), descriptor.MessageTypes[13], new string[] { "Data", }, new string[] { }); internal__static_protobuf_unittest_MoreString__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.MoreString), descriptor.MessageTypes[14], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.MoreString), descriptor.MessageTypes[14], new string[] { "Data", }, new string[] { }); internal__static_protobuf_unittest_OneBytes__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.OneBytes), descriptor.MessageTypes[15], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.OneBytes), descriptor.MessageTypes[15], new string[] { "Data", }, new string[] { }); internal__static_protobuf_unittest_MoreBytes__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.MoreBytes), descriptor.MessageTypes[16], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.MoreBytes), descriptor.MessageTypes[16], new string[] { "Data", }, new string[] { }); internal__static_protobuf_unittest_Int32Message__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.Int32Message), descriptor.MessageTypes[17], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.Int32Message), descriptor.MessageTypes[17], new string[] { "Data", }, new string[] { }); internal__static_protobuf_unittest_Uint32Message__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.Uint32Message), descriptor.MessageTypes[18], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.Uint32Message), descriptor.MessageTypes[18], new string[] { "Data", }, new string[] { }); internal__static_protobuf_unittest_Int64Message__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.Int64Message), descriptor.MessageTypes[19], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.Int64Message), descriptor.MessageTypes[19], new string[] { "Data", }, new string[] { }); internal__static_protobuf_unittest_Uint64Message__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.Uint64Message), descriptor.MessageTypes[20], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.Uint64Message), descriptor.MessageTypes[20], new string[] { "Data", }, new string[] { }); internal__static_protobuf_unittest_BoolMessage__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.BoolMessage), descriptor.MessageTypes[21], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.BoolMessage), descriptor.MessageTypes[21], new string[] { "Data", }, new string[] { }); internal__static_protobuf_unittest_TestOneof__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestOneof), descriptor.MessageTypes[22], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestOneof), descriptor.MessageTypes[22], new string[] { "FooInt", "FooString", "FooMessage", }, new string[] { "Foo", }); internal__static_protobuf_unittest_TestPackedTypes__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestPackedTypes), descriptor.MessageTypes[23], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestPackedTypes), descriptor.MessageTypes[23], new string[] { "PackedInt32", "PackedInt64", "PackedUint32", "PackedUint64", "PackedSint32", "PackedSint64", "PackedFixed32", "PackedFixed64", "PackedSfixed32", "PackedSfixed64", "PackedFloat", "PackedDouble", "PackedBool", "PackedEnum", }, new string[] { }); internal__static_protobuf_unittest_TestUnpackedTypes__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestUnpackedTypes), descriptor.MessageTypes[24], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestUnpackedTypes), descriptor.MessageTypes[24], new string[] { "UnpackedInt32", "UnpackedInt64", "UnpackedUint32", "UnpackedUint64", "UnpackedSint32", "UnpackedSint64", "UnpackedFixed32", "UnpackedFixed64", "UnpackedSfixed32", "UnpackedSfixed64", "UnpackedFloat", "UnpackedDouble", "UnpackedBool", "UnpackedEnum", }, new string[] { }); internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestRepeatedScalarDifferentTagSizes), descriptor.MessageTypes[25], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestRepeatedScalarDifferentTagSizes), descriptor.MessageTypes[25], new string[] { "RepeatedFixed32", "RepeatedInt32", "RepeatedFixed64", "RepeatedInt64", "RepeatedFloat", "RepeatedUint64", }, new string[] { }); internal__static_protobuf_unittest_TestCommentInjectionMessage__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestCommentInjectionMessage), descriptor.MessageTypes[26], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.TestCommentInjectionMessage), descriptor.MessageTypes[26], new string[] { "A", }, new string[] { }); internal__static_protobuf_unittest_FooRequest__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.FooRequest), descriptor.MessageTypes[27], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.FooRequest), descriptor.MessageTypes[27], new string[] { }, new string[] { }); internal__static_protobuf_unittest_FooResponse__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.FooResponse), descriptor.MessageTypes[28], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.FooResponse), descriptor.MessageTypes[28], new string[] { }, new string[] { }); internal__static_protobuf_unittest_FooClientMessage__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.FooClientMessage), descriptor.MessageTypes[29], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.FooClientMessage), descriptor.MessageTypes[29], new string[] { }, new string[] { }); internal__static_protobuf_unittest_FooServerMessage__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.FooServerMessage), descriptor.MessageTypes[30], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.FooServerMessage), descriptor.MessageTypes[30], new string[] { }, new string[] { }); internal__static_protobuf_unittest_BarRequest__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.BarRequest), descriptor.MessageTypes[31], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.BarRequest), descriptor.MessageTypes[31], new string[] { }, new string[] { }); internal__static_protobuf_unittest_BarResponse__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.BarResponse), descriptor.MessageTypes[32], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.TestProtos.BarResponse), descriptor.MessageTypes[32], new string[] { }, new string[] { }); } #endregion @@ -335,11 +335,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "oneof_bytes", "oneof_nested_message", "oneof_string", "oneof_uint32", "repeated_bool", "repeated_bytes", "repeated_double", "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_foreign_enum", "repeated_foreign_message", "repeated_import_enum", "repeated_import_message", "repeated_int32", "repeated_int64", "repeated_nested_enum", "repeated_nested_message", "repeated_public_import_message", "repeated_sfixed32", "repeated_sfixed64", "repeated_sint32", "repeated_sint64", "repeated_string", "repeated_uint32", "repeated_uint64", "single_bool", "single_bytes", "single_double", "single_fixed32", "single_fixed64", "single_float", "single_foreign_enum", "single_foreign_message", "single_import_enum", "single_import_message", "single_int32", "single_int64", "single_nested_enum", "single_nested_message", "single_public_import_message", "single_sfixed32", "single_sfixed64", "single_sint32", "single_sint64", "single_string", "single_uint32", "single_uint64" }; private static readonly uint[] _fieldTags = new uint[] { 914, 898, 906, 888, 346, 362, 338, 298, 306, 330, 418, 394, 426, 402, 250, 258, 410, 386, 434, 314, 322, 282, 290, 354, 266, 274, 104, 122, 97, 61, 65, 93, 176, 154, 184, 162, 8, 16, 168, 146, 210, 77, 81, 40, 48, 114, 24, 32 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_TestAllTypes__FieldAccessorTable; } } @@ -1636,11 +1636,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "bb" }; private static readonly uint[] _fieldTags = new uint[] { 8 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestAllTypes.Descriptor.NestedTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_TestAllTypes_NestedMessage__FieldAccessorTable; } } @@ -1760,11 +1760,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "child", "payload", "repeated_child" }; private static readonly uint[] _fieldTags = new uint[] { 10, 18, 26 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[1]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_NestedTestAllTypes__FieldAccessorTable; } } @@ -1939,11 +1939,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "deprecated_int32" }; private static readonly uint[] _fieldTags = new uint[] { 8 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[2]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_TestDeprecatedFields__FieldAccessorTable; } } @@ -2059,11 +2059,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "c" }; private static readonly uint[] _fieldTags = new uint[] { 8 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[3]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_ForeignMessage__FieldAccessorTable; } } @@ -2178,11 +2178,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { }; private static readonly uint[] _fieldTags = new uint[] { }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[4]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_TestReservedFields__FieldAccessorTable; } } @@ -2270,11 +2270,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "foreign_nested" }; private static readonly uint[] _fieldTags = new uint[] { 10 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[5]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_TestForeignNested__FieldAccessorTable; } } @@ -2396,11 +2396,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "a", "bb" }; private static readonly uint[] _fieldTags = new uint[] { 8, 2147483640 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[6]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_TestReallyLargeTagNumber__FieldAccessorTable; } } @@ -2542,11 +2542,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "a", "i" }; private static readonly uint[] _fieldTags = new uint[] { 10, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[7]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_TestRecursiveMessage__FieldAccessorTable; } } @@ -2695,11 +2695,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "bb" }; private static readonly uint[] _fieldTags = new uint[] { 10 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[8]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_TestMutualRecursionA__FieldAccessorTable; } } @@ -2821,11 +2821,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "a", "optional_int32" }; private static readonly uint[] _fieldTags = new uint[] { 10, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[9]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_TestMutualRecursionB__FieldAccessorTable; } } @@ -2974,11 +2974,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "EnumField", "MessageField", "PrimitiveField", "RepeatedEnumField", "RepeatedMessageField", "RepeatedPrimitiveField", "RepeatedStringField", "StringField" }; private static readonly uint[] _fieldTags = new uint[] { 24, 34, 8, 74, 82, 58, 66, 18 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[10]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_TestCamelCaseFieldNames__FieldAccessorTable; } } @@ -3258,11 +3258,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "my_float", "my_int", "my_string", "single_nested_message" }; private static readonly uint[] _fieldTags = new uint[] { 813, 8, 90, 1602 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[11]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_TestFieldOrderings__FieldAccessorTable; } } @@ -3466,11 +3466,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "bb", "oo" }; private static readonly uint[] _fieldTags = new uint[] { 8, 16 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestFieldOrderings.Descriptor.NestedTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_TestFieldOrderings_NestedMessage__FieldAccessorTable; } } @@ -3617,11 +3617,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "sparse_enum" }; private static readonly uint[] _fieldTags = new uint[] { 8 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[12]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_SparseEnumMessage__FieldAccessorTable; } } @@ -3736,11 +3736,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "data" }; private static readonly uint[] _fieldTags = new uint[] { 10 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[13]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_OneString__FieldAccessorTable; } } @@ -3855,11 +3855,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "data" }; private static readonly uint[] _fieldTags = new uint[] { 10 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[14]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_MoreString__FieldAccessorTable; } } @@ -3966,11 +3966,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "data" }; private static readonly uint[] _fieldTags = new uint[] { 10 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[15]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_OneBytes__FieldAccessorTable; } } @@ -4085,11 +4085,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "data" }; private static readonly uint[] _fieldTags = new uint[] { 10 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[16]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_MoreBytes__FieldAccessorTable; } } @@ -4204,11 +4204,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "data" }; private static readonly uint[] _fieldTags = new uint[] { 8 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[17]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_Int32Message__FieldAccessorTable; } } @@ -4323,11 +4323,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "data" }; private static readonly uint[] _fieldTags = new uint[] { 8 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[18]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_Uint32Message__FieldAccessorTable; } } @@ -4442,11 +4442,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "data" }; private static readonly uint[] _fieldTags = new uint[] { 8 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[19]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_Int64Message__FieldAccessorTable; } } @@ -4561,11 +4561,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "data" }; private static readonly uint[] _fieldTags = new uint[] { 8 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[20]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_Uint64Message__FieldAccessorTable; } } @@ -4680,11 +4680,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "data" }; private static readonly uint[] _fieldTags = new uint[] { 8 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[21]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_BoolMessage__FieldAccessorTable; } } @@ -4799,11 +4799,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "foo_int", "foo_message", "foo_string" }; private static readonly uint[] _fieldTags = new uint[] { 8, 26, 18 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[22]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_TestOneof__FieldAccessorTable; } } @@ -5008,11 +5008,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "packed_bool", "packed_double", "packed_enum", "packed_fixed32", "packed_fixed64", "packed_float", "packed_int32", "packed_int64", "packed_sfixed32", "packed_sfixed64", "packed_sint32", "packed_sint64", "packed_uint32", "packed_uint64" }; private static readonly uint[] _fieldTags = new uint[] { 818, 810, 826, 770, 778, 802, 722, 730, 786, 794, 754, 762, 738, 746 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[23]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_TestPackedTypes__FieldAccessorTable; } } @@ -5379,11 +5379,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "unpacked_bool", "unpacked_double", "unpacked_enum", "unpacked_fixed32", "unpacked_fixed64", "unpacked_float", "unpacked_int32", "unpacked_int64", "unpacked_sfixed32", "unpacked_sfixed64", "unpacked_sint32", "unpacked_sint64", "unpacked_uint32", "unpacked_uint64" }; private static readonly uint[] _fieldTags = new uint[] { 816, 809, 824, 773, 777, 805, 720, 728, 789, 793, 752, 760, 736, 744 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[24]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_TestUnpackedTypes__FieldAccessorTable; } } @@ -5750,11 +5750,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_int32", "repeated_int64", "repeated_uint64" }; private static readonly uint[] _fieldTags = new uint[] { 98, 16370, 2097138, 106, 16378, 2097146 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[25]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__FieldAccessorTable; } } @@ -5962,11 +5962,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { "a" }; private static readonly uint[] _fieldTags = new uint[] { 10 }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[26]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_TestCommentInjectionMessage__FieldAccessorTable; } } @@ -6081,11 +6081,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { }; private static readonly uint[] _fieldTags = new uint[] { }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[27]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_FooRequest__FieldAccessorTable; } } @@ -6173,11 +6173,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { }; private static readonly uint[] _fieldTags = new uint[] { }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[28]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_FooResponse__FieldAccessorTable; } } @@ -6265,11 +6265,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { }; private static readonly uint[] _fieldTags = new uint[] { }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[29]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_FooClientMessage__FieldAccessorTable; } } @@ -6357,11 +6357,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { }; private static readonly uint[] _fieldTags = new uint[] { }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[30]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_FooServerMessage__FieldAccessorTable; } } @@ -6449,11 +6449,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { }; private static readonly uint[] _fieldTags = new uint[] { }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[31]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_BarRequest__FieldAccessorTable; } } @@ -6541,11 +6541,11 @@ namespace Google.Protobuf.TestProtos { private static readonly string[] _fieldNames = new string[] { }; private static readonly uint[] _fieldTags = new uint[] { }; - public static pbd::MessageDescriptor Descriptor { + public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor.MessageTypes[32]; } } - public pb::FieldAccess.FieldAccessorTable Fields { + public pbr::FieldAccessorTable Fields { get { return global::Google.Protobuf.TestProtos.UnittestProto3.internal__static_protobuf_unittest_BarResponse__FieldAccessorTable; } } diff --git a/csharp/src/ProtocolBuffers/IMessage.cs b/csharp/src/ProtocolBuffers/IMessage.cs index 3324e9ae..8c4a4aaf 100644 --- a/csharp/src/ProtocolBuffers/IMessage.cs +++ b/csharp/src/ProtocolBuffers/IMessage.cs @@ -31,7 +31,7 @@ #endregion
using System;
-using Google.Protobuf.FieldAccess;
+using Google.Protobuf.Reflection;
namespace Google.Protobuf
{
diff --git a/csharp/src/ProtocolBuffers/JsonFormatter.cs b/csharp/src/ProtocolBuffers/JsonFormatter.cs index 9bd628eb..dacc7221 100644 --- a/csharp/src/ProtocolBuffers/JsonFormatter.cs +++ b/csharp/src/ProtocolBuffers/JsonFormatter.cs @@ -34,8 +34,7 @@ using System; using System.Collections; using System.Globalization; using System.Text; -using Google.Protobuf.Descriptors; -using Google.Protobuf.FieldAccess; +using Google.Protobuf.Reflection; namespace Google.Protobuf { diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffers.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffers.csproj index f5dd6d5a..eef54391 100644 --- a/csharp/src/ProtocolBuffers/ProtocolBuffers.csproj +++ b/csharp/src/ProtocolBuffers/ProtocolBuffers.csproj @@ -60,47 +60,48 @@ <Compile Include="Collections\MapField.cs" />
<Compile Include="Collections\ReadOnlyDictionary.cs" />
<Compile Include="Collections\RepeatedField.cs" />
- <Compile Include="DescriptorProtos\DescriptorProtoFile.cs" />
- <Compile Include="DescriptorProtos\PartialClasses.cs" />
- <Compile Include="Descriptors\DescriptorBase.cs" />
- <Compile Include="Descriptors\DescriptorPool.cs" />
- <Compile Include="Descriptors\DescriptorUtil.cs" />
- <Compile Include="Descriptors\DescriptorValidationException.cs" />
- <Compile Include="Descriptors\EnumDescriptor.cs" />
- <Compile Include="Descriptors\EnumValueDescriptor.cs" />
- <Compile Include="Descriptors\FieldDescriptor.cs" />
- <Compile Include="Descriptors\FieldType.cs" />
- <Compile Include="Descriptors\FileDescriptor.cs" />
- <Compile Include="Descriptors\OneofDescriptor.cs" />
- <Compile Include="Descriptors\IDescriptor.cs" />
- <Compile Include="Descriptors\MessageDescriptor.cs" />
- <Compile Include="Descriptors\MethodDescriptor.cs" />
- <Compile Include="Descriptors\PackageDescriptor.cs" />
- <Compile Include="Descriptors\ServiceDescriptor.cs" />
- <Compile Include="FieldAccess\MapFieldAccessor.cs" />
<Compile Include="FieldCodec.cs" />
<Compile Include="FrameworkPortability.cs" />
<Compile Include="Freezable.cs" />
<Compile Include="JsonFormatter.cs" />
<Compile Include="MessageExtensions.cs" />
- <Compile Include="FieldAccess\FieldAccessorBase.cs" />
- <Compile Include="FieldAccess\ReflectionUtil.cs" />
- <Compile Include="FieldAccess\RepeatedFieldAccessor.cs" />
- <Compile Include="FieldAccess\SingleFieldAccessor.cs" />
- <Compile Include="FieldAccess\IFieldAccessor.cs" />
- <Compile Include="FieldAccess\FieldAccessorTable.cs" />
- <Compile Include="FieldAccess\OneofAccessor.cs" />
<Compile Include="IMessage.cs" />
<Compile Include="InvalidProtocolBufferException.cs" />
<Compile Include="LimitedInputStream.cs" />
<Compile Include="MessageParser.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Reflection\DescriptorBase.cs" />
+ <Compile Include="Reflection\DescriptorPool.cs" />
+ <Compile Include="Reflection\DescriptorProtoFile.cs" />
+ <Compile Include="Reflection\DescriptorUtil.cs" />
+ <Compile Include="Reflection\DescriptorValidationException.cs" />
+ <Compile Include="Reflection\EnumDescriptor.cs" />
+ <Compile Include="Reflection\EnumValueDescriptor.cs" />
+ <Compile Include="Reflection\FieldAccessorBase.cs" />
+ <Compile Include="Reflection\FieldAccessorTable.cs" />
+ <Compile Include="Reflection\FieldDescriptor.cs" />
+ <Compile Include="Reflection\FieldType.cs" />
+ <Compile Include="Reflection\FileDescriptor.cs" />
+ <Compile Include="Reflection\IDescriptor.cs" />
+ <Compile Include="Reflection\IFieldAccessor.cs" />
+ <Compile Include="Reflection\MapFieldAccessor.cs" />
+ <Compile Include="Reflection\MessageDescriptor.cs" />
+ <Compile Include="Reflection\MethodDescriptor.cs" />
+ <Compile Include="Reflection\OneofAccessor.cs" />
+ <Compile Include="Reflection\OneofDescriptor.cs" />
+ <Compile Include="Reflection\PackageDescriptor.cs" />
+ <Compile Include="Reflection\PartialClasses.cs" />
+ <Compile Include="Reflection\ReflectionUtil.cs" />
+ <Compile Include="Reflection\RepeatedFieldAccessor.cs" />
+ <Compile Include="Reflection\ServiceDescriptor.cs" />
+ <Compile Include="Reflection\SingleFieldAccessor.cs" />
<Compile Include="ThrowHelper.cs" />
<Compile Include="WireFormat.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Google.Protobuf.nuspec" />
</ItemGroup>
+ <ItemGroup />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/csharp/src/ProtocolBuffers/Descriptors/DescriptorBase.cs b/csharp/src/ProtocolBuffers/Reflection/DescriptorBase.cs index 0eb71215..0300cd58 100644 --- a/csharp/src/ProtocolBuffers/Descriptors/DescriptorBase.cs +++ b/csharp/src/ProtocolBuffers/Reflection/DescriptorBase.cs @@ -1,84 +1,82 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-using Google.Protobuf.DescriptorProtos;
-
-namespace Google.Protobuf.Descriptors
-{
- /// <summary>
- /// Base class for nearly all descriptors, providing common functionality.
- /// </summary>
- public abstract class DescriptorBase : IDescriptor
- {
- private readonly FileDescriptor file;
- private readonly string fullName;
- private readonly int index;
-
- internal DescriptorBase(FileDescriptor file, string fullName, int index)
- {
- this.file = file;
- this.fullName = fullName;
- this.index = index;
- }
-
- /// <value>
- /// The index of this descriptor within its parent descriptor.
- /// </value>
- /// <remarks>
- /// This returns the index of this descriptor within its parent, for
- /// this descriptor's type. (There can be duplicate values for different
- /// types, e.g. one enum type with index 0 and one message type with index 0.)
- /// </remarks>
- public int Index
- {
- get { return index; }
- }
-
- public abstract string Name { get; }
-
- /// <summary>
- /// The fully qualified name of the descriptor's target.
- /// </summary>
- public string FullName
- {
- get { return fullName; }
- }
-
- /// <value>
- /// The file this descriptor was declared in.
- /// </value>
- public FileDescriptor File
- {
- get { return file; }
- }
- }
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// Base class for nearly all descriptors, providing common functionality. + /// </summary> + public abstract class DescriptorBase : IDescriptor + { + private readonly FileDescriptor file; + private readonly string fullName; + private readonly int index; + + internal DescriptorBase(FileDescriptor file, string fullName, int index) + { + this.file = file; + this.fullName = fullName; + this.index = index; + } + + /// <value> + /// The index of this descriptor within its parent descriptor. + /// </value> + /// <remarks> + /// This returns the index of this descriptor within its parent, for + /// this descriptor's type. (There can be duplicate values for different + /// types, e.g. one enum type with index 0 and one message type with index 0.) + /// </remarks> + public int Index + { + get { return index; } + } + + public abstract string Name { get; } + + /// <summary> + /// The fully qualified name of the descriptor's target. + /// </summary> + public string FullName + { + get { return fullName; } + } + + /// <value> + /// The file this descriptor was declared in. + /// </value> + public FileDescriptor File + { + get { return file; } + } + } }
\ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/DescriptorPool.cs b/csharp/src/ProtocolBuffers/Reflection/DescriptorPool.cs index b07af060..157ea400 100644 --- a/csharp/src/ProtocolBuffers/Descriptors/DescriptorPool.cs +++ b/csharp/src/ProtocolBuffers/Reflection/DescriptorPool.cs @@ -1,365 +1,365 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Text.RegularExpressions;
-
-namespace Google.Protobuf.Descriptors
-{
- /// <summary>
- /// Contains lookup tables containing all the descriptors defined in a particular file.
- /// </summary>
- internal sealed class DescriptorPool
- {
- private readonly IDictionary<string, IDescriptor> descriptorsByName =
- new Dictionary<string, IDescriptor>();
-
- private readonly IDictionary<DescriptorIntPair, FieldDescriptor> fieldsByNumber =
- new Dictionary<DescriptorIntPair, FieldDescriptor>();
-
- private readonly IDictionary<DescriptorIntPair, EnumValueDescriptor> enumValuesByNumber =
- new Dictionary<DescriptorIntPair, EnumValueDescriptor>();
-
- private readonly HashSet<FileDescriptor> dependencies;
-
- internal DescriptorPool(FileDescriptor[] dependencyFiles)
- {
- dependencies = new HashSet<FileDescriptor>();
- for (int i = 0; i < dependencyFiles.Length; i++)
- {
- dependencies.Add(dependencyFiles[i]);
- ImportPublicDependencies(dependencyFiles[i]);
- }
-
- foreach (FileDescriptor dependency in dependencyFiles)
- {
- AddPackage(dependency.Package, dependency);
- }
- }
-
- private void ImportPublicDependencies(FileDescriptor file)
- {
- foreach (FileDescriptor dependency in file.PublicDependencies)
- {
- if (dependencies.Add(dependency))
- {
- ImportPublicDependencies(dependency);
- }
- }
- }
-
- /// <summary>
- /// Finds a symbol of the given name within the pool.
- /// </summary>
- /// <typeparam name="T">The type of symbol to look for</typeparam>
- /// <param name="fullName">Fully-qualified name to look up</param>
- /// <returns>The symbol with the given name and type,
- /// or null if the symbol doesn't exist or has the wrong type</returns>
- internal T FindSymbol<T>(string fullName) where T : class
- {
- IDescriptor result;
- descriptorsByName.TryGetValue(fullName, out result);
- T descriptor = result as T;
- if (descriptor != null)
- {
- return descriptor;
- }
-
- foreach (FileDescriptor dependency in dependencies)
- {
- dependency.DescriptorPool.descriptorsByName.TryGetValue(fullName, out result);
- descriptor = result as T;
- if (descriptor != null)
- {
- return descriptor;
- }
- }
-
- return null;
- }
-
- /// <summary>
- /// Adds a package to the symbol tables. If a package by the same name
- /// already exists, that is fine, but if some other kind of symbol
- /// exists under the same name, an exception is thrown. If the package
- /// has multiple components, this also adds the parent package(s).
- /// </summary>
- internal void AddPackage(string fullName, FileDescriptor file)
- {
- int dotpos = fullName.LastIndexOf('.');
- String name;
- if (dotpos != -1)
- {
- AddPackage(fullName.Substring(0, dotpos), file);
- name = fullName.Substring(dotpos + 1);
- }
- else
- {
- name = fullName;
- }
-
- IDescriptor old;
- if (descriptorsByName.TryGetValue(fullName, out old))
- {
- if (!(old is PackageDescriptor))
- {
- throw new DescriptorValidationException(file,
- "\"" + name +
- "\" is already defined (as something other than a " +
- "package) in file \"" + old.File.Name + "\".");
- }
- }
- descriptorsByName[fullName] = new PackageDescriptor(name, fullName, file);
- }
-
- /// <summary>
- /// Adds a symbol to the symbol table.
- /// </summary>
- /// <exception cref="DescriptorValidationException">The symbol already existed
- /// in the symbol table.</exception>
- internal void AddSymbol(IDescriptor descriptor)
- {
- ValidateSymbolName(descriptor);
- String fullName = descriptor.FullName;
-
- IDescriptor old;
- if (descriptorsByName.TryGetValue(fullName, out old))
- {
- int dotPos = fullName.LastIndexOf('.');
- string message;
- if (descriptor.File == old.File)
- {
- if (dotPos == -1)
- {
- message = "\"" + fullName + "\" is already defined.";
- }
- else
- {
- message = "\"" + fullName.Substring(dotPos + 1) + "\" is already defined in \"" +
- fullName.Substring(0, dotPos) + "\".";
- }
- }
- else
- {
- message = "\"" + fullName + "\" is already defined in file \"" + old.File.Name + "\".";
- }
- throw new DescriptorValidationException(descriptor, message);
- }
- descriptorsByName[fullName] = descriptor;
- }
-
- private static readonly Regex ValidationRegex = new Regex("^[_A-Za-z][_A-Za-z0-9]*$",
- FrameworkPortability.CompiledRegexWhereAvailable);
-
- /// <summary>
- /// Verifies that the descriptor's name is valid (i.e. it contains
- /// only letters, digits and underscores, and does not start with a digit).
- /// </summary>
- /// <param name="descriptor"></param>
- private static void ValidateSymbolName(IDescriptor descriptor)
- {
- if (descriptor.Name == "")
- {
- throw new DescriptorValidationException(descriptor, "Missing name.");
- }
- if (!ValidationRegex.IsMatch(descriptor.Name))
- {
- throw new DescriptorValidationException(descriptor,
- "\"" + descriptor.Name + "\" is not a valid identifier.");
- }
- }
-
- /// <summary>
- /// Returns the field with the given number in the given descriptor,
- /// or null if it can't be found.
- /// </summary>
- internal FieldDescriptor FindFieldByNumber(MessageDescriptor messageDescriptor, int number)
- {
- FieldDescriptor ret;
- fieldsByNumber.TryGetValue(new DescriptorIntPair(messageDescriptor, number), out ret);
- return ret;
- }
-
- internal EnumValueDescriptor FindEnumValueByNumber(EnumDescriptor enumDescriptor, int number)
- {
- EnumValueDescriptor ret;
- enumValuesByNumber.TryGetValue(new DescriptorIntPair(enumDescriptor, number), out ret);
- return ret;
- }
-
- /// <summary>
- /// Adds a field to the fieldsByNumber table.
- /// </summary>
- /// <exception cref="DescriptorValidationException">A field with the same
- /// containing type and number already exists.</exception>
- internal void AddFieldByNumber(FieldDescriptor field)
- {
- DescriptorIntPair key = new DescriptorIntPair(field.ContainingType, field.FieldNumber);
- FieldDescriptor old;
- if (fieldsByNumber.TryGetValue(key, out old))
- {
- throw new DescriptorValidationException(field, "Field number " + field.FieldNumber +
- "has already been used in \"" +
- field.ContainingType.FullName +
- "\" by field \"" + old.Name + "\".");
- }
- fieldsByNumber[key] = field;
- }
-
- /// <summary>
- /// Adds an enum value to the enumValuesByNumber table. If an enum value
- /// with the same type and number already exists, this method does nothing.
- /// (This is allowed; the first value defined with the number takes precedence.)
- /// </summary>
- internal void AddEnumValueByNumber(EnumValueDescriptor enumValue)
- {
- DescriptorIntPair key = new DescriptorIntPair(enumValue.EnumDescriptor, enumValue.Number);
- if (!enumValuesByNumber.ContainsKey(key))
- {
- enumValuesByNumber[key] = enumValue;
- }
- }
-
- /// <summary>
- /// Looks up a descriptor by name, relative to some other descriptor.
- /// The name may be fully-qualified (with a leading '.'), partially-qualified,
- /// or unqualified. C++-like name lookup semantics are used to search for the
- /// matching descriptor.
- /// </summary>
- internal IDescriptor LookupSymbol(string name, IDescriptor relativeTo)
- {
- // TODO(jonskeet): This could be optimized in a number of ways.
-
- IDescriptor result;
- if (name.StartsWith("."))
- {
- // Fully-qualified name.
- result = FindSymbol<IDescriptor>(name.Substring(1));
- }
- else
- {
- // If "name" is a compound identifier, we want to search for the
- // first component of it, then search within it for the rest.
- int firstPartLength = name.IndexOf('.');
- string firstPart = firstPartLength == -1 ? name : name.Substring(0, firstPartLength);
-
- // We will search each parent scope of "relativeTo" looking for the
- // symbol.
- StringBuilder scopeToTry = new StringBuilder(relativeTo.FullName);
-
- while (true)
- {
- // Chop off the last component of the scope.
-
- // TODO(jonskeet): Make this more efficient. May not be worth using StringBuilder at all
- int dotpos = scopeToTry.ToString().LastIndexOf(".");
- if (dotpos == -1)
- {
- result = FindSymbol<IDescriptor>(name);
- break;
- }
- else
- {
- scopeToTry.Length = dotpos + 1;
-
- // Append firstPart and try to find.
- scopeToTry.Append(firstPart);
- result = FindSymbol<IDescriptor>(scopeToTry.ToString());
-
- if (result != null)
- {
- if (firstPartLength != -1)
- {
- // We only found the first part of the symbol. Now look for
- // the whole thing. If this fails, we *don't* want to keep
- // searching parent scopes.
- scopeToTry.Length = dotpos + 1;
- scopeToTry.Append(name);
- result = FindSymbol<IDescriptor>(scopeToTry.ToString());
- }
- break;
- }
-
- // Not found. Remove the name so we can try again.
- scopeToTry.Length = dotpos;
- }
- }
- }
-
- if (result == null)
- {
- throw new DescriptorValidationException(relativeTo, "\"" + name + "\" is not defined.");
- }
- else
- {
- return result;
- }
- }
-
- /// <summary>
- /// Struct used to hold the keys for the fieldByNumber table.
- /// </summary>
- private struct DescriptorIntPair : IEquatable<DescriptorIntPair>
- {
- private readonly int number;
- private readonly IDescriptor descriptor;
-
- internal DescriptorIntPair(IDescriptor descriptor, int number)
- {
- this.number = number;
- this.descriptor = descriptor;
- }
-
- public bool Equals(DescriptorIntPair other)
- {
- return descriptor == other.descriptor
- && number == other.number;
- }
-
- public override bool Equals(object obj)
- {
- if (obj is DescriptorIntPair)
- {
- return Equals((DescriptorIntPair) obj);
- }
- return false;
- }
-
- public override int GetHashCode()
- {
- return descriptor.GetHashCode()*((1 << 16) - 1) + number;
- }
- }
- }
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.Text.RegularExpressions; + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// Contains lookup tables containing all the descriptors defined in a particular file. + /// </summary> + internal sealed class DescriptorPool + { + private readonly IDictionary<string, IDescriptor> descriptorsByName = + new Dictionary<string, IDescriptor>(); + + private readonly IDictionary<DescriptorIntPair, FieldDescriptor> fieldsByNumber = + new Dictionary<DescriptorIntPair, FieldDescriptor>(); + + private readonly IDictionary<DescriptorIntPair, EnumValueDescriptor> enumValuesByNumber = + new Dictionary<DescriptorIntPair, EnumValueDescriptor>(); + + private readonly HashSet<FileDescriptor> dependencies; + + internal DescriptorPool(FileDescriptor[] dependencyFiles) + { + dependencies = new HashSet<FileDescriptor>(); + for (int i = 0; i < dependencyFiles.Length; i++) + { + dependencies.Add(dependencyFiles[i]); + ImportPublicDependencies(dependencyFiles[i]); + } + + foreach (FileDescriptor dependency in dependencyFiles) + { + AddPackage(dependency.Package, dependency); + } + } + + private void ImportPublicDependencies(FileDescriptor file) + { + foreach (FileDescriptor dependency in file.PublicDependencies) + { + if (dependencies.Add(dependency)) + { + ImportPublicDependencies(dependency); + } + } + } + + /// <summary> + /// Finds a symbol of the given name within the pool. + /// </summary> + /// <typeparam name="T">The type of symbol to look for</typeparam> + /// <param name="fullName">Fully-qualified name to look up</param> + /// <returns>The symbol with the given name and type, + /// or null if the symbol doesn't exist or has the wrong type</returns> + internal T FindSymbol<T>(string fullName) where T : class + { + IDescriptor result; + descriptorsByName.TryGetValue(fullName, out result); + T descriptor = result as T; + if (descriptor != null) + { + return descriptor; + } + + foreach (FileDescriptor dependency in dependencies) + { + dependency.DescriptorPool.descriptorsByName.TryGetValue(fullName, out result); + descriptor = result as T; + if (descriptor != null) + { + return descriptor; + } + } + + return null; + } + + /// <summary> + /// Adds a package to the symbol tables. If a package by the same name + /// already exists, that is fine, but if some other kind of symbol + /// exists under the same name, an exception is thrown. If the package + /// has multiple components, this also adds the parent package(s). + /// </summary> + internal void AddPackage(string fullName, FileDescriptor file) + { + int dotpos = fullName.LastIndexOf('.'); + String name; + if (dotpos != -1) + { + AddPackage(fullName.Substring(0, dotpos), file); + name = fullName.Substring(dotpos + 1); + } + else + { + name = fullName; + } + + IDescriptor old; + if (descriptorsByName.TryGetValue(fullName, out old)) + { + if (!(old is PackageDescriptor)) + { + throw new DescriptorValidationException(file, + "\"" + name + + "\" is already defined (as something other than a " + + "package) in file \"" + old.File.Name + "\"."); + } + } + descriptorsByName[fullName] = new PackageDescriptor(name, fullName, file); + } + + /// <summary> + /// Adds a symbol to the symbol table. + /// </summary> + /// <exception cref="DescriptorValidationException">The symbol already existed + /// in the symbol table.</exception> + internal void AddSymbol(IDescriptor descriptor) + { + ValidateSymbolName(descriptor); + String fullName = descriptor.FullName; + + IDescriptor old; + if (descriptorsByName.TryGetValue(fullName, out old)) + { + int dotPos = fullName.LastIndexOf('.'); + string message; + if (descriptor.File == old.File) + { + if (dotPos == -1) + { + message = "\"" + fullName + "\" is already defined."; + } + else + { + message = "\"" + fullName.Substring(dotPos + 1) + "\" is already defined in \"" + + fullName.Substring(0, dotPos) + "\"."; + } + } + else + { + message = "\"" + fullName + "\" is already defined in file \"" + old.File.Name + "\"."; + } + throw new DescriptorValidationException(descriptor, message); + } + descriptorsByName[fullName] = descriptor; + } + + private static readonly Regex ValidationRegex = new Regex("^[_A-Za-z][_A-Za-z0-9]*$", + FrameworkPortability.CompiledRegexWhereAvailable); + + /// <summary> + /// Verifies that the descriptor's name is valid (i.e. it contains + /// only letters, digits and underscores, and does not start with a digit). + /// </summary> + /// <param name="descriptor"></param> + private static void ValidateSymbolName(IDescriptor descriptor) + { + if (descriptor.Name == "") + { + throw new DescriptorValidationException(descriptor, "Missing name."); + } + if (!ValidationRegex.IsMatch(descriptor.Name)) + { + throw new DescriptorValidationException(descriptor, + "\"" + descriptor.Name + "\" is not a valid identifier."); + } + } + + /// <summary> + /// Returns the field with the given number in the given descriptor, + /// or null if it can't be found. + /// </summary> + internal FieldDescriptor FindFieldByNumber(MessageDescriptor messageDescriptor, int number) + { + FieldDescriptor ret; + fieldsByNumber.TryGetValue(new DescriptorIntPair(messageDescriptor, number), out ret); + return ret; + } + + internal EnumValueDescriptor FindEnumValueByNumber(EnumDescriptor enumDescriptor, int number) + { + EnumValueDescriptor ret; + enumValuesByNumber.TryGetValue(new DescriptorIntPair(enumDescriptor, number), out ret); + return ret; + } + + /// <summary> + /// Adds a field to the fieldsByNumber table. + /// </summary> + /// <exception cref="DescriptorValidationException">A field with the same + /// containing type and number already exists.</exception> + internal void AddFieldByNumber(FieldDescriptor field) + { + DescriptorIntPair key = new DescriptorIntPair(field.ContainingType, field.FieldNumber); + FieldDescriptor old; + if (fieldsByNumber.TryGetValue(key, out old)) + { + throw new DescriptorValidationException(field, "Field number " + field.FieldNumber + + "has already been used in \"" + + field.ContainingType.FullName + + "\" by field \"" + old.Name + "\"."); + } + fieldsByNumber[key] = field; + } + + /// <summary> + /// Adds an enum value to the enumValuesByNumber table. If an enum value + /// with the same type and number already exists, this method does nothing. + /// (This is allowed; the first value defined with the number takes precedence.) + /// </summary> + internal void AddEnumValueByNumber(EnumValueDescriptor enumValue) + { + DescriptorIntPair key = new DescriptorIntPair(enumValue.EnumDescriptor, enumValue.Number); + if (!enumValuesByNumber.ContainsKey(key)) + { + enumValuesByNumber[key] = enumValue; + } + } + + /// <summary> + /// Looks up a descriptor by name, relative to some other descriptor. + /// The name may be fully-qualified (with a leading '.'), partially-qualified, + /// or unqualified. C++-like name lookup semantics are used to search for the + /// matching descriptor. + /// </summary> + internal IDescriptor LookupSymbol(string name, IDescriptor relativeTo) + { + // TODO(jonskeet): This could be optimized in a number of ways. + + IDescriptor result; + if (name.StartsWith(".")) + { + // Fully-qualified name. + result = FindSymbol<IDescriptor>(name.Substring(1)); + } + else + { + // If "name" is a compound identifier, we want to search for the + // first component of it, then search within it for the rest. + int firstPartLength = name.IndexOf('.'); + string firstPart = firstPartLength == -1 ? name : name.Substring(0, firstPartLength); + + // We will search each parent scope of "relativeTo" looking for the + // symbol. + StringBuilder scopeToTry = new StringBuilder(relativeTo.FullName); + + while (true) + { + // Chop off the last component of the scope. + + // TODO(jonskeet): Make this more efficient. May not be worth using StringBuilder at all + int dotpos = scopeToTry.ToString().LastIndexOf("."); + if (dotpos == -1) + { + result = FindSymbol<IDescriptor>(name); + break; + } + else + { + scopeToTry.Length = dotpos + 1; + + // Append firstPart and try to find. + scopeToTry.Append(firstPart); + result = FindSymbol<IDescriptor>(scopeToTry.ToString()); + + if (result != null) + { + if (firstPartLength != -1) + { + // We only found the first part of the symbol. Now look for + // the whole thing. If this fails, we *don't* want to keep + // searching parent scopes. + scopeToTry.Length = dotpos + 1; + scopeToTry.Append(name); + result = FindSymbol<IDescriptor>(scopeToTry.ToString()); + } + break; + } + + // Not found. Remove the name so we can try again. + scopeToTry.Length = dotpos; + } + } + } + + if (result == null) + { + throw new DescriptorValidationException(relativeTo, "\"" + name + "\" is not defined."); + } + else + { + return result; + } + } + + /// <summary> + /// Struct used to hold the keys for the fieldByNumber table. + /// </summary> + private struct DescriptorIntPair : IEquatable<DescriptorIntPair> + { + private readonly int number; + private readonly IDescriptor descriptor; + + internal DescriptorIntPair(IDescriptor descriptor, int number) + { + this.number = number; + this.descriptor = descriptor; + } + + public bool Equals(DescriptorIntPair other) + { + return descriptor == other.descriptor + && number == other.number; + } + + public override bool Equals(object obj) + { + if (obj is DescriptorIntPair) + { + return Equals((DescriptorIntPair) obj); + } + return false; + } + + public override int GetHashCode() + { + return descriptor.GetHashCode()*((1 << 16) - 1) + number; + } + } + } }
\ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs b/csharp/src/ProtocolBuffers/Reflection/DescriptorProtoFile.cs index 52f0c4b2..2ab69400 100644 --- a/csharp/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs +++ b/csharp/src/ProtocolBuffers/Reflection/DescriptorProtoFile.cs @@ -5,42 +5,42 @@ using pb = global::Google.Protobuf; using pbc = global::Google.Protobuf.Collections; -using pbd = global::Google.Protobuf.Descriptors; +using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; -namespace Google.Protobuf.DescriptorProtos { +namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal static partial class DescriptorProtoFile { #region Static variables - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_FileDescriptorSet__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_FileDescriptorProto__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_DescriptorProto__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_DescriptorProto_ExtensionRange__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_DescriptorProto_ReservedRange__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_FieldDescriptorProto__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_OneofDescriptorProto__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_EnumDescriptorProto__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_EnumValueDescriptorProto__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_ServiceDescriptorProto__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_MethodDescriptorProto__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_FileOptions__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_MessageOptions__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_FieldOptions__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_EnumOptions__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_EnumValueOptions__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_ServiceOptions__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_MethodOptions__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_UninterpretedOption__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_UninterpretedOption_NamePart__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_SourceCodeInfo__FieldAccessorTable; - internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_SourceCodeInfo_Location__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_FileDescriptorSet__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_FileDescriptorProto__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_DescriptorProto__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_DescriptorProto_ExtensionRange__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_DescriptorProto_ReservedRange__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_FieldDescriptorProto__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_OneofDescriptorProto__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_EnumDescriptorProto__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_EnumValueDescriptorProto__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_ServiceDescriptorProto__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_MethodDescriptorProto__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_FileOptions__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_MessageOptions__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_FieldOptions__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_EnumOptions__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_EnumValueOptions__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_ServiceOptions__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_MethodOptions__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_UninterpretedOption__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_UninterpretedOption_NamePart__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_SourceCodeInfo__FieldAccessorTable; + internal static pbr::FieldAccessorTable internal__static_google_protobuf_SourceCodeInfo_Location__FieldAccessorTable; #endregion #region Descriptor - public static pbd::FileDescriptor Descriptor { + public static pbr::FileDescriptor Descriptor { get { return descriptor; } } - private static pbd::FileDescriptor descriptor; + private static pbr::FileDescriptor descriptor; static DescriptorProtoFile() { byte[] descriptorData = global::System.Convert.FromBase64String( @@ -153,77 +153,77 @@ namespace Google.Protobuf.DescriptorProtos { "LkxvY2F0aW9uGoYBCghMb2NhdGlvbhIQCgRwYXRoGAEgAygFQgIQARIQCgRz", "cGFuGAIgAygFQgIQARIYChBsZWFkaW5nX2NvbW1lbnRzGAMgASgJEhkKEXRy", "YWlsaW5nX2NvbW1lbnRzGAQgASgJEiEKGWxlYWRpbmdfZGV0YWNoZWRfY29t", - "bWVudHMYBiADKAlCXgoTY29tLmdvb2dsZS5wcm90b2J1ZkIQRGVzY3JpcHRv", - "clByb3Rvc0gBWgpkZXNjcmlwdG9yogIDR1BCqgIgR29vZ2xlLlByb3RvYnVm", - "LkRlc2NyaXB0b3JQcm90b3M=")); - descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, - new pbd::FileDescriptor[] { + "bWVudHMYBiADKAlCWAoTY29tLmdvb2dsZS5wcm90b2J1ZkIQRGVzY3JpcHRv", + "clByb3Rvc0gBWgpkZXNjcmlwdG9yogIDR1BCqgIaR29vZ2xlLlByb3RvYnVm", + "LlJlZmxlY3Rpb24=")); + descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbr::FileDescriptor[] { }); internal__static_google_protobuf_FileDescriptorSet__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.FileDescriptorSet), descriptor.MessageTypes[0], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.FileDescriptorSet), descriptor.MessageTypes[0], new string[] { "File", }, new string[] { }); internal__static_google_protobuf_FileDescriptorProto__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.FileDescriptorProto), descriptor.MessageTypes[1], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.FileDescriptorProto), descriptor.MessageTypes[1], new string[] { "Name", "Package", "Dependency", "PublicDependency", "WeakDependency", "MessageType", "EnumType", "Service", "Extension", "Options", "SourceCodeInfo", "Syntax", }, new string[] { }); internal__static_google_protobuf_DescriptorProto__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.DescriptorProto), descriptor.MessageTypes[2], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.DescriptorProto), descriptor.MessageTypes[2], new string[] { "Name", "Field", "Extension", "NestedType", "EnumType", "ExtensionRange", "OneofDecl", "Options", "ReservedRange", "ReservedName", }, new string[] { }); internal__static_google_protobuf_DescriptorProto_ExtensionRange__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.DescriptorProto.Types.ExtensionRange), descriptor.MessageTypes[2].NestedTypes[0], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange), descriptor.MessageTypes[2].NestedTypes[0], new string[] { "Start", "End", }, new string[] { }); internal__static_google_protobuf_DescriptorProto_ReservedRange__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.DescriptorProto.Types.ReservedRange), descriptor.MessageTypes[2].NestedTypes[1], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange), descriptor.MessageTypes[2].NestedTypes[1], new string[] { "Start", "End", }, new string[] { }); internal__static_google_protobuf_FieldDescriptorProto__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto), descriptor.MessageTypes[3], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto), descriptor.MessageTypes[3], new string[] { "Name", "Number", "Label", "Type", "TypeName", "Extendee", "DefaultValue", "OneofIndex", "Options", }, new string[] { }); internal__static_google_protobuf_OneofDescriptorProto__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.OneofDescriptorProto), descriptor.MessageTypes[4], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.OneofDescriptorProto), descriptor.MessageTypes[4], new string[] { "Name", }, new string[] { }); internal__static_google_protobuf_EnumDescriptorProto__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.EnumDescriptorProto), descriptor.MessageTypes[5], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto), descriptor.MessageTypes[5], new string[] { "Name", "Value", "Options", }, new string[] { }); internal__static_google_protobuf_EnumValueDescriptorProto__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.EnumValueDescriptorProto), descriptor.MessageTypes[6], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.EnumValueDescriptorProto), descriptor.MessageTypes[6], new string[] { "Name", "Number", "Options", }, new string[] { }); internal__static_google_protobuf_ServiceDescriptorProto__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.ServiceDescriptorProto), descriptor.MessageTypes[7], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.ServiceDescriptorProto), descriptor.MessageTypes[7], new string[] { "Name", "Method", "Options", }, new string[] { }); internal__static_google_protobuf_MethodDescriptorProto__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.MethodDescriptorProto), descriptor.MessageTypes[8], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.MethodDescriptorProto), descriptor.MessageTypes[8], new string[] { "Name", "InputType", "OutputType", "Options", "ClientStreaming", "ServerStreaming", }, new string[] { }); internal__static_google_protobuf_FileOptions__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.FileOptions), descriptor.MessageTypes[9], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.FileOptions), descriptor.MessageTypes[9], new string[] { "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "JavaGenerateEqualsAndHash", "JavaStringCheckUtf8", "OptimizeFor", "GoPackage", "CcGenericServices", "JavaGenericServices", "PyGenericServices", "Deprecated", "CcEnableArenas", "ObjcClassPrefix", "CsharpNamespace", "UninterpretedOption", }, new string[] { }); internal__static_google_protobuf_MessageOptions__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.MessageOptions), descriptor.MessageTypes[10], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.MessageOptions), descriptor.MessageTypes[10], new string[] { "MessageSetWireFormat", "NoStandardDescriptorAccessor", "Deprecated", "MapEntry", "UninterpretedOption", }, new string[] { }); internal__static_google_protobuf_FieldOptions__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.FieldOptions), descriptor.MessageTypes[11], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.FieldOptions), descriptor.MessageTypes[11], new string[] { "Ctype", "Packed", "Jstype", "Lazy", "Deprecated", "Weak", "UninterpretedOption", }, new string[] { }); internal__static_google_protobuf_EnumOptions__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.EnumOptions), descriptor.MessageTypes[12], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.EnumOptions), descriptor.MessageTypes[12], new string[] { "AllowAlias", "Deprecated", "UninterpretedOption", }, new string[] { }); internal__static_google_protobuf_EnumValueOptions__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.EnumValueOptions), descriptor.MessageTypes[13], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.EnumValueOptions), descriptor.MessageTypes[13], new string[] { "Deprecated", "UninterpretedOption", }, new string[] { }); internal__static_google_protobuf_ServiceOptions__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.ServiceOptions), descriptor.MessageTypes[14], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.ServiceOptions), descriptor.MessageTypes[14], new string[] { "Deprecated", "UninterpretedOption", }, new string[] { }); internal__static_google_protobuf_MethodOptions__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.MethodOptions), descriptor.MessageTypes[15], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.MethodOptions), descriptor.MessageTypes[15], new string[] { "Deprecated", "UninterpretedOption", }, new string[] { }); internal__static_google_protobuf_UninterpretedOption__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.UninterpretedOption), descriptor.MessageTypes[16], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.UninterpretedOption), descriptor.MessageTypes[16], new string[] { "Name", "IdentifierValue", "PositiveIntValue", "NegativeIntValue", "DoubleValue", "StringValue", "AggregateValue", }, new string[] { }); internal__static_google_protobuf_UninterpretedOption_NamePart__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.UninterpretedOption.Types.NamePart), descriptor.MessageTypes[16].NestedTypes[0], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart), descriptor.MessageTypes[16].NestedTypes[0], new string[] { "NamePart_", "IsExtension", }, new string[] { }); internal__static_google_protobuf_SourceCodeInfo__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.SourceCodeInfo), descriptor.MessageTypes[17], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo), descriptor.MessageTypes[17], new string[] { "Location", }, new string[] { }); internal__static_google_protobuf_SourceCodeInfo_Location__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(typeof(global::Google.Protobuf.DescriptorProtos.SourceCodeInfo.Types.Location), descriptor.MessageTypes[17].NestedTypes[0], + new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location), descriptor.MessageTypes[17].NestedTypes[0], new string[] { "Path", "Span", "LeadingComments", "TrailingComments", "LeadingDetachedComments", }, new string[] { }); } #endregion @@ -237,12 +237,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "file" }; private static readonly uint[] _fieldTags = new uint[] { 10 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.Descriptor.MessageTypes[0]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_FileDescriptorSet__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_FileDescriptorSet__FieldAccessorTable; } } private bool _frozen = false; @@ -271,10 +271,10 @@ namespace Google.Protobuf.DescriptorProtos { } public const int FileFieldNumber = 1; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.FileDescriptorProto> _repeated_file_codec - = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.DescriptorProtos.FileDescriptorProto.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.FileDescriptorProto> file_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.FileDescriptorProto>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.FileDescriptorProto> File { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.FileDescriptorProto> _repeated_file_codec + = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.FileDescriptorProto.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.FileDescriptorProto> file_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.FileDescriptorProto>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.FileDescriptorProto> File { get { return file_; } } @@ -348,12 +348,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "dependency", "enum_type", "extension", "message_type", "name", "options", "package", "public_dependency", "service", "source_code_info", "syntax", "weak_dependency" }; private static readonly uint[] _fieldTags = new uint[] { 26, 42, 58, 34, 10, 66, 18, 80, 50, 74, 98, 88 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.Descriptor.MessageTypes[1]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[1]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_FileDescriptorProto__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_FileDescriptorProto__FieldAccessorTable; } } private bool _frozen = false; @@ -445,40 +445,40 @@ namespace Google.Protobuf.DescriptorProtos { } public const int MessageTypeFieldNumber = 4; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.DescriptorProto> _repeated_messageType_codec - = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.DescriptorProtos.DescriptorProto.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.DescriptorProto> messageType_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.DescriptorProto>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.DescriptorProto> MessageType { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.DescriptorProto> _repeated_messageType_codec + = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Reflection.DescriptorProto.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto> messageType_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto> MessageType { get { return messageType_; } } public const int EnumTypeFieldNumber = 5; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.EnumDescriptorProto> _repeated_enumType_codec - = pb::FieldCodec.ForMessage(42, global::Google.Protobuf.DescriptorProtos.EnumDescriptorProto.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.EnumDescriptorProto> enumType_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.EnumDescriptorProto>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.EnumDescriptorProto> EnumType { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.EnumDescriptorProto> _repeated_enumType_codec + = pb::FieldCodec.ForMessage(42, global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto> enumType_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto> EnumType { get { return enumType_; } } public const int ServiceFieldNumber = 6; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.ServiceDescriptorProto> _repeated_service_codec - = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.DescriptorProtos.ServiceDescriptorProto.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.ServiceDescriptorProto> service_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.ServiceDescriptorProto>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.ServiceDescriptorProto> Service { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.ServiceDescriptorProto> _repeated_service_codec + = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.Reflection.ServiceDescriptorProto.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.ServiceDescriptorProto> service_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.ServiceDescriptorProto>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.ServiceDescriptorProto> Service { get { return service_; } } public const int ExtensionFieldNumber = 7; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto> _repeated_extension_codec - = pb::FieldCodec.ForMessage(58, global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto> extension_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto> Extension { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.FieldDescriptorProto> _repeated_extension_codec + = pb::FieldCodec.ForMessage(58, global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> extension_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> Extension { get { return extension_; } } public const int OptionsFieldNumber = 8; - private global::Google.Protobuf.DescriptorProtos.FileOptions options_; - internal global::Google.Protobuf.DescriptorProtos.FileOptions Options { + private global::Google.Protobuf.Reflection.FileOptions options_; + internal global::Google.Protobuf.Reflection.FileOptions Options { get { return options_; } set { pb::Freezable.CheckMutable(this); @@ -487,8 +487,8 @@ namespace Google.Protobuf.DescriptorProtos { } public const int SourceCodeInfoFieldNumber = 9; - private global::Google.Protobuf.DescriptorProtos.SourceCodeInfo sourceCodeInfo_; - internal global::Google.Protobuf.DescriptorProtos.SourceCodeInfo SourceCodeInfo { + private global::Google.Protobuf.Reflection.SourceCodeInfo sourceCodeInfo_; + internal global::Google.Protobuf.Reflection.SourceCodeInfo SourceCodeInfo { get { return sourceCodeInfo_; } set { pb::Freezable.CheckMutable(this); @@ -629,13 +629,13 @@ namespace Google.Protobuf.DescriptorProtos { extension_.Add(other.extension_); if (other.options_ != null) { if (options_ == null) { - options_ = new global::Google.Protobuf.DescriptorProtos.FileOptions(); + options_ = new global::Google.Protobuf.Reflection.FileOptions(); } Options.MergeFrom(other.Options); } if (other.sourceCodeInfo_ != null) { if (sourceCodeInfo_ == null) { - sourceCodeInfo_ = new global::Google.Protobuf.DescriptorProtos.SourceCodeInfo(); + sourceCodeInfo_ = new global::Google.Protobuf.Reflection.SourceCodeInfo(); } SourceCodeInfo.MergeFrom(other.SourceCodeInfo); } @@ -685,14 +685,14 @@ namespace Google.Protobuf.DescriptorProtos { } case 66: { if (options_ == null) { - options_ = new global::Google.Protobuf.DescriptorProtos.FileOptions(); + options_ = new global::Google.Protobuf.Reflection.FileOptions(); } input.ReadMessage(options_); break; } case 74: { if (sourceCodeInfo_ == null) { - sourceCodeInfo_ = new global::Google.Protobuf.DescriptorProtos.SourceCodeInfo(); + sourceCodeInfo_ = new global::Google.Protobuf.Reflection.SourceCodeInfo(); } input.ReadMessage(sourceCodeInfo_); break; @@ -724,12 +724,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "enum_type", "extension", "extension_range", "field", "name", "nested_type", "oneof_decl", "options", "reserved_name", "reserved_range" }; private static readonly uint[] _fieldTags = new uint[] { 34, 50, 42, 18, 10, 26, 66, 58, 82, 74 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.Descriptor.MessageTypes[2]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[2]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_DescriptorProto__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_DescriptorProto__FieldAccessorTable; } } private bool _frozen = false; @@ -785,56 +785,56 @@ namespace Google.Protobuf.DescriptorProtos { } public const int FieldFieldNumber = 2; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto> _repeated_field_codec - = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto> field_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto> Field { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.FieldDescriptorProto> _repeated_field_codec + = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> field_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> Field { get { return field_; } } public const int ExtensionFieldNumber = 6; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto> _repeated_extension_codec - = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto> extension_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto> Extension { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.FieldDescriptorProto> _repeated_extension_codec + = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> extension_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> Extension { get { return extension_; } } public const int NestedTypeFieldNumber = 3; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.DescriptorProto> _repeated_nestedType_codec - = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.DescriptorProtos.DescriptorProto.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.DescriptorProto> nestedType_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.DescriptorProto>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.DescriptorProto> NestedType { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.DescriptorProto> _repeated_nestedType_codec + = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.Reflection.DescriptorProto.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto> nestedType_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto> NestedType { get { return nestedType_; } } public const int EnumTypeFieldNumber = 4; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.EnumDescriptorProto> _repeated_enumType_codec - = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.DescriptorProtos.EnumDescriptorProto.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.EnumDescriptorProto> enumType_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.EnumDescriptorProto>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.EnumDescriptorProto> EnumType { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.EnumDescriptorProto> _repeated_enumType_codec + = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto> enumType_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto> EnumType { get { return enumType_; } } public const int ExtensionRangeFieldNumber = 5; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.DescriptorProto.Types.ExtensionRange> _repeated_extensionRange_codec - = pb::FieldCodec.ForMessage(42, global::Google.Protobuf.DescriptorProtos.DescriptorProto.Types.ExtensionRange.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.DescriptorProto.Types.ExtensionRange> extensionRange_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.DescriptorProto.Types.ExtensionRange>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.DescriptorProto.Types.ExtensionRange> ExtensionRange { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange> _repeated_extensionRange_codec + = pb::FieldCodec.ForMessage(42, global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange> extensionRange_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange> ExtensionRange { get { return extensionRange_; } } public const int OneofDeclFieldNumber = 8; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.OneofDescriptorProto> _repeated_oneofDecl_codec - = pb::FieldCodec.ForMessage(66, global::Google.Protobuf.DescriptorProtos.OneofDescriptorProto.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.OneofDescriptorProto> oneofDecl_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.OneofDescriptorProto>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.OneofDescriptorProto> OneofDecl { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.OneofDescriptorProto> _repeated_oneofDecl_codec + = pb::FieldCodec.ForMessage(66, global::Google.Protobuf.Reflection.OneofDescriptorProto.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.OneofDescriptorProto> oneofDecl_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.OneofDescriptorProto>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.OneofDescriptorProto> OneofDecl { get { return oneofDecl_; } } public const int OptionsFieldNumber = 7; - private global::Google.Protobuf.DescriptorProtos.MessageOptions options_; - internal global::Google.Protobuf.DescriptorProtos.MessageOptions Options { + private global::Google.Protobuf.Reflection.MessageOptions options_; + internal global::Google.Protobuf.Reflection.MessageOptions Options { get { return options_; } set { pb::Freezable.CheckMutable(this); @@ -843,10 +843,10 @@ namespace Google.Protobuf.DescriptorProtos { } public const int ReservedRangeFieldNumber = 9; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.DescriptorProto.Types.ReservedRange> _repeated_reservedRange_codec - = pb::FieldCodec.ForMessage(74, global::Google.Protobuf.DescriptorProtos.DescriptorProto.Types.ReservedRange.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.DescriptorProto.Types.ReservedRange> reservedRange_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.DescriptorProto.Types.ReservedRange>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.DescriptorProto.Types.ReservedRange> ReservedRange { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange> _repeated_reservedRange_codec + = pb::FieldCodec.ForMessage(74, global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange> reservedRange_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange> ReservedRange { get { return reservedRange_; } } @@ -954,7 +954,7 @@ namespace Google.Protobuf.DescriptorProtos { oneofDecl_.Add(other.oneofDecl_); if (other.options_ != null) { if (options_ == null) { - options_ = new global::Google.Protobuf.DescriptorProtos.MessageOptions(); + options_ = new global::Google.Protobuf.Reflection.MessageOptions(); } Options.MergeFrom(other.Options); } @@ -999,7 +999,7 @@ namespace Google.Protobuf.DescriptorProtos { } case 58: { if (options_ == null) { - options_ = new global::Google.Protobuf.DescriptorProtos.MessageOptions(); + options_ = new global::Google.Protobuf.Reflection.MessageOptions(); } input.ReadMessage(options_); break; @@ -1030,12 +1030,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "end", "start" }; private static readonly uint[] _fieldTags = new uint[] { 16, 8 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProto.Descriptor.NestedTypes[0]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProto.Descriptor.NestedTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_DescriptorProto_ExtensionRange__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_DescriptorProto_ExtensionRange__FieldAccessorTable; } } private bool _frozen = false; @@ -1176,12 +1176,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "end", "start" }; private static readonly uint[] _fieldTags = new uint[] { 16, 8 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProto.Descriptor.NestedTypes[1]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProto.Descriptor.NestedTypes[1]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_DescriptorProto_ReservedRange__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_DescriptorProto_ReservedRange__FieldAccessorTable; } } private bool _frozen = false; @@ -1327,12 +1327,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "default_value", "extendee", "label", "name", "number", "oneof_index", "options", "type", "type_name" }; private static readonly uint[] _fieldTags = new uint[] { 58, 18, 32, 10, 24, 72, 66, 40, 50 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.Descriptor.MessageTypes[3]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[3]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_FieldDescriptorProto__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_FieldDescriptorProto__FieldAccessorTable; } } private bool _frozen = false; @@ -1389,8 +1389,8 @@ namespace Google.Protobuf.DescriptorProtos { } public const int LabelFieldNumber = 4; - private global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Label label_ = global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL; - internal global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Label Label { + private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label label_ = global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL; + internal global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label Label { get { return label_; } set { pb::Freezable.CheckMutable(this); @@ -1399,8 +1399,8 @@ namespace Google.Protobuf.DescriptorProtos { } public const int TypeFieldNumber = 5; - private global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Type type_ = global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Type.TYPE_DOUBLE; - internal global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Type Type { + private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type type_ = global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type.TYPE_DOUBLE; + internal global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type Type { get { return type_; } set { pb::Freezable.CheckMutable(this); @@ -1449,8 +1449,8 @@ namespace Google.Protobuf.DescriptorProtos { } public const int OptionsFieldNumber = 8; - private global::Google.Protobuf.DescriptorProtos.FieldOptions options_; - internal global::Google.Protobuf.DescriptorProtos.FieldOptions Options { + private global::Google.Protobuf.Reflection.FieldOptions options_; + internal global::Google.Protobuf.Reflection.FieldOptions Options { get { return options_; } set { pb::Freezable.CheckMutable(this); @@ -1485,8 +1485,8 @@ namespace Google.Protobuf.DescriptorProtos { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); if (Number != 0) hash ^= Number.GetHashCode(); - if (Label != global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL) hash ^= Label.GetHashCode(); - if (Type != global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Type.TYPE_DOUBLE) hash ^= Type.GetHashCode(); + if (Label != global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL) hash ^= Label.GetHashCode(); + if (Type != global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type.TYPE_DOUBLE) hash ^= Type.GetHashCode(); if (TypeName.Length != 0) hash ^= TypeName.GetHashCode(); if (Extendee.Length != 0) hash ^= Extendee.GetHashCode(); if (DefaultValue.Length != 0) hash ^= DefaultValue.GetHashCode(); @@ -1512,11 +1512,11 @@ namespace Google.Protobuf.DescriptorProtos { output.WriteRawTag(24); output.WriteInt32(Number); } - if (Label != global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL) { + if (Label != global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL) { output.WriteRawTag(32); output.WriteEnum((int) Label); } - if (Type != global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Type.TYPE_DOUBLE) { + if (Type != global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type.TYPE_DOUBLE) { output.WriteRawTag(40); output.WriteEnum((int) Type); } @@ -1546,10 +1546,10 @@ namespace Google.Protobuf.DescriptorProtos { if (Number != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Number); } - if (Label != global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL) { + if (Label != global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Label); } - if (Type != global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Type.TYPE_DOUBLE) { + if (Type != global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type.TYPE_DOUBLE) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type); } if (TypeName.Length != 0) { @@ -1580,10 +1580,10 @@ namespace Google.Protobuf.DescriptorProtos { if (other.Number != 0) { Number = other.Number; } - if (other.Label != global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL) { + if (other.Label != global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL) { Label = other.Label; } - if (other.Type != global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Type.TYPE_DOUBLE) { + if (other.Type != global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type.TYPE_DOUBLE) { Type = other.Type; } if (other.TypeName.Length != 0) { @@ -1600,7 +1600,7 @@ namespace Google.Protobuf.DescriptorProtos { } if (other.options_ != null) { if (options_ == null) { - options_ = new global::Google.Protobuf.DescriptorProtos.FieldOptions(); + options_ = new global::Google.Protobuf.Reflection.FieldOptions(); } Options.MergeFrom(other.Options); } @@ -1630,11 +1630,11 @@ namespace Google.Protobuf.DescriptorProtos { break; } case 32: { - label_ = (global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Label) input.ReadEnum(); + label_ = (global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label) input.ReadEnum(); break; } case 40: { - type_ = (global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Type) input.ReadEnum(); + type_ = (global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type) input.ReadEnum(); break; } case 50: { @@ -1647,7 +1647,7 @@ namespace Google.Protobuf.DescriptorProtos { } case 66: { if (options_ == null) { - options_ = new global::Google.Protobuf.DescriptorProtos.FieldOptions(); + options_ = new global::Google.Protobuf.Reflection.FieldOptions(); } input.ReadMessage(options_); break; @@ -1702,12 +1702,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "name" }; private static readonly uint[] _fieldTags = new uint[] { 10 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.Descriptor.MessageTypes[4]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[4]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_OneofDescriptorProto__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_OneofDescriptorProto__FieldAccessorTable; } } private bool _frozen = false; @@ -1821,12 +1821,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "name", "options", "value" }; private static readonly uint[] _fieldTags = new uint[] { 10, 26, 18 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.Descriptor.MessageTypes[5]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[5]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_EnumDescriptorProto__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_EnumDescriptorProto__FieldAccessorTable; } } private bool _frozen = false; @@ -1868,16 +1868,16 @@ namespace Google.Protobuf.DescriptorProtos { } public const int ValueFieldNumber = 2; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.EnumValueDescriptorProto> _repeated_value_codec - = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.DescriptorProtos.EnumValueDescriptorProto.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.EnumValueDescriptorProto> value_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.EnumValueDescriptorProto>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.EnumValueDescriptorProto> Value { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.EnumValueDescriptorProto> _repeated_value_codec + = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.EnumValueDescriptorProto.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumValueDescriptorProto> value_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumValueDescriptorProto>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumValueDescriptorProto> Value { get { return value_; } } public const int OptionsFieldNumber = 3; - private global::Google.Protobuf.DescriptorProtos.EnumOptions options_; - internal global::Google.Protobuf.DescriptorProtos.EnumOptions Options { + private global::Google.Protobuf.Reflection.EnumOptions options_; + internal global::Google.Protobuf.Reflection.EnumOptions Options { get { return options_; } set { pb::Freezable.CheckMutable(this); @@ -1948,7 +1948,7 @@ namespace Google.Protobuf.DescriptorProtos { value_.Add(other.value_); if (other.options_ != null) { if (options_ == null) { - options_ = new global::Google.Protobuf.DescriptorProtos.EnumOptions(); + options_ = new global::Google.Protobuf.Reflection.EnumOptions(); } Options.MergeFrom(other.Options); } @@ -1975,7 +1975,7 @@ namespace Google.Protobuf.DescriptorProtos { } case 26: { if (options_ == null) { - options_ = new global::Google.Protobuf.DescriptorProtos.EnumOptions(); + options_ = new global::Google.Protobuf.Reflection.EnumOptions(); } input.ReadMessage(options_); break; @@ -1993,12 +1993,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "name", "number", "options" }; private static readonly uint[] _fieldTags = new uint[] { 10, 16, 26 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.Descriptor.MessageTypes[6]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[6]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_EnumValueDescriptorProto__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_EnumValueDescriptorProto__FieldAccessorTable; } } private bool _frozen = false; @@ -2049,8 +2049,8 @@ namespace Google.Protobuf.DescriptorProtos { } public const int OptionsFieldNumber = 3; - private global::Google.Protobuf.DescriptorProtos.EnumValueOptions options_; - internal global::Google.Protobuf.DescriptorProtos.EnumValueOptions Options { + private global::Google.Protobuf.Reflection.EnumValueOptions options_; + internal global::Google.Protobuf.Reflection.EnumValueOptions Options { get { return options_; } set { pb::Freezable.CheckMutable(this); @@ -2128,7 +2128,7 @@ namespace Google.Protobuf.DescriptorProtos { } if (other.options_ != null) { if (options_ == null) { - options_ = new global::Google.Protobuf.DescriptorProtos.EnumValueOptions(); + options_ = new global::Google.Protobuf.Reflection.EnumValueOptions(); } Options.MergeFrom(other.Options); } @@ -2155,7 +2155,7 @@ namespace Google.Protobuf.DescriptorProtos { } case 26: { if (options_ == null) { - options_ = new global::Google.Protobuf.DescriptorProtos.EnumValueOptions(); + options_ = new global::Google.Protobuf.Reflection.EnumValueOptions(); } input.ReadMessage(options_); break; @@ -2173,12 +2173,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "method", "name", "options" }; private static readonly uint[] _fieldTags = new uint[] { 18, 10, 26 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.Descriptor.MessageTypes[7]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[7]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_ServiceDescriptorProto__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_ServiceDescriptorProto__FieldAccessorTable; } } private bool _frozen = false; @@ -2220,16 +2220,16 @@ namespace Google.Protobuf.DescriptorProtos { } public const int MethodFieldNumber = 2; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.MethodDescriptorProto> _repeated_method_codec - = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.DescriptorProtos.MethodDescriptorProto.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.MethodDescriptorProto> method_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.MethodDescriptorProto>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.MethodDescriptorProto> Method { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.MethodDescriptorProto> _repeated_method_codec + = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.MethodDescriptorProto.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.MethodDescriptorProto> method_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.MethodDescriptorProto>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.MethodDescriptorProto> Method { get { return method_; } } public const int OptionsFieldNumber = 3; - private global::Google.Protobuf.DescriptorProtos.ServiceOptions options_; - internal global::Google.Protobuf.DescriptorProtos.ServiceOptions Options { + private global::Google.Protobuf.Reflection.ServiceOptions options_; + internal global::Google.Protobuf.Reflection.ServiceOptions Options { get { return options_; } set { pb::Freezable.CheckMutable(this); @@ -2300,7 +2300,7 @@ namespace Google.Protobuf.DescriptorProtos { method_.Add(other.method_); if (other.options_ != null) { if (options_ == null) { - options_ = new global::Google.Protobuf.DescriptorProtos.ServiceOptions(); + options_ = new global::Google.Protobuf.Reflection.ServiceOptions(); } Options.MergeFrom(other.Options); } @@ -2327,7 +2327,7 @@ namespace Google.Protobuf.DescriptorProtos { } case 26: { if (options_ == null) { - options_ = new global::Google.Protobuf.DescriptorProtos.ServiceOptions(); + options_ = new global::Google.Protobuf.Reflection.ServiceOptions(); } input.ReadMessage(options_); break; @@ -2345,12 +2345,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "client_streaming", "input_type", "name", "options", "output_type", "server_streaming" }; private static readonly uint[] _fieldTags = new uint[] { 40, 18, 10, 34, 26, 48 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.Descriptor.MessageTypes[8]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[8]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_MethodDescriptorProto__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_MethodDescriptorProto__FieldAccessorTable; } } private bool _frozen = false; @@ -2414,8 +2414,8 @@ namespace Google.Protobuf.DescriptorProtos { } public const int OptionsFieldNumber = 4; - private global::Google.Protobuf.DescriptorProtos.MethodOptions options_; - internal global::Google.Protobuf.DescriptorProtos.MethodOptions Options { + private global::Google.Protobuf.Reflection.MethodOptions options_; + internal global::Google.Protobuf.Reflection.MethodOptions Options { get { return options_; } set { pb::Freezable.CheckMutable(this); @@ -2543,7 +2543,7 @@ namespace Google.Protobuf.DescriptorProtos { } if (other.options_ != null) { if (options_ == null) { - options_ = new global::Google.Protobuf.DescriptorProtos.MethodOptions(); + options_ = new global::Google.Protobuf.Reflection.MethodOptions(); } Options.MergeFrom(other.Options); } @@ -2580,7 +2580,7 @@ namespace Google.Protobuf.DescriptorProtos { } case 34: { if (options_ == null) { - options_ = new global::Google.Protobuf.DescriptorProtos.MethodOptions(); + options_ = new global::Google.Protobuf.Reflection.MethodOptions(); } input.ReadMessage(options_); break; @@ -2606,12 +2606,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "cc_enable_arenas", "cc_generic_services", "csharp_namespace", "deprecated", "go_package", "java_generate_equals_and_hash", "java_generic_services", "java_multiple_files", "java_outer_classname", "java_package", "java_string_check_utf8", "objc_class_prefix", "optimize_for", "py_generic_services", "uninterpreted_option" }; private static readonly uint[] _fieldTags = new uint[] { 248, 128, 298, 184, 90, 160, 136, 80, 66, 10, 216, 290, 72, 144, 7994 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.Descriptor.MessageTypes[9]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[9]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_FileOptions__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_FileOptions__FieldAccessorTable; } } private bool _frozen = false; @@ -2704,8 +2704,8 @@ namespace Google.Protobuf.DescriptorProtos { } public const int OptimizeForFieldNumber = 9; - private global::Google.Protobuf.DescriptorProtos.FileOptions.Types.OptimizeMode optimizeFor_ = global::Google.Protobuf.DescriptorProtos.FileOptions.Types.OptimizeMode.SPEED; - internal global::Google.Protobuf.DescriptorProtos.FileOptions.Types.OptimizeMode OptimizeFor { + private global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode optimizeFor_ = global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode.SPEED; + internal global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode OptimizeFor { get { return optimizeFor_; } set { pb::Freezable.CheckMutable(this); @@ -2794,10 +2794,10 @@ namespace Google.Protobuf.DescriptorProtos { } public const int UninterpretedOptionFieldNumber = 999; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> _repeated_uninterpretedOption_codec - = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.DescriptorProtos.UninterpretedOption.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> UninterpretedOption { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec + = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption { get { return uninterpretedOption_; } } @@ -2837,7 +2837,7 @@ namespace Google.Protobuf.DescriptorProtos { if (JavaMultipleFiles != false) hash ^= JavaMultipleFiles.GetHashCode(); if (JavaGenerateEqualsAndHash != false) hash ^= JavaGenerateEqualsAndHash.GetHashCode(); if (JavaStringCheckUtf8 != false) hash ^= JavaStringCheckUtf8.GetHashCode(); - if (OptimizeFor != global::Google.Protobuf.DescriptorProtos.FileOptions.Types.OptimizeMode.SPEED) hash ^= OptimizeFor.GetHashCode(); + if (OptimizeFor != global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode.SPEED) hash ^= OptimizeFor.GetHashCode(); if (GoPackage.Length != 0) hash ^= GoPackage.GetHashCode(); if (CcGenericServices != false) hash ^= CcGenericServices.GetHashCode(); if (JavaGenericServices != false) hash ^= JavaGenericServices.GetHashCode(); @@ -2863,7 +2863,7 @@ namespace Google.Protobuf.DescriptorProtos { output.WriteRawTag(66); output.WriteString(JavaOuterClassname); } - if (OptimizeFor != global::Google.Protobuf.DescriptorProtos.FileOptions.Types.OptimizeMode.SPEED) { + if (OptimizeFor != global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode.SPEED) { output.WriteRawTag(72); output.WriteEnum((int) OptimizeFor); } @@ -2931,7 +2931,7 @@ namespace Google.Protobuf.DescriptorProtos { if (JavaStringCheckUtf8 != false) { size += 2 + 1; } - if (OptimizeFor != global::Google.Protobuf.DescriptorProtos.FileOptions.Types.OptimizeMode.SPEED) { + if (OptimizeFor != global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode.SPEED) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) OptimizeFor); } if (GoPackage.Length != 0) { @@ -2981,7 +2981,7 @@ namespace Google.Protobuf.DescriptorProtos { if (other.JavaStringCheckUtf8 != false) { JavaStringCheckUtf8 = other.JavaStringCheckUtf8; } - if (other.OptimizeFor != global::Google.Protobuf.DescriptorProtos.FileOptions.Types.OptimizeMode.SPEED) { + if (other.OptimizeFor != global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode.SPEED) { OptimizeFor = other.OptimizeFor; } if (other.GoPackage.Length != 0) { @@ -3031,7 +3031,7 @@ namespace Google.Protobuf.DescriptorProtos { break; } case 72: { - optimizeFor_ = (global::Google.Protobuf.DescriptorProtos.FileOptions.Types.OptimizeMode) input.ReadEnum(); + optimizeFor_ = (global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) input.ReadEnum(); break; } case 80: { @@ -3107,12 +3107,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "deprecated", "map_entry", "message_set_wire_format", "no_standard_descriptor_accessor", "uninterpreted_option" }; private static readonly uint[] _fieldTags = new uint[] { 24, 56, 8, 16, 7994 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.Descriptor.MessageTypes[10]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[10]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_MessageOptions__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_MessageOptions__FieldAccessorTable; } } private bool _frozen = false; @@ -3185,10 +3185,10 @@ namespace Google.Protobuf.DescriptorProtos { } public const int UninterpretedOptionFieldNumber = 999; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> _repeated_uninterpretedOption_codec - = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.DescriptorProtos.UninterpretedOption.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> UninterpretedOption { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec + = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption { get { return uninterpretedOption_; } } @@ -3326,12 +3326,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "ctype", "deprecated", "jstype", "lazy", "packed", "uninterpreted_option", "weak" }; private static readonly uint[] _fieldTags = new uint[] { 8, 24, 48, 40, 16, 7994, 80 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.Descriptor.MessageTypes[11]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[11]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_FieldOptions__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_FieldOptions__FieldAccessorTable; } } private bool _frozen = false; @@ -3366,8 +3366,8 @@ namespace Google.Protobuf.DescriptorProtos { } public const int CtypeFieldNumber = 1; - private global::Google.Protobuf.DescriptorProtos.FieldOptions.Types.CType ctype_ = global::Google.Protobuf.DescriptorProtos.FieldOptions.Types.CType.STRING; - internal global::Google.Protobuf.DescriptorProtos.FieldOptions.Types.CType Ctype { + private global::Google.Protobuf.Reflection.FieldOptions.Types.CType ctype_ = global::Google.Protobuf.Reflection.FieldOptions.Types.CType.STRING; + internal global::Google.Protobuf.Reflection.FieldOptions.Types.CType Ctype { get { return ctype_; } set { pb::Freezable.CheckMutable(this); @@ -3386,8 +3386,8 @@ namespace Google.Protobuf.DescriptorProtos { } public const int JstypeFieldNumber = 6; - private global::Google.Protobuf.DescriptorProtos.FieldOptions.Types.JSType jstype_ = global::Google.Protobuf.DescriptorProtos.FieldOptions.Types.JSType.JS_NORMAL; - internal global::Google.Protobuf.DescriptorProtos.FieldOptions.Types.JSType Jstype { + private global::Google.Protobuf.Reflection.FieldOptions.Types.JSType jstype_ = global::Google.Protobuf.Reflection.FieldOptions.Types.JSType.JS_NORMAL; + internal global::Google.Protobuf.Reflection.FieldOptions.Types.JSType Jstype { get { return jstype_; } set { pb::Freezable.CheckMutable(this); @@ -3426,10 +3426,10 @@ namespace Google.Protobuf.DescriptorProtos { } public const int UninterpretedOptionFieldNumber = 999; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> _repeated_uninterpretedOption_codec - = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.DescriptorProtos.UninterpretedOption.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> UninterpretedOption { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec + = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption { get { return uninterpretedOption_; } } @@ -3456,9 +3456,9 @@ namespace Google.Protobuf.DescriptorProtos { public override int GetHashCode() { int hash = 1; - if (Ctype != global::Google.Protobuf.DescriptorProtos.FieldOptions.Types.CType.STRING) hash ^= Ctype.GetHashCode(); + if (Ctype != global::Google.Protobuf.Reflection.FieldOptions.Types.CType.STRING) hash ^= Ctype.GetHashCode(); if (Packed != false) hash ^= Packed.GetHashCode(); - if (Jstype != global::Google.Protobuf.DescriptorProtos.FieldOptions.Types.JSType.JS_NORMAL) hash ^= Jstype.GetHashCode(); + if (Jstype != global::Google.Protobuf.Reflection.FieldOptions.Types.JSType.JS_NORMAL) hash ^= Jstype.GetHashCode(); if (Lazy != false) hash ^= Lazy.GetHashCode(); if (Deprecated != false) hash ^= Deprecated.GetHashCode(); if (Weak != false) hash ^= Weak.GetHashCode(); @@ -3471,7 +3471,7 @@ namespace Google.Protobuf.DescriptorProtos { } public void WriteTo(pb::CodedOutputStream output) { - if (Ctype != global::Google.Protobuf.DescriptorProtos.FieldOptions.Types.CType.STRING) { + if (Ctype != global::Google.Protobuf.Reflection.FieldOptions.Types.CType.STRING) { output.WriteRawTag(8); output.WriteEnum((int) Ctype); } @@ -3487,7 +3487,7 @@ namespace Google.Protobuf.DescriptorProtos { output.WriteRawTag(40); output.WriteBool(Lazy); } - if (Jstype != global::Google.Protobuf.DescriptorProtos.FieldOptions.Types.JSType.JS_NORMAL) { + if (Jstype != global::Google.Protobuf.Reflection.FieldOptions.Types.JSType.JS_NORMAL) { output.WriteRawTag(48); output.WriteEnum((int) Jstype); } @@ -3500,13 +3500,13 @@ namespace Google.Protobuf.DescriptorProtos { public int CalculateSize() { int size = 0; - if (Ctype != global::Google.Protobuf.DescriptorProtos.FieldOptions.Types.CType.STRING) { + if (Ctype != global::Google.Protobuf.Reflection.FieldOptions.Types.CType.STRING) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Ctype); } if (Packed != false) { size += 1 + 1; } - if (Jstype != global::Google.Protobuf.DescriptorProtos.FieldOptions.Types.JSType.JS_NORMAL) { + if (Jstype != global::Google.Protobuf.Reflection.FieldOptions.Types.JSType.JS_NORMAL) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Jstype); } if (Lazy != false) { @@ -3526,13 +3526,13 @@ namespace Google.Protobuf.DescriptorProtos { if (other == null) { return; } - if (other.Ctype != global::Google.Protobuf.DescriptorProtos.FieldOptions.Types.CType.STRING) { + if (other.Ctype != global::Google.Protobuf.Reflection.FieldOptions.Types.CType.STRING) { Ctype = other.Ctype; } if (other.Packed != false) { Packed = other.Packed; } - if (other.Jstype != global::Google.Protobuf.DescriptorProtos.FieldOptions.Types.JSType.JS_NORMAL) { + if (other.Jstype != global::Google.Protobuf.Reflection.FieldOptions.Types.JSType.JS_NORMAL) { Jstype = other.Jstype; } if (other.Lazy != false) { @@ -3559,7 +3559,7 @@ namespace Google.Protobuf.DescriptorProtos { } break; case 8: { - ctype_ = (global::Google.Protobuf.DescriptorProtos.FieldOptions.Types.CType) input.ReadEnum(); + ctype_ = (global::Google.Protobuf.Reflection.FieldOptions.Types.CType) input.ReadEnum(); break; } case 16: { @@ -3575,7 +3575,7 @@ namespace Google.Protobuf.DescriptorProtos { break; } case 48: { - jstype_ = (global::Google.Protobuf.DescriptorProtos.FieldOptions.Types.JSType) input.ReadEnum(); + jstype_ = (global::Google.Protobuf.Reflection.FieldOptions.Types.JSType) input.ReadEnum(); break; } case 80: { @@ -3617,12 +3617,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "allow_alias", "deprecated", "uninterpreted_option" }; private static readonly uint[] _fieldTags = new uint[] { 16, 24, 7994 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.Descriptor.MessageTypes[12]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[12]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_EnumOptions__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_EnumOptions__FieldAccessorTable; } } private bool _frozen = false; @@ -3673,10 +3673,10 @@ namespace Google.Protobuf.DescriptorProtos { } public const int UninterpretedOptionFieldNumber = 999; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> _repeated_uninterpretedOption_codec - = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.DescriptorProtos.UninterpretedOption.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> UninterpretedOption { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec + = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption { get { return uninterpretedOption_; } } @@ -3782,12 +3782,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "deprecated", "uninterpreted_option" }; private static readonly uint[] _fieldTags = new uint[] { 8, 7994 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.Descriptor.MessageTypes[13]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[13]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_EnumValueOptions__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_EnumValueOptions__FieldAccessorTable; } } private bool _frozen = false; @@ -3827,10 +3827,10 @@ namespace Google.Protobuf.DescriptorProtos { } public const int UninterpretedOptionFieldNumber = 999; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> _repeated_uninterpretedOption_codec - = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.DescriptorProtos.UninterpretedOption.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> UninterpretedOption { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec + = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption { get { return uninterpretedOption_; } } @@ -3920,12 +3920,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "deprecated", "uninterpreted_option" }; private static readonly uint[] _fieldTags = new uint[] { 264, 7994 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.Descriptor.MessageTypes[14]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[14]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_ServiceOptions__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_ServiceOptions__FieldAccessorTable; } } private bool _frozen = false; @@ -3965,10 +3965,10 @@ namespace Google.Protobuf.DescriptorProtos { } public const int UninterpretedOptionFieldNumber = 999; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> _repeated_uninterpretedOption_codec - = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.DescriptorProtos.UninterpretedOption.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> UninterpretedOption { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec + = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption { get { return uninterpretedOption_; } } @@ -4058,12 +4058,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "deprecated", "uninterpreted_option" }; private static readonly uint[] _fieldTags = new uint[] { 264, 7994 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.Descriptor.MessageTypes[15]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[15]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_MethodOptions__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_MethodOptions__FieldAccessorTable; } } private bool _frozen = false; @@ -4103,10 +4103,10 @@ namespace Google.Protobuf.DescriptorProtos { } public const int UninterpretedOptionFieldNumber = 999; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> _repeated_uninterpretedOption_codec - = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.DescriptorProtos.UninterpretedOption.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption> UninterpretedOption { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec + = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption { get { return uninterpretedOption_; } } @@ -4196,12 +4196,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "aggregate_value", "double_value", "identifier_value", "name", "negative_int_value", "positive_int_value", "string_value" }; private static readonly uint[] _fieldTags = new uint[] { 66, 49, 26, 18, 40, 32, 58 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.Descriptor.MessageTypes[16]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[16]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_UninterpretedOption__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_UninterpretedOption__FieldAccessorTable; } } private bool _frozen = false; @@ -4236,10 +4236,10 @@ namespace Google.Protobuf.DescriptorProtos { } public const int NameFieldNumber = 2; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.UninterpretedOption.Types.NamePart> _repeated_name_codec - = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.DescriptorProtos.UninterpretedOption.Types.NamePart.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption.Types.NamePart> name_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption.Types.NamePart>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.UninterpretedOption.Types.NamePart> Name { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart> _repeated_name_codec + = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart> name_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart> Name { get { return name_; } } @@ -4470,12 +4470,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "is_extension", "name_part" }; private static readonly uint[] _fieldTags = new uint[] { 16, 10 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.UninterpretedOption.Descriptor.NestedTypes[0]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.UninterpretedOption.Descriptor.NestedTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_UninterpretedOption_NamePart__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_UninterpretedOption_NamePart__FieldAccessorTable; } } private bool _frozen = false; @@ -4621,12 +4621,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "location" }; private static readonly uint[] _fieldTags = new uint[] { 10 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.Descriptor.MessageTypes[17]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[17]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_SourceCodeInfo__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_SourceCodeInfo__FieldAccessorTable; } } private bool _frozen = false; @@ -4655,10 +4655,10 @@ namespace Google.Protobuf.DescriptorProtos { } public const int LocationFieldNumber = 1; - private static readonly pb::FieldCodec<global::Google.Protobuf.DescriptorProtos.SourceCodeInfo.Types.Location> _repeated_location_codec - = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.DescriptorProtos.SourceCodeInfo.Types.Location.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.SourceCodeInfo.Types.Location> location_ = new pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.SourceCodeInfo.Types.Location>(); - internal pbc::RepeatedField<global::Google.Protobuf.DescriptorProtos.SourceCodeInfo.Types.Location> Location { + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location> _repeated_location_codec + = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location> location_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location>(); + internal pbc::RepeatedField<global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location> Location { get { return location_; } } @@ -4733,12 +4733,12 @@ namespace Google.Protobuf.DescriptorProtos { private static readonly string[] _fieldNames = new string[] { "leading_comments", "leading_detached_comments", "path", "span", "trailing_comments" }; private static readonly uint[] _fieldTags = new uint[] { 26, 50, 10, 18, 34 }; - public static pbd::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.DescriptorProtos.SourceCodeInfo.Descriptor.NestedTypes[0]; } + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.SourceCodeInfo.Descriptor.NestedTypes[0]; } } - public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.Protobuf.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_SourceCodeInfo_Location__FieldAccessorTable; } + public pbr::FieldAccessorTable Fields { + get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_SourceCodeInfo_Location__FieldAccessorTable; } } private bool _frozen = false; diff --git a/csharp/src/ProtocolBuffers/Descriptors/DescriptorUtil.cs b/csharp/src/ProtocolBuffers/Reflection/DescriptorUtil.cs index eb4ced60..af31dfb1 100644 --- a/csharp/src/ProtocolBuffers/Descriptors/DescriptorUtil.cs +++ b/csharp/src/ProtocolBuffers/Reflection/DescriptorUtil.cs @@ -1,65 +1,65 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-namespace Google.Protobuf.Descriptors
-{
- /// <summary>
- /// Internal class containing utility methods when working with descriptors.
- /// </summary>
- internal static class DescriptorUtil
- {
- /// <summary>
- /// Equivalent to Func[TInput, int, TOutput] but usable in .NET 2.0. Only used to convert
- /// arrays.
- /// </summary>
- internal delegate TOutput IndexedConverter<TInput, TOutput>(TInput element, int index);
-
- /// <summary>
- /// Converts the given array into a read-only list, applying the specified conversion to
- /// each input element.
- /// </summary>
- internal static IList<TOutput> ConvertAndMakeReadOnly<TInput, TOutput>(IList<TInput> input,
- IndexedConverter<TInput, TOutput>
- converter)
- {
- TOutput[] array = new TOutput[input.Count];
- for (int i = 0; i < array.Length; i++)
- {
- array[i] = converter(input[i], i);
- }
- return new ReadOnlyCollection<TOutput>(array);
- }
- }
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System.Collections.Generic; +using System.Collections.ObjectModel; + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// Internal class containing utility methods when working with descriptors. + /// </summary> + internal static class DescriptorUtil + { + /// <summary> + /// Equivalent to Func[TInput, int, TOutput] but usable in .NET 2.0. Only used to convert + /// arrays. + /// </summary> + internal delegate TOutput IndexedConverter<TInput, TOutput>(TInput element, int index); + + /// <summary> + /// Converts the given array into a read-only list, applying the specified conversion to + /// each input element. + /// </summary> + internal static IList<TOutput> ConvertAndMakeReadOnly<TInput, TOutput>(IList<TInput> input, + IndexedConverter<TInput, TOutput> + converter) + { + TOutput[] array = new TOutput[input.Count]; + for (int i = 0; i < array.Length; i++) + { + array[i] = converter(input[i], i); + } + return new ReadOnlyCollection<TOutput>(array); + } + } }
\ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/DescriptorValidationException.cs b/csharp/src/ProtocolBuffers/Reflection/DescriptorValidationException.cs index 855eda61..143671db 100644 --- a/csharp/src/ProtocolBuffers/Descriptors/DescriptorValidationException.cs +++ b/csharp/src/ProtocolBuffers/Reflection/DescriptorValidationException.cs @@ -1,80 +1,80 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-using System;
-
-namespace Google.Protobuf.Descriptors
-{
- /// <summary>
- /// Thrown when building descriptors fails because the source DescriptorProtos
- /// are not valid.
- /// </summary>
- public sealed class DescriptorValidationException : Exception
- {
- private readonly String name;
- private readonly string description;
-
- /// <value>
- /// The full name of the descriptor where the error occurred.
- /// </value>
- public String ProblemSymbolName
- {
- get { return name; }
- }
-
- /// <value>
- /// A human-readable description of the error. (The Message property
- /// is made up of the descriptor's name and this description.)
- /// </value>
- public string Description
- {
- get { return description; }
- }
-
- internal DescriptorValidationException(IDescriptor problemDescriptor, string description) :
- base(problemDescriptor.FullName + ": " + description)
- {
- // Note that problemDescriptor may be partially uninitialized, so we
- // don't want to expose it directly to the user. So, we only provide
- // the name and the original proto.
- name = problemDescriptor.FullName;
- this.description = description;
- }
-
- internal DescriptorValidationException(IDescriptor problemDescriptor, string description, Exception cause) :
- base(problemDescriptor.FullName + ": " + description, cause)
- {
- name = problemDescriptor.FullName;
- this.description = description;
- }
- }
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// Thrown when building descriptors fails because the source DescriptorProtos + /// are not valid. + /// </summary> + public sealed class DescriptorValidationException : Exception + { + private readonly String name; + private readonly string description; + + /// <value> + /// The full name of the descriptor where the error occurred. + /// </value> + public String ProblemSymbolName + { + get { return name; } + } + + /// <value> + /// A human-readable description of the error. (The Message property + /// is made up of the descriptor's name and this description.) + /// </value> + public string Description + { + get { return description; } + } + + internal DescriptorValidationException(IDescriptor problemDescriptor, string description) : + base(problemDescriptor.FullName + ": " + description) + { + // Note that problemDescriptor may be partially uninitialized, so we + // don't want to expose it directly to the user. So, we only provide + // the name and the original proto. + name = problemDescriptor.FullName; + this.description = description; + } + + internal DescriptorValidationException(IDescriptor problemDescriptor, string description, Exception cause) : + base(problemDescriptor.FullName + ": " + description, cause) + { + name = problemDescriptor.FullName; + this.description = description; + } + } }
\ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/EnumDescriptor.cs b/csharp/src/ProtocolBuffers/Reflection/EnumDescriptor.cs index 57860e61..bf8f8c83 100644 --- a/csharp/src/ProtocolBuffers/Descriptors/EnumDescriptor.cs +++ b/csharp/src/ProtocolBuffers/Reflection/EnumDescriptor.cs @@ -1,109 +1,108 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-using System.Collections.Generic;
-using Google.Protobuf.DescriptorProtos;
-
-namespace Google.Protobuf.Descriptors
-{
- /// <summary>
- /// Descriptor for an enum type in a .proto file.
- /// </summary>
- public sealed class EnumDescriptor : DescriptorBase
- {
- private readonly EnumDescriptorProto proto;
- private readonly MessageDescriptor containingType;
- private readonly IList<EnumValueDescriptor> values;
-
- internal EnumDescriptor(EnumDescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int index)
- : base(file, file.ComputeFullName(parent, proto.Name), index)
- {
- this.proto = proto;
- containingType = parent;
-
- if (proto.Value.Count == 0)
- {
- // We cannot allow enums with no values because this would mean there
- // would be no valid default value for fields of this type.
- throw new DescriptorValidationException(this, "Enums must contain at least one value.");
- }
-
- values = DescriptorUtil.ConvertAndMakeReadOnly(proto.Value,
- (value, i) => new EnumValueDescriptor(value, file, this, i));
-
- File.DescriptorPool.AddSymbol(this);
- }
-
- internal EnumDescriptorProto Proto { get { return proto; } }
-
- /// <summary>
- /// The brief name of the descriptor's target.
- /// </summary>
- public override string Name { get { return proto.Name; } }
-
- /// <value>
- /// If this is a nested type, get the outer descriptor, otherwise null.
- /// </value>
- public MessageDescriptor ContainingType
- {
- get { return containingType; }
- }
-
- /// <value>
- /// An unmodifiable list of defined value descriptors for this enum.
- /// </value>
- public IList<EnumValueDescriptor> Values
- {
- get { return values; }
- }
-
- /// <summary>
- /// Finds an enum value by number. If multiple enum values have the
- /// same number, this returns the first defined value with that number.
- /// If there is no value for the given number, this returns <c>null</c>.
- /// </summary>
- public EnumValueDescriptor FindValueByNumber(int number)
- {
- return File.DescriptorPool.FindEnumValueByNumber(this, number);
- }
-
- /// <summary>
- /// Finds an enum value by name.
- /// </summary>
- /// <param name="name">The unqualified name of the value (e.g. "FOO").</param>
- /// <returns>The value's descriptor, or null if not found.</returns>
- public EnumValueDescriptor FindValueByName(string name)
- {
- return File.DescriptorPool.FindSymbol<EnumValueDescriptor>(FullName + "." + name);
- }
- }
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System.Collections.Generic; + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// Descriptor for an enum type in a .proto file. + /// </summary> + public sealed class EnumDescriptor : DescriptorBase + { + private readonly EnumDescriptorProto proto; + private readonly MessageDescriptor containingType; + private readonly IList<EnumValueDescriptor> values; + + internal EnumDescriptor(EnumDescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int index) + : base(file, file.ComputeFullName(parent, proto.Name), index) + { + this.proto = proto; + containingType = parent; + + if (proto.Value.Count == 0) + { + // We cannot allow enums with no values because this would mean there + // would be no valid default value for fields of this type. + throw new DescriptorValidationException(this, "Enums must contain at least one value."); + } + + values = DescriptorUtil.ConvertAndMakeReadOnly(proto.Value, + (value, i) => new EnumValueDescriptor(value, file, this, i)); + + File.DescriptorPool.AddSymbol(this); + } + + internal EnumDescriptorProto Proto { get { return proto; } } + + /// <summary> + /// The brief name of the descriptor's target. + /// </summary> + public override string Name { get { return proto.Name; } } + + /// <value> + /// If this is a nested type, get the outer descriptor, otherwise null. + /// </value> + public MessageDescriptor ContainingType + { + get { return containingType; } + } + + /// <value> + /// An unmodifiable list of defined value descriptors for this enum. + /// </value> + public IList<EnumValueDescriptor> Values + { + get { return values; } + } + + /// <summary> + /// Finds an enum value by number. If multiple enum values have the + /// same number, this returns the first defined value with that number. + /// If there is no value for the given number, this returns <c>null</c>. + /// </summary> + public EnumValueDescriptor FindValueByNumber(int number) + { + return File.DescriptorPool.FindEnumValueByNumber(this, number); + } + + /// <summary> + /// Finds an enum value by name. + /// </summary> + /// <param name="name">The unqualified name of the value (e.g. "FOO").</param> + /// <returns>The value's descriptor, or null if not found.</returns> + public EnumValueDescriptor FindValueByName(string name) + { + return File.DescriptorPool.FindSymbol<EnumValueDescriptor>(FullName + "." + name); + } + } }
\ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/EnumValueDescriptor.cs b/csharp/src/ProtocolBuffers/Reflection/EnumValueDescriptor.cs index e609b1f8..29833c4a 100644 --- a/csharp/src/ProtocolBuffers/Descriptors/EnumValueDescriptor.cs +++ b/csharp/src/ProtocolBuffers/Reflection/EnumValueDescriptor.cs @@ -1,63 +1,61 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-using Google.Protobuf.DescriptorProtos;
-
-namespace Google.Protobuf.Descriptors
-{
- /// <summary>
- /// Descriptor for a single enum value within an enum in a .proto file.
- /// </summary>
- public sealed class EnumValueDescriptor : DescriptorBase
- {
- private readonly EnumDescriptor enumDescriptor;
- private readonly EnumValueDescriptorProto proto;
-
- internal EnumValueDescriptor(EnumValueDescriptorProto proto, FileDescriptor file,
- EnumDescriptor parent, int index)
- : base(file, parent.FullName + "." + proto.Name, index)
- {
- this.proto = proto;
- enumDescriptor = parent;
- file.DescriptorPool.AddSymbol(this);
- file.DescriptorPool.AddEnumValueByNumber(this);
- }
-
- internal EnumValueDescriptorProto Proto { get { return proto; } }
-
- public override string Name { get { return proto.Name; } }
-
- public int Number { get { return Proto.Number; } }
-
- public EnumDescriptor EnumDescriptor { get { return enumDescriptor; } }
- }
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// Descriptor for a single enum value within an enum in a .proto file. + /// </summary> + public sealed class EnumValueDescriptor : DescriptorBase + { + private readonly EnumDescriptor enumDescriptor; + private readonly EnumValueDescriptorProto proto; + + internal EnumValueDescriptor(EnumValueDescriptorProto proto, FileDescriptor file, + EnumDescriptor parent, int index) + : base(file, parent.FullName + "." + proto.Name, index) + { + this.proto = proto; + enumDescriptor = parent; + file.DescriptorPool.AddSymbol(this); + file.DescriptorPool.AddEnumValueByNumber(this); + } + + internal EnumValueDescriptorProto Proto { get { return proto; } } + + public override string Name { get { return proto.Name; } } + + public int Number { get { return Proto.Number; } } + + public EnumDescriptor EnumDescriptor { get { return enumDescriptor; } } + } }
\ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/FieldAccess/FieldAccessorBase.cs b/csharp/src/ProtocolBuffers/Reflection/FieldAccessorBase.cs index 2a3e5b8b..39a63b47 100644 --- a/csharp/src/ProtocolBuffers/FieldAccess/FieldAccessorBase.cs +++ b/csharp/src/ProtocolBuffers/Reflection/FieldAccessorBase.cs @@ -32,9 +32,8 @@ using System; using System.Reflection; -using Google.Protobuf.Descriptors; -namespace Google.Protobuf.FieldAccess +namespace Google.Protobuf.Reflection { /// <summary> /// Base class for field accessors. diff --git a/csharp/src/ProtocolBuffers/FieldAccess/FieldAccessorTable.cs b/csharp/src/ProtocolBuffers/Reflection/FieldAccessorTable.cs index 80be93f5..24fcbc64 100644 --- a/csharp/src/ProtocolBuffers/FieldAccess/FieldAccessorTable.cs +++ b/csharp/src/ProtocolBuffers/Reflection/FieldAccessorTable.cs @@ -1,98 +1,97 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-using System;
-using System.Collections.ObjectModel;
-using Google.Protobuf.Descriptors;
-
-namespace Google.Protobuf.FieldAccess
-{
- /// <summary>
- /// Provides access to fields in generated messages via reflection.
- /// </summary>
- public sealed class FieldAccessorTable
- {
- private readonly ReadOnlyCollection<IFieldAccessor> accessors;
- private readonly ReadOnlyCollection<OneofAccessor> oneofs;
- private readonly MessageDescriptor descriptor;
-
- /// <summary>
- /// Constructs a FieldAccessorTable for a particular message class.
- /// Only one FieldAccessorTable should be constructed per class.
- /// </summary>
- /// <param name="type">The CLR type for the message.</param>
- /// <param name="descriptor">The type's descriptor</param>
- /// <param name="propertyNames">The Pascal-case names of all the field-based properties in the message.</param>
- public FieldAccessorTable(Type type, MessageDescriptor descriptor, string[] propertyNames, string[] oneofPropertyNames)
- {
- this.descriptor = descriptor;
- var accessorsArray = new IFieldAccessor[descriptor.Fields.Count];
- for (int i = 0; i < accessorsArray.Length; i++)
- {
- var field = descriptor.Fields[i];
- var name = propertyNames[i];
- accessorsArray[i] =
- field.IsMap ? new MapFieldAccessor(type, name, field)
- : field.IsRepeated ? new RepeatedFieldAccessor(type, name, field)
- : (IFieldAccessor) new SingleFieldAccessor(type, name, field);
- }
- accessors = new ReadOnlyCollection<IFieldAccessor>(accessorsArray);
- var oneofsArray = new OneofAccessor[descriptor.Oneofs.Count];
- for (int i = 0; i < oneofsArray.Length; i++)
- {
- var oneof = descriptor.Oneofs[i];
- oneofsArray[i] = new OneofAccessor(type, oneofPropertyNames[i], oneof);
- }
- oneofs = new ReadOnlyCollection<OneofAccessor>(oneofsArray);
- }
-
- // TODO: Validate the name here... should possibly make this type a more "general reflection access" type,
- // bearing in mind the oneof parts to come as well.
- /// <summary>
- /// Returns all of the field accessors for the message type.
- /// </summary>
- public ReadOnlyCollection<IFieldAccessor> Accessors { get { return accessors; } }
-
- public ReadOnlyCollection<OneofAccessor> Oneofs { get { return oneofs; } }
-
- // TODO: Review this, as it's easy to get confused between FieldNumber and Index.
- // Currently only used to get an accessor related to a oneof... maybe just make that simpler?
- public IFieldAccessor this[int fieldNumber]
- {
- get
- {
- FieldDescriptor field = descriptor.FindFieldByNumber(fieldNumber);
- return accessors[field.Index];
- }
- }
- }
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections.ObjectModel; + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// Provides access to fields in generated messages via reflection. + /// </summary> + public sealed class FieldAccessorTable + { + private readonly ReadOnlyCollection<IFieldAccessor> accessors; + private readonly ReadOnlyCollection<OneofAccessor> oneofs; + private readonly MessageDescriptor descriptor; + + /// <summary> + /// Constructs a FieldAccessorTable for a particular message class. + /// Only one FieldAccessorTable should be constructed per class. + /// </summary> + /// <param name="type">The CLR type for the message.</param> + /// <param name="descriptor">The type's descriptor</param> + /// <param name="propertyNames">The Pascal-case names of all the field-based properties in the message.</param> + public FieldAccessorTable(Type type, MessageDescriptor descriptor, string[] propertyNames, string[] oneofPropertyNames) + { + this.descriptor = descriptor; + var accessorsArray = new IFieldAccessor[descriptor.Fields.Count]; + for (int i = 0; i < accessorsArray.Length; i++) + { + var field = descriptor.Fields[i]; + var name = propertyNames[i]; + accessorsArray[i] = + field.IsMap ? new MapFieldAccessor(type, name, field) + : field.IsRepeated ? new RepeatedFieldAccessor(type, name, field) + : (IFieldAccessor) new SingleFieldAccessor(type, name, field); + } + accessors = new ReadOnlyCollection<IFieldAccessor>(accessorsArray); + var oneofsArray = new OneofAccessor[descriptor.Oneofs.Count]; + for (int i = 0; i < oneofsArray.Length; i++) + { + var oneof = descriptor.Oneofs[i]; + oneofsArray[i] = new OneofAccessor(type, oneofPropertyNames[i], oneof); + } + oneofs = new ReadOnlyCollection<OneofAccessor>(oneofsArray); + } + + // TODO: Validate the name here... should possibly make this type a more "general reflection access" type, + // bearing in mind the oneof parts to come as well. + /// <summary> + /// Returns all of the field accessors for the message type. + /// </summary> + public ReadOnlyCollection<IFieldAccessor> Accessors { get { return accessors; } } + + public ReadOnlyCollection<OneofAccessor> Oneofs { get { return oneofs; } } + + // TODO: Review this, as it's easy to get confused between FieldNumber and Index. + // Currently only used to get an accessor related to a oneof... maybe just make that simpler? + public IFieldAccessor this[int fieldNumber] + { + get + { + FieldDescriptor field = descriptor.FindFieldByNumber(fieldNumber); + return accessors[field.Index]; + } + } + } }
\ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/FieldDescriptor.cs b/csharp/src/ProtocolBuffers/Reflection/FieldDescriptor.cs index 7af69bbb..3d9d0d75 100644 --- a/csharp/src/ProtocolBuffers/Descriptors/FieldDescriptor.cs +++ b/csharp/src/ProtocolBuffers/Reflection/FieldDescriptor.cs @@ -1,293 +1,292 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-using System;
-using Google.Protobuf.DescriptorProtos;
-
-namespace Google.Protobuf.Descriptors
-{
- /// <summary>
- /// Descriptor for a field or extension within a message in a .proto file.
- /// </summary>
- public sealed class FieldDescriptor : DescriptorBase, IComparable<FieldDescriptor>
- {
- private readonly FieldDescriptorProto proto;
- private EnumDescriptor enumType;
- private MessageDescriptor messageType;
- private readonly MessageDescriptor containingType;
- private readonly OneofDescriptor containingOneof;
- private FieldType fieldType;
-
- internal FieldDescriptor(FieldDescriptorProto proto, FileDescriptor file,
- MessageDescriptor parent, int index)
- : base(file, file.ComputeFullName(parent, proto.Name), index)
- {
- this.proto = proto;
- if (proto.Type != 0)
- {
- fieldType = GetFieldTypeFromProtoType(proto.Type);
- }
-
- if (FieldNumber <= 0)
- {
- throw new DescriptorValidationException(this,
- "Field numbers must be positive integers.");
- }
- containingType = parent;
- // OneofIndex "defaults" to -1 due to a hack in FieldDescriptor.OnConstruction.
- if (proto.OneofIndex != -1)
- {
- if (proto.OneofIndex < 0 || proto.OneofIndex >= parent.Proto.OneofDecl.Count)
- {
- throw new DescriptorValidationException(this,
- "FieldDescriptorProto.oneof_index is out of range for type " + parent.Name);
- }
- containingOneof = parent.Oneofs[proto.OneofIndex];
- }
-
- file.DescriptorPool.AddSymbol(this);
- }
-
- /// <summary>
- /// The brief name of the descriptor's target.
- /// </summary>
- public override string Name { get { return proto.Name; } }
-
- internal FieldDescriptorProto Proto { get { return proto; } }
-
- /// <summary>
- /// Maps a field type as included in the .proto file to a FieldType.
- /// </summary>
- private static FieldType GetFieldTypeFromProtoType(FieldDescriptorProto.Types.Type type)
- {
- switch (type)
- {
- case FieldDescriptorProto.Types.Type.TYPE_DOUBLE:
- return FieldType.Double;
- case FieldDescriptorProto.Types.Type.TYPE_FLOAT:
- return FieldType.Float;
- case FieldDescriptorProto.Types.Type.TYPE_INT64:
- return FieldType.Int64;
- case FieldDescriptorProto.Types.Type.TYPE_UINT64:
- return FieldType.UInt64;
- case FieldDescriptorProto.Types.Type.TYPE_INT32:
- return FieldType.Int32;
- case FieldDescriptorProto.Types.Type.TYPE_FIXED64:
- return FieldType.Fixed64;
- case FieldDescriptorProto.Types.Type.TYPE_FIXED32:
- return FieldType.Fixed32;
- case FieldDescriptorProto.Types.Type.TYPE_BOOL:
- return FieldType.Bool;
- case FieldDescriptorProto.Types.Type.TYPE_STRING:
- return FieldType.String;
- case FieldDescriptorProto.Types.Type.TYPE_GROUP:
- return FieldType.Group;
- case FieldDescriptorProto.Types.Type.TYPE_MESSAGE:
- return FieldType.Message;
- case FieldDescriptorProto.Types.Type.TYPE_BYTES:
- return FieldType.Bytes;
- case FieldDescriptorProto.Types.Type.TYPE_UINT32:
- return FieldType.UInt32;
- case FieldDescriptorProto.Types.Type.TYPE_ENUM:
- return FieldType.Enum;
- case FieldDescriptorProto.Types.Type.TYPE_SFIXED32:
- return FieldType.SFixed32;
- case FieldDescriptorProto.Types.Type.TYPE_SFIXED64:
- return FieldType.SFixed64;
- case FieldDescriptorProto.Types.Type.TYPE_SINT32:
- return FieldType.SInt32;
- case FieldDescriptorProto.Types.Type.TYPE_SINT64:
- return FieldType.SInt64;
- default:
- throw new ArgumentException("Invalid type specified");
- }
- }
-
- public bool IsRepeated
- {
- get { return Proto.Label == FieldDescriptorProto.Types.Label.LABEL_REPEATED; }
- }
-
- public bool IsMap
- {
- get { return fieldType == FieldType.Message && messageType.Proto.Options != null && messageType.Proto.Options.MapEntry; }
- }
-
- public bool IsPacked
- {
- get { return Proto.Options != null && Proto.Options.Packed; }
- }
-
- /// <summary>
- /// Get the field's containing type. For extensions, this is the type being
- /// extended, not the location where the extension was defined. See
- /// <see cref="ExtensionScope" />.
- /// </summary>
- public MessageDescriptor ContainingType
- {
- get { return containingType; }
- }
-
- public OneofDescriptor ContainingOneof
- {
- get { return containingOneof; }
- }
-
- public FieldType FieldType
- {
- get { return fieldType; }
- }
-
- public int FieldNumber
- {
- get { return Proto.Number; }
- }
-
- /// <summary>
- /// Compares this descriptor with another one, ordering in "canonical" order
- /// which simply means ascending order by field number. <paramref name="other"/>
- /// must be a field of the same type, i.e. the <see cref="ContainingType"/> of
- /// both fields must be the same.
- /// </summary>
- public int CompareTo(FieldDescriptor other)
- {
- if (other.containingType != containingType)
- {
- throw new ArgumentException("FieldDescriptors can only be compared to other FieldDescriptors " +
- "for fields of the same message type.");
- }
- return FieldNumber - other.FieldNumber;
- }
-
- /// <summary>
- /// For enum fields, returns the field's type.
- /// </summary>
- public EnumDescriptor EnumType
- {
- get
- {
- if (fieldType != FieldType.Enum)
- {
- throw new InvalidOperationException("EnumType is only valid for enum fields.");
- }
- return enumType;
- }
- }
-
- /// <summary>
- /// For embedded message and group fields, returns the field's type.
- /// </summary>
- public MessageDescriptor MessageType
- {
- get
- {
- if (fieldType != FieldType.Message)
- {
- throw new InvalidOperationException("MessageType is only valid for enum fields.");
- }
- return messageType;
- }
- }
-
- /// <summary>
- /// Look up and cross-link all field types etc.
- /// </summary>
- internal void CrossLink()
- {
- if (Proto.TypeName != "")
- {
- IDescriptor typeDescriptor =
- File.DescriptorPool.LookupSymbol(Proto.TypeName, this);
-
- if (Proto.Type != 0)
- {
- // Choose field type based on symbol.
- if (typeDescriptor is MessageDescriptor)
- {
- fieldType = FieldType.Message;
- }
- else if (typeDescriptor is EnumDescriptor)
- {
- fieldType = FieldType.Enum;
- }
- else
- {
- throw new DescriptorValidationException(this, "\"" + Proto.TypeName + "\" is not a type.");
- }
- }
-
- if (fieldType == FieldType.Message)
- {
- if (!(typeDescriptor is MessageDescriptor))
- {
- throw new DescriptorValidationException(this,
- "\"" + Proto.TypeName + "\" is not a message type.");
- }
- messageType = (MessageDescriptor) typeDescriptor;
-
- if (Proto.DefaultValue != "")
- {
- throw new DescriptorValidationException(this, "Messages can't have default values.");
- }
- }
- else if (fieldType == FieldType.Enum)
- {
- if (!(typeDescriptor is EnumDescriptor))
- {
- throw new DescriptorValidationException(this, "\"" + Proto.TypeName + "\" is not an enum type.");
- }
- enumType = (EnumDescriptor) typeDescriptor;
- }
- else
- {
- throw new DescriptorValidationException(this, "Field with primitive type has type_name.");
- }
- }
- else
- {
- if (fieldType == FieldType.Message || fieldType == FieldType.Enum)
- {
- throw new DescriptorValidationException(this, "Field with message or enum type missing type_name.");
- }
- }
-
- // Note: no attempt to perform any default value parsing
-
- File.DescriptorPool.AddFieldByNumber(this);
-
- if (containingType != null && containingType.Proto.Options != null && containingType.Proto.Options.MessageSetWireFormat)
- {
- throw new DescriptorValidationException(this, "MessageSet format is not supported.");
- }
- }
- }
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// Descriptor for a field or extension within a message in a .proto file. + /// </summary> + public sealed class FieldDescriptor : DescriptorBase, IComparable<FieldDescriptor> + { + private readonly FieldDescriptorProto proto; + private EnumDescriptor enumType; + private MessageDescriptor messageType; + private readonly MessageDescriptor containingType; + private readonly OneofDescriptor containingOneof; + private FieldType fieldType; + + internal FieldDescriptor(FieldDescriptorProto proto, FileDescriptor file, + MessageDescriptor parent, int index) + : base(file, file.ComputeFullName(parent, proto.Name), index) + { + this.proto = proto; + if (proto.Type != 0) + { + fieldType = GetFieldTypeFromProtoType(proto.Type); + } + + if (FieldNumber <= 0) + { + throw new DescriptorValidationException(this, + "Field numbers must be positive integers."); + } + containingType = parent; + // OneofIndex "defaults" to -1 due to a hack in FieldDescriptor.OnConstruction. + if (proto.OneofIndex != -1) + { + if (proto.OneofIndex < 0 || proto.OneofIndex >= parent.Proto.OneofDecl.Count) + { + throw new DescriptorValidationException(this, + "FieldDescriptorProto.oneof_index is out of range for type " + parent.Name); + } + containingOneof = parent.Oneofs[proto.OneofIndex]; + } + + file.DescriptorPool.AddSymbol(this); + } + + /// <summary> + /// The brief name of the descriptor's target. + /// </summary> + public override string Name { get { return proto.Name; } } + + internal FieldDescriptorProto Proto { get { return proto; } } + + /// <summary> + /// Maps a field type as included in the .proto file to a FieldType. + /// </summary> + private static FieldType GetFieldTypeFromProtoType(FieldDescriptorProto.Types.Type type) + { + switch (type) + { + case FieldDescriptorProto.Types.Type.TYPE_DOUBLE: + return FieldType.Double; + case FieldDescriptorProto.Types.Type.TYPE_FLOAT: + return FieldType.Float; + case FieldDescriptorProto.Types.Type.TYPE_INT64: + return FieldType.Int64; + case FieldDescriptorProto.Types.Type.TYPE_UINT64: + return FieldType.UInt64; + case FieldDescriptorProto.Types.Type.TYPE_INT32: + return FieldType.Int32; + case FieldDescriptorProto.Types.Type.TYPE_FIXED64: + return FieldType.Fixed64; + case FieldDescriptorProto.Types.Type.TYPE_FIXED32: + return FieldType.Fixed32; + case FieldDescriptorProto.Types.Type.TYPE_BOOL: + return FieldType.Bool; + case FieldDescriptorProto.Types.Type.TYPE_STRING: + return FieldType.String; + case FieldDescriptorProto.Types.Type.TYPE_GROUP: + return FieldType.Group; + case FieldDescriptorProto.Types.Type.TYPE_MESSAGE: + return FieldType.Message; + case FieldDescriptorProto.Types.Type.TYPE_BYTES: + return FieldType.Bytes; + case FieldDescriptorProto.Types.Type.TYPE_UINT32: + return FieldType.UInt32; + case FieldDescriptorProto.Types.Type.TYPE_ENUM: + return FieldType.Enum; + case FieldDescriptorProto.Types.Type.TYPE_SFIXED32: + return FieldType.SFixed32; + case FieldDescriptorProto.Types.Type.TYPE_SFIXED64: + return FieldType.SFixed64; + case FieldDescriptorProto.Types.Type.TYPE_SINT32: + return FieldType.SInt32; + case FieldDescriptorProto.Types.Type.TYPE_SINT64: + return FieldType.SInt64; + default: + throw new ArgumentException("Invalid type specified"); + } + } + + public bool IsRepeated + { + get { return Proto.Label == FieldDescriptorProto.Types.Label.LABEL_REPEATED; } + } + + public bool IsMap + { + get { return fieldType == FieldType.Message && messageType.Proto.Options != null && messageType.Proto.Options.MapEntry; } + } + + public bool IsPacked + { + get { return Proto.Options != null && Proto.Options.Packed; } + } + + /// <summary> + /// Get the field's containing type. For extensions, this is the type being + /// extended, not the location where the extension was defined. See + /// <see cref="ExtensionScope" />. + /// </summary> + public MessageDescriptor ContainingType + { + get { return containingType; } + } + + public OneofDescriptor ContainingOneof + { + get { return containingOneof; } + } + + public FieldType FieldType + { + get { return fieldType; } + } + + public int FieldNumber + { + get { return Proto.Number; } + } + + /// <summary> + /// Compares this descriptor with another one, ordering in "canonical" order + /// which simply means ascending order by field number. <paramref name="other"/> + /// must be a field of the same type, i.e. the <see cref="ContainingType"/> of + /// both fields must be the same. + /// </summary> + public int CompareTo(FieldDescriptor other) + { + if (other.containingType != containingType) + { + throw new ArgumentException("FieldDescriptors can only be compared to other FieldDescriptors " + + "for fields of the same message type."); + } + return FieldNumber - other.FieldNumber; + } + + /// <summary> + /// For enum fields, returns the field's type. + /// </summary> + public EnumDescriptor EnumType + { + get + { + if (fieldType != FieldType.Enum) + { + throw new InvalidOperationException("EnumType is only valid for enum fields."); + } + return enumType; + } + } + + /// <summary> + /// For embedded message and group fields, returns the field's type. + /// </summary> + public MessageDescriptor MessageType + { + get + { + if (fieldType != FieldType.Message) + { + throw new InvalidOperationException("MessageType is only valid for enum fields."); + } + return messageType; + } + } + + /// <summary> + /// Look up and cross-link all field types etc. + /// </summary> + internal void CrossLink() + { + if (Proto.TypeName != "") + { + IDescriptor typeDescriptor = + File.DescriptorPool.LookupSymbol(Proto.TypeName, this); + + if (Proto.Type != 0) + { + // Choose field type based on symbol. + if (typeDescriptor is MessageDescriptor) + { + fieldType = FieldType.Message; + } + else if (typeDescriptor is EnumDescriptor) + { + fieldType = FieldType.Enum; + } + else + { + throw new DescriptorValidationException(this, "\"" + Proto.TypeName + "\" is not a type."); + } + } + + if (fieldType == FieldType.Message) + { + if (!(typeDescriptor is MessageDescriptor)) + { + throw new DescriptorValidationException(this, + "\"" + Proto.TypeName + "\" is not a message type."); + } + messageType = (MessageDescriptor) typeDescriptor; + + if (Proto.DefaultValue != "") + { + throw new DescriptorValidationException(this, "Messages can't have default values."); + } + } + else if (fieldType == FieldType.Enum) + { + if (!(typeDescriptor is EnumDescriptor)) + { + throw new DescriptorValidationException(this, "\"" + Proto.TypeName + "\" is not an enum type."); + } + enumType = (EnumDescriptor) typeDescriptor; + } + else + { + throw new DescriptorValidationException(this, "Field with primitive type has type_name."); + } + } + else + { + if (fieldType == FieldType.Message || fieldType == FieldType.Enum) + { + throw new DescriptorValidationException(this, "Field with message or enum type missing type_name."); + } + } + + // Note: no attempt to perform any default value parsing + + File.DescriptorPool.AddFieldByNumber(this); + + if (containingType != null && containingType.Proto.Options != null && containingType.Proto.Options.MessageSetWireFormat) + { + throw new DescriptorValidationException(this, "MessageSet format is not supported."); + } + } + } }
\ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/FieldType.cs b/csharp/src/ProtocolBuffers/Reflection/FieldType.cs index 69851464..41fa702d 100644 --- a/csharp/src/ProtocolBuffers/Descriptors/FieldType.cs +++ b/csharp/src/ProtocolBuffers/Reflection/FieldType.cs @@ -1,60 +1,60 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-namespace Google.Protobuf.Descriptors
-{
- /// <summary>
- /// Enumeration of all the possible field types. The odd formatting is to make it very clear
- /// which attribute applies to which value, while maintaining a compact format.
- /// </summary>
- public enum FieldType
- {
- Double,
- Float,
- Int64,
- UInt64,
- Int32,
- Fixed64,
- Fixed32,
- Bool,
- String,
- Group,
- Message,
- Bytes,
- UInt32,
- SFixed32,
- SFixed64,
- SInt32,
- SInt64,
- Enum
- }
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// Enumeration of all the possible field types. The odd formatting is to make it very clear + /// which attribute applies to which value, while maintaining a compact format. + /// </summary> + public enum FieldType + { + Double, + Float, + Int64, + UInt64, + Int32, + Fixed64, + Fixed32, + Bool, + String, + Group, + Message, + Bytes, + UInt32, + SFixed32, + SFixed64, + SInt32, + SInt64, + Enum + } }
\ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/FileDescriptor.cs b/csharp/src/ProtocolBuffers/Reflection/FileDescriptor.cs index 9d0bdfd3..db393480 100644 --- a/csharp/src/ProtocolBuffers/Descriptors/FileDescriptor.cs +++ b/csharp/src/ProtocolBuffers/Reflection/FileDescriptor.cs @@ -1,354 +1,352 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using Google.Protobuf.DescriptorProtos;
-using FileOptions = Google.Protobuf.DescriptorProtos.FileOptions;
-
-namespace Google.Protobuf.Descriptors
-{
- /// <summary>
- /// Describes a .proto file, including everything defined within.
- /// IDescriptor is implemented such that the File property returns this descriptor,
- /// and the FullName is the same as the Name.
- /// </summary>
- public sealed class FileDescriptor : IDescriptor
- {
- private readonly FileDescriptorProto proto;
- private readonly IList<MessageDescriptor> messageTypes;
- private readonly IList<EnumDescriptor> enumTypes;
- private readonly IList<ServiceDescriptor> services;
- private readonly IList<FileDescriptor> dependencies;
- private readonly IList<FileDescriptor> publicDependencies;
- private readonly DescriptorPool pool;
-
- public enum ProtoSyntax
- {
- Proto2,
- Proto3
- }
-
- public ProtoSyntax Syntax
- {
- get { return proto.Syntax == "proto3" ? ProtoSyntax.Proto3 : ProtoSyntax.Proto2; }
- }
-
- private FileDescriptor(FileDescriptorProto proto, FileDescriptor[] dependencies, DescriptorPool pool, bool allowUnknownDependencies)
- {
- this.pool = pool;
- this.proto = proto;
- this.dependencies = new ReadOnlyCollection<FileDescriptor>((FileDescriptor[]) dependencies.Clone());
-
- publicDependencies = DeterminePublicDependencies(this, proto, dependencies, allowUnknownDependencies);
-
- pool.AddPackage(Package, this);
-
- messageTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.MessageType,
- (message, index) =>
- new MessageDescriptor(message, this, null, index));
-
- enumTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.EnumType,
- (enumType, index) =>
- new EnumDescriptor(enumType, this, null, index));
-
- services = DescriptorUtil.ConvertAndMakeReadOnly(proto.Service,
- (service, index) =>
- new ServiceDescriptor(service, this, index));
- }
-
- /// <summary>
- /// Computes the full name of a descriptor within this file, with an optional parent message.
- /// </summary>
- internal string ComputeFullName(MessageDescriptor parent, string name)
- {
- if (parent != null)
- {
- return parent.FullName + "." + name;
- }
- if (Package.Length > 0)
- {
- return Package + "." + name;
- }
- return name;
- }
-
- /// <summary>
- /// Extracts public dependencies from direct dependencies. This is a static method despite its
- /// first parameter, as the value we're in the middle of constructing is only used for exceptions.
- /// </summary>
- private static IList<FileDescriptor> DeterminePublicDependencies(FileDescriptor @this, FileDescriptorProto proto, FileDescriptor[] dependencies, bool allowUnknownDependencies)
- {
- var nameToFileMap = new Dictionary<string, FileDescriptor>();
- foreach (var file in dependencies)
- {
- nameToFileMap[file.Name] = file;
- }
- var publicDependencies = new List<FileDescriptor>();
- for (int i = 0; i < proto.PublicDependency.Count; i++)
- {
- int index = proto.PublicDependency[i];
- if (index < 0 || index >= proto.Dependency.Count)
- {
- throw new DescriptorValidationException(@this, "Invalid public dependency index.");
- }
- string name = proto.Dependency[index];
- FileDescriptor file = nameToFileMap[name];
- if (file == null)
- {
- if (!allowUnknownDependencies)
- {
- throw new DescriptorValidationException(@this, "Invalid public dependency: " + name);
- }
- // Ignore unknown dependencies.
- }
- else
- {
- publicDependencies.Add(file);
- }
- }
- return new ReadOnlyCollection<FileDescriptor>(publicDependencies);
- }
-
- /// <value>
- /// The descriptor in its protocol message representation.
- /// </value>
- internal FileDescriptorProto Proto
- {
- get { return proto; }
- }
-
- /// <value>
- /// The file name.
- /// </value>
- public string Name
- {
- get { return proto.Name; }
- }
-
- /// <summary>
- /// The package as declared in the .proto file. This may or may not
- /// be equivalent to the .NET namespace of the generated classes.
- /// </summary>
- public string Package
- {
- get { return proto.Package; }
- }
-
- /// <value>
- /// Unmodifiable list of top-level message types declared in this file.
- /// </value>
- public IList<MessageDescriptor> MessageTypes
- {
- get { return messageTypes; }
- }
-
- /// <value>
- /// Unmodifiable list of top-level enum types declared in this file.
- /// </value>
- public IList<EnumDescriptor> EnumTypes
- {
- get { return enumTypes; }
- }
-
- /// <value>
- /// Unmodifiable list of top-level services declared in this file.
- /// </value>
- public IList<ServiceDescriptor> Services
- {
- get { return services; }
- }
-
- /// <value>
- /// Unmodifiable list of this file's dependencies (imports).
- /// </value>
- public IList<FileDescriptor> Dependencies
- {
- get { return dependencies; }
- }
-
- /// <value>
- /// Unmodifiable list of this file's public dependencies (public imports).
- /// </value>
- public IList<FileDescriptor> PublicDependencies
- {
- get { return publicDependencies; }
- }
-
- /// <value>
- /// Implementation of IDescriptor.FullName - just returns the same as Name.
- /// </value>
- string IDescriptor.FullName
- {
- get { return Name; }
- }
-
- /// <value>
- /// Implementation of IDescriptor.File - just returns this descriptor.
- /// </value>
- FileDescriptor IDescriptor.File
- {
- get { return this; }
- }
-
- /// <value>
- /// Pool containing symbol descriptors.
- /// </value>
- internal DescriptorPool DescriptorPool
- {
- get { return pool; }
- }
-
- /// <summary>
- /// Finds a type (message, enum, service or extension) in the file by name. Does not find nested types.
- /// </summary>
- /// <param name="name">The unqualified type name to look for.</param>
- /// <typeparam name="T">The type of descriptor to look for (or ITypeDescriptor for any)</typeparam>
- /// <returns>The type's descriptor, or null if not found.</returns>
- public T FindTypeByName<T>(String name)
- where T : class, IDescriptor
- {
- // Don't allow looking up nested types. This will make optimization
- // easier later.
- if (name.IndexOf('.') != -1)
- {
- return null;
- }
- if (Package.Length > 0)
- {
- name = Package + "." + name;
- }
- T result = pool.FindSymbol<T>(name);
- if (result != null && result.File == this)
- {
- return result;
- }
- return null;
- }
-
- /// <summary>
- /// Builds a FileDescriptor from its protocol buffer representation.
- /// </summary>
- /// <param name="proto">The protocol message form of the FileDescriptor.</param>
- /// <param name="dependencies">FileDescriptors corresponding to all of the
- /// file's dependencies, in the exact order listed in the .proto file. May be null,
- /// in which case it is treated as an empty array.</param>
- /// <param name="allowUnknownDependencies">Whether unknown dependencies are ignored (true) or cause an exception to be thrown (false).</param>
- /// <exception cref="DescriptorValidationException">If <paramref name="proto"/> is not
- /// a valid descriptor. This can occur for a number of reasons, such as a field
- /// having an undefined type or because two messages were defined with the same name.</exception>
- private static FileDescriptor BuildFrom(FileDescriptorProto proto, FileDescriptor[] dependencies, bool allowUnknownDependencies)
- {
- // Building descriptors involves two steps: translating and linking.
- // In the translation step (implemented by FileDescriptor's
- // constructor), we build an object tree mirroring the
- // FileDescriptorProto's tree and put all of the descriptors into the
- // DescriptorPool's lookup tables. In the linking step, we look up all
- // type references in the DescriptorPool, so that, for example, a
- // FieldDescriptor for an embedded message contains a pointer directly
- // to the Descriptor for that message's type. We also detect undefined
- // types in the linking step.
- if (dependencies == null)
- {
- dependencies = new FileDescriptor[0];
- }
-
- DescriptorPool pool = new DescriptorPool(dependencies);
- FileDescriptor result = new FileDescriptor(proto, dependencies, pool, allowUnknownDependencies);
-
- // TODO(jonskeet): Reinstate these checks, or get rid of them entirely. They aren't in the Java code,
- // and fail for the CustomOptions test right now. (We get "descriptor.proto" vs "google/protobuf/descriptor.proto".)
- //if (dependencies.Length != proto.DependencyCount)
- //{
- // throw new DescriptorValidationException(result,
- // "Dependencies passed to FileDescriptor.BuildFrom() don't match " +
- // "those listed in the FileDescriptorProto.");
- //}
- //for (int i = 0; i < proto.DependencyCount; i++)
- //{
- // if (dependencies[i].Name != proto.DependencyList[i])
- // {
- // throw new DescriptorValidationException(result,
- // "Dependencies passed to FileDescriptor.BuildFrom() don't match " +
- // "those listed in the FileDescriptorProto.");
- // }
- //}
-
- result.CrossLink();
- return result;
- }
-
- private void CrossLink()
- {
- foreach (MessageDescriptor message in messageTypes)
- {
- message.CrossLink();
- }
-
- foreach (ServiceDescriptor service in services)
- {
- service.CrossLink();
- }
- }
-
- public static FileDescriptor InternalBuildGeneratedFileFrom(byte[] descriptorData,
- FileDescriptor[] dependencies)
- {
- FileDescriptorProto proto;
- try
- {
- proto = FileDescriptorProto.Parser.ParseFrom(descriptorData);
- }
- catch (InvalidProtocolBufferException e)
- {
- throw new ArgumentException("Failed to parse protocol buffer descriptor for generated code.", e);
- }
-
- try
- {
- // When building descriptors for generated code, we allow unknown
- // dependencies by default.
- return BuildFrom(proto, dependencies, true);
- }
- catch (DescriptorValidationException e)
- {
- throw new ArgumentException("Invalid embedded descriptor for \"" + proto.Name + "\".", e);
- }
- }
-
- public override string ToString()
- {
- return "FileDescriptor for " + proto.Name;
- }
- }
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// Describes a .proto file, including everything defined within. + /// IDescriptor is implemented such that the File property returns this descriptor, + /// and the FullName is the same as the Name. + /// </summary> + public sealed class FileDescriptor : IDescriptor + { + private readonly FileDescriptorProto proto; + private readonly IList<MessageDescriptor> messageTypes; + private readonly IList<EnumDescriptor> enumTypes; + private readonly IList<ServiceDescriptor> services; + private readonly IList<FileDescriptor> dependencies; + private readonly IList<FileDescriptor> publicDependencies; + private readonly DescriptorPool pool; + + public enum ProtoSyntax + { + Proto2, + Proto3 + } + + public ProtoSyntax Syntax + { + get { return proto.Syntax == "proto3" ? ProtoSyntax.Proto3 : ProtoSyntax.Proto2; } + } + + private FileDescriptor(FileDescriptorProto proto, FileDescriptor[] dependencies, DescriptorPool pool, bool allowUnknownDependencies) + { + this.pool = pool; + this.proto = proto; + this.dependencies = new ReadOnlyCollection<FileDescriptor>((FileDescriptor[]) dependencies.Clone()); + + publicDependencies = DeterminePublicDependencies(this, proto, dependencies, allowUnknownDependencies); + + pool.AddPackage(Package, this); + + messageTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.MessageType, + (message, index) => + new MessageDescriptor(message, this, null, index)); + + enumTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.EnumType, + (enumType, index) => + new EnumDescriptor(enumType, this, null, index)); + + services = DescriptorUtil.ConvertAndMakeReadOnly(proto.Service, + (service, index) => + new ServiceDescriptor(service, this, index)); + } + + /// <summary> + /// Computes the full name of a descriptor within this file, with an optional parent message. + /// </summary> + internal string ComputeFullName(MessageDescriptor parent, string name) + { + if (parent != null) + { + return parent.FullName + "." + name; + } + if (Package.Length > 0) + { + return Package + "." + name; + } + return name; + } + + /// <summary> + /// Extracts public dependencies from direct dependencies. This is a static method despite its + /// first parameter, as the value we're in the middle of constructing is only used for exceptions. + /// </summary> + private static IList<FileDescriptor> DeterminePublicDependencies(FileDescriptor @this, FileDescriptorProto proto, FileDescriptor[] dependencies, bool allowUnknownDependencies) + { + var nameToFileMap = new Dictionary<string, FileDescriptor>(); + foreach (var file in dependencies) + { + nameToFileMap[file.Name] = file; + } + var publicDependencies = new List<FileDescriptor>(); + for (int i = 0; i < proto.PublicDependency.Count; i++) + { + int index = proto.PublicDependency[i]; + if (index < 0 || index >= proto.Dependency.Count) + { + throw new DescriptorValidationException(@this, "Invalid public dependency index."); + } + string name = proto.Dependency[index]; + FileDescriptor file = nameToFileMap[name]; + if (file == null) + { + if (!allowUnknownDependencies) + { + throw new DescriptorValidationException(@this, "Invalid public dependency: " + name); + } + // Ignore unknown dependencies. + } + else + { + publicDependencies.Add(file); + } + } + return new ReadOnlyCollection<FileDescriptor>(publicDependencies); + } + + /// <value> + /// The descriptor in its protocol message representation. + /// </value> + internal FileDescriptorProto Proto + { + get { return proto; } + } + + /// <value> + /// The file name. + /// </value> + public string Name + { + get { return proto.Name; } + } + + /// <summary> + /// The package as declared in the .proto file. This may or may not + /// be equivalent to the .NET namespace of the generated classes. + /// </summary> + public string Package + { + get { return proto.Package; } + } + + /// <value> + /// Unmodifiable list of top-level message types declared in this file. + /// </value> + public IList<MessageDescriptor> MessageTypes + { + get { return messageTypes; } + } + + /// <value> + /// Unmodifiable list of top-level enum types declared in this file. + /// </value> + public IList<EnumDescriptor> EnumTypes + { + get { return enumTypes; } + } + + /// <value> + /// Unmodifiable list of top-level services declared in this file. + /// </value> + public IList<ServiceDescriptor> Services + { + get { return services; } + } + + /// <value> + /// Unmodifiable list of this file's dependencies (imports). + /// </value> + public IList<FileDescriptor> Dependencies + { + get { return dependencies; } + } + + /// <value> + /// Unmodifiable list of this file's public dependencies (public imports). + /// </value> + public IList<FileDescriptor> PublicDependencies + { + get { return publicDependencies; } + } + + /// <value> + /// Implementation of IDescriptor.FullName - just returns the same as Name. + /// </value> + string IDescriptor.FullName + { + get { return Name; } + } + + /// <value> + /// Implementation of IDescriptor.File - just returns this descriptor. + /// </value> + FileDescriptor IDescriptor.File + { + get { return this; } + } + + /// <value> + /// Pool containing symbol descriptors. + /// </value> + internal DescriptorPool DescriptorPool + { + get { return pool; } + } + + /// <summary> + /// Finds a type (message, enum, service or extension) in the file by name. Does not find nested types. + /// </summary> + /// <param name="name">The unqualified type name to look for.</param> + /// <typeparam name="T">The type of descriptor to look for (or ITypeDescriptor for any)</typeparam> + /// <returns>The type's descriptor, or null if not found.</returns> + public T FindTypeByName<T>(String name) + where T : class, IDescriptor + { + // Don't allow looking up nested types. This will make optimization + // easier later. + if (name.IndexOf('.') != -1) + { + return null; + } + if (Package.Length > 0) + { + name = Package + "." + name; + } + T result = pool.FindSymbol<T>(name); + if (result != null && result.File == this) + { + return result; + } + return null; + } + + /// <summary> + /// Builds a FileDescriptor from its protocol buffer representation. + /// </summary> + /// <param name="proto">The protocol message form of the FileDescriptor.</param> + /// <param name="dependencies">FileDescriptors corresponding to all of the + /// file's dependencies, in the exact order listed in the .proto file. May be null, + /// in which case it is treated as an empty array.</param> + /// <param name="allowUnknownDependencies">Whether unknown dependencies are ignored (true) or cause an exception to be thrown (false).</param> + /// <exception cref="DescriptorValidationException">If <paramref name="proto"/> is not + /// a valid descriptor. This can occur for a number of reasons, such as a field + /// having an undefined type or because two messages were defined with the same name.</exception> + private static FileDescriptor BuildFrom(FileDescriptorProto proto, FileDescriptor[] dependencies, bool allowUnknownDependencies) + { + // Building descriptors involves two steps: translating and linking. + // In the translation step (implemented by FileDescriptor's + // constructor), we build an object tree mirroring the + // FileDescriptorProto's tree and put all of the descriptors into the + // DescriptorPool's lookup tables. In the linking step, we look up all + // type references in the DescriptorPool, so that, for example, a + // FieldDescriptor for an embedded message contains a pointer directly + // to the Descriptor for that message's type. We also detect undefined + // types in the linking step. + if (dependencies == null) + { + dependencies = new FileDescriptor[0]; + } + + DescriptorPool pool = new DescriptorPool(dependencies); + FileDescriptor result = new FileDescriptor(proto, dependencies, pool, allowUnknownDependencies); + + // TODO(jonskeet): Reinstate these checks, or get rid of them entirely. They aren't in the Java code, + // and fail for the CustomOptions test right now. (We get "descriptor.proto" vs "google/protobuf/descriptor.proto".) + //if (dependencies.Length != proto.DependencyCount) + //{ + // throw new DescriptorValidationException(result, + // "Dependencies passed to FileDescriptor.BuildFrom() don't match " + + // "those listed in the FileDescriptorProto."); + //} + //for (int i = 0; i < proto.DependencyCount; i++) + //{ + // if (dependencies[i].Name != proto.DependencyList[i]) + // { + // throw new DescriptorValidationException(result, + // "Dependencies passed to FileDescriptor.BuildFrom() don't match " + + // "those listed in the FileDescriptorProto."); + // } + //} + + result.CrossLink(); + return result; + } + + private void CrossLink() + { + foreach (MessageDescriptor message in messageTypes) + { + message.CrossLink(); + } + + foreach (ServiceDescriptor service in services) + { + service.CrossLink(); + } + } + + public static FileDescriptor InternalBuildGeneratedFileFrom(byte[] descriptorData, + FileDescriptor[] dependencies) + { + FileDescriptorProto proto; + try + { + proto = FileDescriptorProto.Parser.ParseFrom(descriptorData); + } + catch (InvalidProtocolBufferException e) + { + throw new ArgumentException("Failed to parse protocol buffer descriptor for generated code.", e); + } + + try + { + // When building descriptors for generated code, we allow unknown + // dependencies by default. + return BuildFrom(proto, dependencies, true); + } + catch (DescriptorValidationException e) + { + throw new ArgumentException("Invalid embedded descriptor for \"" + proto.Name + "\".", e); + } + } + + public override string ToString() + { + return "FileDescriptor for " + proto.Name; + } + } }
\ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/IDescriptor.cs b/csharp/src/ProtocolBuffers/Reflection/IDescriptor.cs index 92c6d463..6506db1b 100644 --- a/csharp/src/ProtocolBuffers/Descriptors/IDescriptor.cs +++ b/csharp/src/ProtocolBuffers/Reflection/IDescriptor.cs @@ -1,44 +1,44 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-namespace Google.Protobuf.Descriptors
-{
- /// <summary>
- /// Interface implemented by all descriptor types.
- /// </summary>
- public interface IDescriptor
- {
- string Name { get; }
- string FullName { get; }
- FileDescriptor File { get; }
- }
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// Interface implemented by all descriptor types. + /// </summary> + public interface IDescriptor + { + string Name { get; } + string FullName { get; } + FileDescriptor File { get; } + } }
\ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/FieldAccess/IFieldAccessor.cs b/csharp/src/ProtocolBuffers/Reflection/IFieldAccessor.cs index d1727cb4..b631d34f 100644 --- a/csharp/src/ProtocolBuffers/FieldAccess/IFieldAccessor.cs +++ b/csharp/src/ProtocolBuffers/Reflection/IFieldAccessor.cs @@ -1,72 +1,70 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-using Google.Protobuf.Descriptors;
-
-namespace Google.Protobuf.FieldAccess
-{
- /// <summary>
- /// Allows fields to be reflectively accessed.
- /// </summary>
- public interface IFieldAccessor
- {
- /// <summary>
- /// Returns the descriptor associated with this field.
- /// </summary>
- FieldDescriptor Descriptor { get; }
-
- // TODO: Should the argument type for these messages by IReflectedMessage?
-
- /// <summary>
- /// Clears the field in the specified message. (For repeated fields,
- /// this clears the list.)
- /// </summary>
- void Clear(object message);
-
- /// <summary>
- /// Fetches the field value. For repeated values, this will be an
- /// <see cref="IList"/> implementation. For map values, this will be an
- /// <see cref="IDictionary"/> implementation.
- /// </summary>
- object GetValue(object message);
-
- /// <summary>
- /// Mutator for single "simple" fields only.
- /// </summary>
- /// <remarks>
- /// Repeated fields are mutated by fetching the value and manipulating it as a list.
- /// Map fields are mutated by fetching the value and manipulating it as a dictionary.
- /// </remarks>
- /// <exception cref="InvalidOperationException">The field is not a "simple" field, or the message is frozen.</exception>
- void SetValue(object message, object value);
- }
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// Allows fields to be reflectively accessed. + /// </summary> + public interface IFieldAccessor + { + /// <summary> + /// Returns the descriptor associated with this field. + /// </summary> + FieldDescriptor Descriptor { get; } + + // TODO: Should the argument type for these messages by IReflectedMessage? + + /// <summary> + /// Clears the field in the specified message. (For repeated fields, + /// this clears the list.) + /// </summary> + void Clear(object message); + + /// <summary> + /// Fetches the field value. For repeated values, this will be an + /// <see cref="IList"/> implementation. For map values, this will be an + /// <see cref="IDictionary"/> implementation. + /// </summary> + object GetValue(object message); + + /// <summary> + /// Mutator for single "simple" fields only. + /// </summary> + /// <remarks> + /// Repeated fields are mutated by fetching the value and manipulating it as a list. + /// Map fields are mutated by fetching the value and manipulating it as a dictionary. + /// </remarks> + /// <exception cref="InvalidOperationException">The field is not a "simple" field, or the message is frozen.</exception> + void SetValue(object message, object value); + } }
\ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/FieldAccess/MapFieldAccessor.cs b/csharp/src/ProtocolBuffers/Reflection/MapFieldAccessor.cs index 100dbb37..317fbd8d 100644 --- a/csharp/src/ProtocolBuffers/FieldAccess/MapFieldAccessor.cs +++ b/csharp/src/ProtocolBuffers/Reflection/MapFieldAccessor.cs @@ -32,9 +32,8 @@ using System; using System.Collections; -using Google.Protobuf.Descriptors; -namespace Google.Protobuf.FieldAccess +namespace Google.Protobuf.Reflection { /// <summary> /// Accessor for map fields. diff --git a/csharp/src/ProtocolBuffers/Descriptors/MessageDescriptor.cs b/csharp/src/ProtocolBuffers/Reflection/MessageDescriptor.cs index e65e8bb0..b6351d36 100644 --- a/csharp/src/ProtocolBuffers/Descriptors/MessageDescriptor.cs +++ b/csharp/src/ProtocolBuffers/Reflection/MessageDescriptor.cs @@ -1,173 +1,172 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-using System;
-using System.Collections.Generic;
-using Google.Protobuf.DescriptorProtos;
-
-namespace Google.Protobuf.Descriptors
-{
- /// <summary>
- /// Describes a message type.
- /// </summary>
- public sealed class MessageDescriptor : DescriptorBase
- {
- private readonly DescriptorProto proto;
- private readonly MessageDescriptor containingType;
- private readonly IList<MessageDescriptor> nestedTypes;
- private readonly IList<EnumDescriptor> enumTypes;
- private readonly IList<FieldDescriptor> fields;
- private readonly IList<OneofDescriptor> oneofs;
-
- internal MessageDescriptor(DescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int typeIndex)
- : base(file, file.ComputeFullName(parent, proto.Name), typeIndex)
- {
- this.proto = proto;
- containingType = parent;
-
- oneofs = DescriptorUtil.ConvertAndMakeReadOnly(proto.OneofDecl,
- (oneof, index) =>
- new OneofDescriptor(oneof, file, this, index));
-
- nestedTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.NestedType,
- (type, index) =>
- new MessageDescriptor(type, file, this, index));
-
- enumTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.EnumType,
- (type, index) =>
- new EnumDescriptor(type, file, this, index));
-
- // TODO(jonskeet): Sort fields first?
- fields = DescriptorUtil.ConvertAndMakeReadOnly(proto.Field,
- (field, index) =>
- new FieldDescriptor(field, file, this, index));
- file.DescriptorPool.AddSymbol(this);
- }
-
- /// <summary>
- /// The brief name of the descriptor's target.
- /// </summary>
- public override string Name { get { return proto.Name; } }
-
- internal DescriptorProto Proto { get { return proto; } }
-
- /// <value>
- /// If this is a nested type, get the outer descriptor, otherwise null.
- /// </value>
- public MessageDescriptor ContainingType
- {
- get { return containingType; }
- }
-
- /// <value>
- /// An unmodifiable list of this message type's fields.
- /// </value>
- public IList<FieldDescriptor> Fields
- {
- get { return fields; }
- }
-
- /// <value>
- /// An unmodifiable list of this message type's nested types.
- /// </value>
- public IList<MessageDescriptor> NestedTypes
- {
- get { return nestedTypes; }
- }
-
- /// <value>
- /// An unmodifiable list of this message type's enum types.
- /// </value>
- public IList<EnumDescriptor> EnumTypes
- {
- get { return enumTypes; }
- }
-
- public IList<OneofDescriptor> Oneofs
- {
- get { return oneofs; }
- }
-
- /// <summary>
- /// Finds a field by field name.
- /// </summary>
- /// <param name="name">The unqualified name of the field (e.g. "foo").</param>
- /// <returns>The field's descriptor, or null if not found.</returns>
- public FieldDescriptor FindFieldByName(String name)
- {
- return File.DescriptorPool.FindSymbol<FieldDescriptor>(FullName + "." + name);
- }
-
- /// <summary>
- /// Finds a field by field number.
- /// </summary>
- /// <param name="number">The field number within this message type.</param>
- /// <returns>The field's descriptor, or null if not found.</returns>
- public FieldDescriptor FindFieldByNumber(int number)
- {
- return File.DescriptorPool.FindFieldByNumber(this, number);
- }
-
- /// <summary>
- /// Finds a nested descriptor by name. The is valid for fields, nested
- /// message types, oneofs and enums.
- /// </summary>
- /// <param name="name">The unqualified name of the descriptor, e.g. "Foo"</param>
- /// <returns>The descriptor, or null if not found.</returns>
- public T FindDescriptor<T>(string name)
- where T : class, IDescriptor
- {
- return File.DescriptorPool.FindSymbol<T>(FullName + "." + name);
- }
-
- /// <summary>
- /// Looks up and cross-links all fields and nested types.
- /// </summary>
- internal void CrossLink()
- {
- foreach (MessageDescriptor message in nestedTypes)
- {
- message.CrossLink();
- }
-
- foreach (FieldDescriptor field in fields)
- {
- field.CrossLink();
- }
-
- foreach (OneofDescriptor oneof in oneofs)
- {
- oneof.CrossLink();
- }
- }
- }
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections.Generic; + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// Describes a message type. + /// </summary> + public sealed class MessageDescriptor : DescriptorBase + { + private readonly DescriptorProto proto; + private readonly MessageDescriptor containingType; + private readonly IList<MessageDescriptor> nestedTypes; + private readonly IList<EnumDescriptor> enumTypes; + private readonly IList<FieldDescriptor> fields; + private readonly IList<OneofDescriptor> oneofs; + + internal MessageDescriptor(DescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int typeIndex) + : base(file, file.ComputeFullName(parent, proto.Name), typeIndex) + { + this.proto = proto; + containingType = parent; + + oneofs = DescriptorUtil.ConvertAndMakeReadOnly(proto.OneofDecl, + (oneof, index) => + new OneofDescriptor(oneof, file, this, index)); + + nestedTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.NestedType, + (type, index) => + new MessageDescriptor(type, file, this, index)); + + enumTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.EnumType, + (type, index) => + new EnumDescriptor(type, file, this, index)); + + // TODO(jonskeet): Sort fields first? + fields = DescriptorUtil.ConvertAndMakeReadOnly(proto.Field, + (field, index) => + new FieldDescriptor(field, file, this, index)); + file.DescriptorPool.AddSymbol(this); + } + + /// <summary> + /// The brief name of the descriptor's target. + /// </summary> + public override string Name { get { return proto.Name; } } + + internal DescriptorProto Proto { get { return proto; } } + + /// <value> + /// If this is a nested type, get the outer descriptor, otherwise null. + /// </value> + public MessageDescriptor ContainingType + { + get { return containingType; } + } + + /// <value> + /// An unmodifiable list of this message type's fields. + /// </value> + public IList<FieldDescriptor> Fields + { + get { return fields; } + } + + /// <value> + /// An unmodifiable list of this message type's nested types. + /// </value> + public IList<MessageDescriptor> NestedTypes + { + get { return nestedTypes; } + } + + /// <value> + /// An unmodifiable list of this message type's enum types. + /// </value> + public IList<EnumDescriptor> EnumTypes + { + get { return enumTypes; } + } + + public IList<OneofDescriptor> Oneofs + { + get { return oneofs; } + } + + /// <summary> + /// Finds a field by field name. + /// </summary> + /// <param name="name">The unqualified name of the field (e.g. "foo").</param> + /// <returns>The field's descriptor, or null if not found.</returns> + public FieldDescriptor FindFieldByName(String name) + { + return File.DescriptorPool.FindSymbol<FieldDescriptor>(FullName + "." + name); + } + + /// <summary> + /// Finds a field by field number. + /// </summary> + /// <param name="number">The field number within this message type.</param> + /// <returns>The field's descriptor, or null if not found.</returns> + public FieldDescriptor FindFieldByNumber(int number) + { + return File.DescriptorPool.FindFieldByNumber(this, number); + } + + /// <summary> + /// Finds a nested descriptor by name. The is valid for fields, nested + /// message types, oneofs and enums. + /// </summary> + /// <param name="name">The unqualified name of the descriptor, e.g. "Foo"</param> + /// <returns>The descriptor, or null if not found.</returns> + public T FindDescriptor<T>(string name) + where T : class, IDescriptor + { + return File.DescriptorPool.FindSymbol<T>(FullName + "." + name); + } + + /// <summary> + /// Looks up and cross-links all fields and nested types. + /// </summary> + internal void CrossLink() + { + foreach (MessageDescriptor message in nestedTypes) + { + message.CrossLink(); + } + + foreach (FieldDescriptor field in fields) + { + field.CrossLink(); + } + + foreach (OneofDescriptor oneof in oneofs) + { + oneof.CrossLink(); + } + } + } }
\ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/MethodDescriptor.cs b/csharp/src/ProtocolBuffers/Reflection/MethodDescriptor.cs index 7d4a6f4f..0c9c6949 100644 --- a/csharp/src/ProtocolBuffers/Descriptors/MethodDescriptor.cs +++ b/csharp/src/ProtocolBuffers/Reflection/MethodDescriptor.cs @@ -1,95 +1,93 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-using Google.Protobuf.DescriptorProtos;
-
-namespace Google.Protobuf.Descriptors
-{
- /// <summary>
- /// Describes a single method in a service.
- /// </summary>
- public sealed class MethodDescriptor : DescriptorBase
- {
- private readonly MethodDescriptorProto proto;
- private readonly ServiceDescriptor service;
- private MessageDescriptor inputType;
- private MessageDescriptor outputType;
-
- /// <value>
- /// The service this method belongs to.
- /// </value>
- public ServiceDescriptor Service { get { return service; } }
-
- /// <value>
- /// The method's input type.
- /// </value>
- public MessageDescriptor InputType { get { return inputType; } }
-
- /// <value>
- /// The method's input type.
- /// </value>
- public MessageDescriptor OutputType { get { return outputType; } }
-
- internal MethodDescriptor(MethodDescriptorProto proto, FileDescriptor file,
- ServiceDescriptor parent, int index)
- : base(file, parent.FullName + "." + proto.Name, index)
- {
- this.proto = proto;
- service = parent;
- file.DescriptorPool.AddSymbol(this);
- }
-
- internal MethodDescriptorProto Proto { get { return proto; } }
-
- /// <summary>
- /// The brief name of the descriptor's target.
- /// </summary>
- public override string Name { get { return proto.Name; } }
-
- internal void CrossLink()
- {
- IDescriptor lookup = File.DescriptorPool.LookupSymbol(Proto.InputType, this);
- if (!(lookup is MessageDescriptor))
- {
- throw new DescriptorValidationException(this, "\"" + Proto.InputType + "\" is not a message type.");
- }
- inputType = (MessageDescriptor) lookup;
-
- lookup = File.DescriptorPool.LookupSymbol(Proto.OutputType, this);
- if (!(lookup is MessageDescriptor))
- {
- throw new DescriptorValidationException(this, "\"" + Proto.OutputType + "\" is not a message type.");
- }
- outputType = (MessageDescriptor) lookup;
- }
- }
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// Describes a single method in a service. + /// </summary> + public sealed class MethodDescriptor : DescriptorBase + { + private readonly MethodDescriptorProto proto; + private readonly ServiceDescriptor service; + private MessageDescriptor inputType; + private MessageDescriptor outputType; + + /// <value> + /// The service this method belongs to. + /// </value> + public ServiceDescriptor Service { get { return service; } } + + /// <value> + /// The method's input type. + /// </value> + public MessageDescriptor InputType { get { return inputType; } } + + /// <value> + /// The method's input type. + /// </value> + public MessageDescriptor OutputType { get { return outputType; } } + + internal MethodDescriptor(MethodDescriptorProto proto, FileDescriptor file, + ServiceDescriptor parent, int index) + : base(file, parent.FullName + "." + proto.Name, index) + { + this.proto = proto; + service = parent; + file.DescriptorPool.AddSymbol(this); + } + + internal MethodDescriptorProto Proto { get { return proto; } } + + /// <summary> + /// The brief name of the descriptor's target. + /// </summary> + public override string Name { get { return proto.Name; } } + + internal void CrossLink() + { + IDescriptor lookup = File.DescriptorPool.LookupSymbol(Proto.InputType, this); + if (!(lookup is MessageDescriptor)) + { + throw new DescriptorValidationException(this, "\"" + Proto.InputType + "\" is not a message type."); + } + inputType = (MessageDescriptor) lookup; + + lookup = File.DescriptorPool.LookupSymbol(Proto.OutputType, this); + if (!(lookup is MessageDescriptor)) + { + throw new DescriptorValidationException(this, "\"" + Proto.OutputType + "\" is not a message type."); + } + outputType = (MessageDescriptor) lookup; + } + } }
\ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/FieldAccess/OneofAccessor.cs b/csharp/src/ProtocolBuffers/Reflection/OneofAccessor.cs index 590b6309..7a11d36b 100644 --- a/csharp/src/ProtocolBuffers/FieldAccess/OneofAccessor.cs +++ b/csharp/src/ProtocolBuffers/Reflection/OneofAccessor.cs @@ -1,86 +1,85 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-using Google.Protobuf.Descriptors;
-using System;
-using System.Reflection;
-
-namespace Google.Protobuf.FieldAccess
-{
- /// <summary>
- /// Reflection access for a oneof, allowing clear and "get case" actions.
- /// </summary>
- public sealed class OneofAccessor
- {
- private readonly Func<object, int> caseDelegate;
- private readonly Action<object> clearDelegate;
- private OneofDescriptor descriptor;
-
- internal OneofAccessor(Type type, string propertyName, OneofDescriptor descriptor)
- {
- PropertyInfo property = type.GetProperty(propertyName + "Case");
- if (property == null || !property.CanRead)
- {
- throw new ArgumentException("Not all required properties/methods available");
- }
- this.descriptor = descriptor;
- caseDelegate = ReflectionUtil.CreateFuncObjectT<int>(property.GetGetMethod());
-
- this.descriptor = descriptor;
- MethodInfo clearMethod = type.GetMethod("Clear" + propertyName);
- clearDelegate = ReflectionUtil.CreateActionObject(clearMethod);
- }
-
- public OneofDescriptor Descriptor { get { return descriptor; } }
-
- /// <summary>
- /// Clears the oneof in the specified message.
- /// </summary>
- public void Clear(object message)
- {
- clearDelegate(message);
- }
-
- /// <summary>
- /// Indicates which field in the oneof is set for specified message
- /// </summary>
- public FieldDescriptor GetCaseFieldDescriptor(object message)
- {
- int fieldNumber = caseDelegate(message);
- if (fieldNumber > 0)
- {
- return descriptor.ContainingType.FindFieldByNumber(fieldNumber);
- }
- return null;
- }
- }
-}
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Reflection; + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// Reflection access for a oneof, allowing clear and "get case" actions. + /// </summary> + public sealed class OneofAccessor + { + private readonly Func<object, int> caseDelegate; + private readonly Action<object> clearDelegate; + private OneofDescriptor descriptor; + + internal OneofAccessor(Type type, string propertyName, OneofDescriptor descriptor) + { + PropertyInfo property = type.GetProperty(propertyName + "Case"); + if (property == null || !property.CanRead) + { + throw new ArgumentException("Not all required properties/methods available"); + } + this.descriptor = descriptor; + caseDelegate = ReflectionUtil.CreateFuncObjectT<int>(property.GetGetMethod()); + + this.descriptor = descriptor; + MethodInfo clearMethod = type.GetMethod("Clear" + propertyName); + clearDelegate = ReflectionUtil.CreateActionObject(clearMethod); + } + + public OneofDescriptor Descriptor { get { return descriptor; } } + + /// <summary> + /// Clears the oneof in the specified message. + /// </summary> + public void Clear(object message) + { + clearDelegate(message); + } + + /// <summary> + /// Indicates which field in the oneof is set for specified message + /// </summary> + public FieldDescriptor GetCaseFieldDescriptor(object message) + { + int fieldNumber = caseDelegate(message); + if (fieldNumber > 0) + { + return descriptor.ContainingType.FindFieldByNumber(fieldNumber); + } + return null; + } + } +} diff --git a/csharp/src/ProtocolBuffers/Descriptors/OneofDescriptor.cs b/csharp/src/ProtocolBuffers/Reflection/OneofDescriptor.cs index 8418948f..e92dc8bb 100644 --- a/csharp/src/ProtocolBuffers/Descriptors/OneofDescriptor.cs +++ b/csharp/src/ProtocolBuffers/Reflection/OneofDescriptor.cs @@ -1,79 +1,78 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using Google.Protobuf.DescriptorProtos;
-
-namespace Google.Protobuf.Descriptors
-{
- public sealed class OneofDescriptor : DescriptorBase
- {
- private readonly OneofDescriptorProto proto;
- private MessageDescriptor containingType;
- private IList<FieldDescriptor> fields;
-
- internal OneofDescriptor(OneofDescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int index)
- : base(file, file.ComputeFullName(parent, proto.Name), index)
- {
- this.proto = proto;
- containingType = parent;
-
- file.DescriptorPool.AddSymbol(this);
- }
-
- /// <summary>
- /// The brief name of the descriptor's target.
- /// </summary>
- public override string Name { get { return proto.Name; } }
-
- public MessageDescriptor ContainingType
- {
- get { return containingType; }
- }
-
- public IList<FieldDescriptor> Fields { get { return fields; } }
-
- internal void CrossLink()
- {
- List<FieldDescriptor> fieldCollection = new List<FieldDescriptor>();
- foreach (var field in ContainingType.Fields)
- {
- if (field.ContainingOneof == this)
- {
- fieldCollection.Add(field);
- }
- }
- fields = new ReadOnlyCollection<FieldDescriptor>(fieldCollection);
- }
- }
-}
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System.Collections.Generic; +using System.Collections.ObjectModel; + +namespace Google.Protobuf.Reflection +{ + public sealed class OneofDescriptor : DescriptorBase + { + private readonly OneofDescriptorProto proto; + private MessageDescriptor containingType; + private IList<FieldDescriptor> fields; + + internal OneofDescriptor(OneofDescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int index) + : base(file, file.ComputeFullName(parent, proto.Name), index) + { + this.proto = proto; + containingType = parent; + + file.DescriptorPool.AddSymbol(this); + } + + /// <summary> + /// The brief name of the descriptor's target. + /// </summary> + public override string Name { get { return proto.Name; } } + + public MessageDescriptor ContainingType + { + get { return containingType; } + } + + public IList<FieldDescriptor> Fields { get { return fields; } } + + internal void CrossLink() + { + List<FieldDescriptor> fieldCollection = new List<FieldDescriptor>(); + foreach (var field in ContainingType.Fields) + { + if (field.ContainingOneof == this) + { + fieldCollection.Add(field); + } + } + fields = new ReadOnlyCollection<FieldDescriptor>(fieldCollection); + } + } +} diff --git a/csharp/src/ProtocolBuffers/Descriptors/PackageDescriptor.cs b/csharp/src/ProtocolBuffers/Reflection/PackageDescriptor.cs index 18adc9e3..e547d834 100644 --- a/csharp/src/ProtocolBuffers/Descriptors/PackageDescriptor.cs +++ b/csharp/src/ProtocolBuffers/Reflection/PackageDescriptor.cs @@ -1,68 +1,68 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-namespace Google.Protobuf.Descriptors
-{
- /// <summary>
- /// Represents a package in the symbol table. We use PackageDescriptors
- /// just as placeholders so that someone cannot define, say, a message type
- /// that has the same name as an existing package.
- /// </summary>
- internal sealed class PackageDescriptor : IDescriptor
- {
- private readonly string name;
- private readonly string fullName;
- private readonly FileDescriptor file;
-
- internal PackageDescriptor(string name, string fullName, FileDescriptor file)
- {
- this.file = file;
- this.fullName = fullName;
- this.name = name;
- }
-
- public string Name
- {
- get { return name; }
- }
-
- public string FullName
- {
- get { return fullName; }
- }
-
- public FileDescriptor File
- {
- get { return file; }
- }
- }
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// Represents a package in the symbol table. We use PackageDescriptors + /// just as placeholders so that someone cannot define, say, a message type + /// that has the same name as an existing package. + /// </summary> + internal sealed class PackageDescriptor : IDescriptor + { + private readonly string name; + private readonly string fullName; + private readonly FileDescriptor file; + + internal PackageDescriptor(string name, string fullName, FileDescriptor file) + { + this.file = file; + this.fullName = fullName; + this.name = name; + } + + public string Name + { + get { return name; } + } + + public string FullName + { + get { return fullName; } + } + + public FileDescriptor File + { + get { return file; } + } + } }
\ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/DescriptorProtos/PartialClasses.cs b/csharp/src/ProtocolBuffers/Reflection/PartialClasses.cs index dc19cdad..c7ed4342 100644 --- a/csharp/src/ProtocolBuffers/DescriptorProtos/PartialClasses.cs +++ b/csharp/src/ProtocolBuffers/Reflection/PartialClasses.cs @@ -31,7 +31,7 @@ #endregion
// This file just contains partial classes for any autogenerated classes that need additional support.
-namespace Google.Protobuf.DescriptorProtos
+namespace Google.Protobuf.Reflection
{
internal partial class FieldDescriptorProto
{
diff --git a/csharp/src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs b/csharp/src/ProtocolBuffers/Reflection/ReflectionUtil.cs index 08ef6c0c..d0dc3e8b 100644 --- a/csharp/src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs +++ b/csharp/src/ProtocolBuffers/Reflection/ReflectionUtil.cs @@ -1,106 +1,106 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-using System;
-using System.Linq.Expressions;
-using System.Reflection;
-
-namespace Google.Protobuf.FieldAccess
-{
- /// <summary>
- /// The methods in this class are somewhat evil, and should not be tampered with lightly.
- /// Basically they allow the creation of relatively weakly typed delegates from MethodInfos
- /// which are more strongly typed. They do this by creating an appropriate strongly typed
- /// delegate from the MethodInfo, and then calling that within an anonymous method.
- /// Mind-bending stuff (at least to your humble narrator) but the resulting delegates are
- /// very fast compared with calling Invoke later on.
- /// </summary>
- internal static class ReflectionUtil
- {
- /// <summary>
- /// Empty Type[] used when calling GetProperty to force property instead of indexer fetching.
- /// </summary>
- internal static readonly Type[] EmptyTypes = new Type[0];
-
- /// <summary>
- /// Creates a delegate which will cast the argument to the appropriate method target type,
- /// call the method on it, then convert the result to object.
- /// </summary>
- internal static Func<object, object> CreateFuncObjectObject(MethodInfo method)
- {
- ParameterExpression parameter = Expression.Parameter(typeof(object), "p");
- Expression downcast = Expression.Convert(parameter, method.DeclaringType);
- Expression call = Expression.Call(downcast, method);
- Expression upcast = Expression.Convert(call, typeof(object));
- return Expression.Lambda<Func<object, object>>(upcast, parameter).Compile();
- }
-
- /// <summary>
- /// Creates a delegate which will cast the argument to the appropriate method target type,
- /// call the method on it, then convert the result to the specified type.
- /// </summary>
- internal static Func<object, T> CreateFuncObjectT<T>(MethodInfo method)
- {
- ParameterExpression parameter = Expression.Parameter(typeof(object), "p");
- Expression downcast = Expression.Convert(parameter, method.DeclaringType);
- Expression call = Expression.Call(downcast, method);
- Expression upcast = Expression.Convert(call, typeof(T));
- return Expression.Lambda<Func<object, T>>(upcast, parameter).Compile();
- }
-
- /// <summary>
- /// Creates a delegate which will execute the given method after casting the first argument to
- /// the target type of the method, and the second argument to the first parameter type of the method.
- /// </summary>
- internal static Action<object, object> CreateActionObjectObject(MethodInfo method)
- {
- ParameterExpression targetParameter = Expression.Parameter(typeof(object), "target");
- ParameterExpression argParameter = Expression.Parameter(typeof(object), "arg");
- Expression castTarget = Expression.Convert(targetParameter, method.DeclaringType);
- Expression castArgument = Expression.Convert(argParameter, method.GetParameters()[0].ParameterType);
- Expression call = Expression.Call(castTarget, method, castArgument);
- return Expression.Lambda<Action<object, object>>(call, targetParameter, argParameter).Compile();
- }
-
- /// <summary>
- /// Creates a delegate which will execute the given method after casting the first argument to
- /// the target type of the method.
- /// </summary>
- internal static Action<object> CreateActionObject(MethodInfo method)
- {
- ParameterExpression targetParameter = Expression.Parameter(typeof(object), "target");
- Expression castTarget = Expression.Convert(targetParameter, method.DeclaringType);
- Expression call = Expression.Call(castTarget, method);
- return Expression.Lambda<Action<object>>(call, targetParameter).Compile();
- }
- }
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Linq.Expressions; +using System.Reflection; + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// The methods in this class are somewhat evil, and should not be tampered with lightly. + /// Basically they allow the creation of relatively weakly typed delegates from MethodInfos + /// which are more strongly typed. They do this by creating an appropriate strongly typed + /// delegate from the MethodInfo, and then calling that within an anonymous method. + /// Mind-bending stuff (at least to your humble narrator) but the resulting delegates are + /// very fast compared with calling Invoke later on. + /// </summary> + internal static class ReflectionUtil + { + /// <summary> + /// Empty Type[] used when calling GetProperty to force property instead of indexer fetching. + /// </summary> + internal static readonly Type[] EmptyTypes = new Type[0]; + + /// <summary> + /// Creates a delegate which will cast the argument to the appropriate method target type, + /// call the method on it, then convert the result to object. + /// </summary> + internal static Func<object, object> CreateFuncObjectObject(MethodInfo method) + { + ParameterExpression parameter = Expression.Parameter(typeof(object), "p"); + Expression downcast = Expression.Convert(parameter, method.DeclaringType); + Expression call = Expression.Call(downcast, method); + Expression upcast = Expression.Convert(call, typeof(object)); + return Expression.Lambda<Func<object, object>>(upcast, parameter).Compile(); + } + + /// <summary> + /// Creates a delegate which will cast the argument to the appropriate method target type, + /// call the method on it, then convert the result to the specified type. + /// </summary> + internal static Func<object, T> CreateFuncObjectT<T>(MethodInfo method) + { + ParameterExpression parameter = Expression.Parameter(typeof(object), "p"); + Expression downcast = Expression.Convert(parameter, method.DeclaringType); + Expression call = Expression.Call(downcast, method); + Expression upcast = Expression.Convert(call, typeof(T)); + return Expression.Lambda<Func<object, T>>(upcast, parameter).Compile(); + } + + /// <summary> + /// Creates a delegate which will execute the given method after casting the first argument to + /// the target type of the method, and the second argument to the first parameter type of the method. + /// </summary> + internal static Action<object, object> CreateActionObjectObject(MethodInfo method) + { + ParameterExpression targetParameter = Expression.Parameter(typeof(object), "target"); + ParameterExpression argParameter = Expression.Parameter(typeof(object), "arg"); + Expression castTarget = Expression.Convert(targetParameter, method.DeclaringType); + Expression castArgument = Expression.Convert(argParameter, method.GetParameters()[0].ParameterType); + Expression call = Expression.Call(castTarget, method, castArgument); + return Expression.Lambda<Action<object, object>>(call, targetParameter, argParameter).Compile(); + } + + /// <summary> + /// Creates a delegate which will execute the given method after casting the first argument to + /// the target type of the method. + /// </summary> + internal static Action<object> CreateActionObject(MethodInfo method) + { + ParameterExpression targetParameter = Expression.Parameter(typeof(object), "target"); + Expression castTarget = Expression.Convert(targetParameter, method.DeclaringType); + Expression call = Expression.Call(castTarget, method); + return Expression.Lambda<Action<object>>(call, targetParameter).Compile(); + } + } }
\ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/FieldAccess/RepeatedFieldAccessor.cs b/csharp/src/ProtocolBuffers/Reflection/RepeatedFieldAccessor.cs index 8d7ecbaf..0ada7567 100644 --- a/csharp/src/ProtocolBuffers/FieldAccess/RepeatedFieldAccessor.cs +++ b/csharp/src/ProtocolBuffers/Reflection/RepeatedFieldAccessor.cs @@ -32,9 +32,8 @@ using System; using System.Collections; -using Google.Protobuf.Descriptors; -namespace Google.Protobuf.FieldAccess +namespace Google.Protobuf.Reflection { /// <summary> /// Accessor for repeated fields. diff --git a/csharp/src/ProtocolBuffers/Descriptors/ServiceDescriptor.cs b/csharp/src/ProtocolBuffers/Reflection/ServiceDescriptor.cs index 2556e272..cc0a5010 100644 --- a/csharp/src/ProtocolBuffers/Descriptors/ServiceDescriptor.cs +++ b/csharp/src/ProtocolBuffers/Reflection/ServiceDescriptor.cs @@ -1,90 +1,89 @@ -#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-using System;
-using System.Collections.Generic;
-using Google.Protobuf.DescriptorProtos;
-
-namespace Google.Protobuf.Descriptors
-{
- /// <summary>
- /// Describes a service type.
- /// </summary>
- public sealed class ServiceDescriptor : DescriptorBase
- {
- private readonly ServiceDescriptorProto proto;
- private readonly IList<MethodDescriptor> methods;
-
- internal ServiceDescriptor(ServiceDescriptorProto proto, FileDescriptor file, int index)
- : base(file, file.ComputeFullName(null, proto.Name), index)
- {
- this.proto = proto;
- methods = DescriptorUtil.ConvertAndMakeReadOnly(proto.Method,
- (method, i) => new MethodDescriptor(method, file, this, i));
-
- file.DescriptorPool.AddSymbol(this);
- }
-
- /// <summary>
- /// The brief name of the descriptor's target.
- /// </summary>
- public override string Name { get { return proto.Name; } }
-
- internal ServiceDescriptorProto Proto { get { return proto; } }
-
- /// <value>
- /// An unmodifiable list of methods in this service.
- /// </value>
- public IList<MethodDescriptor> Methods
- {
- get { return methods; }
- }
-
- /// <summary>
- /// Finds a method by name.
- /// </summary>
- /// <param name="name">The unqualified name of the method (e.g. "Foo").</param>
- /// <returns>The method's decsriptor, or null if not found.</returns>
- public MethodDescriptor FindMethodByName(String name)
- {
- return File.DescriptorPool.FindSymbol<MethodDescriptor>(FullName + "." + name);
- }
-
- internal void CrossLink()
- {
- foreach (MethodDescriptor method in methods)
- {
- method.CrossLink();
- }
- }
- }
+#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections.Generic; + +namespace Google.Protobuf.Reflection +{ + /// <summary> + /// Describes a service type. + /// </summary> + public sealed class ServiceDescriptor : DescriptorBase + { + private readonly ServiceDescriptorProto proto; + private readonly IList<MethodDescriptor> methods; + + internal ServiceDescriptor(ServiceDescriptorProto proto, FileDescriptor file, int index) + : base(file, file.ComputeFullName(null, proto.Name), index) + { + this.proto = proto; + methods = DescriptorUtil.ConvertAndMakeReadOnly(proto.Method, + (method, i) => new MethodDescriptor(method, file, this, i)); + + file.DescriptorPool.AddSymbol(this); + } + + /// <summary> + /// The brief name of the descriptor's target. + /// </summary> + public override string Name { get { return proto.Name; } } + + internal ServiceDescriptorProto Proto { get { return proto; } } + + /// <value> + /// An unmodifiable list of methods in this service. + /// </value> + public IList<MethodDescriptor> Methods + { + get { return methods; } + } + + /// <summary> + /// Finds a method by name. + /// </summary> + /// <param name="name">The unqualified name of the method (e.g. "Foo").</param> + /// <returns>The method's decsriptor, or null if not found.</returns> + public MethodDescriptor FindMethodByName(String name) + { + return File.DescriptorPool.FindSymbol<MethodDescriptor>(FullName + "." + name); + } + + internal void CrossLink() + { + foreach (MethodDescriptor method in methods) + { + method.CrossLink(); + } + } + } }
\ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/FieldAccess/SingleFieldAccessor.cs b/csharp/src/ProtocolBuffers/Reflection/SingleFieldAccessor.cs index cdc89e8d..8c24e46e 100644 --- a/csharp/src/ProtocolBuffers/FieldAccess/SingleFieldAccessor.cs +++ b/csharp/src/ProtocolBuffers/Reflection/SingleFieldAccessor.cs @@ -29,12 +29,11 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endregion - + using System; using System.Reflection; -using Google.Protobuf.Descriptors; -namespace Google.Protobuf.FieldAccess +namespace Google.Protobuf.Reflection { /// <summary> /// Accessor for single fields. diff --git a/csharp/src/ProtocolBuffers/WireFormat.cs b/csharp/src/ProtocolBuffers/WireFormat.cs index 7489c2fc..c1712daa 100644 --- a/csharp/src/ProtocolBuffers/WireFormat.cs +++ b/csharp/src/ProtocolBuffers/WireFormat.cs @@ -31,7 +31,7 @@ #endregion
using System;
-using Google.Protobuf.Descriptors;
+using Google.Protobuf.Reflection;
namespace Google.Protobuf
{
diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc index 2c492b04..b28cf51b 100644 --- a/src/google/protobuf/any.pb.cc +++ b/src/google/protobuf/any.pb.cc @@ -82,9 +82,8 @@ void protobuf_AddDesc_google_2fprotobuf_2fany_2eproto() { ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( "\n\031google/protobuf/any.proto\022\017google.prot" "obuf\"&\n\003Any\022\020\n\010type_url\030\001 \001(\t\022\r\n\005value\030\002" - " \001(\014BC\n\023com.google.protobufB\010AnyProtoP\001\240" - "\001\001\242\002\003GPB\252\002\026Google.ProtocolBuffersb\006proto" - "3", 161); + " \001(\014B<\n\023com.google.protobufB\010AnyProtoP\001\240" + "\001\001\242\002\003GPB\252\002\017Google.Protobufb\006proto3", 154); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/any.proto", &protobuf_RegisterTypes); Any::default_instance_ = new Any(); diff --git a/src/google/protobuf/compiler/csharp/csharp_message.cc b/src/google/protobuf/compiler/csharp/csharp_message.cc index 3fbec2b5..7cbba911 100644 --- a/src/google/protobuf/compiler/csharp/csharp_message.cc +++ b/src/google/protobuf/compiler/csharp/csharp_message.cc @@ -116,7 +116,7 @@ void MessageGenerator::GenerateStaticVariables(io::Printer* printer) { // The descriptor for this type. printer->Print( - "internal static pb::FieldAccess.FieldAccessorTable internal__$identifier$__FieldAccessorTable;\n", + "internal static pbr::FieldAccessorTable internal__$identifier$__FieldAccessorTable;\n", "identifier", GetUniqueFileScopeIdentifier(descriptor_), "full_class_name", full_class_name()); @@ -145,7 +145,7 @@ void MessageGenerator::GenerateStaticVariableInitializers(io::Printer* printer) printer->Print( vars, "internal__$identifier$__FieldAccessorTable = \n" - " new pb::FieldAccess.FieldAccessorTable(typeof($full_class_name$), $descriptor_chain$,\n"); + " new pbr::FieldAccessorTable(typeof($full_class_name$), $descriptor_chain$,\n"); printer->Print(" new string[] { "); for (int i = 0; i < descriptor_->field_count(); i++) { printer->Print("\"$property_name$\", ", @@ -211,11 +211,11 @@ void MessageGenerator::Generate(io::Printer* printer) { printer->Print( vars, - "public static pbd::MessageDescriptor Descriptor {\n" + "public static pbr::MessageDescriptor Descriptor {\n" " get { return $descriptor_accessor$; }\n" "}\n" "\n" - "public pb::FieldAccess.FieldAccessorTable Fields {\n" + "public pbr::FieldAccessorTable Fields {\n" " get { return $umbrella_class_name$.internal__$identifier$__FieldAccessorTable; }\n" "}\n" "\n" diff --git a/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc b/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc index 8fbd3e9a..b75c68a1 100644 --- a/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc +++ b/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc @@ -119,7 +119,7 @@ void UmbrellaClassGenerator::WriteIntroduction(io::Printer* printer) { "\n" "using pb = global::Google.Protobuf;\n" "using pbc = global::Google.Protobuf.Collections;\n" - "using pbd = global::Google.Protobuf.Descriptors;\n" + "using pbr = global::Google.Protobuf.Reflection;\n" "using scg = global::System.Collections.Generic;\n", "file_name", file_->name()); @@ -151,10 +151,10 @@ void UmbrellaClassGenerator::WriteIntroduction(io::Printer* printer) { void UmbrellaClassGenerator::WriteDescriptor(io::Printer* printer) { printer->Print( "#region Descriptor\n" - "public static pbd::FileDescriptor Descriptor {\n" + "public static pbr::FileDescriptor Descriptor {\n" " get { return descriptor; }\n" "}\n" - "private static pbd::FileDescriptor descriptor;\n" + "private static pbr::FileDescriptor descriptor;\n" "\n" "static $umbrella_class_name$() {\n", "umbrella_class_name", umbrellaClassname_); @@ -180,8 +180,8 @@ void UmbrellaClassGenerator::WriteDescriptor(io::Printer* printer) { // ----------------------------------------------------------------- // Invoke InternalBuildGeneratedFileFrom() to build the file. printer->Print( - "descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,\n"); - printer->Print(" new pbd::FileDescriptor[] {\n"); + "descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,\n"); + printer->Print(" new pbr::FileDescriptor[] {\n"); for (int i = 0; i < file_->dependency_count(); i++) { printer->Print( " $full_umbrella_class_name$.Descriptor, \n", diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 1f49cd6d..f7f7832a 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -753,9 +753,9 @@ void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() { "ion\032\206\001\n\010Location\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004sp" "an\030\002 \003(\005B\002\020\001\022\030\n\020leading_comments\030\003 \001(\t\022\031" "\n\021trailing_comments\030\004 \001(\t\022!\n\031leading_det" - "ached_comments\030\006 \003(\tB^\n\023com.google.proto" + "ached_comments\030\006 \003(\tBX\n\023com.google.proto" "bufB\020DescriptorProtosH\001Z\ndescriptor\242\002\003GP" - "B\252\002 Google.Protobuf.DescriptorProtos", 4956); + "B\252\002\032Google.Protobuf.Reflection", 4950); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/descriptor.proto", &protobuf_RegisterTypes); FileDescriptorSet::default_instance_ = new FileDescriptorSet(); diff --git a/src/google/protobuf/descriptor.proto b/src/google/protobuf/descriptor.proto index 82de7b09..db6b9b7e 100644 --- a/src/google/protobuf/descriptor.proto +++ b/src/google/protobuf/descriptor.proto @@ -43,7 +43,7 @@ package google.protobuf; option go_package = "descriptor"; option java_package = "com.google.protobuf"; option java_outer_classname = "DescriptorProtos"; -option csharp_namespace = "Google.Protobuf.DescriptorProtos"; +option csharp_namespace = "Google.Protobuf.Reflection"; option objc_class_prefix = "GPB"; // descriptor.proto must be optimized for speed because reflection-based diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc index f78fce21..f4933729 100644 --- a/src/google/protobuf/duration.pb.cc +++ b/src/google/protobuf/duration.pb.cc @@ -82,9 +82,9 @@ void protobuf_AddDesc_google_2fprotobuf_2fduration_2eproto() { ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( "\n\036google/protobuf/duration.proto\022\017google" ".protobuf\"*\n\010Duration\022\017\n\007seconds\030\001 \001(\003\022\r" - "\n\005nanos\030\002 \001(\005BH\n\023com.google.protobufB\rDu" - "rationProtoP\001\240\001\001\242\002\003GPB\252\002\026Google.Protocol" - "Buffersb\006proto3", 175); + "\n\005nanos\030\002 \001(\005BA\n\023com.google.protobufB\rDu" + "rationProtoP\001\240\001\001\242\002\003GPB\252\002\017Google.Protobuf" + "b\006proto3", 168); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/duration.proto", &protobuf_RegisterTypes); Duration::default_instance_ = new Duration(); diff --git a/src/google/protobuf/field_mask.pb.cc b/src/google/protobuf/field_mask.pb.cc index 68314fd3..4a80c2f0 100644 --- a/src/google/protobuf/field_mask.pb.cc +++ b/src/google/protobuf/field_mask.pb.cc @@ -81,8 +81,8 @@ void protobuf_AddDesc_google_2fprotobuf_2ffield_5fmask_2eproto() { ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( "\n google/protobuf/field_mask.proto\022\017goog" "le.protobuf\"\032\n\tFieldMask\022\r\n\005paths\030\001 \003(\tB" - "F\n\023com.google.protobufB\016FieldMaskProtoP\001" - "\242\002\003GPB\252\002\026Google.ProtocolBuffersb\006proto3", 159); + "\?\n\023com.google.protobufB\016FieldMaskProtoP\001" + "\242\002\003GPB\252\002\017Google.Protobufb\006proto3", 152); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/field_mask.proto", &protobuf_RegisterTypes); FieldMask::default_instance_ = new FieldMask(); diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc index 30113cdb..1105ae5c 100644 --- a/src/google/protobuf/struct.pb.cc +++ b/src/google/protobuf/struct.pb.cc @@ -165,9 +165,9 @@ void protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto() { "\000\0220\n\nlist_value\030\006 \001(\0132\032.google.protobuf." "ListValueH\000B\006\n\004kind\"3\n\tListValue\022&\n\006valu" "es\030\001 \003(\0132\026.google.protobuf.Value*\033\n\tNull" - "Value\022\016\n\nNULL_VALUE\020\000BF\n\023com.google.prot" - "obufB\013StructProtoP\001\240\001\001\242\002\003GPB\252\002\026Google.Pr" - "otocolBuffersb\006proto3", 581); + "Value\022\016\n\nNULL_VALUE\020\000B\?\n\023com.google.prot" + "obufB\013StructProtoP\001\240\001\001\242\002\003GPB\252\002\017Google.Pr" + "otobufb\006proto3", 574); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/struct.proto", &protobuf_RegisterTypes); Struct::default_instance_ = new Struct(); diff --git a/src/google/protobuf/timestamp.pb.cc b/src/google/protobuf/timestamp.pb.cc index 877dc8f3..5b2f4ee3 100644 --- a/src/google/protobuf/timestamp.pb.cc +++ b/src/google/protobuf/timestamp.pb.cc @@ -82,9 +82,9 @@ void protobuf_AddDesc_google_2fprotobuf_2ftimestamp_2eproto() { ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( "\n\037google/protobuf/timestamp.proto\022\017googl" "e.protobuf\"+\n\tTimestamp\022\017\n\007seconds\030\001 \001(\003" - "\022\r\n\005nanos\030\002 \001(\005BI\n\023com.google.protobufB\016" - "TimestampProtoP\001\240\001\001\242\002\003GPB\252\002\026Google.Proto" - "colBuffersb\006proto3", 178); + "\022\r\n\005nanos\030\002 \001(\005BB\n\023com.google.protobufB\016" + "TimestampProtoP\001\240\001\001\242\002\003GPB\252\002\017Google.Proto" + "bufb\006proto3", 171); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/timestamp.proto", &protobuf_RegisterTypes); Timestamp::default_instance_ = new Timestamp(); diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc index ffc77f1c..fb7330f9 100644 --- a/src/google/protobuf/wrappers.pb.cc +++ b/src/google/protobuf/wrappers.pb.cc @@ -262,9 +262,9 @@ void protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto() { "e\030\001 \001(\004\"\033\n\nInt32Value\022\r\n\005value\030\001 \001(\005\"\034\n\013" "UInt32Value\022\r\n\005value\030\001 \001(\r\"\032\n\tBoolValue\022" "\r\n\005value\030\001 \001(\010\"\034\n\013StringValue\022\r\n\005value\030\001" - " \001(\t\"\033\n\nBytesValue\022\r\n\005value\030\001 \001(\014BE\n\023com" + " \001(\t\"\033\n\nBytesValue\022\r\n\005value\030\001 \001(\014B>\n\023com" ".google.protobufB\rWrappersProtoP\001\242\002\003GPB\252" - "\002\026Google.ProtocolBuffersb\006proto3", 392); + "\002\017Google.Protobufb\006proto3", 385); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/wrappers.proto", &protobuf_RegisterTypes); DoubleValue::default_instance_ = new DoubleValue(); |