Commit f30c3d35 authored by Jon Skeet's avatar Jon Skeet

Merge pull request #593 from jskeet/reflection-namespace

Change the reflection namespace in C#
parents 24f8626c 1660c563
...@@ -38,7 +38,7 @@ fi ...@@ -38,7 +38,7 @@ fi
# Descriptor proto # Descriptor proto
# TODO(jonskeet): Remove fixup # TODO(jonskeet): Remove fixup
cp src/google/protobuf/descriptor.proto src/google/protobuf/descriptor_proto_file.proto 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 src/google/protobuf/descriptor_proto_file.proto
rm src/google/protobuf/descriptor_proto_file.proto rm src/google/protobuf/descriptor_proto_file.proto
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
using pb = global::Google.Protobuf; using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections; using pbc = global::Google.Protobuf.Collections;
using pbd = global::Google.Protobuf.Descriptors; using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic; using scg = global::System.Collections.Generic;
namespace Google.Protobuf.Examples.AddressBook { namespace Google.Protobuf.Examples.AddressBook {
...@@ -13,15 +13,15 @@ namespace Google.Protobuf.Examples.AddressBook { ...@@ -13,15 +13,15 @@ namespace Google.Protobuf.Examples.AddressBook {
public static partial class Addressbook { public static partial class Addressbook {
#region Static variables #region Static variables
internal static pb::FieldAccess.FieldAccessorTable internal__static_tutorial_Person__FieldAccessorTable; internal static pbr::FieldAccessorTable internal__static_tutorial_Person__FieldAccessorTable;
internal static pb::FieldAccess.FieldAccessorTable internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable; internal static pbr::FieldAccessorTable internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable;
internal static pb::FieldAccess.FieldAccessorTable internal__static_tutorial_AddressBook__FieldAccessorTable; internal static pbr::FieldAccessorTable internal__static_tutorial_AddressBook__FieldAccessorTable;
#endregion #endregion
#region Descriptor #region Descriptor
public static pbd::FileDescriptor Descriptor { public static pbr::FileDescriptor Descriptor {
get { return descriptor; } get { return descriptor; }
} }
private static pbd::FileDescriptor descriptor; private static pbr::FileDescriptor descriptor;
static Addressbook() { static Addressbook() {
byte[] descriptorData = global::System.Convert.FromBase64String( byte[] descriptorData = global::System.Convert.FromBase64String(
...@@ -35,17 +35,17 @@ namespace Google.Protobuf.Examples.AddressBook { ...@@ -35,17 +35,17 @@ namespace Google.Protobuf.Examples.AddressBook {
"ASADKAsyEC50dXRvcmlhbC5QZXJzb25CUAoUY29tLmV4YW1wbGUudHV0b3Jp", "ASADKAsyEC50dXRvcmlhbC5QZXJzb25CUAoUY29tLmV4YW1wbGUudHV0b3Jp",
"YWxCEUFkZHJlc3NCb29rUHJvdG9zqgIkR29vZ2xlLlByb3RvYnVmLkV4YW1w", "YWxCEUFkZHJlc3NCb29rUHJvdG9zqgIkR29vZ2xlLlByb3RvYnVmLkV4YW1w",
"bGVzLkFkZHJlc3NCb29rYgZwcm90bzM=")); "bGVzLkFkZHJlc3NCb29rYgZwcm90bzM="));
descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbd::FileDescriptor[] { new pbr::FileDescriptor[] {
}); });
internal__static_tutorial_Person__FieldAccessorTable = 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[] { }); new string[] { "Name", "Id", "Email", "Phone", }, new string[] { });
internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable = 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[] { }); new string[] { "Number", "Type", }, new string[] { });
internal__static_tutorial_AddressBook__FieldAccessorTable = 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[] { }); new string[] { "Person", }, new string[] { });
} }
#endregion #endregion
...@@ -59,11 +59,11 @@ namespace Google.Protobuf.Examples.AddressBook { ...@@ -59,11 +59,11 @@ namespace Google.Protobuf.Examples.AddressBook {
private static readonly string[] _fieldNames = new string[] { "email", "id", "name", "phone" }; private static readonly string[] _fieldNames = new string[] { "email", "id", "name", "phone" };
private static readonly uint[] _fieldTags = new uint[] { 26, 16, 10, 34 }; 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]; } 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; } get { return global::Google.Protobuf.Examples.AddressBook.Addressbook.internal__static_tutorial_Person__FieldAccessorTable; }
} }
...@@ -258,11 +258,11 @@ namespace Google.Protobuf.Examples.AddressBook { ...@@ -258,11 +258,11 @@ namespace Google.Protobuf.Examples.AddressBook {
private static readonly string[] _fieldNames = new string[] { "number", "type" }; private static readonly string[] _fieldNames = new string[] { "number", "type" };
private static readonly uint[] _fieldTags = new uint[] { 10, 16 }; 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]; } 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; } get { return global::Google.Protobuf.Examples.AddressBook.Addressbook.internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable; }
} }
...@@ -409,11 +409,11 @@ namespace Google.Protobuf.Examples.AddressBook { ...@@ -409,11 +409,11 @@ namespace Google.Protobuf.Examples.AddressBook {
private static readonly string[] _fieldNames = new string[] { "person" }; private static readonly string[] _fieldNames = new string[] { "person" };
private static readonly uint[] _fieldTags = new uint[] { 10 }; 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]; } 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; } get { return global::Google.Protobuf.Examples.AddressBook.Addressbook.internal__static_tutorial_AddressBook__FieldAccessorTable; }
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion #endregion
using Google.Protobuf.Descriptors; using Google.Protobuf.Reflection;
using UnitTest.Issues.TestProtos; using UnitTest.Issues.TestProtos;
using NUnit.Framework; using NUnit.Framework;
......
...@@ -81,6 +81,7 @@ ...@@ -81,6 +81,7 @@
<Compile Include="Collections\MapFieldTest.cs" /> <Compile Include="Collections\MapFieldTest.cs" />
<Compile Include="Collections\RepeatedFieldTest.cs" /> <Compile Include="Collections\RepeatedFieldTest.cs" />
<Compile Include="JsonFormatterTest.cs" /> <Compile Include="JsonFormatterTest.cs" />
<Compile Include="Reflection\DescriptorsTest.cs" />
<Compile Include="SampleEnum.cs" /> <Compile Include="SampleEnum.cs" />
<Compile Include="SampleMessages.cs" /> <Compile Include="SampleMessages.cs" />
<Compile Include="TestProtos\MapUnittestProto3.cs" /> <Compile Include="TestProtos\MapUnittestProto3.cs" />
...@@ -89,7 +90,6 @@ ...@@ -89,7 +90,6 @@
<Compile Include="TestProtos\UnittestIssues.cs" /> <Compile Include="TestProtos\UnittestIssues.cs" />
<Compile Include="TestProtos\UnittestProto3.cs" /> <Compile Include="TestProtos\UnittestProto3.cs" />
<Compile Include="DeprecatedMemberTest.cs" /> <Compile Include="DeprecatedMemberTest.cs" />
<Compile Include="DescriptorsTest.cs" />
<Compile Include="IssuesTest.cs" /> <Compile Include="IssuesTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestCornerCases.cs" /> <Compile Include="TestCornerCases.cs" />
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
using pb = global::Google.Protobuf; using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections; using pbc = global::Google.Protobuf.Collections;
using pbd = global::Google.Protobuf.Descriptors; using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic; using scg = global::System.Collections.Generic;
namespace Google.Protobuf.TestProtos { namespace Google.Protobuf.TestProtos {
...@@ -13,13 +13,13 @@ namespace Google.Protobuf.TestProtos { ...@@ -13,13 +13,13 @@ namespace Google.Protobuf.TestProtos {
public static partial class UnittestImportProto3 { public static partial class UnittestImportProto3 {
#region Static variables #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 #endregion
#region Descriptor #region Descriptor
public static pbd::FileDescriptor Descriptor { public static pbr::FileDescriptor Descriptor {
get { return descriptor; } get { return descriptor; }
} }
private static pbd::FileDescriptor descriptor; private static pbr::FileDescriptor descriptor;
static UnittestImportProto3() { static UnittestImportProto3() {
byte[] descriptorData = global::System.Convert.FromBase64String( byte[] descriptorData = global::System.Convert.FromBase64String(
...@@ -32,12 +32,12 @@ namespace Google.Protobuf.TestProtos { ...@@ -32,12 +32,12 @@ namespace Google.Protobuf.TestProtos {
"UhAIEg4KCklNUE9SVF9CQVoQCUI8Chhjb20uZ29vZ2xlLnByb3RvYnVmLnRl", "UhAIEg4KCklNUE9SVF9CQVoQCUI8Chhjb20uZ29vZ2xlLnByb3RvYnVmLnRl",
"c3RIAfgBAaoCGkdvb2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zUABiBnByb3Rv", "c3RIAfgBAaoCGkdvb2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zUABiBnByb3Rv",
"Mw==")); "Mw=="));
descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbd::FileDescriptor[] { new pbr::FileDescriptor[] {
global::Google.Protobuf.TestProtos.UnittestImportPublicProto3.Descriptor, global::Google.Protobuf.TestProtos.UnittestImportPublicProto3.Descriptor,
}); });
internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable = 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[] { }); new string[] { "D", }, new string[] { });
} }
#endregion #endregion
...@@ -61,11 +61,11 @@ namespace Google.Protobuf.TestProtos { ...@@ -61,11 +61,11 @@ namespace Google.Protobuf.TestProtos {
private static readonly string[] _fieldNames = new string[] { "d" }; private static readonly string[] _fieldNames = new string[] { "d" };
private static readonly uint[] _fieldTags = new uint[] { 8 }; 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]; } 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; } get { return global::Google.Protobuf.TestProtos.UnittestImportProto3.internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable; }
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
using pb = global::Google.Protobuf; using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections; using pbc = global::Google.Protobuf.Collections;
using pbd = global::Google.Protobuf.Descriptors; using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic; using scg = global::System.Collections.Generic;
namespace Google.Protobuf.TestProtos { namespace Google.Protobuf.TestProtos {
...@@ -13,13 +13,13 @@ namespace Google.Protobuf.TestProtos { ...@@ -13,13 +13,13 @@ namespace Google.Protobuf.TestProtos {
public static partial class UnittestImportPublicProto3 { public static partial class UnittestImportPublicProto3 {
#region Static variables #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 #endregion
#region Descriptor #region Descriptor
public static pbd::FileDescriptor Descriptor { public static pbr::FileDescriptor Descriptor {
get { return descriptor; } get { return descriptor; }
} }
private static pbd::FileDescriptor descriptor; private static pbr::FileDescriptor descriptor;
static UnittestImportPublicProto3() { static UnittestImportPublicProto3() {
byte[] descriptorData = global::System.Convert.FromBase64String( byte[] descriptorData = global::System.Convert.FromBase64String(
...@@ -28,11 +28,11 @@ namespace Google.Protobuf.TestProtos { ...@@ -28,11 +28,11 @@ namespace Google.Protobuf.TestProtos {
"bzMucHJvdG8SGHByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydCIgChNQdWJsaWNJ", "bzMucHJvdG8SGHByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydCIgChNQdWJsaWNJ",
"bXBvcnRNZXNzYWdlEgkKAWUYASABKAVCNwoYY29tLmdvb2dsZS5wcm90b2J1", "bXBvcnRNZXNzYWdlEgkKAWUYASABKAVCNwoYY29tLmdvb2dsZS5wcm90b2J1",
"Zi50ZXN0qgIaR29vZ2xlLlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3RvMw==")); "Zi50ZXN0qgIaR29vZ2xlLlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3RvMw=="));
descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbd::FileDescriptor[] { new pbr::FileDescriptor[] {
}); });
internal__static_protobuf_unittest_import_PublicImportMessage__FieldAccessorTable = 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[] { }); new string[] { "E", }, new string[] { });
} }
#endregion #endregion
...@@ -46,11 +46,11 @@ namespace Google.Protobuf.TestProtos { ...@@ -46,11 +46,11 @@ namespace Google.Protobuf.TestProtos {
private static readonly string[] _fieldNames = new string[] { "e" }; private static readonly string[] _fieldNames = new string[] { "e" };
private static readonly uint[] _fieldTags = new uint[] { 8 }; 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]; } 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; } get { return global::Google.Protobuf.TestProtos.UnittestImportPublicProto3.internal__static_protobuf_unittest_import_PublicImportMessage__FieldAccessorTable; }
} }
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#endregion #endregion
using System; using System;
using Google.Protobuf.FieldAccess; using Google.Protobuf.Reflection;
namespace Google.Protobuf namespace Google.Protobuf
{ {
......
...@@ -34,8 +34,7 @@ using System; ...@@ -34,8 +34,7 @@ using System;
using System.Collections; using System.Collections;
using System.Globalization; using System.Globalization;
using System.Text; using System.Text;
using Google.Protobuf.Descriptors; using Google.Protobuf.Reflection;
using Google.Protobuf.FieldAccess;
namespace Google.Protobuf namespace Google.Protobuf
{ {
......
...@@ -60,47 +60,48 @@ ...@@ -60,47 +60,48 @@
<Compile Include="Collections\MapField.cs" /> <Compile Include="Collections\MapField.cs" />
<Compile Include="Collections\ReadOnlyDictionary.cs" /> <Compile Include="Collections\ReadOnlyDictionary.cs" />
<Compile Include="Collections\RepeatedField.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="FieldCodec.cs" />
<Compile Include="FrameworkPortability.cs" /> <Compile Include="FrameworkPortability.cs" />
<Compile Include="Freezable.cs" /> <Compile Include="Freezable.cs" />
<Compile Include="JsonFormatter.cs" /> <Compile Include="JsonFormatter.cs" />
<Compile Include="MessageExtensions.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="IMessage.cs" />
<Compile Include="InvalidProtocolBufferException.cs" /> <Compile Include="InvalidProtocolBufferException.cs" />
<Compile Include="LimitedInputStream.cs" /> <Compile Include="LimitedInputStream.cs" />
<Compile Include="MessageParser.cs" /> <Compile Include="MessageParser.cs" />
<Compile Include="Properties\AssemblyInfo.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="ThrowHelper.cs" />
<Compile Include="WireFormat.cs" /> <Compile Include="WireFormat.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Google.Protobuf.nuspec" /> <None Include="Google.Protobuf.nuspec" />
</ItemGroup> </ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /> <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. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.
......
#region Copyright notice and license #region Copyright notice and license
// Protocol Buffers - Google's data interchange format // Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved. // Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/ // https://developers.google.com/protocol-buffers/
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
// //
// * Redistributions of source code must retain the above copyright // * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer. // notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above // * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer // copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the // in the documentation and/or other materials provided with the
// distribution. // distribution.
// * Neither the name of Google Inc. nor the names of its // * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from // contributors may be used to endorse or promote products derived from
// this software without specific prior written permission. // this software without specific prior written permission.
// //
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion #endregion
using Google.Protobuf.DescriptorProtos; namespace Google.Protobuf.Reflection
{
namespace Google.Protobuf.Descriptors /// <summary>
{ /// Base class for nearly all descriptors, providing common functionality.
/// <summary> /// </summary>
/// Base class for nearly all descriptors, providing common functionality. public abstract class DescriptorBase : IDescriptor
/// </summary> {
public abstract class DescriptorBase : IDescriptor private readonly FileDescriptor file;
{ private readonly string fullName;
private readonly FileDescriptor file; private readonly int index;
private readonly string fullName;
private readonly int index; internal DescriptorBase(FileDescriptor file, string fullName, int index)
{
internal DescriptorBase(FileDescriptor file, string fullName, int index) this.file = file;
{ this.fullName = fullName;
this.file = file; this.index = index;
this.fullName = fullName; }
this.index = index;
} /// <value>
/// The index of this descriptor within its parent descriptor.
/// <value> /// </value>
/// The index of this descriptor within its parent descriptor. /// <remarks>
/// </value> /// This returns the index of this descriptor within its parent, for
/// <remarks> /// this descriptor's type. (There can be duplicate values for different
/// This returns the index of this descriptor within its parent, for /// types, e.g. one enum type with index 0 and one message type with index 0.)
/// this descriptor's type. (There can be duplicate values for different /// </remarks>
/// types, e.g. one enum type with index 0 and one message type with index 0.) public int Index
/// </remarks> {
public int Index get { return index; }
{ }
get { return index; }
} public abstract string Name { get; }
public abstract string Name { get; } /// <summary>
/// The fully qualified name of the descriptor's target.
/// <summary> /// </summary>
/// The fully qualified name of the descriptor's target. public string FullName
/// </summary> {
public string FullName get { return fullName; }
{ }
get { return fullName; }
} /// <value>
/// The file this descriptor was declared in.
/// <value> /// </value>
/// The file this descriptor was declared in. public FileDescriptor File
/// </value> {
public FileDescriptor File get { return file; }
{ }
get { return file; } }
}
}
} }
\ No newline at end of file
#region Copyright notice and license #region Copyright notice and license
// Protocol Buffers - Google's data interchange format // Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved. // Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/ // https://developers.google.com/protocol-buffers/
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
// //
// * Redistributions of source code must retain the above copyright // * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer. // notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above // * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer // copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the // in the documentation and/or other materials provided with the
// distribution. // distribution.
// * Neither the name of Google Inc. nor the names of its // * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from // contributors may be used to endorse or promote products derived from
// this software without specific prior written permission. // this software without specific prior written permission.
// //
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
namespace Google.Protobuf.Descriptors namespace Google.Protobuf.Reflection
{ {
/// <summary> /// <summary>
/// Internal class containing utility methods when working with descriptors. /// Internal class containing utility methods when working with descriptors.
/// </summary> /// </summary>
internal static class DescriptorUtil internal static class DescriptorUtil
{ {
/// <summary> /// <summary>
/// Equivalent to Func[TInput, int, TOutput] but usable in .NET 2.0. Only used to convert /// Equivalent to Func[TInput, int, TOutput] but usable in .NET 2.0. Only used to convert
/// arrays. /// arrays.
/// </summary> /// </summary>
internal delegate TOutput IndexedConverter<TInput, TOutput>(TInput element, int index); internal delegate TOutput IndexedConverter<TInput, TOutput>(TInput element, int index);
/// <summary> /// <summary>
/// Converts the given array into a read-only list, applying the specified conversion to /// Converts the given array into a read-only list, applying the specified conversion to
/// each input element. /// each input element.
/// </summary> /// </summary>
internal static IList<TOutput> ConvertAndMakeReadOnly<TInput, TOutput>(IList<TInput> input, internal static IList<TOutput> ConvertAndMakeReadOnly<TInput, TOutput>(IList<TInput> input,
IndexedConverter<TInput, TOutput> IndexedConverter<TInput, TOutput>
converter) converter)
{ {
TOutput[] array = new TOutput[input.Count]; TOutput[] array = new TOutput[input.Count];
for (int i = 0; i < array.Length; i++) for (int i = 0; i < array.Length; i++)
{ {
array[i] = converter(input[i], i); array[i] = converter(input[i], i);
} }
return new ReadOnlyCollection<TOutput>(array); return new ReadOnlyCollection<TOutput>(array);
} }
} }
} }
\ No newline at end of file
#region Copyright notice and license #region Copyright notice and license
// Protocol Buffers - Google's data interchange format // Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved. // Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/ // https://developers.google.com/protocol-buffers/
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
// //
// * Redistributions of source code must retain the above copyright // * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer. // notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above // * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer // copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the // in the documentation and/or other materials provided with the
// distribution. // distribution.
// * Neither the name of Google Inc. nor the names of its // * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from // contributors may be used to endorse or promote products derived from
// this software without specific prior written permission. // this software without specific prior written permission.
// //
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion #endregion
using System; using System;
namespace Google.Protobuf.Descriptors namespace Google.Protobuf.Reflection
{ {
/// <summary> /// <summary>
/// Thrown when building descriptors fails because the source DescriptorProtos /// Thrown when building descriptors fails because the source DescriptorProtos
/// are not valid. /// are not valid.
/// </summary> /// </summary>
public sealed class DescriptorValidationException : Exception public sealed class DescriptorValidationException : Exception
{ {
private readonly String name; private readonly String name;
private readonly string description; private readonly string description;
/// <value> /// <value>
/// The full name of the descriptor where the error occurred. /// The full name of the descriptor where the error occurred.
/// </value> /// </value>
public String ProblemSymbolName public String ProblemSymbolName
{ {
get { return name; } get { return name; }
} }
/// <value> /// <value>
/// A human-readable description of the error. (The Message property /// A human-readable description of the error. (The Message property
/// is made up of the descriptor's name and this description.) /// is made up of the descriptor's name and this description.)
/// </value> /// </value>
public string Description public string Description
{ {
get { return description; } get { return description; }
} }
internal DescriptorValidationException(IDescriptor problemDescriptor, string description) : internal DescriptorValidationException(IDescriptor problemDescriptor, string description) :
base(problemDescriptor.FullName + ": " + description) base(problemDescriptor.FullName + ": " + description)
{ {
// Note that problemDescriptor may be partially uninitialized, so we // Note that problemDescriptor may be partially uninitialized, so we
// don't want to expose it directly to the user. So, we only provide // don't want to expose it directly to the user. So, we only provide
// the name and the original proto. // the name and the original proto.
name = problemDescriptor.FullName; name = problemDescriptor.FullName;
this.description = description; this.description = description;
} }
internal DescriptorValidationException(IDescriptor problemDescriptor, string description, Exception cause) : internal DescriptorValidationException(IDescriptor problemDescriptor, string description, Exception cause) :
base(problemDescriptor.FullName + ": " + description, cause) base(problemDescriptor.FullName + ": " + description, cause)
{ {
name = problemDescriptor.FullName; name = problemDescriptor.FullName;
this.description = description; this.description = description;
} }
} }
} }
\ No newline at end of file
...@@ -32,9 +32,8 @@ ...@@ -32,9 +32,8 @@
using System; using System;
using System.Reflection; using System.Reflection;
using Google.Protobuf.Descriptors;
namespace Google.Protobuf.FieldAccess namespace Google.Protobuf.Reflection
{ {
/// <summary> /// <summary>
/// Base class for field accessors. /// Base class for field accessors.
......
...@@ -32,9 +32,8 @@ ...@@ -32,9 +32,8 @@
using System; using System;
using System.Collections; using System.Collections;
using Google.Protobuf.Descriptors;
namespace Google.Protobuf.FieldAccess namespace Google.Protobuf.Reflection
{ {
/// <summary> /// <summary>
/// Accessor for map fields. /// Accessor for map fields.
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#endregion #endregion
// This file just contains partial classes for any autogenerated classes that need additional support. // 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 internal partial class FieldDescriptorProto
{ {
......
...@@ -32,9 +32,8 @@ ...@@ -32,9 +32,8 @@
using System; using System;
using System.Collections; using System.Collections;
using Google.Protobuf.Descriptors;
namespace Google.Protobuf.FieldAccess namespace Google.Protobuf.Reflection
{ {
/// <summary> /// <summary>
/// Accessor for repeated fields. /// Accessor for repeated fields.
......
...@@ -29,12 +29,11 @@ ...@@ -29,12 +29,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion #endregion
using System; using System;
using System.Reflection; using System.Reflection;
using Google.Protobuf.Descriptors;
namespace Google.Protobuf.FieldAccess namespace Google.Protobuf.Reflection
{ {
/// <summary> /// <summary>
/// Accessor for single fields. /// Accessor for single fields.
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#endregion #endregion
using System; using System;
using Google.Protobuf.Descriptors; using Google.Protobuf.Reflection;
namespace Google.Protobuf namespace Google.Protobuf
{ {
......
This diff is collapsed.
This diff is collapsed.
...@@ -43,7 +43,7 @@ package google.protobuf; ...@@ -43,7 +43,7 @@ package google.protobuf;
option go_package = "descriptor"; option go_package = "descriptor";
option java_package = "com.google.protobuf"; option java_package = "com.google.protobuf";
option java_outer_classname = "DescriptorProtos"; option java_outer_classname = "DescriptorProtos";
option csharp_namespace = "Google.Protobuf.DescriptorProtos"; option csharp_namespace = "Google.Protobuf.Reflection";
option objc_class_prefix = "GPB"; option objc_class_prefix = "GPB";
// descriptor.proto must be optimized for speed because reflection-based // descriptor.proto must be optimized for speed because reflection-based
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment