Commit 9f37de96 authored by Jon Skeet's avatar Jon Skeet

Changing reflection namespace (part 1)

- Move types into Google.Protobuf.Reflection
- Change codegen to reflect that in generated types

Generated code changes coming in part 2
parent 24f8626c
......@@ -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;
......
......@@ -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" />
......
......@@ -31,12 +31,10 @@
#endregion
using System.Linq;
using Google.Protobuf.DescriptorProtos;
using Google.Protobuf.Descriptors;
using Google.Protobuf.TestProtos;
using NUnit.Framework;
namespace Google.Protobuf
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Tests for descriptors. (Not in its own namespace or broken up into individual classes as the
......
......@@ -31,7 +31,7 @@
#endregion
using System;
using Google.Protobuf.FieldAccess;
using Google.Protobuf.Reflection;
namespace Google.Protobuf
{
......
......@@ -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
{
......
......@@ -62,45 +62,46 @@
<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\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\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.
......
......@@ -30,9 +30,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
using Google.Protobuf.DescriptorProtos;
namespace Google.Protobuf.Descriptors
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Base class for nearly all descriptors, providing common functionality.
......
......@@ -35,7 +35,7 @@ using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace Google.Protobuf.Descriptors
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Contains lookup tables containing all the descriptors defined in a particular file.
......
......@@ -33,7 +33,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace Google.Protobuf.Descriptors
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Internal class containing utility methods when working with descriptors.
......
......@@ -32,7 +32,7 @@
using System;
namespace Google.Protobuf.Descriptors
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Thrown when building descriptors fails because the source DescriptorProtos
......
......@@ -33,7 +33,7 @@
using System.Collections.Generic;
using Google.Protobuf.DescriptorProtos;
namespace Google.Protobuf.Descriptors
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Descriptor for an enum type in a .proto file.
......
......@@ -32,7 +32,7 @@
using Google.Protobuf.DescriptorProtos;
namespace Google.Protobuf.Descriptors
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Descriptor for a single enum value within an enum in a .proto file.
......
......@@ -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.
......
......@@ -32,9 +32,8 @@
using System;
using System.Collections.ObjectModel;
using Google.Protobuf.Descriptors;
namespace Google.Protobuf.FieldAccess
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Provides access to fields in generated messages via reflection.
......
......@@ -33,7 +33,7 @@
using System;
using Google.Protobuf.DescriptorProtos;
namespace Google.Protobuf.Descriptors
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Descriptor for a field or extension within a message in a .proto file.
......
......@@ -30,7 +30,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
namespace Google.Protobuf.Descriptors
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Enumeration of all the possible field types. The odd formatting is to make it very clear
......
......@@ -36,7 +36,7 @@ using System.Collections.ObjectModel;
using Google.Protobuf.DescriptorProtos;
using FileOptions = Google.Protobuf.DescriptorProtos.FileOptions;
namespace Google.Protobuf.Descriptors
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Describes a .proto file, including everything defined within.
......
......@@ -30,7 +30,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
namespace Google.Protobuf.Descriptors
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Interface implemented by all descriptor types.
......
......@@ -30,9 +30,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
using Google.Protobuf.Descriptors;
namespace Google.Protobuf.FieldAccess
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Allows fields to be reflectively accessed.
......
......@@ -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.
......
......@@ -34,7 +34,7 @@ using System;
using System.Collections.Generic;
using Google.Protobuf.DescriptorProtos;
namespace Google.Protobuf.Descriptors
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Describes a message type.
......
......@@ -32,7 +32,7 @@
using Google.Protobuf.DescriptorProtos;
namespace Google.Protobuf.Descriptors
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Describes a single method in a service.
......
......@@ -30,11 +30,10 @@
// 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
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Reflection access for a oneof, allowing clear and "get case" actions.
......
......@@ -34,7 +34,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using Google.Protobuf.DescriptorProtos;
namespace Google.Protobuf.Descriptors
namespace Google.Protobuf.Reflection
{
public sealed class OneofDescriptor : DescriptorBase
{
......
......@@ -30,7 +30,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
namespace Google.Protobuf.Descriptors
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Represents a package in the symbol table. We use PackageDescriptors
......
......@@ -34,7 +34,7 @@ using System;
using System.Linq.Expressions;
using System.Reflection;
namespace Google.Protobuf.FieldAccess
namespace Google.Protobuf.Reflection
{
/// <summary>
/// The methods in this class are somewhat evil, and should not be tampered with lightly.
......
......@@ -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.
......
......@@ -34,7 +34,7 @@ using System;
using System.Collections.Generic;
using Google.Protobuf.DescriptorProtos;
namespace Google.Protobuf.Descriptors
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Describes a service type.
......
......@@ -32,9 +32,8 @@
using System;
using System.Reflection;
using Google.Protobuf.Descriptors;
namespace Google.Protobuf.FieldAccess
namespace Google.Protobuf.Reflection
{
/// <summary>
/// Accessor for single fields.
......
......@@ -31,7 +31,7 @@
#endregion
using System;
using Google.Protobuf.Descriptors;
using Google.Protobuf.Reflection;
namespace Google.Protobuf
{
......
......@@ -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"
......
......@@ -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",
......
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