Abandon the 'self' namespace alias - we need to be able to import types in other namespaces too.

pull/288/head
Jon Skeet 17 years ago
parent 5407a4329d
commit eb4ef52c66
  1. 2
      csharp/ProtocolBuffers.Test/TestProtos/EnumWithNoOuter.cs
  2. 162
      csharp/ProtocolBuffers.Test/TestProtos/MessageWithNoOuter.cs
  3. 12
      csharp/ProtocolBuffers.Test/TestProtos/MultiFileProto.cs
  4. 26
      csharp/ProtocolBuffers.Test/TestProtos/ServiceWithNoOuter.cs
  5. 126
      csharp/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs
  6. 56
      csharp/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs
  7. 402
      csharp/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs
  8. 68
      csharp/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs
  9. 2512
      csharp/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs
  10. 1514
      csharp/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs
  11. 4
      src/google/protobuf/compiler/csharp/csharp_file.cc
  12. 13
      src/google/protobuf/compiler/csharp/csharp_helpers.cc

@ -4,8 +4,6 @@ using pb = global::Google.ProtocolBuffers;
using pbc = global::Google.ProtocolBuffers.Collections;
using pbd = global::Google.ProtocolBuffers.Descriptors;
using scg = global::System.Collections.Generic;
using self = global::Google.ProtocolBuffers.TestProtos;
namespace Google.ProtocolBuffers.TestProtos {
public enum EnumWithNoOuter {

@ -4,8 +4,6 @@ using pb = global::Google.ProtocolBuffers;
using pbc = global::Google.ProtocolBuffers.Collections;
using pbd = global::Google.ProtocolBuffers.Descriptors;
using scg = global::System.Collections.Generic;
using self = global::Google.ProtocolBuffers.TestProtos;
namespace Google.ProtocolBuffers.TestProtos {
public sealed partial class MessageWithNoOuter : pb::GeneratedMessage<MessageWithNoOuter, MessageWithNoOuter.Builder> {
@ -19,11 +17,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public static pbd::MessageDescriptor Descriptor {
get { return self::MultiFileProto.internal__static_protobuf_unittest_MessageWithNoOuter__Descriptor; }
get { return global::Google.ProtocolBuffers.TestProtos.MultiFileProto.internal__static_protobuf_unittest_MessageWithNoOuter__Descriptor; }
}
protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors {
get { return self::MultiFileProto.internal__static_protobuf_unittest_MessageWithNoOuter__FieldAccessorTable; }
get { return global::Google.ProtocolBuffers.TestProtos.MultiFileProto.internal__static_protobuf_unittest_MessageWithNoOuter__FieldAccessorTable; }
}
#region Nested types
@ -43,11 +41,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public static pbd::MessageDescriptor Descriptor {
get { return self::MultiFileProto.internal__static_protobuf_unittest_MessageWithNoOuter_NestedMessage__Descriptor; }
get { return global::Google.ProtocolBuffers.TestProtos.MultiFileProto.internal__static_protobuf_unittest_MessageWithNoOuter_NestedMessage__Descriptor; }
}
protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors {
get { return self::MultiFileProto.internal__static_protobuf_unittest_MessageWithNoOuter_NestedMessage__FieldAccessorTable; }
get { return global::Google.ProtocolBuffers.TestProtos.MultiFileProto.internal__static_protobuf_unittest_MessageWithNoOuter_NestedMessage__FieldAccessorTable; }
}
// optional int32 i = 1;
@ -60,35 +58,35 @@ namespace Google.ProtocolBuffers.TestProtos {
get { return i_; }
}
public static self::MessageWithNoOuter.Types.NestedMessage ParseFrom(pb::ByteString data) {
public static global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage ParseFrom(pb::ByteString data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
public static self::MessageWithNoOuter.Types.NestedMessage ParseFrom(pb::ByteString data,
public static global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage ParseFrom(pb::ByteString data,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry))
.BuildParsed();
}
public static self::MessageWithNoOuter.Types.NestedMessage ParseFrom(byte[] data) {
public static global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage ParseFrom(byte[] data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
public static self::MessageWithNoOuter.Types.NestedMessage ParseFrom(byte[] data,
public static global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage ParseFrom(byte[] data,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry))
.BuildParsed();
}
public static self::MessageWithNoOuter.Types.NestedMessage ParseFrom(global::System.IO.Stream input) {
public static global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage ParseFrom(global::System.IO.Stream input) {
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
}
public static self::MessageWithNoOuter.Types.NestedMessage ParseFrom(
public static global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage ParseFrom(
global::System.IO.Stream input,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry))
.BuildParsed();
}
public static self::MessageWithNoOuter.Types.NestedMessage ParseFrom(pb::CodedInputStream input) {
public static global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage ParseFrom(pb::CodedInputStream input) {
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
}
public static self::MessageWithNoOuter.Types.NestedMessage ParseFrom(pb::CodedInputStream input,
public static global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage ParseFrom(pb::CodedInputStream input,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry))
.BuildParsed();
@ -96,26 +94,26 @@ namespace Google.ProtocolBuffers.TestProtos {
public static Builder CreateBuilder() { return new Builder(); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(self::MessageWithNoOuter.Types.NestedMessage prototype) {
public static Builder CreateBuilder(global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage prototype) {
return (Builder) new Builder().MergeFrom(prototype);
}
public sealed partial class Builder : pb::GeneratedBuilder<self::MessageWithNoOuter.Types.NestedMessage, Builder> {
public sealed partial class Builder : pb::GeneratedBuilder<global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage, Builder> {
protected override Builder ThisBuilder {
get { return this; }
}
// Construct using self::MessageWithNoOuter.Types.NestedMessage.CreateBuilder()
// Construct using global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage.CreateBuilder()
internal Builder() {}
self::MessageWithNoOuter.Types.NestedMessage result = new self::MessageWithNoOuter.Types.NestedMessage();
global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage result = new global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage();
protected override self::MessageWithNoOuter.Types.NestedMessage MessageBeingBuilt {
protected override global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage MessageBeingBuilt {
get { return result; }
}
public override Builder Clear() {
result = new self::MessageWithNoOuter.Types.NestedMessage();
result = new global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage();
return this;
}
@ -124,15 +122,15 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override pbd::MessageDescriptor DescriptorForType {
get { return self::MessageWithNoOuter.Types.NestedMessage.Descriptor; }
get { return global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage.Descriptor; }
}
public override self::MessageWithNoOuter.Types.NestedMessage DefaultInstanceForType {
get { return self::MessageWithNoOuter.Types.NestedMessage.DefaultInstance; }
public override global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage DefaultInstanceForType {
get { return global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage.DefaultInstance; }
}
public override self::MessageWithNoOuter.Types.NestedMessage BuildPartial() {
self::MessageWithNoOuter.Types.NestedMessage returnMe = result;
public override global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage BuildPartial() {
global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage returnMe = result;
result = null;
return returnMe;
}
@ -164,71 +162,71 @@ namespace Google.ProtocolBuffers.TestProtos {
// optional .protobuf_unittest.MessageWithNoOuter.NestedMessage nested = 1;
private bool hasNested;
private self::MessageWithNoOuter.Types.NestedMessage nested_ = self::MessageWithNoOuter.Types.NestedMessage.DefaultInstance;
private global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage nested_ = global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage.DefaultInstance;
public bool HasNested {
get { return hasNested; }
}
public self::MessageWithNoOuter.Types.NestedMessage Nested {
public global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage Nested {
get { return nested_; }
}
// repeated .protobuf_unittest.TestAllTypes foreign = 2;
private scg::IList<self::TestAllTypes> foreign_ = pbc::Lists<self::TestAllTypes>.Empty;
public scg::IList<self::TestAllTypes> ForeignList {
private scg::IList<global::Google.ProtocolBuffers.TestProtos.TestAllTypes> foreign_ = pbc::Lists<global::Google.ProtocolBuffers.TestProtos.TestAllTypes>.Empty;
public scg::IList<global::Google.ProtocolBuffers.TestProtos.TestAllTypes> ForeignList {
get { return foreign_; }
}
public int ForeignCount
{ get { return foreign_.Count; }
}
public self::TestAllTypes GetForeign(int index) {
public global::Google.ProtocolBuffers.TestProtos.TestAllTypes GetForeign(int index) {
return foreign_ [index];
}
// optional .protobuf_unittest.MessageWithNoOuter.NestedEnum nested_enum = 3;
private bool hasNestedEnum;
private self::MessageWithNoOuter.Types.NestedEnum nestedEnum_ = self::MessageWithNoOuter.Types.NestedEnum.BAZ;
private global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedEnum nestedEnum_ = global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedEnum.BAZ;
public bool HasNestedEnum {
get { return hasNestedEnum; }
}
public self::MessageWithNoOuter.Types.NestedEnum NestedEnum { get { return nestedEnum_; }}
public global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedEnum NestedEnum { get { return nestedEnum_; }}
// optional .protobuf_unittest.EnumWithNoOuter foreign_enum = 4;
private bool hasForeignEnum;
private self::EnumWithNoOuter foreignEnum_ = self::EnumWithNoOuter.FOO;
private global::Google.ProtocolBuffers.TestProtos.EnumWithNoOuter foreignEnum_ = global::Google.ProtocolBuffers.TestProtos.EnumWithNoOuter.FOO;
public bool HasForeignEnum {
get { return hasForeignEnum; }
}
public self::EnumWithNoOuter ForeignEnum { get { return foreignEnum_; }}
public global::Google.ProtocolBuffers.TestProtos.EnumWithNoOuter ForeignEnum { get { return foreignEnum_; }}
public static self::MessageWithNoOuter ParseFrom(pb::ByteString data) {
public static global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter ParseFrom(pb::ByteString data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
public static self::MessageWithNoOuter ParseFrom(pb::ByteString data,
public static global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter ParseFrom(pb::ByteString data,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry))
.BuildParsed();
}
public static self::MessageWithNoOuter ParseFrom(byte[] data) {
public static global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter ParseFrom(byte[] data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
public static self::MessageWithNoOuter ParseFrom(byte[] data,
public static global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter ParseFrom(byte[] data,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry))
.BuildParsed();
}
public static self::MessageWithNoOuter ParseFrom(global::System.IO.Stream input) {
public static global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter ParseFrom(global::System.IO.Stream input) {
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
}
public static self::MessageWithNoOuter ParseFrom(
public static global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter ParseFrom(
global::System.IO.Stream input,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry))
.BuildParsed();
}
public static self::MessageWithNoOuter ParseFrom(pb::CodedInputStream input) {
public static global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter ParseFrom(pb::CodedInputStream input) {
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
}
public static self::MessageWithNoOuter ParseFrom(pb::CodedInputStream input,
public static global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter ParseFrom(pb::CodedInputStream input,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry))
.BuildParsed();
@ -236,26 +234,26 @@ namespace Google.ProtocolBuffers.TestProtos {
public static Builder CreateBuilder() { return new Builder(); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(self::MessageWithNoOuter prototype) {
public static Builder CreateBuilder(global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter prototype) {
return (Builder) new Builder().MergeFrom(prototype);
}
public sealed partial class Builder : pb::GeneratedBuilder<self::MessageWithNoOuter, Builder> {
public sealed partial class Builder : pb::GeneratedBuilder<global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter, Builder> {
protected override Builder ThisBuilder {
get { return this; }
}
// Construct using self::MessageWithNoOuter.CreateBuilder()
// Construct using global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.CreateBuilder()
internal Builder() {}
self::MessageWithNoOuter result = new self::MessageWithNoOuter();
global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter result = new global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter();
protected override self::MessageWithNoOuter MessageBeingBuilt {
protected override global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter MessageBeingBuilt {
get { return result; }
}
public override Builder Clear() {
result = new self::MessageWithNoOuter();
result = new global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter();
return this;
}
@ -264,18 +262,18 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override pbd::MessageDescriptor DescriptorForType {
get { return self::MessageWithNoOuter.Descriptor; }
get { return global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Descriptor; }
}
public override self::MessageWithNoOuter DefaultInstanceForType {
get { return self::MessageWithNoOuter.DefaultInstance; }
public override global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter DefaultInstanceForType {
get { return global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.DefaultInstance; }
}
public override self::MessageWithNoOuter BuildPartial() {
if (result.foreign_ != pbc::Lists<self::TestAllTypes>.Empty) {
result.foreign_ = pbc::Lists<self::TestAllTypes>.AsReadOnly(result.foreign_);
public override global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter BuildPartial() {
if (result.foreign_ != pbc::Lists<global::Google.ProtocolBuffers.TestProtos.TestAllTypes>.Empty) {
result.foreign_ = pbc::Lists<global::Google.ProtocolBuffers.TestProtos.TestAllTypes>.AsReadOnly(result.foreign_);
}
self::MessageWithNoOuter returnMe = result;
global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter returnMe = result;
result = null;
return returnMe;
}
@ -285,25 +283,25 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasNested {
get { return result.HasNested; }
}
public self::MessageWithNoOuter.Types.NestedMessage Nested {
public global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage Nested {
get { return result.Nested; }
set { SetNested(value); }
}
public Builder SetNested(self::MessageWithNoOuter.Types.NestedMessage value) {
public Builder SetNested(global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage value) {
result.hasNested = true;
result.nested_ = value;
return this;
}
public Builder SetNested(self::MessageWithNoOuter.Types.NestedMessage.Builder builderForValue) {
public Builder SetNested(global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage.Builder builderForValue) {
result.hasNested = true;
result.nested_ = builderForValue.Build();
return this;
}
public Builder MergeNested(self::MessageWithNoOuter.Types.NestedMessage value) {
public Builder MergeNested(global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage value) {
if (result.HasNested &&
result.nested_ != self::MessageWithNoOuter.Types.NestedMessage.DefaultInstance) {
result.nested_ != global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage.DefaultInstance) {
result.nested_ =
self::MessageWithNoOuter.Types.NestedMessage.CreateBuilder(result.nested_).MergeFrom(value).BuildPartial();
global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage.CreateBuilder(result.nested_).MergeFrom(value).BuildPartial();
} else {
result.nested_ = value;
}
@ -312,51 +310,51 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder ClearNested() {
result.hasNested = false;
result.nested_ = self::MessageWithNoOuter.Types.NestedMessage.DefaultInstance;
result.nested_ = global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage.DefaultInstance;
return this;
}
// repeated .protobuf_unittest.TestAllTypes foreign = 2;
public scg::IList<self::TestAllTypes> ForeignList {
public scg::IList<global::Google.ProtocolBuffers.TestProtos.TestAllTypes> ForeignList {
get { return pbc::Lists.AsReadOnly(result.foreign_); }
}
public int ForeignCount {
get { return result.ForeignCount; }
}
public self::TestAllTypes GetForeign(int index) {
public global::Google.ProtocolBuffers.TestProtos.TestAllTypes GetForeign(int index) {
return result.GetForeign(index);
}
public Builder SetForeign(int index, self::TestAllTypes value) {
public Builder SetForeign(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes value) {
result.foreign_[index] = value;
return this;
}
public Builder SetForeign(int index, self::TestAllTypes.Builder builderForValue) {
public Builder SetForeign(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Builder builderForValue) {
result.foreign_[index] = builderForValue.Build();
return this;
}
public Builder AddForeign(self::TestAllTypes value) {
if (result.foreign_ == pbc::Lists<self::TestAllTypes>.Empty) {
result.foreign_ = new scg::List<self::TestAllTypes>();
public Builder AddForeign(global::Google.ProtocolBuffers.TestProtos.TestAllTypes value) {
if (result.foreign_ == pbc::Lists<global::Google.ProtocolBuffers.TestProtos.TestAllTypes>.Empty) {
result.foreign_ = new scg::List<global::Google.ProtocolBuffers.TestProtos.TestAllTypes>();
}
result.foreign_.Add(value);
return this;
}
public Builder AddForeign(self::TestAllTypes.Builder builderForValue) {
if (result.foreign_ == pbc::Lists<self::TestAllTypes>.Empty) {
result.foreign_ = new scg::List<self::TestAllTypes>();
public Builder AddForeign(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Builder builderForValue) {
if (result.foreign_ == pbc::Lists<global::Google.ProtocolBuffers.TestProtos.TestAllTypes>.Empty) {
result.foreign_ = new scg::List<global::Google.ProtocolBuffers.TestProtos.TestAllTypes>();
}
result.foreign_.Add(builderForValue.Build());
return this;
}
public Builder AddRangeForeign(scg::IEnumerable<self::TestAllTypes> values) {
if (result.foreign_ == pbc::Lists<self::TestAllTypes>.Empty) {
result.foreign_ = new scg::List<self::TestAllTypes>();
public Builder AddRangeForeign(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.TestAllTypes> values) {
if (result.foreign_ == pbc::Lists<global::Google.ProtocolBuffers.TestProtos.TestAllTypes>.Empty) {
result.foreign_ = new scg::List<global::Google.ProtocolBuffers.TestProtos.TestAllTypes>();
}
base.AddRange(values, result.foreign_);
return this;
}
public Builder ClearForeign() {
result.foreign_ = pbc::Lists<self::TestAllTypes>.Empty;
result.foreign_ = pbc::Lists<global::Google.ProtocolBuffers.TestProtos.TestAllTypes>.Empty;
return this;
}
@ -364,18 +362,18 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasNestedEnum {
get { return result.HasNestedEnum; }
}
public self::MessageWithNoOuter.Types.NestedEnum NestedEnum {
public global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedEnum NestedEnum {
get { return result.NestedEnum; }
set { SetNestedEnum(value); }
}
public Builder SetNestedEnum(self::MessageWithNoOuter.Types.NestedEnum value) {
public Builder SetNestedEnum(global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedEnum value) {
result.hasNestedEnum = true;
result.nestedEnum_ = value;
return this;
}
public Builder ClearNestedEnum() {
result.hasNestedEnum = false;
result.nestedEnum_ = self::MessageWithNoOuter.Types.NestedEnum.BAZ;
result.nestedEnum_ = global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedEnum.BAZ;
return this;
}
@ -383,18 +381,18 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasForeignEnum {
get { return result.HasForeignEnum; }
}
public self::EnumWithNoOuter ForeignEnum {
public global::Google.ProtocolBuffers.TestProtos.EnumWithNoOuter ForeignEnum {
get { return result.ForeignEnum; }
set { SetForeignEnum(value); }
}
public Builder SetForeignEnum(self::EnumWithNoOuter value) {
public Builder SetForeignEnum(global::Google.ProtocolBuffers.TestProtos.EnumWithNoOuter value) {
result.hasForeignEnum = true;
result.foreignEnum_ = value;
return this;
}
public Builder ClearForeignEnum() {
result.hasForeignEnum = false;
result.foreignEnum_ = self::EnumWithNoOuter.FOO;
result.foreignEnum_ = global::Google.ProtocolBuffers.TestProtos.EnumWithNoOuter.FOO;
return this;
}
}

@ -4,8 +4,6 @@ using pb = global::Google.ProtocolBuffers;
using pbc = global::Google.ProtocolBuffers.Collections;
using pbd = global::Google.ProtocolBuffers.Descriptors;
using scg = global::System.Collections.Generic;
using self = global::Google.ProtocolBuffers.TestProtos;
namespace Google.ProtocolBuffers.TestProtos {
public static partial class MultiFileProto {
@ -54,7 +52,7 @@ namespace Google.ProtocolBuffers.TestProtos {
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0xca, 0x3e, 0x0e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x46, 0x69, 0x6c, 0x65, 0x50, 0x72,
0x6f, 0x74, 0x6f, 0xd0, 0x3e, 0x01, 0xd8, 0x3e, 0x00, 0xe0, 0x3e, 0x01,
}, new pbd::FileDescriptor[] {
self::UnitTestProtoFile.Descriptor,
global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor,
});
#endregion
@ -69,15 +67,15 @@ namespace Google.ProtocolBuffers.TestProtos {
internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_MessageWithNoOuter__FieldAccessorTable
= new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_MessageWithNoOuter__Descriptor,
new string[] { "Nested", "Foreign", "NestedEnum", "ForeignEnum", },
typeof (self::MessageWithNoOuter),
typeof (self::MessageWithNoOuter.Builder));
typeof (global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter),
typeof (global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Builder));
internal static readonly pbd::MessageDescriptor internal__static_protobuf_unittest_MessageWithNoOuter_NestedMessage__Descriptor
= internal__static_protobuf_unittest_MessageWithNoOuter__Descriptor.NestedTypes[0];
internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_MessageWithNoOuter_NestedMessage__FieldAccessorTable
= new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_MessageWithNoOuter_NestedMessage__Descriptor,
new string[] { "I", },
typeof (self::MessageWithNoOuter.Types.NestedMessage),
typeof (self::MessageWithNoOuter.Types.NestedMessage.Builder));
typeof (global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage),
typeof (global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.Types.NestedMessage.Builder));
#endregion
}

@ -4,18 +4,16 @@ using pb = global::Google.ProtocolBuffers;
using pbc = global::Google.ProtocolBuffers.Collections;
using pbd = global::Google.ProtocolBuffers.Descriptors;
using scg = global::System.Collections.Generic;
using self = global::Google.ProtocolBuffers.TestProtos;
namespace Google.ProtocolBuffers.TestProtos {
public abstract class ServiceWithNoOuter : pb::IService {
public abstract void Foo(
pb::IRpcController controller,
self::MessageWithNoOuter request,
global::System.Action<self::TestAllTypes> done);
global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter request,
global::System.Action<global::Google.ProtocolBuffers.TestProtos.TestAllTypes> done);
public static pbd::ServiceDescriptor Descriptor {
get { return self::MultiFileProto.Descriptor.Services[0]; }
get { return global::Google.ProtocolBuffers.TestProtos.MultiFileProto.Descriptor.Services[0]; }
}
public pbd::ServiceDescriptor DescriptorForType {
get { return Descriptor; }
@ -33,8 +31,8 @@ namespace Google.ProtocolBuffers.TestProtos {
}
switch(method.Index) {
case 0:
this.Foo(controller, (self::MessageWithNoOuter)request,
pb::RpcUtil.SpecializeCallback<self::TestAllTypes>(
this.Foo(controller, (global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter)request,
pb::RpcUtil.SpecializeCallback<global::Google.ProtocolBuffers.TestProtos.TestAllTypes>(
done));
return;
default:
@ -50,7 +48,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
switch(method.Index) {
case 0:
return self::MessageWithNoOuter.DefaultInstance;
return global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter.DefaultInstance;
default:
throw new global::System.ArgumentException("Can't get here.");
}
@ -64,7 +62,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
switch(method.Index) {
case 0:
return self::TestAllTypes.DefaultInstance;
return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance;
default:
throw new global::System.ArgumentException("Can't get here.");
}
@ -75,7 +73,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return new Stub(channel);
}
public class Stub : self::ServiceWithNoOuter {
public class Stub : global::Google.ProtocolBuffers.TestProtos.ServiceWithNoOuter {
internal Stub(pb::IRpcChannel channel) {
this.channel = channel;
}
@ -88,14 +86,14 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void Foo(
pb::IRpcController controller,
self::MessageWithNoOuter request,
global::System.Action<self::TestAllTypes> done) {
global::Google.ProtocolBuffers.TestProtos.MessageWithNoOuter request,
global::System.Action<global::Google.ProtocolBuffers.TestProtos.TestAllTypes> done) {
channel.CallMethod(
Descriptor.Methods[0],
controller,
request,
self::TestAllTypes.DefaultInstance,
pb::RpcUtil.GeneralizeCallback<self::TestAllTypes, self::TestAllTypes.Builder>(done, self::TestAllTypes.DefaultInstance));
global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance,
pb::RpcUtil.GeneralizeCallback<global::Google.ProtocolBuffers.TestProtos.TestAllTypes, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Builder>(done, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance));
}
}
}

@ -4,8 +4,6 @@ using pb = global::Google.ProtocolBuffers;
using pbc = global::Google.ProtocolBuffers.Collections;
using pbd = global::Google.ProtocolBuffers.Descriptors;
using scg = global::System.Collections.Generic;
using self = global::Google.ProtocolBuffers.TestProtos;
namespace Google.ProtocolBuffers.TestProtos {
public static partial class UnitTestEmbedOptimizeForProtoFile {
@ -35,7 +33,7 @@ namespace Google.ProtocolBuffers.TestProtos {
0x3e, 0x21, 0x55, 0x6e, 0x69, 0x74, 0x54, 0x65, 0x73, 0x74, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6d,
0x69, 0x7a, 0x65, 0x46, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x69, 0x6c, 0x65,
}, new pbd::FileDescriptor[] {
self::UnitTestOptimizeForProtoFile.Descriptor,
global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.Descriptor,
});
#endregion
@ -48,8 +46,8 @@ namespace Google.ProtocolBuffers.TestProtos {
internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestEmbedOptimizedForSize__FieldAccessorTable
= new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestEmbedOptimizedForSize__Descriptor,
new string[] { "OptionalMessage", "RepeatedMessage", },
typeof (self::TestEmbedOptimizedForSize),
typeof (self::TestEmbedOptimizedForSize.Builder));
typeof (global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize),
typeof (global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize.Builder));
#endregion
}
@ -69,32 +67,32 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public static pbd::MessageDescriptor Descriptor {
get { return self::UnitTestEmbedOptimizeForProtoFile.internal__static_protobuf_unittest_TestEmbedOptimizedForSize__Descriptor; }
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestEmbedOptimizeForProtoFile.internal__static_protobuf_unittest_TestEmbedOptimizedForSize__Descriptor; }
}
protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors {
get { return self::UnitTestEmbedOptimizeForProtoFile.internal__static_protobuf_unittest_TestEmbedOptimizedForSize__FieldAccessorTable; }
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestEmbedOptimizeForProtoFile.internal__static_protobuf_unittest_TestEmbedOptimizedForSize__FieldAccessorTable; }
}
// optional .protobuf_unittest.TestOptimizedForSize optional_message = 1;
private bool hasOptionalMessage;
private self::TestOptimizedForSize optionalMessage_ = self::TestOptimizedForSize.DefaultInstance;
private global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance;
public bool HasOptionalMessage {
get { return hasOptionalMessage; }
}
public self::TestOptimizedForSize OptionalMessage {
public global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize OptionalMessage {
get { return optionalMessage_; }
}
// repeated .protobuf_unittest.TestOptimizedForSize repeated_message = 2;
private scg::IList<self::TestOptimizedForSize> repeatedMessage_ = pbc::Lists<self::TestOptimizedForSize>.Empty;
public scg::IList<self::TestOptimizedForSize> RepeatedMessageList {
private scg::IList<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize> repeatedMessage_ = pbc::Lists<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize>.Empty;
public scg::IList<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize> RepeatedMessageList {
get { return repeatedMessage_; }
}
public int RepeatedMessageCount
{ get { return repeatedMessage_.Count; }
}
public self::TestOptimizedForSize GetRepeatedMessage(int index) {
public global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize GetRepeatedMessage(int index) {
return repeatedMessage_ [index];
}
@ -103,7 +101,7 @@ namespace Google.ProtocolBuffers.TestProtos {
if (HasOptionalMessage) {
if (!OptionalMessage.IsInitialized) return false;
}
foreach (self::TestOptimizedForSize element in RepeatedMessageList) {
foreach (global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize element in RepeatedMessageList) {
if (!element.IsInitialized) return false;
}
return true;
@ -114,7 +112,7 @@ namespace Google.ProtocolBuffers.TestProtos {
if (HasOptionalMessage) {
output.WriteMessage(1, OptionalMessage);
}
foreach (self::TestOptimizedForSize element in RepeatedMessageList) {
foreach (global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize element in RepeatedMessageList) {
output.WriteMessage(2, element);
}
UnknownFields.WriteTo(output);
@ -130,7 +128,7 @@ namespace Google.ProtocolBuffers.TestProtos {
if (HasOptionalMessage) {
size += pb::CodedOutputStream.ComputeMessageSize(1, OptionalMessage);
}
foreach (self::TestOptimizedForSize element in RepeatedMessageList) {
foreach (global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize element in RepeatedMessageList) {
size += pb::CodedOutputStream.ComputeMessageSize(2, element);
}
size += UnknownFields.SerializedSize;
@ -139,35 +137,35 @@ namespace Google.ProtocolBuffers.TestProtos {
}
}
public static self::TestEmbedOptimizedForSize ParseFrom(pb::ByteString data) {
public static global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize ParseFrom(pb::ByteString data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
public static self::TestEmbedOptimizedForSize ParseFrom(pb::ByteString data,
public static global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize ParseFrom(pb::ByteString data,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry))
.BuildParsed();
}
public static self::TestEmbedOptimizedForSize ParseFrom(byte[] data) {
public static global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize ParseFrom(byte[] data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
public static self::TestEmbedOptimizedForSize ParseFrom(byte[] data,
public static global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize ParseFrom(byte[] data,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry))
.BuildParsed();
}
public static self::TestEmbedOptimizedForSize ParseFrom(global::System.IO.Stream input) {
public static global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize ParseFrom(global::System.IO.Stream input) {
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
}
public static self::TestEmbedOptimizedForSize ParseFrom(
public static global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize ParseFrom(
global::System.IO.Stream input,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry))
.BuildParsed();
}
public static self::TestEmbedOptimizedForSize ParseFrom(pb::CodedInputStream input) {
public static global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize ParseFrom(pb::CodedInputStream input) {
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
}
public static self::TestEmbedOptimizedForSize ParseFrom(pb::CodedInputStream input,
public static global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize ParseFrom(pb::CodedInputStream input,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry))
.BuildParsed();
@ -175,26 +173,26 @@ namespace Google.ProtocolBuffers.TestProtos {
public static Builder CreateBuilder() { return new Builder(); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(self::TestEmbedOptimizedForSize prototype) {
public static Builder CreateBuilder(global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize prototype) {
return (Builder) new Builder().MergeFrom(prototype);
}
public sealed partial class Builder : pb::GeneratedBuilder<self::TestEmbedOptimizedForSize, Builder> {
public sealed partial class Builder : pb::GeneratedBuilder<global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize, Builder> {
protected override Builder ThisBuilder {
get { return this; }
}
// Construct using self::TestEmbedOptimizedForSize.CreateBuilder()
// Construct using global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize.CreateBuilder()
internal Builder() {}
self::TestEmbedOptimizedForSize result = new self::TestEmbedOptimizedForSize();
global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize result = new global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize();
protected override self::TestEmbedOptimizedForSize MessageBeingBuilt {
protected override global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize MessageBeingBuilt {
get { return result; }
}
public override Builder Clear() {
result = new self::TestEmbedOptimizedForSize();
result = new global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize();
return this;
}
@ -203,39 +201,39 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override pbd::MessageDescriptor DescriptorForType {
get { return self::TestEmbedOptimizedForSize.Descriptor; }
get { return global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize.Descriptor; }
}
public override self::TestEmbedOptimizedForSize DefaultInstanceForType {
get { return self::TestEmbedOptimizedForSize.DefaultInstance; }
public override global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize DefaultInstanceForType {
get { return global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize.DefaultInstance; }
}
public override self::TestEmbedOptimizedForSize BuildPartial() {
if (result.repeatedMessage_ != pbc::Lists<self::TestOptimizedForSize>.Empty) {
result.repeatedMessage_ = pbc::Lists<self::TestOptimizedForSize>.AsReadOnly(result.repeatedMessage_);
public override global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize BuildPartial() {
if (result.repeatedMessage_ != pbc::Lists<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize>.Empty) {
result.repeatedMessage_ = pbc::Lists<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize>.AsReadOnly(result.repeatedMessage_);
}
self::TestEmbedOptimizedForSize returnMe = result;
global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize returnMe = result;
result = null;
return returnMe;
}
public override Builder MergeFrom(pb::IMessage other) {
if (other is self::TestEmbedOptimizedForSize) {
return MergeFrom((self::TestEmbedOptimizedForSize) other);
if (other is global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize) {
return MergeFrom((global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize) other);
} else {
base.MergeFrom(other);
return this;
}
}
public override Builder MergeFrom(self::TestEmbedOptimizedForSize other) {
if (other == self::TestEmbedOptimizedForSize.DefaultInstance) return this;
public override Builder MergeFrom(global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize.DefaultInstance) return this;
if (other.HasOptionalMessage) {
MergeOptionalMessage(other.OptionalMessage);
}
if (other.repeatedMessage_.Count != 0) {
if (result.repeatedMessage_.Count == 0) {
result.repeatedMessage_ = new scg::List<self::TestOptimizedForSize>();
result.repeatedMessage_ = new scg::List<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize>();
}
base.AddRange(other.repeatedMessage_, result.repeatedMessage_);
}
@ -265,7 +263,7 @@ namespace Google.ProtocolBuffers.TestProtos {
break;
}
case 10: {
self::TestOptimizedForSize.Builder subBuilder = self::TestOptimizedForSize.CreateBuilder();
global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.CreateBuilder();
if (HasOptionalMessage) {
subBuilder.MergeFrom(OptionalMessage);
}
@ -274,7 +272,7 @@ namespace Google.ProtocolBuffers.TestProtos {
break;
}
case 18: {
self::TestOptimizedForSize.Builder subBuilder = self::TestOptimizedForSize.CreateBuilder();
global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.CreateBuilder();
input.ReadMessage(subBuilder, extensionRegistry);
AddRepeatedMessage(subBuilder.BuildPartial());
break;
@ -288,25 +286,25 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasOptionalMessage {
get { return result.HasOptionalMessage; }
}
public self::TestOptimizedForSize OptionalMessage {
public global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize OptionalMessage {
get { return result.OptionalMessage; }
set { SetOptionalMessage(value); }
}
public Builder SetOptionalMessage(self::TestOptimizedForSize value) {
public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) {
result.hasOptionalMessage = true;
result.optionalMessage_ = value;
return this;
}
public Builder SetOptionalMessage(self::TestOptimizedForSize.Builder builderForValue) {
public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder builderForValue) {
result.hasOptionalMessage = true;
result.optionalMessage_ = builderForValue.Build();
return this;
}
public Builder MergeOptionalMessage(self::TestOptimizedForSize value) {
public Builder MergeOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) {
if (result.HasOptionalMessage &&
result.optionalMessage_ != self::TestOptimizedForSize.DefaultInstance) {
result.optionalMessage_ != global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance) {
result.optionalMessage_ =
self::TestOptimizedForSize.CreateBuilder(result.optionalMessage_).MergeFrom(value).BuildPartial();
global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.CreateBuilder(result.optionalMessage_).MergeFrom(value).BuildPartial();
} else {
result.optionalMessage_ = value;
}
@ -315,51 +313,51 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder ClearOptionalMessage() {
result.hasOptionalMessage = false;
result.optionalMessage_ = self::TestOptimizedForSize.DefaultInstance;
result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance;
return this;
}
// repeated .protobuf_unittest.TestOptimizedForSize repeated_message = 2;
public scg::IList<self::TestOptimizedForSize> RepeatedMessageList {
public scg::IList<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize> RepeatedMessageList {
get { return pbc::Lists.AsReadOnly(result.repeatedMessage_); }
}
public int RepeatedMessageCount {
get { return result.RepeatedMessageCount; }
}
public self::TestOptimizedForSize GetRepeatedMessage(int index) {
public global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize GetRepeatedMessage(int index) {
return result.GetRepeatedMessage(index);
}
public Builder SetRepeatedMessage(int index, self::TestOptimizedForSize value) {
public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) {
result.repeatedMessage_[index] = value;
return this;
}
public Builder SetRepeatedMessage(int index, self::TestOptimizedForSize.Builder builderForValue) {
public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder builderForValue) {
result.repeatedMessage_[index] = builderForValue.Build();
return this;
}
public Builder AddRepeatedMessage(self::TestOptimizedForSize value) {
if (result.repeatedMessage_ == pbc::Lists<self::TestOptimizedForSize>.Empty) {
result.repeatedMessage_ = new scg::List<self::TestOptimizedForSize>();
public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) {
if (result.repeatedMessage_ == pbc::Lists<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize>.Empty) {
result.repeatedMessage_ = new scg::List<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize>();
}
result.repeatedMessage_.Add(value);
return this;
}
public Builder AddRepeatedMessage(self::TestOptimizedForSize.Builder builderForValue) {
if (result.repeatedMessage_ == pbc::Lists<self::TestOptimizedForSize>.Empty) {
result.repeatedMessage_ = new scg::List<self::TestOptimizedForSize>();
public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder builderForValue) {
if (result.repeatedMessage_ == pbc::Lists<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize>.Empty) {
result.repeatedMessage_ = new scg::List<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize>();
}
result.repeatedMessage_.Add(builderForValue.Build());
return this;
}
public Builder AddRangeRepeatedMessage(scg::IEnumerable<self::TestOptimizedForSize> values) {
if (result.repeatedMessage_ == pbc::Lists<self::TestOptimizedForSize>.Empty) {
result.repeatedMessage_ = new scg::List<self::TestOptimizedForSize>();
public Builder AddRangeRepeatedMessage(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize> values) {
if (result.repeatedMessage_ == pbc::Lists<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize>.Empty) {
result.repeatedMessage_ = new scg::List<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize>();
}
base.AddRange(values, result.repeatedMessage_);
return this;
}
public Builder ClearRepeatedMessage() {
result.repeatedMessage_ = pbc::Lists<self::TestOptimizedForSize>.Empty;
result.repeatedMessage_ = pbc::Lists<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize>.Empty;
return this;
}
}

@ -4,8 +4,6 @@ using pb = global::Google.ProtocolBuffers;
using pbc = global::Google.ProtocolBuffers.Collections;
using pbd = global::Google.ProtocolBuffers.Descriptors;
using scg = global::System.Collections.Generic;
using self = global::Google.ProtocolBuffers.TestProtos;
namespace Google.ProtocolBuffers.TestProtos {
public static partial class UnitTestImportProtoFile {
@ -42,8 +40,8 @@ namespace Google.ProtocolBuffers.TestProtos {
internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable
= new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_import_ImportMessage__Descriptor,
new string[] { "D", },
typeof (self::ImportMessage),
typeof (self::ImportMessage.Builder));
typeof (global::Google.ProtocolBuffers.TestProtos.ImportMessage),
typeof (global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder));
#endregion
}
@ -69,11 +67,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public static pbd::MessageDescriptor Descriptor {
get { return self::UnitTestImportProtoFile.internal__static_protobuf_unittest_import_ImportMessage__Descriptor; }
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.internal__static_protobuf_unittest_import_ImportMessage__Descriptor; }
}
protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors {
get { return self::UnitTestImportProtoFile.internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable; }
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable; }
}
// optional int32 d = 1;
@ -115,35 +113,35 @@ namespace Google.ProtocolBuffers.TestProtos {
}
}
public static self::ImportMessage ParseFrom(pb::ByteString data) {
public static global::Google.ProtocolBuffers.TestProtos.ImportMessage ParseFrom(pb::ByteString data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
public static self::ImportMessage ParseFrom(pb::ByteString data,
public static global::Google.ProtocolBuffers.TestProtos.ImportMessage ParseFrom(pb::ByteString data,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry))
.BuildParsed();
}
public static self::ImportMessage ParseFrom(byte[] data) {
public static global::Google.ProtocolBuffers.TestProtos.ImportMessage ParseFrom(byte[] data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
public static self::ImportMessage ParseFrom(byte[] data,
public static global::Google.ProtocolBuffers.TestProtos.ImportMessage ParseFrom(byte[] data,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry))
.BuildParsed();
}
public static self::ImportMessage ParseFrom(global::System.IO.Stream input) {
public static global::Google.ProtocolBuffers.TestProtos.ImportMessage ParseFrom(global::System.IO.Stream input) {
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
}
public static self::ImportMessage ParseFrom(
public static global::Google.ProtocolBuffers.TestProtos.ImportMessage ParseFrom(
global::System.IO.Stream input,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry))
.BuildParsed();
}
public static self::ImportMessage ParseFrom(pb::CodedInputStream input) {
public static global::Google.ProtocolBuffers.TestProtos.ImportMessage ParseFrom(pb::CodedInputStream input) {
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
}
public static self::ImportMessage ParseFrom(pb::CodedInputStream input,
public static global::Google.ProtocolBuffers.TestProtos.ImportMessage ParseFrom(pb::CodedInputStream input,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry))
.BuildParsed();
@ -151,26 +149,26 @@ namespace Google.ProtocolBuffers.TestProtos {
public static Builder CreateBuilder() { return new Builder(); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(self::ImportMessage prototype) {
public static Builder CreateBuilder(global::Google.ProtocolBuffers.TestProtos.ImportMessage prototype) {
return (Builder) new Builder().MergeFrom(prototype);
}
public sealed partial class Builder : pb::GeneratedBuilder<self::ImportMessage, Builder> {
public sealed partial class Builder : pb::GeneratedBuilder<global::Google.ProtocolBuffers.TestProtos.ImportMessage, Builder> {
protected override Builder ThisBuilder {
get { return this; }
}
// Construct using self::ImportMessage.CreateBuilder()
// Construct using global::Google.ProtocolBuffers.TestProtos.ImportMessage.CreateBuilder()
internal Builder() {}
self::ImportMessage result = new self::ImportMessage();
global::Google.ProtocolBuffers.TestProtos.ImportMessage result = new global::Google.ProtocolBuffers.TestProtos.ImportMessage();
protected override self::ImportMessage MessageBeingBuilt {
protected override global::Google.ProtocolBuffers.TestProtos.ImportMessage MessageBeingBuilt {
get { return result; }
}
public override Builder Clear() {
result = new self::ImportMessage();
result = new global::Google.ProtocolBuffers.TestProtos.ImportMessage();
return this;
}
@ -179,30 +177,30 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override pbd::MessageDescriptor DescriptorForType {
get { return self::ImportMessage.Descriptor; }
get { return global::Google.ProtocolBuffers.TestProtos.ImportMessage.Descriptor; }
}
public override self::ImportMessage DefaultInstanceForType {
get { return self::ImportMessage.DefaultInstance; }
public override global::Google.ProtocolBuffers.TestProtos.ImportMessage DefaultInstanceForType {
get { return global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance; }
}
public override self::ImportMessage BuildPartial() {
self::ImportMessage returnMe = result;
public override global::Google.ProtocolBuffers.TestProtos.ImportMessage BuildPartial() {
global::Google.ProtocolBuffers.TestProtos.ImportMessage returnMe = result;
result = null;
return returnMe;
}
public override Builder MergeFrom(pb::IMessage other) {
if (other is self::ImportMessage) {
return MergeFrom((self::ImportMessage) other);
if (other is global::Google.ProtocolBuffers.TestProtos.ImportMessage) {
return MergeFrom((global::Google.ProtocolBuffers.TestProtos.ImportMessage) other);
} else {
base.MergeFrom(other);
return this;
}
}
public override Builder MergeFrom(self::ImportMessage other) {
if (other == self::ImportMessage.DefaultInstance) return this;
public override Builder MergeFrom(global::Google.ProtocolBuffers.TestProtos.ImportMessage other) {
if (other == global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance) return this;
if (other.HasD) {
D = other.D;
}

@ -4,8 +4,6 @@ using pb = global::Google.ProtocolBuffers;
using pbc = global::Google.ProtocolBuffers.Collections;
using pbd = global::Google.ProtocolBuffers.Descriptors;
using scg = global::System.Collections.Generic;
using self = global::Google.ProtocolBuffers.TestProtos;
namespace Google.ProtocolBuffers.TestProtos {
public static partial class UnitTestOptimizeForProtoFile {
@ -34,7 +32,7 @@ namespace Google.ProtocolBuffers.TestProtos {
0x55, 0x6e, 0x69, 0x74, 0x54, 0x65, 0x73, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x46, 0x6f, 0x72, 0x50,
0x72, 0x6f, 0x74, 0x6f, 0x46, 0x69, 0x6c, 0x65,
}, new pbd::FileDescriptor[] {
self::UnitTestProtoFile.Descriptor,
global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor,
});
#endregion
@ -47,8 +45,8 @@ namespace Google.ProtocolBuffers.TestProtos {
internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestOptimizedForSize__FieldAccessorTable
= new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestOptimizedForSize__Descriptor,
new string[] { "I", "Msg", },
typeof (self::TestOptimizedForSize),
typeof (self::TestOptimizedForSize.Builder));
typeof (global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize),
typeof (global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder));
#endregion
}
@ -68,11 +66,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public static pbd::MessageDescriptor Descriptor {
get { return self::UnitTestOptimizeForProtoFile.internal__static_protobuf_unittest_TestOptimizedForSize__Descriptor; }
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.internal__static_protobuf_unittest_TestOptimizedForSize__Descriptor; }
}
protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors {
get { return self::UnitTestOptimizeForProtoFile.internal__static_protobuf_unittest_TestOptimizedForSize__FieldAccessorTable; }
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.internal__static_protobuf_unittest_TestOptimizedForSize__FieldAccessorTable; }
}
public static readonly pb::GeneratedExtensionBase<int> TestExtension =
@ -94,43 +92,43 @@ namespace Google.ProtocolBuffers.TestProtos {
// optional .protobuf_unittest.ForeignMessage msg = 19;
private bool hasMsg;
private self::ForeignMessage msg_ = self::ForeignMessage.DefaultInstance;
private global::Google.ProtocolBuffers.TestProtos.ForeignMessage msg_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance;
public bool HasMsg {
get { return hasMsg; }
}
public self::ForeignMessage Msg {
public global::Google.ProtocolBuffers.TestProtos.ForeignMessage Msg {
get { return msg_; }
}
public static self::TestOptimizedForSize ParseFrom(pb::ByteString data) {
public static global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize ParseFrom(pb::ByteString data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
public static self::TestOptimizedForSize ParseFrom(pb::ByteString data,
public static global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize ParseFrom(pb::ByteString data,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry))
.BuildParsed();
}
public static self::TestOptimizedForSize ParseFrom(byte[] data) {
public static global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize ParseFrom(byte[] data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
public static self::TestOptimizedForSize ParseFrom(byte[] data,
public static global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize ParseFrom(byte[] data,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry))
.BuildParsed();
}
public static self::TestOptimizedForSize ParseFrom(global::System.IO.Stream input) {
public static global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize ParseFrom(global::System.IO.Stream input) {
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
}
public static self::TestOptimizedForSize ParseFrom(
public static global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize ParseFrom(
global::System.IO.Stream input,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry))
.BuildParsed();
}
public static self::TestOptimizedForSize ParseFrom(pb::CodedInputStream input) {
public static global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize ParseFrom(pb::CodedInputStream input) {
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
}
public static self::TestOptimizedForSize ParseFrom(pb::CodedInputStream input,
public static global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize ParseFrom(pb::CodedInputStream input,
pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry))
.BuildParsed();
@ -138,26 +136,26 @@ namespace Google.ProtocolBuffers.TestProtos {
public static Builder CreateBuilder() { return new Builder(); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(self::TestOptimizedForSize prototype) {
public static Builder CreateBuilder(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize prototype) {
return (Builder) new Builder().MergeFrom(prototype);
}
public sealed partial class Builder : pb::ExtendableBuilder<self::TestOptimizedForSize, self::TestOptimizedForSize.Builder> {
public sealed partial class Builder : pb::ExtendableBuilder<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize, global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder> {
protected override Builder ThisBuilder {
get { return this; }
}
// Construct using self::TestOptimizedForSize.CreateBuilder()
// Construct using global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.CreateBuilder()
internal Builder() {}
self::TestOptimizedForSize result = new self::TestOptimizedForSize();
global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize result = new global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize();
protected override self::TestOptimizedForSize MessageBeingBuilt {
protected override global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize MessageBeingBuilt {
get { return result; }
}
public override Builder Clear() {
result = new self::TestOptimizedForSize();
result = new global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize();
return this;
}
@ -166,15 +164,15 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override pbd::MessageDescriptor DescriptorForType {
get { return self::TestOptimizedForSize.Descriptor; }
get { return global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Descriptor; }
}
public override self::TestOptimizedForSize DefaultInstanceForType {
get { return self::TestOptimizedForSize.DefaultInstance; }
public override global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize DefaultInstanceForType {
get { return global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance; }
}
public override self::TestOptimizedForSize BuildPartial() {
self::TestOptimizedForSize returnMe = result;
public override global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize BuildPartial() {
global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize returnMe = result;
result = null;
return returnMe;
}
@ -203,25 +201,25 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasMsg {
get { return result.HasMsg; }
}
public self::ForeignMessage Msg {
public global::Google.ProtocolBuffers.TestProtos.ForeignMessage Msg {
get { return result.Msg; }
set { SetMsg(value); }
}
public Builder SetMsg(self::ForeignMessage value) {
public Builder SetMsg(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) {
result.hasMsg = true;
result.msg_ = value;
return this;
}
public Builder SetMsg(self::ForeignMessage.Builder builderForValue) {
public Builder SetMsg(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) {
result.hasMsg = true;
result.msg_ = builderForValue.Build();
return this;
}
public Builder MergeMsg(self::ForeignMessage value) {
public Builder MergeMsg(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) {
if (result.HasMsg &&
result.msg_ != self::ForeignMessage.DefaultInstance) {
result.msg_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) {
result.msg_ =
self::ForeignMessage.CreateBuilder(result.msg_).MergeFrom(value).BuildPartial();
global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.msg_).MergeFrom(value).BuildPartial();
} else {
result.msg_ = value;
}
@ -230,7 +228,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder ClearMsg() {
result.hasMsg = false;
result.msg_ = self::ForeignMessage.DefaultInstance;
result.msg_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance;
return this;
}
}

File diff suppressed because it is too large Load Diff

@ -95,8 +95,6 @@ void FileGenerator::Generate(io::Printer* printer) {
printer->Print("using scg = global::System.Collections.Generic;\r\n");
if (!csharp_namespace_.empty()) {
printer->Print("using self = global::$selfnamespace$;\r\n\r\n",
"selfnamespace", csharp_namespace_);
printer->Print(
"namespace $namespace$ {\r\n",
"namespace", csharp_namespace_);
@ -238,8 +236,6 @@ static void GenerateSibling(const string& csharp_namespace,
printer.Print("using scg = global::System.Collections.Generic;\r\n");
if (!csharp_namespace.empty()) {
printer.Print("using self = global::$selfnamespace$;\r\n\r\n",
"selfnamespace", csharp_namespace);
printer.Print(
"namespace $namespace$ {\r\n",
"namespace", csharp_namespace);

@ -138,7 +138,7 @@ string FileCSharpNamespace(const FileDescriptor* file) {
string ToCSharpName(const string& full_name, const FileDescriptor* file) {
string result;
if (!file->options().csharp_nest_classes()) {
result = "";
result = FileCSharpNamespace(file);
} else {
result = ClassName(file);
}
@ -150,17 +150,18 @@ string ToCSharpName(const string& full_name, const FileDescriptor* file) {
classname = full_name;
} else {
// Strip the proto package from full_name since we've replaced it with
// the C# package.
// the C# namespace.
classname = full_name.substr(file->package().size() + 1);
}
result += StringReplace(classname, ".", ".Types.", true);
const char *prefix = FileCSharpNamespace(file).empty() ? "global::" : "self::";
return prefix + result;
return "global::" + result;
}
string ClassName(const FileDescriptor* descriptor) {
string alias = FileCSharpNamespace(descriptor).empty() ? "global::" : "self::";
return alias + FileClassName(descriptor);
string result = FileCSharpNamespace(descriptor);
if (!result.empty()) result += '.';
result += FileClassName(descriptor);
return "global::" + result;
}
MappedType GetMappedType(FieldDescriptor::Type field_type) {

Loading…
Cancel
Save