From e60ce8bfafca616ed4fd430ae4f82360de165e80 Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Wed, 22 Oct 2008 07:11:17 +0100 Subject: Final commit before changing layout --- csharp/ProtoGen.Test/DependencyResolutionTest.cs | 82 +- csharp/ProtoGen.Test/DescriptorUtilTest.cs | 69 + csharp/ProtoGen.Test/GeneratorTest.cs | 9 +- csharp/ProtoGen.Test/HelpersTest.cs | 33 + csharp/ProtoGen.Test/ProtoGen.Test.csproj | 6 +- csharp/ProtoGen/DescriptorUtil.cs | 108 + csharp/ProtoGen/EnumFieldGenerator.cs | 75 + csharp/ProtoGen/EnumGenerator.cs | 19 + csharp/ProtoGen/ExtensionGenerator.cs | 37 + csharp/ProtoGen/FieldGeneratorBase.cs | 130 + csharp/ProtoGen/Generator.cs | 101 +- csharp/ProtoGen/Helpers.cs | 78 + csharp/ProtoGen/IFieldSourceGenerator.cs | 11 + csharp/ProtoGen/ISourceGenerator.cs | 5 + csharp/ProtoGen/MessageFieldGenerator.cs | 92 + csharp/ProtoGen/MessageGenerator.cs | 453 +++ csharp/ProtoGen/PrimitiveFieldGenerator.cs | 70 + csharp/ProtoGen/Program.cs | 16 +- csharp/ProtoGen/ProtoGen.csproj | 19 + csharp/ProtoGen/ProtoGen.csproj.user | 6 + csharp/ProtoGen/RepeatedEnumFieldGenerator.cs | 90 + csharp/ProtoGen/RepeatedMessageFieldGenerator.cs | 100 + csharp/ProtoGen/RepeatedPrimitiveFieldGenerator.cs | 84 + csharp/ProtoGen/ServiceGenerator.cs | 138 + csharp/ProtoGen/SourceFileGenerator.cs | 29 + csharp/ProtoGen/SourceGeneratorBase.cs | 50 + csharp/ProtoGen/SourceGenerators.cs | 42 + csharp/ProtoGen/UmbrellaClassGenerator.cs | 96 + .../TestProtos/UnitTestImportProtoFile.cs | 116 +- .../DescriptorProtos/CSharpOptions.cs | 49 + .../DescriptorProtos/DescriptorProtoFile.cs | 3115 ++++++++++++-------- .../DescriptorProtos/PartialClasses.cs | 15 + .../ProtocolBuffers/Descriptors/FileDescriptor.cs | 6 +- .../FieldAccess/RepeatedPrimitiveAccessor.cs | 2 +- .../FieldAccess/SinglePrimitiveAccessor.cs | 9 +- csharp/ProtocolBuffers/FieldSet.cs | 1 + csharp/ProtocolBuffers/ProtocolBuffers.csproj | 1 + csharp/ProtocolBuffers/TextGenerator.cs | 4 + csharp/ProtocolBuffers/UnknownFieldSet.cs | 6 + 39 files changed, 4019 insertions(+), 1353 deletions(-) create mode 100644 csharp/ProtoGen.Test/DescriptorUtilTest.cs create mode 100644 csharp/ProtoGen.Test/HelpersTest.cs create mode 100644 csharp/ProtoGen/DescriptorUtil.cs create mode 100644 csharp/ProtoGen/EnumFieldGenerator.cs create mode 100644 csharp/ProtoGen/EnumGenerator.cs create mode 100644 csharp/ProtoGen/ExtensionGenerator.cs create mode 100644 csharp/ProtoGen/FieldGeneratorBase.cs create mode 100644 csharp/ProtoGen/Helpers.cs create mode 100644 csharp/ProtoGen/IFieldSourceGenerator.cs create mode 100644 csharp/ProtoGen/ISourceGenerator.cs create mode 100644 csharp/ProtoGen/MessageFieldGenerator.cs create mode 100644 csharp/ProtoGen/MessageGenerator.cs create mode 100644 csharp/ProtoGen/PrimitiveFieldGenerator.cs create mode 100644 csharp/ProtoGen/ProtoGen.csproj.user create mode 100644 csharp/ProtoGen/RepeatedEnumFieldGenerator.cs create mode 100644 csharp/ProtoGen/RepeatedMessageFieldGenerator.cs create mode 100644 csharp/ProtoGen/RepeatedPrimitiveFieldGenerator.cs create mode 100644 csharp/ProtoGen/ServiceGenerator.cs create mode 100644 csharp/ProtoGen/SourceFileGenerator.cs create mode 100644 csharp/ProtoGen/SourceGeneratorBase.cs create mode 100644 csharp/ProtoGen/SourceGenerators.cs create mode 100644 csharp/ProtoGen/UmbrellaClassGenerator.cs create mode 100644 csharp/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs (limited to 'csharp') diff --git a/csharp/ProtoGen.Test/DependencyResolutionTest.cs b/csharp/ProtoGen.Test/DependencyResolutionTest.cs index 1906c44d..ef911263 100644 --- a/csharp/ProtoGen.Test/DependencyResolutionTest.cs +++ b/csharp/ProtoGen.Test/DependencyResolutionTest.cs @@ -1,9 +1,12 @@ using System; using System.Collections.Generic; using System.Text; +using Google.ProtocolBuffers.Descriptors; using NUnit.Framework; +using Google.ProtocolBuffers.DescriptorProtos; +using Google.ProtocolBuffers.ProtoGen; -namespace ProtoGen { +namespace Google.ProtocolBuffers.ProtoGen { /// /// Tests for the dependency resolution in Generator. /// @@ -12,6 +15,81 @@ namespace ProtoGen { [Test] public void TwoDistinctFiles() { + FileDescriptorProto first = new FileDescriptorProto.Builder { Name="First" }.Build(); + FileDescriptorProto second = new FileDescriptorProto.Builder { Name="Second" }.Build(); + FileDescriptorSet set = new FileDescriptorSet { FileList = { first, second } }; + + IList converted = Generator.ConvertDescriptors(set); + Assert.AreEqual(2, converted.Count); + Assert.AreEqual("First", converted[0].Name); + Assert.AreEqual(0, converted[0].Dependencies.Count); + Assert.AreEqual("Second", converted[1].Name); + Assert.AreEqual(0, converted[1].Dependencies.Count); + } + + [Test] + public void FirstDependsOnSecond() { + FileDescriptorProto first = new FileDescriptorProto.Builder { Name = "First", DependencyList = {"Second"} }.Build(); + FileDescriptorProto second = new FileDescriptorProto.Builder { Name = "Second" }.Build(); + FileDescriptorSet set = new FileDescriptorSet { FileList = { first, second } }; + IList converted = Generator.ConvertDescriptors(set); + Assert.AreEqual(2, converted.Count); + Assert.AreEqual("First", converted[0].Name); + Assert.AreEqual(1, converted[0].Dependencies.Count); + Assert.AreEqual(converted[1], converted[0].Dependencies[0]); + Assert.AreEqual("Second", converted[1].Name); + Assert.AreEqual(0, converted[1].Dependencies.Count); + } + + [Test] + public void SecondDependsOnFirst() { + FileDescriptorProto first = new FileDescriptorProto.Builder { Name = "First" }.Build(); + FileDescriptorProto second = new FileDescriptorProto.Builder { Name = "Second", DependencyList = {"First"} }.Build(); + FileDescriptorSet set = new FileDescriptorSet { FileList = { first, second } }; + IList converted = Generator.ConvertDescriptors(set); + Assert.AreEqual(2, converted.Count); + Assert.AreEqual("First", converted[0].Name); + Assert.AreEqual(0, converted[0].Dependencies.Count); + Assert.AreEqual("Second", converted[1].Name); + Assert.AreEqual(1, converted[1].Dependencies.Count); + Assert.AreEqual(converted[0], converted[1].Dependencies[0]); + } + + [Test] + public void CircularDependency() { + FileDescriptorProto first = new FileDescriptorProto.Builder { Name = "First", DependencyList = { "Second" } }.Build(); + FileDescriptorProto second = new FileDescriptorProto.Builder { Name = "Second", DependencyList = { "First" } }.Build(); + FileDescriptorSet set = new FileDescriptorSet { FileList = { first, second } }; + try { + Generator.ConvertDescriptors(set); + Assert.Fail("Expected exception"); + } catch (DependencyResolutionException) { + // Expected + } + } + + [Test] + public void MissingDependency() { + FileDescriptorProto first = new FileDescriptorProto.Builder { Name = "First", DependencyList = { "Second" } }.Build(); + FileDescriptorSet set = new FileDescriptorSet { FileList = { first } }; + try { + Generator.ConvertDescriptors(set); + Assert.Fail("Expected exception"); + } catch (DependencyResolutionException) { + // Expected + } + } + + [Test] + public void SelfDependency() { + FileDescriptorProto first = new FileDescriptorProto.Builder { Name = "First", DependencyList = { "First" } }.Build(); + FileDescriptorSet set = new FileDescriptorSet { FileList = { first } }; + try { + Generator.ConvertDescriptors(set); + Assert.Fail("Expected exception"); + } catch (DependencyResolutionException) { + // Expected + } } } -} +} \ No newline at end of file diff --git a/csharp/ProtoGen.Test/DescriptorUtilTest.cs b/csharp/ProtoGen.Test/DescriptorUtilTest.cs new file mode 100644 index 00000000..5674892e --- /dev/null +++ b/csharp/ProtoGen.Test/DescriptorUtilTest.cs @@ -0,0 +1,69 @@ +using Google.ProtocolBuffers.DescriptorProtos; +using Google.ProtocolBuffers.Descriptors; +using NUnit.Framework; + +namespace Google.ProtocolBuffers.ProtoGen { + [TestFixture] + public class DescriptorUtilTest { + + [Test] + public void ExplicitNamespace() { + FileDescriptorProto proto = new FileDescriptorProto.Builder { + Name = "x", Package = "pack", Options = new FileOptions.Builder().SetExtension(CSharpOptions.CSharpNamespace, "Foo.Bar").Build() + }.Build(); + FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null); + Assert.AreEqual("Foo.Bar", DescriptorUtil.GetNamespace(descriptor)); + } + + [Test] + public void NoNamespaceFallsBackToPackage() { + FileDescriptorProto proto = new FileDescriptorProto.Builder { Name = "x", Package = "pack" }.Build(); + FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null); + Assert.AreEqual("pack", DescriptorUtil.GetNamespace(descriptor)); + } + + [Test] + public void NoNamespaceOrPackageFallsBackToEmptyString() { + FileDescriptorProto proto = new FileDescriptorProto.Builder { Name = "x" }.Build(); + FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null); + Assert.AreEqual("", DescriptorUtil.GetNamespace(descriptor)); + } + + [Test] + public void ExplicitlyNamedFileClass() { + FileDescriptorProto proto = new FileDescriptorProto.Builder { + Name = "x", Options = new FileOptions.Builder().SetExtension(CSharpOptions.CSharpUmbrellaClassname, "Foo").Build() + }.Build(); + FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null); + Assert.AreEqual("Foo", DescriptorUtil.GetUmbrellaClassName(descriptor)); + } + + [Test] + public void ImplicitFileClassWithProtoSuffix() { + FileDescriptorProto proto = new FileDescriptorProto.Builder { Name = "foo_bar.proto" }.Build(); + FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null); + Assert.AreEqual("FooBar", DescriptorUtil.GetUmbrellaClassName(descriptor)); + } + + [Test] + public void ImplicitFileClassWithProtoDevelSuffix() { + FileDescriptorProto proto = new FileDescriptorProto.Builder { Name = "foo_bar.protodevel" }.Build(); + FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null); + Assert.AreEqual("FooBar", DescriptorUtil.GetUmbrellaClassName(descriptor)); + } + + [Test] + public void ImplicitFileClassWithNoSuffix() { + FileDescriptorProto proto = new FileDescriptorProto.Builder { Name = "foo_bar" }.Build(); + FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null); + Assert.AreEqual("FooBar", DescriptorUtil.GetUmbrellaClassName(descriptor)); + } + + [Test] + public void ImplicitFileClassWithDirectoryStructure() { + FileDescriptorProto proto = new FileDescriptorProto.Builder { Name = "x/y/foo_bar" }.Build(); + FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null); + Assert.AreEqual("FooBar", DescriptorUtil.GetUmbrellaClassName(descriptor)); + } + } +} diff --git a/csharp/ProtoGen.Test/GeneratorTest.cs b/csharp/ProtoGen.Test/GeneratorTest.cs index 137d9348..dbd18787 100644 --- a/csharp/ProtoGen.Test/GeneratorTest.cs +++ b/csharp/ProtoGen.Test/GeneratorTest.cs @@ -1,7 +1,10 @@ -using NUnit.Framework; +using Google.ProtocolBuffers.DescriptorProtos; +using NUnit.Framework; +using Google.ProtocolBuffers.Descriptors; -namespace ProtoGen { +namespace Google.ProtocolBuffers.ProtoGen { [TestFixture] public class GeneratorTest { + } -} +} \ No newline at end of file diff --git a/csharp/ProtoGen.Test/HelpersTest.cs b/csharp/ProtoGen.Test/HelpersTest.cs new file mode 100644 index 00000000..af084973 --- /dev/null +++ b/csharp/ProtoGen.Test/HelpersTest.cs @@ -0,0 +1,33 @@ +using Google.ProtocolBuffers.ProtoGen; +using NUnit.Framework; + +namespace Google.ProtocolBuffers.ProtoGen { + [TestFixture] + public class HelpersTest { + + [Test] + public void UnderscoresToPascalCase() { + Assert.AreEqual("FooBar", Helpers.UnderscoresToPascalCase("Foo_bar")); + Assert.AreEqual("FooBar", Helpers.UnderscoresToPascalCase("foo_bar")); + Assert.AreEqual("Foo0Bar", Helpers.UnderscoresToPascalCase("Foo0bar")); + Assert.AreEqual("FooBar", Helpers.UnderscoresToPascalCase("Foo_+_Bar")); + } + + [Test] + public void UnderscoresToCamelCase() { + Assert.AreEqual("fooBar", Helpers.UnderscoresToCamelCase("Foo_bar")); + Assert.AreEqual("fooBar", Helpers.UnderscoresToCamelCase("foo_bar")); + Assert.AreEqual("foo0Bar", Helpers.UnderscoresToCamelCase("Foo0bar")); + Assert.AreEqual("fooBar", Helpers.UnderscoresToCamelCase("Foo_+_Bar")); + } + + [Test] + public void StripSuffix() { + string text = "FooBar"; + Assert.IsFalse(Helpers.StripSuffix(ref text, "Foo")); + Assert.AreEqual("FooBar", text); + Assert.IsTrue(Helpers.StripSuffix(ref text, "Bar")); + Assert.AreEqual("Foo", text); + } + } +} \ No newline at end of file diff --git a/csharp/ProtoGen.Test/ProtoGen.Test.csproj b/csharp/ProtoGen.Test/ProtoGen.Test.csproj index c1c05243..83e6f961 100644 --- a/csharp/ProtoGen.Test/ProtoGen.Test.csproj +++ b/csharp/ProtoGen.Test/ProtoGen.Test.csproj @@ -8,7 +8,7 @@ {C268DA4C-4004-47DA-AF23-44C983281A68} Library Properties - ProtoGen + Google.ProtocolBuffers.ProtoGen Google.ProtocolBuffers.ProtoGen.Test v2.0 512 @@ -42,10 +42,14 @@ ..\lib\Rhino.Mocks.dll + + + + diff --git a/csharp/ProtoGen/DescriptorUtil.cs b/csharp/ProtoGen/DescriptorUtil.cs new file mode 100644 index 00000000..e70ad468 --- /dev/null +++ b/csharp/ProtoGen/DescriptorUtil.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Google.ProtocolBuffers.Descriptors; +using Google.ProtocolBuffers.DescriptorProtos; + +namespace Google.ProtocolBuffers.ProtoGen { + /// + /// Utility class for determining namespaces etc. + /// + internal static class DescriptorUtil { + + internal static bool NestClasses(IDescriptor descriptor) { + // Defaults to false + return descriptor.File.Options.GetExtension(CSharpOptions.CSharpNestClasses); + } + + internal static string GetNamespace(FileDescriptor descriptor) { + if (descriptor.Name == "google/protobuf/descriptor.proto") { + return typeof(DescriptorProtoFile).Namespace; + } + return descriptor.Options.HasExtension(CSharpOptions.CSharpNamespace) ? + descriptor.Options.GetExtension(CSharpOptions.CSharpNamespace) : descriptor.Package; + } + + // Groups are hacky: The name of the field is just the lower-cased name + // of the group type. In C#, though, we would like to retain the original + // capitalization of the type name. + internal static string GetFieldName(FieldDescriptor descriptor) { + if (descriptor.FieldType == FieldType.Group) { + return descriptor.MessageType.Name; + } else { + return descriptor.Name; + } + } + + internal static string GetClassName(IDescriptor descriptor) { + return ToCSharpName(descriptor.FullName, descriptor.File); + } + + internal static string GetFullUmbrellaClassName(FileDescriptor descriptor) { + string result = GetNamespace(descriptor); + if (result != "") result += '.'; + result += GetUmbrellaClassName(descriptor); + return "global::" + result; + } + + internal static string GetUmbrellaClassName(FileDescriptor descriptor) { + if (descriptor.Name == "google/protobuf/descriptor.proto") { + return typeof(DescriptorProtoFile).Name; + } + FileOptions options = descriptor.Options; + if (options.HasExtension(CSharpOptions.CSharpUmbrellaClassname)) { + return descriptor.Options.GetExtension(CSharpOptions.CSharpUmbrellaClassname); + } + int lastSlash = descriptor.Name.LastIndexOf('/'); + string baseName = descriptor.Name.Substring(lastSlash + 1); + return Helpers.UnderscoresToPascalCase(StripProto(baseName)); + } + + private static string StripProto(string text) { + if (!Helpers.StripSuffix(ref text, ".protodevel")) { + Helpers.StripSuffix(ref text, ".proto"); + } + return text; + } + + private static string ToCSharpName(string name, FileDescriptor file) { + string result; + if (!NestClasses(file)) { + result = GetNamespace(file); + } else { + result = GetUmbrellaClassName(file); + } + if (result != "") { + result += '.'; + } + string classname; + if (file.Package == "") { + classname = name; + } else { + // Strip the proto package from full_name since we've replaced it with + // the C# namespace. + classname = name.Substring(file.Package.Length + 1); + } + result += classname.Replace(".", ".Types."); + return "global::" + result; + } + + internal static string GetMappedTypeName(MappedType type) { + switch(type) { + case MappedType.Int32: return "int"; + case MappedType.Int64: return "long"; + case MappedType.UInt32: return "uint"; + case MappedType.UInt64: return "ulong"; + case MappedType.Single: return "float"; + case MappedType.Double: return "double"; + case MappedType.Boolean: return "bool"; + case MappedType.String: return "string"; + case MappedType.ByteString: return "pb::ByteString"; + case MappedType.Enum: return null; + case MappedType.Message: return null; + default: + throw new ArgumentOutOfRangeException("Unknown mapped type " + type); + } + } + } +} diff --git a/csharp/ProtoGen/EnumFieldGenerator.cs b/csharp/ProtoGen/EnumFieldGenerator.cs new file mode 100644 index 00000000..9f6a56f2 --- /dev/null +++ b/csharp/ProtoGen/EnumFieldGenerator.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen { + internal class EnumFieldGenerator : FieldGeneratorBase, IFieldSourceGenerator { + internal EnumFieldGenerator(FieldDescriptor descriptor) + : base(descriptor) { + } + + public void GenerateMembers(TextGenerator writer) { + writer.WriteLine("private bool has{0};", CapitalizedName); + writer.WriteLine("private {0} {1}_ = {2};", TypeName, Name, DefaultValue); + writer.WriteLine("public bool Has{0} {{", CapitalizedName); + writer.WriteLine(" get {{ return has{0}; }}", CapitalizedName); + writer.WriteLine("}"); + writer.WriteLine("public {0} {1} {{", TypeName, PropertyName); + writer.WriteLine(" get {{ return {0}_; }}", Name); + writer.WriteLine("}"); + } + + public void GenerateBuilderMembers(TextGenerator writer) { + writer.WriteLine("public bool Has{0} {{", CapitalizedName); + writer.WriteLine(" get {{ return result.Has{0}; }}", CapitalizedName); + writer.WriteLine("}"); + writer.WriteLine("public {0} {1} {{", TypeName, PropertyName); + writer.WriteLine(" get {{ return result.{0}; }}", PropertyName); + writer.WriteLine(" set {{ Set{0}(value); }}", CapitalizedName); + writer.WriteLine("}"); + writer.WriteLine("public Builder Set{0}({1} value) {{", CapitalizedName, TypeName); + writer.WriteLine(" result.has{0} = true;", CapitalizedName); + writer.WriteLine(" result.{0}_ = value;", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + writer.WriteLine("public Builder Clear{0}() {{", CapitalizedName); + writer.WriteLine(" result.has{0} = false;", CapitalizedName); + writer.WriteLine(" result.{0}_ = {1};", Name, DefaultValue); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + } + + public void GenerateMergingCode(TextGenerator writer) { + writer.WriteLine("if (other.Has{0}) {{", CapitalizedName); + writer.WriteLine(" {0} = other.{0};", PropertyName); + writer.WriteLine("}"); + } + + public void GenerateBuildingCode(TextGenerator writer) { + // Nothing to do here for enum types + } + + public void GenerateParsingCode(TextGenerator writer) { + // TODO(jonskeet): Make a more efficient way of doing this + writer.WriteLine("int rawValue = input.ReadEnum();"); + writer.WriteLine("if (!global::System.Enum.IsDefined(typeof({0}), rawValue)) {{", TypeName); + writer.WriteLine(" unknownFields.MergeVarintField({0}, (ulong) rawValue);", Number); + writer.WriteLine("} else {"); + writer.WriteLine(" {0} = ({1}) rawValue;", PropertyName, TypeName); + writer.WriteLine("}"); + } + + public void GenerateSerializationCode(TextGenerator writer) { + writer.WriteLine("if (Has{0}) {{", CapitalizedName); + writer.WriteLine(" output.WriteEnum({0}, (int) {1});", Number, PropertyName); + writer.WriteLine("}"); + } + + public void GenerateSerializedSizeCode(TextGenerator writer) { + writer.WriteLine("if (Has{0}) {{", CapitalizedName); + writer.WriteLine(" size += pb::CodedOutputStream.ComputeEnumSize({0}, (int) {1});", Number, PropertyName); + writer.WriteLine("}"); + } + } +} diff --git a/csharp/ProtoGen/EnumGenerator.cs b/csharp/ProtoGen/EnumGenerator.cs new file mode 100644 index 00000000..0de6b89c --- /dev/null +++ b/csharp/ProtoGen/EnumGenerator.cs @@ -0,0 +1,19 @@ +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen { + internal class EnumGenerator : SourceGeneratorBase, ISourceGenerator { + internal EnumGenerator(EnumDescriptor descriptor) : base(descriptor) { + } + + public void Generate(TextGenerator writer) { + writer.WriteLine("{0} enum {1} {{", ClassAccessLevel, Descriptor.Name); + writer.Indent(); + foreach (EnumValueDescriptor value in Descriptor.Values) { + writer.WriteLine("{0} = {1},", value.Name, value.Number); + } + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + } + } +} diff --git a/csharp/ProtoGen/ExtensionGenerator.cs b/csharp/ProtoGen/ExtensionGenerator.cs new file mode 100644 index 00000000..9c235456 --- /dev/null +++ b/csharp/ProtoGen/ExtensionGenerator.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen { + internal class ExtensionGenerator : SourceGeneratorBase, ISourceGenerator { + internal ExtensionGenerator(FieldDescriptor descriptor) : base(descriptor) { + } + + public void Generate(TextGenerator writer) { + string name = Helpers.UnderscoresToPascalCase(DescriptorUtil.GetFieldName(Descriptor)); + + string type; + switch (Descriptor.MappedType) { + case MappedType.Message: + type = DescriptorUtil.GetClassName(Descriptor.MessageType); + break; + case MappedType.Enum: + type = DescriptorUtil.GetClassName(Descriptor.EnumType); + break; + default: + type = DescriptorUtil.GetMappedTypeName(Descriptor.MappedType); + break; + } + + if (Descriptor.IsRepeated) { + writer.WriteLine("{0} static readonly", ClassAccessLevel); + writer.WriteLine(" pb::GeneratedExtensionBase> {1} =", type, name); + writer.WriteLine(" pb::GeneratedRepeatExtension<{0}>.CreateInstance(Descriptor.Extensions[{1}]);", type, Descriptor.Index); + } else { + writer.WriteLine("{0} static readonly pb::GeneratedExtensionBase<{1}> {2} =", ClassAccessLevel, type, name); + writer.WriteLine(" pb::GeneratedSingleExtension<{0}>.CreateInstance(Descriptor.Extensions[{1}]);", type, Descriptor.Index); + } + } + } +} diff --git a/csharp/ProtoGen/FieldGeneratorBase.cs b/csharp/ProtoGen/FieldGeneratorBase.cs new file mode 100644 index 00000000..9103e0c1 --- /dev/null +++ b/csharp/ProtoGen/FieldGeneratorBase.cs @@ -0,0 +1,130 @@ +using System; +using Google.ProtocolBuffers.Descriptors; +using System.Globalization; + +namespace Google.ProtocolBuffers.ProtoGen { + internal abstract class FieldGeneratorBase : SourceGeneratorBase { + protected FieldGeneratorBase(FieldDescriptor descriptor) + : base(descriptor) { + } + + private static bool AllPrintableAscii(string text) { + foreach (char c in text) { + if (c < 0x20 || c > 0x7e) { + return false; + } + } + return true; + } + + protected string DefaultValue { + get { + string suffix = ""; + switch (Descriptor.FieldType) { + case FieldType.Float: suffix = "F"; break; + case FieldType.Double: suffix = "D"; break; + case FieldType.Int64: suffix = "L"; break; + case FieldType.UInt64: suffix = "UL"; break; + } + switch (Descriptor.FieldType) { + case FieldType.Float: + case FieldType.Double: + case FieldType.Int32: + case FieldType.Int64: + case FieldType.SInt32: + case FieldType.SInt64: + case FieldType.SFixed32: + case FieldType.SFixed64: + case FieldType.UInt32: + case FieldType.UInt64: + case FieldType.Fixed32: + case FieldType.Fixed64: + // The simple Object.ToString converts using the current culture. + // We want to always use the invariant culture so it's predictable. + IConvertible value = (IConvertible) Descriptor.DefaultValue; + return value.ToString(CultureInfo.InvariantCulture) + suffix; + case FieldType.Bool: + return (bool) Descriptor.DefaultValue ? "true" : "false"; + + case FieldType.Bytes: + if (!Descriptor.HasDefaultValue) { + return "pb::ByteString.Empty"; + } + return string.Format("(pb::ByteString) {0}.Descriptor.Fields[{1}].DefaultValue", TypeName, Number); + case FieldType.String: + if (AllPrintableAscii(Descriptor.Proto.DefaultValue)) { + // All chars are ASCII and printable. In this case we only + // need to escape quotes and backslashes. + return "\"" + Descriptor.Proto.DefaultValue + .Replace("\\", "\\\\") + .Replace("'", "\\'") + .Replace("\"", "\\\"") + + "\""; + } + return string.Format("(string) {0}.Descriptor.Fields[{1}].DefaultValue", TypeName, Number); + case FieldType.Enum: + return TypeName + "." + ((EnumValueDescriptor) Descriptor.DefaultValue).Name; + case FieldType.Message: + case FieldType.Group: + return TypeName + ".DefaultInstance"; + default: + throw new InvalidOperationException("Invalid field descriptor type"); + } + } + } + + /// + /// Usually the same as CapitalizedName, except when the enclosing type has the same name, + /// in which case an underscore is appended. + /// + protected string PropertyName { + get { + string ret = CapitalizedName; + if (ret == Descriptor.ContainingType.Name) { + ret += "_"; + } + return ret; + } + } + + protected string CapitalizedName { + get { return Helpers.UnderscoresToPascalCase(DescriptorUtil.GetFieldName(Descriptor)); } + } + + protected string Name { + get { return Helpers.UnderscoresToCamelCase(DescriptorUtil.GetFieldName(Descriptor)); } + } + + protected int Number { + get { return Descriptor.FieldNumber; } + } + + protected string TypeName { + get { + switch (Descriptor.FieldType) { + case FieldType.Enum: + return DescriptorUtil.GetClassName(Descriptor.EnumType); + case FieldType.Message: + case FieldType.Group: + return DescriptorUtil.GetClassName(Descriptor.MessageType); + default: + return DescriptorUtil.GetMappedTypeName(Descriptor.MappedType); + } + } + } + + protected string MessageOrGroup { + get { return Descriptor.FieldType == FieldType.Group ? "Group" : "Message"; } + } + + /// + /// Returns the type name as used in CodedInputStream method names: SFixed32, UInt32 etc. + /// + protected string CapitalizedTypeName { + get { + // Our enum names match perfectly. How serendipitous. + return Descriptor.FieldType.ToString(); + } + } + } +} diff --git a/csharp/ProtoGen/Generator.cs b/csharp/ProtoGen/Generator.cs index d1ff76b2..f656386b 100644 --- a/csharp/ProtoGen/Generator.cs +++ b/csharp/ProtoGen/Generator.cs @@ -1,8 +1,10 @@ using System; using System.Collections.Generic; +using System.Text; using Google.ProtocolBuffers.DescriptorProtos; using System.IO; using Google.ProtocolBuffers.Descriptors; +using Google.ProtocolBuffers.Collections; namespace Google.ProtocolBuffers.ProtoGen { /// @@ -26,22 +28,111 @@ namespace Google.ProtocolBuffers.ProtoGen { public void Generate() { foreach (string inputFile in options.InputFiles) { - FileDescriptorSet descriptorProtos; + FileDescriptorSet descriptorProtos; + ExtensionRegistry extensionRegistry = ExtensionRegistry.CreateInstance(); + extensionRegistry.Add(CSharpOptions.CSharpUmbrellaClassname); + extensionRegistry.Add(CSharpOptions.CSharpMultipleFiles); + extensionRegistry.Add(CSharpOptions.CSharpNamespace); + extensionRegistry.Add(CSharpOptions.CSharpNestClasses); + extensionRegistry.Add(CSharpOptions.CSharpPublicClasses); using (Stream inputStream = File.OpenRead(inputFile)) { - descriptorProtos = FileDescriptorSet.ParseFrom(inputStream); + descriptorProtos = FileDescriptorSet.ParseFrom(inputStream, extensionRegistry); } - List descriptors = ConvertDescriptors(descriptorProtos); + IList descriptors = ConvertDescriptors(descriptorProtos); + + foreach (FileDescriptor descriptor in descriptors) { + Generate(descriptor); + } + } + } + + /// + /// Generates code for a particular file. All dependencies must + /// already have been resolved. + /// + private void Generate(FileDescriptor descriptor) { + string umbrellaClass = DescriptorUtil.GetUmbrellaClassName(descriptor); + string ns = DescriptorUtil.GetNamespace(descriptor); + using (TextWriter textWriter = File.CreateText(Path.Combine(options.OutputDirectory, umbrellaClass + ".cs"))) { + TextGenerator writer = new TextGenerator(textWriter); + + UmbrellaClassGenerator ucg = new UmbrellaClassGenerator(descriptor); + ucg.Generate(writer); + /* + GenerateSiblings(umbrellaSource, descriptor, descriptor.MessageTypes); + GenerateSiblings(umbrellaSource, descriptor, descriptor.EnumTypes); + GenerateSiblings(umbrellaSource, descriptor, descriptor.Services);*/ } } + private static void GenerateSiblings(SourceFileGenerator parentSourceGenerator, FileDescriptor file, IEnumerable siblings) + where T : IDescriptor { + } + /// /// Resolves any dependencies and converts FileDescriptorProtos into FileDescriptors. /// The list returned is in the same order as the protos are listed in the descriptor set. /// Note: this method is internal rather than private to allow testing. /// /// Not all dependencies could be resolved. - internal static List ConvertDescriptors(FileDescriptorSet descriptorProtos) { - return null; + internal static IList ConvertDescriptors(FileDescriptorSet descriptorProtos) { + // Simple strategy: Keep going through the list of protos to convert, only doing ones where + // we've already converted all the dependencies, until we get to a stalemate + IList fileList = descriptorProtos.FileList; + FileDescriptor[] converted = new FileDescriptor[fileList.Count]; + + Dictionary convertedMap = new Dictionary(); + + int totalConverted = 0; + + bool madeProgress = true; + while (madeProgress && totalConverted < converted.Length) { + madeProgress = false; + for (int i = 0; i < converted.Length; i++) { + if (converted[i] != null) { + // Already done this one + continue; + } + FileDescriptorProto candidate = fileList[i]; + FileDescriptor[] dependencies = new FileDescriptor[candidate.DependencyList.Count]; + bool foundAllDependencies = true; + for (int j = 0; j < dependencies.Length; j++) { + if (!convertedMap.TryGetValue(candidate.DependencyList[j], out dependencies[j])) { + foundAllDependencies = false; + break; + } + } + if (!foundAllDependencies) { + continue; + } + madeProgress = true; + totalConverted++; + converted[i] = FileDescriptor.BuildFrom(candidate, dependencies); + convertedMap[candidate.Name] = converted[i]; + } + } + if (!madeProgress) { + StringBuilder remaining = new StringBuilder(); + for (int i = 0; i < converted.Length; i++) { + if (converted[i] == null) { + if (remaining.Length != 0) { + remaining.Append(", "); + } + FileDescriptorProto failure = fileList[i]; + remaining.Append(failure.Name); + remaining.Append(":"); + foreach (string dependency in failure.DependencyList) { + if (!convertedMap.ContainsKey(dependency)) { + remaining.Append(" "); + remaining.Append(dependency); + } + } + remaining.Append(";"); + } + } + throw new DependencyResolutionException("Unable to resolve all dependencies: " + remaining); + } + return Lists.AsReadOnly(converted); } } } diff --git a/csharp/ProtoGen/Helpers.cs b/csharp/ProtoGen/Helpers.cs new file mode 100644 index 00000000..79a2912c --- /dev/null +++ b/csharp/ProtoGen/Helpers.cs @@ -0,0 +1,78 @@ +using System; +using System.Text; +using Google.ProtocolBuffers.DescriptorProtos; +using Google.ProtocolBuffers.Descriptors; +namespace Google.ProtocolBuffers.ProtoGen { + + /// + /// Helpers to resolve class names etc. + /// + internal static class Helpers { + internal static string UnderscoresToPascalCase(string input) { + return UnderscoresToPascalOrCamelCase(input, true); + } + + internal static string UnderscoresToCamelCase(string input) { + return UnderscoresToPascalOrCamelCase(input, false); + } + + internal static void WriteNamespaces(TextGenerator writer) { + writer.WriteLine("using pb = global::Google.ProtocolBuffers;"); + writer.WriteLine("using pbc = global::Google.ProtocolBuffers.Collections;"); + writer.WriteLine("using pbd = global::Google.ProtocolBuffers.Descriptors;"); + writer.WriteLine("using scg = global::System.Collections.Generic;"); + } + + /// + /// Converts a string to Pascal or Camel case. The first letter is capitalized or + /// lower-cased depending on is true. + /// After the first letter, any punctuation is removed but triggers capitalization + /// of the next letter. Digits are preserved but trigger capitalization of the next + /// letter. + /// All capitalisation is done in the invariant culture. + /// + private static string UnderscoresToPascalOrCamelCase(string input, bool pascal) { + StringBuilder result = new StringBuilder(); + bool capitaliseNext = pascal; + for (int i=0; i < input.Length; i++) { + char c = input[i]; + if ('a' <= c && c <= 'z') { + if (capitaliseNext) { + result.Append(char.ToUpperInvariant(c)); + } else { + result.Append(c); + } + capitaliseNext = false; + } else if ('A' <= c && c <= 'Z') { + if (i == 0 && !pascal) { + // Force first letter to lower-case unless explicitly told to + // capitalize it. + result.Append(char.ToLowerInvariant(c)); + } else { + // Capital letters after the first are left as-is. + result.Append(c); + } + capitaliseNext = false; + } else if ('0' <= c && c <= '9') { + result.Append(c); + capitaliseNext = true; + } else { + capitaliseNext = true; + } + } + return result.ToString(); + } + + /// + /// Attempts to strip a suffix from a string, returning whether + /// or not the suffix was actually present. + /// + internal static bool StripSuffix(ref string text, string suffix) { + if (text.EndsWith(suffix)) { + text = text.Substring(0, text.Length - suffix.Length); + return true; + } + return false; + } + } +} diff --git a/csharp/ProtoGen/IFieldSourceGenerator.cs b/csharp/ProtoGen/IFieldSourceGenerator.cs new file mode 100644 index 00000000..a64043c8 --- /dev/null +++ b/csharp/ProtoGen/IFieldSourceGenerator.cs @@ -0,0 +1,11 @@ +namespace Google.ProtocolBuffers.ProtoGen { + internal interface IFieldSourceGenerator { + void GenerateMembers(TextGenerator writer); + void GenerateBuilderMembers(TextGenerator writer); + void GenerateMergingCode(TextGenerator writer); + void GenerateBuildingCode(TextGenerator writer); + void GenerateParsingCode(TextGenerator writer); + void GenerateSerializationCode(TextGenerator writer); + void GenerateSerializedSizeCode(TextGenerator writer); + } +} diff --git a/csharp/ProtoGen/ISourceGenerator.cs b/csharp/ProtoGen/ISourceGenerator.cs new file mode 100644 index 00000000..16e7c29a --- /dev/null +++ b/csharp/ProtoGen/ISourceGenerator.cs @@ -0,0 +1,5 @@ +namespace Google.ProtocolBuffers.ProtoGen { + internal interface ISourceGenerator { + void Generate(TextGenerator writer); + } +} diff --git a/csharp/ProtoGen/MessageFieldGenerator.cs b/csharp/ProtoGen/MessageFieldGenerator.cs new file mode 100644 index 00000000..c73edfc0 --- /dev/null +++ b/csharp/ProtoGen/MessageFieldGenerator.cs @@ -0,0 +1,92 @@ +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen { + internal class MessageFieldGenerator : FieldGeneratorBase, IFieldSourceGenerator { + + internal MessageFieldGenerator(FieldDescriptor descriptor) + : base(descriptor) { + } + + public void GenerateMembers(TextGenerator writer) { + writer.WriteLine("private bool has{0};", CapitalizedName); + writer.WriteLine("private {0} {1}_ = {2};", TypeName, Name, DefaultValue); + writer.WriteLine("public bool Has{0} {{", CapitalizedName); + writer.WriteLine(" get {{ return has{0}; }}", CapitalizedName); + writer.WriteLine("}"); + writer.WriteLine("public {0} {1} {{", TypeName, CapitalizedName); + writer.WriteLine(" get {{ return {0}_; }}", Name); + writer.WriteLine("}"); + } + + public void GenerateBuilderMembers(TextGenerator writer) { + writer.WriteLine("public bool Has{0} {{", CapitalizedName); + writer.WriteLine(" get {{ return result.Has{0}; }}", CapitalizedName); + writer.WriteLine("}"); + writer.WriteLine("public {0} {1} {{", TypeName, CapitalizedName); + writer.WriteLine(" get {{ return result.{0}; }}", CapitalizedName); + writer.WriteLine(" set {{ Set{0}(value); }}", CapitalizedName); + writer.WriteLine("}"); + writer.WriteLine("public Builder Set{0}({1} value) {{", CapitalizedName, TypeName); + writer.WriteLine(" result.has{0} = true;", CapitalizedName); + writer.WriteLine(" result.{0}_ = value;", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + writer.WriteLine("public Builder Set{0}({1}.Builder builderForValue) {{", CapitalizedName, TypeName); + writer.WriteLine(" result.has{0} = true;", CapitalizedName); + writer.WriteLine(" result.{0}_ = builderForValue.Build();", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + writer.WriteLine("public Builder Merge{0}({1} value) {{", CapitalizedName, TypeName); + writer.WriteLine(" if (result.Has{0} &&", CapitalizedName); + writer.WriteLine(" result.{0}_ != {1}) {{", Name, DefaultValue); + writer.WriteLine(" result.{0}_ = {1}.CreateBuilder(result.{0}_).MergeFrom(value).BuildPartial();", Name, TypeName); + writer.WriteLine(" } else {"); + writer.WriteLine(" result.{0}_ = value;", Name); + writer.WriteLine(" }"); + writer.WriteLine(" result.has{0} = true;", CapitalizedName); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + writer.WriteLine("public Builder Clear{0}() {{", CapitalizedName); + writer.WriteLine(" result.has{0} = false;", CapitalizedName); + writer.WriteLine(" result.{0}_ = {1};", Name, DefaultValue); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + } + + public void GenerateMergingCode(TextGenerator writer) { + writer.WriteLine("if (other.Has{0}) {{", CapitalizedName); + writer.WriteLine(" Merge{0}(other.{0});", CapitalizedName); + writer.WriteLine("}"); + } + + public void GenerateBuildingCode(TextGenerator writer) { + // Nothing to do for singular fields + } + + public void GenerateParsingCode(TextGenerator writer) { + writer.WriteLine("{0}.Builder subBuilder = {0}.CreateBuilder();", TypeName); + writer.WriteLine("if (Has{0}) {{", CapitalizedName); + writer.WriteLine(" subBuilder.MergeFrom({0});", CapitalizedName); + writer.WriteLine("}"); + if (Descriptor.FieldType == FieldType.Group) { + writer.WriteLine("input.ReadGroup({0}, subBuilder, extensionRegistry);", Number); + } else { + writer.WriteLine("input.ReadMessage(subBuilder, extensionRegistry);"); + } + writer.WriteLine("{0} = subBuilder.BuildPartial();", CapitalizedName); + } + + public void GenerateSerializationCode(TextGenerator writer) { + writer.WriteLine("if (Has{0}) {{", CapitalizedName); + writer.WriteLine(" output.Write{0}({1}, {2});", MessageOrGroup, Number, CapitalizedName); + writer.WriteLine("}"); + } + + public void GenerateSerializedSizeCode(TextGenerator writer) { + writer.WriteLine("if (Has{0}) {{", CapitalizedName); + writer.WriteLine(" size += pb::CodedOutputStream.Compute{0}Size({1}, {2});", + MessageOrGroup, Number, CapitalizedName); + writer.WriteLine("}"); + } + } +} diff --git a/csharp/ProtoGen/MessageGenerator.cs b/csharp/ProtoGen/MessageGenerator.cs new file mode 100644 index 00000000..ba48c85c --- /dev/null +++ b/csharp/ProtoGen/MessageGenerator.cs @@ -0,0 +1,453 @@ +using System.Collections; +using Google.ProtocolBuffers.Descriptors; +using Google.ProtocolBuffers.DescriptorProtos; +using System.Collections.Generic; + +using ExtensionRange = Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange; + +namespace Google.ProtocolBuffers.ProtoGen { + internal class MessageGenerator : SourceGeneratorBase, ISourceGenerator { + internal MessageGenerator(MessageDescriptor descriptor) : base(descriptor) { + } + + private string ClassName { + get { return Descriptor.Name; } + } + + private string FullClassName { + get { return DescriptorUtil.GetClassName(Descriptor); } + } + + /// + /// Get an identifier that uniquely identifies this type within the file. + /// This is used to declare static variables related to this type at the + /// outermost file scope. + /// + static string GetUniqueFileScopeIdentifier(IDescriptor descriptor) { + return "static_" + descriptor.FullName.Replace(".", "_"); + } + + internal void GenerateStaticVariables(TextGenerator writer) { + // Because descriptor.proto (Google.ProtocolBuffers.DescriptorProtos) is + // used in the construction of descriptors, we have a tricky bootstrapping + // problem. To help control static initialization order, we make sure all + // descriptors and other static data that depends on them are members of + // the proto-descriptor class. This way, they will be initialized in + // a deterministic order. + + string identifier = GetUniqueFileScopeIdentifier(Descriptor); + + // The descriptor for this type. + string access = Descriptor.File.Options.GetExtension(CSharpOptions.CSharpNestClasses) ? "private" : "internal"; + writer.WriteLine("{0} static readonly pbd::MessageDescriptor internal__{1}__Descriptor", access, identifier); + if (Descriptor.ContainingType == null) { + writer.WriteLine(" = Descriptor.MessageTypes[{0}];", Descriptor.Index); + } else { + writer.WriteLine(" = internal__{0}__Descriptor.NestedTypes[{1}];", GetUniqueFileScopeIdentifier(Descriptor.ContainingType), Descriptor.Index); + } + writer.WriteLine("{0} static pb::FieldAccess.FieldAccessorTable<{1}, {1}.Builder> internal__{2}__FieldAccessorTable", + access, FullClassName, identifier); + writer.WriteLine(" = new pb::FieldAccess.FieldAccessorTable<{0}, {0}.Builder>(internal__{1}__Descriptor,", + FullClassName, identifier); + writer.Print(" new string[] { "); + foreach (FieldDescriptor field in Descriptor.Fields) { + writer.Write("\"{0}\", ", Helpers.UnderscoresToPascalCase(DescriptorUtil.GetFieldName(field))); + } + writer.WriteLine("});"); + + // Generate static members for all nested types. + foreach (MessageDescriptor nestedMessage in Descriptor.NestedTypes) { + new MessageGenerator(nestedMessage).GenerateStaticVariables(writer); + } + } + + public void Generate(TextGenerator writer) { + writer.WriteLine("{0} sealed partial class {1} : pb::{2}Message<{1}, {1}.Builder> {{", + ClassAccessLevel, ClassName, Descriptor.Proto.ExtensionRangeCount > 0 ? "Extendable" : "Generated"); + writer.Indent(); + // Must call BuildPartial() to make sure all lists are made read-only + writer.WriteLine("private static readonly {0} defaultInstance = new Builder().BuildPartial();", ClassName); + writer.WriteLine("public static {0} DefaultInstance {{", ClassName); + writer.WriteLine(" get { return defaultInstance; }"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("public override {0} DefaultInstanceForType {{", ClassName); + writer.WriteLine(" get { return defaultInstance; }"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("protected override {0} ThisMessage {{", ClassName); + writer.WriteLine(" get { return this; }"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("public static pbd::MessageDescriptor Descriptor {"); + writer.WriteLine(" get {{ return {0}.internal__{1}__Descriptor; }}", DescriptorUtil.GetFullUmbrellaClassName(Descriptor.File), + GetUniqueFileScopeIdentifier(Descriptor)); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("protected override pb::FieldAccess.FieldAccessorTable<{0}, {0}.Builder> InternalFieldAccessors {{", ClassName); + writer.WriteLine(" get {{ return {0}.internal__{1}__FieldAccessorTable; }}", DescriptorUtil.GetFullUmbrellaClassName(Descriptor.File), + GetUniqueFileScopeIdentifier(Descriptor)); + writer.WriteLine("}"); + writer.WriteLine(); + + // Extensions don't need to go in an extra nested type + WriteChildren(writer, null, Descriptor.Extensions); + + if (Descriptor.EnumTypes.Count + Descriptor.NestedTypes.Count > 0) { + writer.WriteLine("#region Nested types"); + writer.WriteLine("public static class Types {"); + writer.Indent(); + WriteChildren(writer, null, Descriptor.EnumTypes); + WriteChildren(writer, null, Descriptor.NestedTypes); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine("#endregion"); + writer.WriteLine(); + } + + foreach(FieldDescriptor fieldDescriptor in Descriptor.Fields) { + // Rats: we lose the debug comment here :( + SourceGenerators.CreateFieldGenerator(fieldDescriptor).GenerateMembers(writer); + writer.WriteLine(); + } + + if (Descriptor.File.Options.OptimizeFor == FileOptions.Types.OptimizeMode.SPEED) { + GenerateIsInitialized(writer); + GenerateMessageSerializationMethods(writer); + } + + GenerateParseFromMethods(writer); + GenerateBuilder(writer); + } + + private void GenerateMessageSerializationMethods(TextGenerator writer) { + List sortedFields = new List(Descriptor.Fields); + sortedFields.Sort((f1, f2) => f1.FieldNumber.CompareTo(f2.FieldNumber)); + + List sortedExtensions = new List(Descriptor.Proto.ExtensionRangeList); + sortedExtensions.Sort((r1, r2) => (r1.Start.CompareTo(r2.Start))); + + writer.WriteLine("public override void WriteTo(pb::CodedOutputStream output) {"); + writer.Indent(); + if (Descriptor.Proto.ExtensionRangeList.Count > 0) { + writer.WriteLine("pb::ExtendableMessage<{0}, {0}.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);", + ClassName); + } + + // Merge the fields and the extension ranges, both sorted by field number. + for (int i = 0, j = 0; i < Descriptor.Fields.Count || j < sortedExtensions.Count; ) { + if (i == Descriptor.Fields.Count) { + GenerateSerializeOneExtensionRange(writer, sortedExtensions[j++]); + } else if (j == sortedExtensions.Count) { + GenerateSerializeOneField(writer, sortedFields[i++]); + } else if (sortedFields[i].FieldNumber < sortedExtensions[j].Start) { + GenerateSerializeOneField(writer, sortedFields[i++]); + } else { + GenerateSerializeOneExtensionRange(writer, sortedExtensions[j++]); + } + } + + if (Descriptor.Proto.Options.MessageSetWireFormat) { + writer.WriteLine("UnknownFields.WriteAsMessageSetTo(output);"); + } else { + writer.WriteLine("UnknownFields.WriteTo(output);"); + } + + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("private int memoizedSerializedSize = -1;"); + writer.WriteLine("public override int SerializedSize {"); + writer.Indent(); + writer.WriteLine("get {"); + writer.Indent(); + writer.WriteLine("int size = memoizedSerializedSize;"); + writer.WriteLine("if (size != -1) return size;"); + writer.WriteLine(); + writer.WriteLine("size = 0;"); + foreach (FieldDescriptor field in Descriptor.Fields) { + SourceGenerators.CreateFieldGenerator(field).GenerateSerializedSizeCode(writer); + } + if (Descriptor.Proto.ExtensionRangeCount > 0) { + writer.WriteLine("size += ExtensionsSerializedSize;"); + } + + if (Descriptor.Options.MessageSetWireFormat) { + writer.WriteLine("size += UnknownFields.SerializedSizeAsMessageSet;"); + } else { + writer.WriteLine("size += UnknownFields.SerializedSize;"); + } + writer.WriteLine("memoizedSerializedSize = size;"); + writer.WriteLine("return size;"); + writer.Outdent(); + writer.WriteLine("}"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + } + + private static void GenerateSerializeOneField(TextGenerator writer, FieldDescriptor fieldDescriptor) { + SourceGenerators.CreateFieldGenerator(fieldDescriptor).GenerateSerializationCode(writer); + } + + private static void GenerateSerializeOneExtensionRange(TextGenerator writer, ExtensionRange extensionRange) { + writer.WriteLine("extensionWriter.WriteUntil({0}, output);", extensionRange.End); + } + + private void GenerateParseFromMethods(TextGenerator writer) { + // Note: These are separate from GenerateMessageSerializationMethods() + // because they need to be generated even for messages that are optimized + // for code size. + + writer.WriteLine("public static {0} ParseFrom(pb::ByteString data) {{", ClassName); + writer.WriteLine(" return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();"); + writer.WriteLine("}"); + writer.WriteLine("public static {0} ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {{", ClassName); + writer.WriteLine(" return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();"); + writer.WriteLine("}"); + writer.WriteLine("public static {0} ParseFrom(byte[] data) {{", ClassName); + writer.WriteLine(" return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();"); + writer.WriteLine("}"); + writer.WriteLine("public static {0} ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {{", ClassName); + writer.WriteLine(" return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();"); + writer.WriteLine("}"); + writer.WriteLine("public static {0} ParseFrom(global::System.IO.Stream input) {{", ClassName); + writer.WriteLine(" return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();"); + writer.WriteLine("}"); + writer.WriteLine("public static {0} ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {{", ClassName); + writer.WriteLine(" return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();"); + writer.WriteLine("}"); + writer.WriteLine("public static {0} ParseFrom(pb::CodedInputStream input) {{", ClassName); + writer.WriteLine(" return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();"); + writer.WriteLine("}"); + writer.WriteLine("public static {0} ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {{", ClassName); + writer.WriteLine(" return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();"); + writer.WriteLine("}"); + } + + /// + /// Returns whether or not the specified message type has any required fields. + /// If it doesn't, calls to check for initialization can be optimised. + /// TODO(jonskeet): Move this into MessageDescriptor? + /// + private static bool HasRequiredFields(MessageDescriptor descriptor, Dictionary alreadySeen) { + if (alreadySeen.ContainsKey(descriptor)) { + // The type is already in cache. This means that either: + // a. The type has no required fields. + // b. We are in the midst of checking if the type has required fields, + // somewhere up the stack. In this case, we know that if the type + // has any required fields, they'll be found when we return to it, + // and the whole call to HasRequiredFields() will return true. + // Therefore, we don't have to check if this type has required fields + // here. + return false; + } + alreadySeen[descriptor] = descriptor; // Value is irrelevant + + // If the type has extensions, an extension with message type could contain + // required fields, so we have to be conservative and assume such an + // extension exists. + if (descriptor.Extensions.Count > 0) { + return true; + } + + foreach (FieldDescriptor field in descriptor.Fields) { + if (field.IsRequired) { + return true; + } + // Message or group + if (field.MappedType == MappedType.Message) { + if (HasRequiredFields(field.MessageType, alreadySeen)) { + return true; + } + } + } + return false; + } + + private void GenerateBuilder(TextGenerator writer) { + writer.WriteLine("public static Builder CreateBuilder() { return new Builder(); }"); + writer.WriteLine("public override Builder CreateBuilderForType() { return new Builder(); }"); + writer.WriteLine("public static Builder CreateBuilder({0} prototype) {{", ClassName); + writer.WriteLine(" return (Builder) new Builder().MergeFrom(prototype);"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("{0} sealed partial class Builder : pb::{2}Builder<{1}, Builder> {{", + ClassAccessLevel, ClassName, Descriptor.Proto.ExtensionRangeCount > 0 ? "Extendable" : "Generated"); + writer.Indent(); + writer.WriteLine("protected override Builder ThisBuilder {"); + writer.WriteLine(" get { return this; }"); + writer.WriteLine("}"); + GenerateCommonBuilderMethods(writer); + if (Descriptor.File.Options.OptimizeFor == FileOptions.Types.OptimizeMode.SPEED) { + GenerateBuilderParsingMethods(writer); + } + foreach (FieldDescriptor field in Descriptor.Fields) { + writer.WriteLine(); + // No field comment :( + SourceGenerators.CreateFieldGenerator(field).GenerateBuilderMembers(writer); + } + writer.Outdent(); + writer.WriteLine("}"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + } + + private void GenerateCommonBuilderMethods(TextGenerator writer) { + writer.WriteLine("{0} Builder() {{}}", ClassAccessLevel); + writer.WriteLine(); + writer.WriteLine("{0} result = new {0}();", ClassName); + writer.WriteLine(); + writer.WriteLine("protected override {0} MessageBeingBuilt {{", ClassName); + writer.WriteLine(" get { return result; }"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("public override Builder Clear() {"); + writer.WriteLine(" result = new {0}();", ClassName); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("public override Builder Clone() {"); + writer.WriteLine(" return new Builder().MergeFrom(result);"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("public override pbd::MessageDescriptor DescriptorForType {"); + writer.WriteLine(" get {{ return {0}.Descriptor; }}", ClassName); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("public override {0} DefaultInstanceForType {{", ClassName); + writer.WriteLine(" get {{ return {0}.DefaultInstance; }}", ClassName); + writer.WriteLine("}"); + writer.WriteLine(); + + writer.WriteLine("public override {0} BuildPartial() {{", ClassName); + writer.Indent(); + foreach (FieldDescriptor field in Descriptor.Fields) { + SourceGenerators.CreateFieldGenerator(field).GenerateBuildingCode(writer); + } + writer.WriteLine("{0} returnMe = result;", ClassName); + writer.WriteLine("result = null;"); + writer.WriteLine("return returnMe;"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + + if (Descriptor.File.Options.OptimizeFor == FileOptions.Types.OptimizeMode.SPEED) { + writer.WriteLine("public override Builder MergeFrom(pb::IMessage other) {"); + writer.WriteLine(" if (other is {0}) {{", ClassName); + writer.WriteLine(" return MergeFrom(({0}) other);", ClassName); + writer.WriteLine(" } else {"); + writer.WriteLine(" base.MergeFrom(other);"); + writer.WriteLine(" return this;"); + writer.WriteLine(" }"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("public override Builder MergeFrom({0} other) {{", ClassName); + // Optimization: If other is the default instance, we know none of its + // fields are set so we can skip the merge. + writer.Indent(); + writer.WriteLine("if (other == {0}.DefaultInstance) return this;", ClassName); + foreach (FieldDescriptor field in Descriptor.Fields) { + SourceGenerators.CreateFieldGenerator(field).GenerateMergingCode(writer); + } + writer.WriteLine("this.MergeUnknownFields(other.UnknownFields);"); + writer.WriteLine("return this;"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + } + } + + private void GenerateBuilderParsingMethods(TextGenerator writer) { + List sortedFields = new List(Descriptor.Fields); + sortedFields.Sort((f1, f2) => f1.FieldNumber.CompareTo(f2.FieldNumber)); + + writer.WriteLine("public override Builder MergeFrom(pb::CodedInputStream input) {"); + writer.WriteLine(" return MergeFrom(input, pb::ExtensionRegistry.Empty);"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {"); + writer.Indent(); + writer.WriteLine("pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);"); + writer.WriteLine("while (true) {"); + writer.Indent(); + writer.WriteLine("uint tag = input.ReadTag();"); + writer.WriteLine("switch (tag) {"); + writer.Indent(); + writer.WriteLine("case 0: {"); // 0 signals EOF / limit reached + writer.WriteLine(" this.UnknownFields = unknownFields.Build();"); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + writer.WriteLine("default: {"); + writer.WriteLine(" if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) {"); + writer.WriteLine(" this.UnknownFields = unknownFields.Build();"); + writer.WriteLine(" return this;"); // it's an endgroup tag + writer.WriteLine(" }"); + writer.WriteLine(" break;"); + writer.WriteLine("}"); + foreach (FieldDescriptor field in sortedFields) { + uint tag = WireFormat.MakeTag(field.FieldNumber, WireFormat.GetWireType(field.FieldType)); + writer.WriteLine("case {0}: {{", tag); + writer.Indent(); + SourceGenerators.CreateFieldGenerator(field).GenerateParsingCode(writer); + writer.WriteLine("break;"); + writer.Outdent(); + writer.WriteLine("}"); + } + writer.Outdent(); + writer.WriteLine("}"); + writer.Outdent(); + writer.WriteLine("}"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + } + + private void GenerateIsInitialized(TextGenerator writer) { + writer.WriteLine("public override bool IsInitialized {"); + writer.Indent(); + writer.WriteLine("get {"); + writer.Indent(); + + // Check that all required fields in this message are set. + // TODO(kenton): We can optimize this when we switch to putting all the + // "has" fields into a single bitfield. + foreach (FieldDescriptor field in Descriptor.Fields) { + if (field.IsRequired) { + writer.WriteLine("if (!has{0}) return false;", Helpers.UnderscoresToPascalCase(field.Name)); + } + } + + // Now check that all embedded messages are initialized. + foreach (FieldDescriptor field in Descriptor.Fields) { + if (field.FieldType != FieldType.Message || + !HasRequiredFields(field.MessageType, new Dictionary())) { + continue; + } + string propertyName = Helpers.UnderscoresToPascalCase(DescriptorUtil.GetFieldName(field)); + if (field.IsRepeated) { + writer.WriteLine("foreach ({0} element in {1}List) {{", DescriptorUtil.GetClassName(field.MessageType), propertyName); + writer.WriteLine(" if (!element.IsInitialized) return false;"); + writer.WriteLine("}"); + } else if (field.IsOptional) { + writer.WriteLine("if (Has{0}) {{", propertyName); + writer.WriteLine(" if (!{0}.IsInitialized) return false;", propertyName); + writer.WriteLine("}"); + } else { + writer.WriteLine("if (!{0}.IsInitialized) return false;", propertyName); + } + } + + if (Descriptor.Extensions.Count > 0) { + writer.WriteLine("if (!ExtensionsAreInitialized) return false;"); + } + writer.WriteLine("return true;"); + writer.Outdent(); + writer.WriteLine("}"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + } + } +} diff --git a/csharp/ProtoGen/PrimitiveFieldGenerator.cs b/csharp/ProtoGen/PrimitiveFieldGenerator.cs new file mode 100644 index 00000000..9107def9 --- /dev/null +++ b/csharp/ProtoGen/PrimitiveFieldGenerator.cs @@ -0,0 +1,70 @@ +using System; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen { + // TODO(jonskeet): Refactor this. There's loads of common code here. + internal class PrimitiveFieldGenerator : FieldGeneratorBase, IFieldSourceGenerator { + + internal PrimitiveFieldGenerator(FieldDescriptor descriptor) + : base(descriptor) { + } + + public void GenerateMembers(TextGenerator writer) { + writer.WriteLine("private bool has{0};", CapitalizedName); + writer.WriteLine("private {0} {1}_ = {2};", TypeName, Name, DefaultValue); + writer.WriteLine("public bool Has{0} {{", CapitalizedName); + writer.WriteLine(" get {{ return has{0}; }}", CapitalizedName); + writer.WriteLine("}"); + writer.WriteLine("public {0} {1} {{", TypeName, PropertyName); + writer.WriteLine(" get {{ return {0}_; }}", Name); + writer.WriteLine("}"); + } + + public void GenerateBuilderMembers(TextGenerator writer) { + writer.WriteLine("public bool Has{0} {{", CapitalizedName); + writer.WriteLine(" get {{ return result.Has{0}; }}", CapitalizedName); + writer.WriteLine("}"); + writer.WriteLine("public {0} {1} {{", TypeName, PropertyName); + writer.WriteLine(" get {{ return result.{0}; }}", PropertyName); + writer.WriteLine(" set {{ Set{0}(value); }}", CapitalizedName); + writer.WriteLine("}"); + writer.WriteLine("public Builder Set{0}({1} value) {{", CapitalizedName, TypeName); + writer.WriteLine(" result.has{0} = true;", CapitalizedName); + writer.WriteLine(" result.{0}_ = value;", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + writer.WriteLine("public Builder Clear{0}() {{", CapitalizedName); + writer.WriteLine(" result.has{0} = false;", CapitalizedName); + writer.WriteLine(" result.{0}_ = {1};", Name, DefaultValue); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + } + + public void GenerateMergingCode(TextGenerator writer) { + writer.WriteLine("if (other.Has{0}) {{", CapitalizedName); + writer.WriteLine(" {0} = other.{0};", PropertyName); + writer.WriteLine("}"); + } + + public void GenerateBuildingCode(TextGenerator writer) { + // Nothing to do here for primitive types + } + + public void GenerateParsingCode(TextGenerator writer) { + writer.WriteLine("{0} = input.Read{1}();", PropertyName, CapitalizedTypeName); + } + + public void GenerateSerializationCode(TextGenerator writer) { + writer.WriteLine("if (Has{0}) {{", CapitalizedName); + writer.WriteLine(" output.Write{0}({1}, {2});", CapitalizedTypeName, Number, PropertyName); + writer.WriteLine("}"); + } + + public void GenerateSerializedSizeCode(TextGenerator writer) { + writer.WriteLine("if (Has{0}) {{", CapitalizedName); + writer.WriteLine(" size += pb::CodedOutputStream.Compute{0}Size({1}, {2});", + CapitalizedTypeName, Number, PropertyName); + writer.WriteLine("}"); + } + } +} diff --git a/csharp/ProtoGen/Program.cs b/csharp/ProtoGen/Program.cs index 22245ab8..08cad358 100644 --- a/csharp/ProtoGen/Program.cs +++ b/csharp/ProtoGen/Program.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Google.ProtocolBuffers.DescriptorProtos; namespace Google.ProtocolBuffers.ProtoGen { /// @@ -8,7 +9,8 @@ namespace Google.ProtocolBuffers.ProtoGen { class Program { static int Main(string[] args) { try { - + // Hack to make sure everything's initialized + DescriptorProtoFile.Descriptor.ToString(); GeneratorOptions options = ParseCommandLineArguments(args); IList validationFailures; @@ -25,16 +27,20 @@ namespace Google.ProtocolBuffers.ProtoGen { return 0; } catch (Exception e) { - Console.Error.WriteLine("Caught unhandled exception: {0}", e); + Console.Error.WriteLine("Error: {0}", e.Message); + Console.Error.WriteLine(); + Console.Error.WriteLine("Detailed exception information: {0}", e); return 1; } } private static GeneratorOptions ParseCommandLineArguments(string[] args) { GeneratorOptions options = new GeneratorOptions(); - string baseDir = "c:\\Users\\Jon\\Documents\\Visual Studio 2008\\Projects\\ProtocolBuffers"; - options.OutputDirectory = baseDir + "\\tmp"; - options.InputFiles = new[] { baseDir + "\\protos\\nwind.protobin" }; + //string baseDir = "c:\\Users\\Jon\\Documents\\Visual Studio 2008\\Projects\\ProtocolBuffers"; + //options.OutputDirectory = baseDir + "\\tmp"; + //options.InputFiles = new[] { baseDir + "\\protos\\nwind-solo.protobin" }; + options.OutputDirectory = "."; + options.InputFiles = args; return options; } } diff --git a/csharp/ProtoGen/ProtoGen.csproj b/csharp/ProtoGen/ProtoGen.csproj index b4d06c50..f48df42c 100644 --- a/csharp/ProtoGen/ProtoGen.csproj +++ b/csharp/ProtoGen/ProtoGen.csproj @@ -38,12 +38,31 @@ + + + + + + + + + + + + + + + + + + + diff --git a/csharp/ProtoGen/ProtoGen.csproj.user b/csharp/ProtoGen/ProtoGen.csproj.user new file mode 100644 index 00000000..ae26d4a2 --- /dev/null +++ b/csharp/ProtoGen/ProtoGen.csproj.user @@ -0,0 +1,6 @@ + + + c:\Users\Jon\Documents\Visual Studio 2008\Projects\ProtocolBuffers\csharp\testprotos + unittest.protobin + + \ No newline at end of file diff --git a/csharp/ProtoGen/RepeatedEnumFieldGenerator.cs b/csharp/ProtoGen/RepeatedEnumFieldGenerator.cs new file mode 100644 index 00000000..088045f7 --- /dev/null +++ b/csharp/ProtoGen/RepeatedEnumFieldGenerator.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen { + internal class RepeatedEnumFieldGenerator : FieldGeneratorBase, IFieldSourceGenerator { + + internal RepeatedEnumFieldGenerator(FieldDescriptor descriptor) + : base(descriptor) { + } + + public void GenerateMembers(TextGenerator writer) { + writer.WriteLine("private pbc::PopsicleList<{0}> {1}_ = new pbc::PopsicleList<{0}>();", TypeName, Name); + writer.WriteLine("public scg::IList<{0}> {1}List {{", TypeName, CapitalizedName); + writer.WriteLine(" get {{ return pbc::Lists.AsReadOnly({0}_); }}", Name); + writer.WriteLine("}"); + + // TODO(jonskeet): Redundant API calls? Possibly - include for portability though. Maybe create an option. + writer.WriteLine("public int {0}Count {{", CapitalizedName); + writer.WriteLine(" get {{ return {0}_.Count; }}", Name); + writer.WriteLine("}"); + + writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, CapitalizedName); + writer.WriteLine(" return {0}_[index];", Name); + writer.WriteLine("}"); + } + + public void GenerateBuilderMembers(TextGenerator writer) { + // Note: We can return the original list here, because we make it unmodifiable when we build + writer.WriteLine("public scg::IList<{0}> {1}List {{", TypeName, CapitalizedName); + writer.WriteLine(" get {{ return result.{0}_; }}", Name); + writer.WriteLine("}"); + writer.WriteLine("public int {0}Count {{", CapitalizedName); + writer.WriteLine(" get {{ return result.{0}Count; }}", CapitalizedName); + writer.WriteLine("}"); + writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, CapitalizedName); + writer.WriteLine(" return result.Get{0}(index);", CapitalizedName); + writer.WriteLine("}"); + writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", CapitalizedName, TypeName); + writer.WriteLine(" result.{0}_[index] = value;", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + writer.WriteLine("public Builder Add{0}({1} value) {{", CapitalizedName, TypeName); + writer.WriteLine(" result.{0}_.Add(value);", Name, TypeName); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", CapitalizedName, TypeName); + writer.WriteLine(" base.AddRange(values, result.{0}_);", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + writer.WriteLine("public Builder Clear{0}() {{", CapitalizedName); + writer.WriteLine(" result.{0}_.Clear();", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + } + + public void GenerateMergingCode(TextGenerator writer) { + writer.WriteLine("if (other.{0}_.Count != 0) {{", Name); + writer.WriteLine(" base.AddRange(other.{0}_, result.{0}_);", Name); + writer.WriteLine("}"); + } + + public void GenerateBuildingCode(TextGenerator writer) { + writer.WriteLine("result.{0}_.MakeReadOnly();", Name); + } + + public void GenerateParsingCode(TextGenerator writer) { + // TODO(jonskeet): Make a more efficient way of doing this + writer.WriteLine("int rawValue = input.ReadEnum();"); + writer.WriteLine("if (!global::System.Enum.IsDefined(typeof({0}), rawValue)) {{", TypeName); + writer.WriteLine(" unknownFields.MergeVarintField({0}, (ulong) rawValue);", Number); + writer.WriteLine("} else {"); + writer.WriteLine(" Add{0}({1} rawValue);", CapitalizedName, TypeName); + writer.WriteLine("}"); + } + + public void GenerateSerializationCode(TextGenerator writer) { + writer.WriteLine("foreach ({0} element in {1}List) {{", TypeName, CapitalizedName); + writer.WriteLine(" output.WriteEnum({0}, (int) element);", Number); + writer.WriteLine("}"); + } + + public void GenerateSerializedSizeCode(TextGenerator writer) { + writer.WriteLine("foreach ({0} element in {1}List) {{", TypeName, CapitalizedName); + writer.WriteLine(" size += pb::CodedOutputStream.ComputeEnumSize({0}, (int) element);", Number); + writer.WriteLine("}"); + } + } +} diff --git a/csharp/ProtoGen/RepeatedMessageFieldGenerator.cs b/csharp/ProtoGen/RepeatedMessageFieldGenerator.cs new file mode 100644 index 00000000..08d574a9 --- /dev/null +++ b/csharp/ProtoGen/RepeatedMessageFieldGenerator.cs @@ -0,0 +1,100 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen { + internal class RepeatedMessageFieldGenerator : FieldGeneratorBase, IFieldSourceGenerator { + + internal RepeatedMessageFieldGenerator(FieldDescriptor descriptor) + : base(descriptor) { + } + + public void GenerateMembers(TextGenerator writer) { + writer.WriteLine("private pbc::PopsicleList<{0}> {1}_ = new pbc::PopsicleList<{0}>();", TypeName, Name); + writer.WriteLine("public scg::IList<{0}> {1}List {{", TypeName, CapitalizedName); + writer.WriteLine(" get {{ return {0}_; }}", Name); + writer.WriteLine("}"); + + // TODO(jonskeet): Redundant API calls? Possibly - include for portability though. Maybe create an option. + writer.WriteLine("public int {0}Count {{", CapitalizedName); + writer.WriteLine(" get {{ return {0}_.Count; }}", Name); + writer.WriteLine("}"); + + writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, CapitalizedName); + writer.WriteLine(" return {0}_[index];", Name); + writer.WriteLine("}"); + } + + public void GenerateBuilderMembers(TextGenerator writer) { + // Note: We can return the original list here, because we make it unmodifiable when we build + writer.WriteLine("public scg::IList<{0}> {1}List {{", TypeName, CapitalizedName); + writer.WriteLine(" get {{ return result.{0}_; }}", Name); + writer.WriteLine("}"); + writer.WriteLine("public int {0}Count {{", CapitalizedName); + writer.WriteLine(" get {{ return result.{0}Count; }}", CapitalizedName); + writer.WriteLine("}"); + writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, CapitalizedName); + writer.WriteLine(" return result.Get{0}(index);", CapitalizedName); + writer.WriteLine("}"); + writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", CapitalizedName, TypeName); + writer.WriteLine(" result.{0}_[index] = value;", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + // Extra overload for builder (just on messages) + writer.WriteLine("public Builder Set{0}(int index, {1}.Builder builderForValue) {{", CapitalizedName, TypeName); + writer.WriteLine(" result.{0}_[index] = builderForValue.Build();", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + writer.WriteLine("public Builder Add{0}({1} value) {{", CapitalizedName, TypeName); + writer.WriteLine(" result.{0}_.Add(value);", Name, TypeName); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + // Extra overload for builder (just on messages) + writer.WriteLine("public Builder Add{0}({1}.Builder builderForValue) {{", CapitalizedName, TypeName); + writer.WriteLine(" result.{0}_.Add(builderForValue.Build());", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", CapitalizedName, TypeName); + writer.WriteLine(" base.AddRange(values, result.{0}_);", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + writer.WriteLine("public Builder Clear{0}() {{", CapitalizedName); + writer.WriteLine(" result.{0}_.Clear();", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + } + + public void GenerateMergingCode(TextGenerator writer) { + writer.WriteLine("if (other.{0}_.Count != 0) {{", Name); + writer.WriteLine(" base.AddRange(other.{0}_, result.{0}_);", Name); + writer.WriteLine("}"); + } + + public void GenerateBuildingCode(TextGenerator writer) { + writer.WriteLine("result.{0}_.MakeReadOnly();", Name); + } + + public void GenerateParsingCode(TextGenerator writer) { + writer.WriteLine("{0}.Builder subBuilder = {0}.CreateBuilder();", TypeName); + if (Descriptor.FieldType == FieldType.Group) { + writer.WriteLine("input.ReadGroup({0}, subBuilder, extensionRegistry);", Number); + } else { + writer.WriteLine("input.ReadMessage(subBuilder, extensionRegistry);"); + } + writer.WriteLine("Add{0}(subBuilder.BuildPartial());", CapitalizedName); + } + + public void GenerateSerializationCode(TextGenerator writer) { + writer.WriteLine("foreach ({0} element in {1}List) {{", TypeName, CapitalizedName); + writer.WriteLine(" output.Write{0}({1}, element);", MessageOrGroup, Number); + writer.WriteLine("}"); + } + + public void GenerateSerializedSizeCode(TextGenerator writer) { + writer.WriteLine("foreach ({0} element in {1}List) {{", TypeName, CapitalizedName); + writer.WriteLine(" size += pb::CodedOutputStream.Compute{0}Size({1}, element);", MessageOrGroup, Number); + writer.WriteLine("}"); + } + } +} diff --git a/csharp/ProtoGen/RepeatedPrimitiveFieldGenerator.cs b/csharp/ProtoGen/RepeatedPrimitiveFieldGenerator.cs new file mode 100644 index 00000000..cdb7cd6f --- /dev/null +++ b/csharp/ProtoGen/RepeatedPrimitiveFieldGenerator.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen { + internal class RepeatedPrimitiveFieldGenerator : FieldGeneratorBase, IFieldSourceGenerator { + + internal RepeatedPrimitiveFieldGenerator(FieldDescriptor descriptor) + : base(descriptor) { + } + + public void GenerateMembers(TextGenerator writer) { + writer.WriteLine("private pbc::PopsicleList<{0}> {1}_ = new pbc::PopsicleList<{0}>();", TypeName, Name); + writer.WriteLine("public scg::IList<{0}> {1}List {{", TypeName, CapitalizedName); + writer.WriteLine(" get {{ return pbc::Lists.AsReadOnly({0}_); }}", Name); + writer.WriteLine("}"); + + // TODO(jonskeet): Redundant API calls? Possibly - include for portability though. Maybe create an option. + writer.WriteLine("public int {0}Count {{", CapitalizedName); + writer.WriteLine(" get {{ return {0}_.Count; }}", Name); + writer.WriteLine("}"); + + writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, CapitalizedName); + writer.WriteLine(" return {0}_[index];", Name); + writer.WriteLine("}"); + } + + public void GenerateBuilderMembers(TextGenerator writer) { + // Note: We can return the original list here, because we make it unmodifiable when we build + writer.WriteLine("public scg::IList<{0}> {1}List {{", TypeName, CapitalizedName); + writer.WriteLine(" get {{ return result.{0}_; }}", Name); + writer.WriteLine("}"); + writer.WriteLine("public int {0}Count {{", CapitalizedName); + writer.WriteLine(" get {{ return result.{0}Count; }}", CapitalizedName); + writer.WriteLine("}"); + writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, CapitalizedName); + writer.WriteLine(" return result.Get{0}(index);", CapitalizedName); + writer.WriteLine("}"); + writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", CapitalizedName, TypeName); + writer.WriteLine(" result.{0}_[index] = value;", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + writer.WriteLine("public Builder Add{0}({1} value) {{", CapitalizedName, TypeName); + writer.WriteLine(" result.{0}_.Add(value);", Name, TypeName); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", CapitalizedName, TypeName); + writer.WriteLine(" base.AddRange(values, result.{0}_);", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + writer.WriteLine("public Builder Clear{0}() {{", CapitalizedName); + writer.WriteLine(" result.{0}_.Clear();", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + } + + public void GenerateMergingCode(TextGenerator writer) { + writer.WriteLine("if (other.{0}_.Count != 0) {{", Name); + writer.WriteLine(" base.AddRange(other.{0}_, result.{0}_);", Name); + writer.WriteLine("}"); + } + + public void GenerateBuildingCode(TextGenerator writer) { + writer.WriteLine("result.{0}_.MakeReadOnly();", Name); + } + + public void GenerateParsingCode(TextGenerator writer) { + writer.WriteLine("Add{0}(input.Read{1}());", CapitalizedName, CapitalizedTypeName); + } + + public void GenerateSerializationCode(TextGenerator writer) { + writer.WriteLine("foreach ({0} element in {1}List) {{", TypeName, CapitalizedName); + writer.WriteLine(" output.Write{0}({1}, element);", CapitalizedTypeName, Number); + writer.WriteLine("}"); + } + + public void GenerateSerializedSizeCode(TextGenerator writer) { + writer.WriteLine("foreach ({0} element in {1}List) {{", TypeName, CapitalizedName); + writer.WriteLine(" size += pb::CodedOutputStream.Compute{0}Size({1}, element);", CapitalizedTypeName, Number); + writer.WriteLine("}"); + } + } +} diff --git a/csharp/ProtoGen/ServiceGenerator.cs b/csharp/ProtoGen/ServiceGenerator.cs new file mode 100644 index 00000000..9b642b74 --- /dev/null +++ b/csharp/ProtoGen/ServiceGenerator.cs @@ -0,0 +1,138 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen { + internal class ServiceGenerator : SourceGeneratorBase, ISourceGenerator { + + private enum RequestOrResponse { + Request, + Response + } + + internal ServiceGenerator(ServiceDescriptor descriptor) + : base(descriptor) { + } + + public void Generate(TextGenerator writer) { + writer.WriteLine("{0} abstract class {1} : pb::IService {{", ClassAccessLevel, Descriptor.Name); + writer.Indent(); + + foreach (MethodDescriptor method in Descriptor.Methods) { + writer.WriteLine("{0} abstract void {1}(", ClassAccessLevel, Helpers.UnderscoresToPascalCase(method.Name)); + writer.WriteLine(" pb::IRpcController controller,"); + writer.WriteLine(" {0} request,", DescriptorUtil.GetClassName(method.InputType)); + writer.WriteLine(" global::System.Action<{0}> done);", DescriptorUtil.GetClassName(method.OutputType)); + } + + // Generate Descriptor and DescriptorForType. + writer.WriteLine(); + writer.WriteLine("{0} static pbd::ServiceDescriptor Descriptor {{", ClassAccessLevel); + writer.WriteLine(" get {{ return {0}.Descriptor.Services[{1}]; }}", + DescriptorUtil.GetUmbrellaClassName(Descriptor.File), Descriptor.Index); + writer.WriteLine("}"); + writer.WriteLine("{0} pbd::ServiceDescriptor DescriptorForType {{", ClassAccessLevel); + writer.WriteLine(" get { return Descriptor; }"); + writer.WriteLine("}"); + + GenerateCallMethod(writer); + GenerateGetPrototype(RequestOrResponse.Request, writer); + GenerateGetPrototype(RequestOrResponse.Response, writer); + GenerateStub(writer); + + writer.Outdent(); + writer.WriteLine("}"); + } + + private void GenerateCallMethod(TextGenerator writer) { + writer.WriteLine(); + writer.WriteLine("public void CallMethod(", ClassAccessLevel); + writer.WriteLine(" pbd::MethodDescriptor method,"); + writer.WriteLine(" pb::IRpcController controller,"); + writer.WriteLine(" pb::IMessage request,"); + writer.WriteLine(" global::System.Action done) {"); + writer.Indent(); + writer.WriteLine("if (method.Service != Descriptor) {"); + writer.WriteLine(" throw new global::System.ArgumentException("); + writer.WriteLine(" \"Service.CallMethod() given method descriptor for wrong service type.\");"); + writer.WriteLine("}"); + writer.WriteLine("switch(method.Index) {"); + writer.Indent(); + foreach (MethodDescriptor method in Descriptor.Methods) { + writer.WriteLine("case {0}:", method.Index); + writer.WriteLine(" this.{0}(controller, ({0}) request,", + Helpers.UnderscoresToPascalCase(method.Name), DescriptorUtil.GetClassName(method.InputType)); + writer.WriteLine(" pb::RpcUtil.SpecializeCallback<{0}>(", DescriptorUtil.GetClassName(method.OutputType)); + writer.WriteLine(" done));"); + writer.WriteLine(" return;"); + } + writer.WriteLine("default:"); + writer.WriteLine(" throw new global::System.InvalidOperationException(\"Can't get here.\");"); + writer.Outdent(); + writer.WriteLine("}"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + } + + private void GenerateGetPrototype(RequestOrResponse which, TextGenerator writer) { + writer.WriteLine("public pb::IMessage Get{0}Prototype(pbd::MethodDescriptor method) {{", which); + writer.Indent(); + writer.WriteLine("if (method.Service != Descriptor) {"); + writer.WriteLine(" throw new global::System.ArgumentException("); + writer.WriteLine(" \"Service.Get{0}Prototype() given method descriptor for wrong service type.\");", which); + writer.WriteLine("}"); + writer.WriteLine("switch(method.Index) {"); + writer.Indent(); + + foreach (MethodDescriptor method in Descriptor.Methods) { + writer.WriteLine("case {0}:", method.Index); + writer.WriteLine(" return {0}.DefaultInstance;", + DescriptorUtil.GetClassName(which == RequestOrResponse.Request ? method.InputType : method.OutputType)); + } + writer.WriteLine("default:"); + writer.WriteLine(" throw new global::System.InvalidOperationException(\"Can't get here.\");"); + writer.Outdent(); + writer.WriteLine("}"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + } + + private void GenerateStub(TextGenerator writer) { + writer.WriteLine("public static Stub CreateStub(pb::IRpcChannel channel) {"); + writer.WriteLine(" return new Stub(channel);"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("{0} class Stub : {1} {{", ClassAccessLevel, DescriptorUtil.GetClassName(Descriptor)); + writer.Indent(); + writer.WriteLine("internal Stub(pb::IRpcChannel channel) {"); + writer.WriteLine(" this.channel = channel;"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("private readonly pb::IRpcChannel channel;"); + writer.WriteLine(); + writer.WriteLine("public pb::IRpcChannel Channel {"); + writer.WriteLine(" get { return channel; }"); + writer.WriteLine("}"); + + foreach (MethodDescriptor method in Descriptor.Methods) { + writer.WriteLine(); + writer.WriteLine("public override void {0}(", Helpers.UnderscoresToPascalCase(method.Name)); + writer.WriteLine(" pb::IRpcController controller,"); + writer.WriteLine(" {0} request,", DescriptorUtil.GetClassName(method.InputType)); + writer.WriteLine(" global::System.Action<{0}> done) {{", DescriptorUtil.GetClassName(method.OutputType)); + writer.Indent(); + writer.WriteLine("channel.CallMethod(Descriptor.Methods[{0}],", method.Index); + writer.WriteLine(" controller, request, {0}.DefaultInstance,", DescriptorUtil.GetClassName(method.OutputType)); + writer.WriteLine(" pb::RpcUtil.GeneralizeCallback<{0}, {0}.Builder>(done, {0}.DefaultInstance));", + DescriptorUtil.GetClassName(method.OutputType)); + writer.Outdent(); + writer.WriteLine("}"); + } + writer.Outdent(); + writer.WriteLine("}"); + } + } +} diff --git a/csharp/ProtoGen/SourceFileGenerator.cs b/csharp/ProtoGen/SourceFileGenerator.cs new file mode 100644 index 00000000..1984d297 --- /dev/null +++ b/csharp/ProtoGen/SourceFileGenerator.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen { + /// + /// Generator to hold a TextGenerator, generate namespace aliases etc. + /// Each source file created uses one of these, and it can be used to create + /// multiple classes within the same file. + /// + internal class SourceFileGenerator { + + private readonly TextGenerator output; + + private SourceFileGenerator(TextWriter writer) { + output = new TextGenerator(writer); + } + + /// + /// Creates a ClassFileGenerator for the given writer, which will be closed + /// when the instance is disposed. The specified namespace is created, if it's non-null. + /// + internal static SourceFileGenerator ForWriter(TextWriter writer) { + return new SourceFileGenerator(writer); + } + } +} diff --git a/csharp/ProtoGen/SourceGeneratorBase.cs b/csharp/ProtoGen/SourceGeneratorBase.cs new file mode 100644 index 00000000..563c64a1 --- /dev/null +++ b/csharp/ProtoGen/SourceGeneratorBase.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using Google.ProtocolBuffers.DescriptorProtos; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen { + internal abstract class SourceGeneratorBase where T : IDescriptor { + + private readonly T descriptor; + + protected SourceGeneratorBase(T descriptor) { + this.descriptor = descriptor; + } + + protected T Descriptor { + get { return descriptor; } + } + + protected string ClassAccessLevel { + get { + // Default to public + return !descriptor.File.Options.HasExtension(CSharpOptions.CSharpPublicClasses) + || descriptor.File.Options.GetExtension(CSharpOptions.CSharpPublicClasses) ? "public" : "internal"; + } + } + + public bool MultipleFiles { + get { return descriptor.File.Options.GetExtension(CSharpOptions.CSharpMultipleFiles); } + } + + protected static void WriteChildren(TextGenerator writer, string region, IEnumerable children) + where TChild : IDescriptor { + // Copy the set of children; makes access easier + List copy = new List(children); + if (copy.Count == 0) { + return; + } + + if (region != null) { + writer.WriteLine("#region {0}", region); + } + foreach (TChild child in children) { + SourceGenerators.CreateGenerator(child).Generate(writer); + } + if (region != null) { + writer.WriteLine("#endregion"); + writer.WriteLine(); + } + } + } +} diff --git a/csharp/ProtoGen/SourceGenerators.cs b/csharp/ProtoGen/SourceGenerators.cs new file mode 100644 index 00000000..c775e419 --- /dev/null +++ b/csharp/ProtoGen/SourceGenerators.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen { + internal static class SourceGenerators { + + private static readonly Dictionary> GeneratorFactories = new Dictionary> { + { typeof(FileDescriptor), descriptor => new UmbrellaClassGenerator((FileDescriptor) descriptor) }, + { typeof(EnumDescriptor), descriptor => new EnumGenerator((EnumDescriptor) descriptor) }, + { typeof(ServiceDescriptor), descriptor => new ServiceGenerator((ServiceDescriptor) descriptor) }, + { typeof(MessageDescriptor), descriptor => new MessageGenerator((MessageDescriptor) descriptor) }, + // For other fields, we have IFieldSourceGenerators. + { typeof(FieldDescriptor), descriptor => new ExtensionGenerator((FieldDescriptor) descriptor) } + }; + + public static IFieldSourceGenerator CreateFieldGenerator(FieldDescriptor field) { + switch (field.MappedType) { + case MappedType.Message : + return field.IsRepeated + ? (IFieldSourceGenerator) new RepeatedMessageFieldGenerator(field) + : new MessageFieldGenerator(field); + case MappedType.Enum: + return field.IsRepeated + ? (IFieldSourceGenerator)new RepeatedEnumFieldGenerator(field) + : new EnumFieldGenerator(field); + default: + return field.IsRepeated + ? (IFieldSourceGenerator)new RepeatedPrimitiveFieldGenerator(field) + : new PrimitiveFieldGenerator(field); + } + } + + public static ISourceGenerator CreateGenerator(T descriptor) where T : IDescriptor { + Func factory; + if (!GeneratorFactories.TryGetValue(typeof(T), out factory)) { + throw new ArgumentException("No generator registered for " + typeof(T).Name); + } + return factory(descriptor); + } + } +} diff --git a/csharp/ProtoGen/UmbrellaClassGenerator.cs b/csharp/ProtoGen/UmbrellaClassGenerator.cs new file mode 100644 index 00000000..7db5c46c --- /dev/null +++ b/csharp/ProtoGen/UmbrellaClassGenerator.cs @@ -0,0 +1,96 @@ +using System; +using Google.ProtocolBuffers.DescriptorProtos; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen { + /// + /// Generator for the class describing the .proto file in general, + /// containing things like the message descriptor. + /// + internal sealed class UmbrellaClassGenerator : SourceGeneratorBase, ISourceGenerator { + + internal UmbrellaClassGenerator(FileDescriptor descriptor) + : base(descriptor) { + } + + public void Generate(TextGenerator writer) { + WriteIntroduction(writer); + WriteDescriptor(writer); + WriteChildren(writer, "Extensions", Descriptor.Extensions); + writer.WriteLine("#region Static variables"); + foreach (MessageDescriptor message in Descriptor.MessageTypes) { + new MessageGenerator(message).GenerateStaticVariables(writer); + } + writer.WriteLine("#endregion"); + // The class declaration either gets closed before or after the children are written. + if (!DescriptorUtil.NestClasses(Descriptor)) { + writer.Outdent(); + writer.WriteLine("}"); + } + WriteChildren(writer, "Enums", Descriptor.EnumTypes); + WriteChildren(writer, "Messages", Descriptor.MessageTypes); + WriteChildren(writer, "Services", Descriptor.Services); + if (DescriptorUtil.NestClasses(Descriptor)) { + writer.Outdent(); + writer.WriteLine("}"); + } + if (DescriptorUtil.GetNamespace(Descriptor) != "") { + writer.Outdent(); + writer.WriteLine("}"); + } + } + + private void WriteIntroduction(TextGenerator writer) { + writer.WriteLine("// Generated by the protocol buffer compiler. DO NOT EDIT!"); + writer.WriteLine(); + Helpers.WriteNamespaces(writer); + + if (DescriptorUtil.GetNamespace(Descriptor) != "") { + writer.WriteLine("namespace {0} {{", DescriptorUtil.GetNamespace(Descriptor)); + writer.Indent(); + writer.WriteLine(); + } + + writer.WriteLine("{0} static partial class {1} {{", ClassAccessLevel, DescriptorUtil.GetUmbrellaClassName(Descriptor)); + writer.WriteLine(); + writer.Indent(); + } + + private void WriteDescriptor(TextGenerator writer) { + writer.WriteLine("#region Descriptor"); + + writer.WriteLine("public static pbd::FileDescriptor Descriptor {"); + writer.WriteLine(" get { return descriptor; }"); + writer.WriteLine("}"); + writer.WriteLine("private static readonly pbd::FileDescriptor descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom("); + writer.WriteLine(" global::System.Convert.FromBase64String("); + writer.Indent(); + writer.Indent(); + + // TODO(jonskeet): Consider a C#-escaping format here instead of just Base64. + byte[] bytes = Descriptor.Proto.ToByteArray(); + string base64 = Convert.ToBase64String(bytes); + + while (base64.Length > 60) { + writer.WriteLine("\"{0}\" + ", base64.Substring(0, 60)); + base64 = base64.Substring(60); + } + writer.WriteLine("\"{0}\"),", base64); + + writer.WriteLine("new pbd::FileDescriptor[] {"); + foreach (FileDescriptor dependency in Descriptor.Dependencies) { + // TODO(jonskeet): The normal code won't work for the bootstrapping descriptor, because we don't get unknown fields :( + if (dependency.Package == "google.protobuf" && dependency.Name.EndsWith("descriptor.proto")) { + writer.WriteLine(" global::" + typeof(DescriptorProtoFile).FullName + ".Descriptor, "); + continue; + } + writer.WriteLine(" {0}.Descriptor, ", DescriptorUtil.GetFullUmbrellaClassName(dependency)); + } + writer.WriteLine("});"); + writer.Outdent(); + writer.Outdent(); + writer.WriteLine("#endregion"); + writer.WriteLine(); + } + } +} diff --git a/csharp/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs b/csharp/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs index 7d8d1d0e..f4314b30 100644 --- a/csharp/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs +++ b/csharp/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs @@ -10,40 +10,31 @@ namespace Google.ProtocolBuffers.TestProtos { #region Descriptor public static pbd::FileDescriptor Descriptor { - get { return descriptor; } - } - private static readonly pbd::FileDescriptor descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom ( - new byte[] { - 0x0a, 0x25, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x75, 0x6e, - 0x69, 0x74, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x18, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x69, - 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x1a, 0x0a, 0x0d, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x12, 0x09, 0x0a, 0x01, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x2a, 0x3c, 0x0a, 0x0a, 0x49, 0x6d, 0x70, - 0x6f, 0x72, 0x74, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x4d, 0x50, 0x4f, 0x52, 0x54, 0x5f, 0x46, 0x4f, - 0x4f, 0x10, 0x07, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x4d, 0x50, 0x4f, 0x52, 0x54, 0x5f, 0x42, 0x41, 0x52, 0x10, 0x08, 0x12, - 0x0e, 0x0a, 0x0a, 0x49, 0x4d, 0x50, 0x4f, 0x52, 0x54, 0x5f, 0x42, 0x41, 0x5a, 0x10, 0x09, 0x42, 0x5a, 0x0a, 0x18, 0x63, - 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x48, 0x01, 0xc2, 0x3e, 0x21, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x63, 0x6f, 0x6c, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x73, 0xca, 0x3e, 0x17, 0x55, 0x6e, 0x69, 0x74, 0x54, 0x65, 0x73, 0x74, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x46, 0x69, 0x6c, 0x65, - }, new pbd::FileDescriptor[] { + get { return descriptor; } + } + private static readonly pbd::FileDescriptor descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom( + global::System.Convert.FromBase64String( + "ChV1bml0dGVzdF9pbXBvcnQucHJvdG8SGHByb3RvYnVmX3VuaXR0ZXN0X2lt" + + "cG9ydBokZ29vZ2xlL3Byb3RvYnVmL2NzaGFycF9vcHRpb25zLnByb3RvGiBn" + + "b29nbGUvcHJvdG9idWYvZGVzY3JpcHRvci5wcm90byIaCg1JbXBvcnRNZXNz" + + "YWdlEgkKAWQYASABKAUqPAoKSW1wb3J0RW51bRIOCgpJTVBPUlRfRk9PEAcS" + + "DgoKSU1QT1JUX0JBUhAIEg4KCklNUE9SVF9CQVoQCUJcChhjb20uZ29vZ2xl" + + "LnByb3RvYnVmLnRlc3RIAYLiCSFHb29nbGUuUHJvdG9jb2xCdWZmZXJzLlRl" + + "c3RQcm90b3OK4gkXVW5pdFRlc3RJbXBvcnRQcm90b0ZpbGU="), + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, }); #endregion - #region Extensions - #endregion - #region Static variables - internal static readonly pbd::MessageDescriptor internal__static_protobuf_unittest_import_ImportMessage__Descriptor + internal static readonly pbd::MessageDescriptor internal__static_protobuf_unittest_import_ImportMessage__Descriptor = Descriptor.MessageTypes[0]; 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", }); #endregion - } - #region Enums public enum ImportEnum { IMPORT_FOO = 7, @@ -76,7 +67,6 @@ namespace Google.ProtocolBuffers.TestProtos { get { return global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable; } } - // optional int32 d = 1; private bool hasD; private int d_ = 0; public bool HasD { @@ -115,62 +105,50 @@ namespace Google.ProtocolBuffers.TestProtos { } } - public static global::Google.ProtocolBuffers.TestProtos.ImportMessage ParseFrom(pb::ByteString data) { + public static ImportMessage ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.TestProtos.ImportMessage ParseFrom(pb::ByteString data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static ImportMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.TestProtos.ImportMessage ParseFrom(byte[] data) { + public static ImportMessage ParseFrom(byte[] data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.TestProtos.ImportMessage ParseFrom(byte[] data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static ImportMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.TestProtos.ImportMessage ParseFrom(global::System.IO.Stream input) { + public static ImportMessage ParseFrom(global::System.IO.Stream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - 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 ImportMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.TestProtos.ImportMessage ParseFrom(pb::CodedInputStream input) { + public static ImportMessage ParseFrom(pb::CodedInputStream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.TestProtos.ImportMessage ParseFrom(pb::CodedInputStream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static ImportMessage ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static Builder CreateBuilder() { return new Builder(); } public override Builder CreateBuilderForType() { return new Builder(); } - public static Builder CreateBuilder(global::Google.ProtocolBuffers.TestProtos.ImportMessage prototype) { + public static Builder CreateBuilder(ImportMessage prototype) { return (Builder) new Builder().MergeFrom(prototype); } - public sealed partial class Builder : pb::GeneratedBuilder { + public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } } - - // Construct using global::Google.ProtocolBuffers.TestProtos.ImportMessage.CreateBuilder() public Builder() {} - global::Google.ProtocolBuffers.TestProtos.ImportMessage result = new global::Google.ProtocolBuffers.TestProtos.ImportMessage(); + ImportMessage result = new ImportMessage(); - protected override global::Google.ProtocolBuffers.TestProtos.ImportMessage MessageBeingBuilt { + protected override ImportMessage MessageBeingBuilt { get { return result; } } public override Builder Clear() { - result = new global::Google.ProtocolBuffers.TestProtos.ImportMessage(); + result = new ImportMessage(); return this; } @@ -179,30 +157,30 @@ namespace Google.ProtocolBuffers.TestProtos { } public override pbd::MessageDescriptor DescriptorForType { - get { return global::Google.ProtocolBuffers.TestProtos.ImportMessage.Descriptor; } + get { return ImportMessage.Descriptor; } } - public override global::Google.ProtocolBuffers.TestProtos.ImportMessage DefaultInstanceForType { - get { return global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance; } + public override ImportMessage DefaultInstanceForType { + get { return ImportMessage.DefaultInstance; } } - public override global::Google.ProtocolBuffers.TestProtos.ImportMessage BuildPartial() { - global::Google.ProtocolBuffers.TestProtos.ImportMessage returnMe = result; + public override ImportMessage BuildPartial() { + ImportMessage returnMe = result; result = null; return returnMe; } public override Builder MergeFrom(pb::IMessage other) { - if (other is global::Google.ProtocolBuffers.TestProtos.ImportMessage) { - return MergeFrom((global::Google.ProtocolBuffers.TestProtos.ImportMessage) other); + if (other is ImportMessage) { + return MergeFrom((ImportMessage) other); } else { base.MergeFrom(other); return this; } } - public override Builder MergeFrom(global::Google.ProtocolBuffers.TestProtos.ImportMessage other) { - if (other == global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance) return this; + public override Builder MergeFrom(ImportMessage other) { + if (other == ImportMessage.DefaultInstance) return this; if (other.HasD) { D = other.D; } @@ -215,17 +193,16 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { - pb::UnknownFieldSet.Builder unknownFields = - pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); while (true) { uint tag = input.ReadTag(); switch (tag) { - case 0: + case 0: { this.UnknownFields = unknownFields.Build(); return this; + } default: { - if (!ParseUnknownField(input, unknownFields, - extensionRegistry, tag)) { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.UnknownFields = unknownFields.Build(); return this; } @@ -240,7 +217,6 @@ namespace Google.ProtocolBuffers.TestProtos { } - // optional int32 d = 1; public bool HasD { get { return result.HasD; } } @@ -263,6 +239,4 @@ namespace Google.ProtocolBuffers.TestProtos { #endregion - #region Services - #endregion } diff --git a/csharp/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs b/csharp/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs new file mode 100644 index 00000000..14d6bb64 --- /dev/null +++ b/csharp/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs @@ -0,0 +1,49 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.DescriptorProtos { + + public static partial class CSharpOptions { + + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static readonly pbd::FileDescriptor descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom( + global::System.Convert.FromBase64String( + "CiRnb29nbGUvcHJvdG9idWYvY3NoYXJwX29wdGlvbnMucHJvdG8SD2dvb2ds" + + "ZS5wcm90b2J1ZhogZ29vZ2xlL3Byb3RvYnVmL2Rlc2NyaXB0b3IucHJvdG86" + + "NwoPQ1NoYXJwTmFtZXNwYWNlEhwuZ29vZ2xlLnByb3RvYnVmLkZpbGVPcHRp" + + "b25zGKCcASABKAk6PwoXQ1NoYXJwVW1icmVsbGFDbGFzc25hbWUSHC5nb29n" + + "bGUucHJvdG9idWYuRmlsZU9wdGlvbnMYoZwBIAEoCTo7ChNDU2hhcnBNdWx0" + + "aXBsZUZpbGVzEhwuZ29vZ2xlLnByb3RvYnVmLkZpbGVPcHRpb25zGKKcASAB" + + "KAg6OQoRQ1NoYXJwTmVzdENsYXNzZXMSHC5nb29nbGUucHJvdG9idWYuRmls" + + "ZU9wdGlvbnMYo5wBIAEoCDo7ChNDU2hhcnBQdWJsaWNDbGFzc2VzEhwuZ29v" + + "Z2xlLnByb3RvYnVmLkZpbGVPcHRpb25zGKScASABKAhCPILiCSdHb29nbGUu" + + "UHJvdG9jb2xCdWZmZXJzLkRlc2NyaXB0b3JQcm90b3OK4gkNQ1NoYXJwT3B0" + + "aW9ucw=="), + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, + }); + #endregion + + #region Extensions + public static readonly pb::GeneratedExtensionBase CSharpNamespace = + pb::GeneratedSingleExtension.CreateInstance(Descriptor.Extensions[0]); + public static readonly pb::GeneratedExtensionBase CSharpUmbrellaClassname = + pb::GeneratedSingleExtension.CreateInstance(Descriptor.Extensions[1]); + public static readonly pb::GeneratedExtensionBase CSharpMultipleFiles = + pb::GeneratedSingleExtension.CreateInstance(Descriptor.Extensions[2]); + public static readonly pb::GeneratedExtensionBase CSharpNestClasses = + pb::GeneratedSingleExtension.CreateInstance(Descriptor.Extensions[3]); + public static readonly pb::GeneratedExtensionBase CSharpPublicClasses = + pb::GeneratedSingleExtension.CreateInstance(Descriptor.Extensions[4]); + #endregion + + #region Static variables + #endregion + } +} diff --git a/csharp/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs b/csharp/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs index 488b0c60..1a7c9a1f 100644 --- a/csharp/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs +++ b/csharp/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs @@ -10,249 +10,184 @@ namespace Google.ProtocolBuffers.DescriptorProtos { #region Descriptor public static pbd::FileDescriptor Descriptor { - get { return descriptor; } - } - private static readonly pbd::FileDescriptor descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom ( - new byte[] { - 0x0a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x47, 0x0a, 0x11, 0x46, 0x69, 0x6c, 0x65, 0x44, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x12, 0x32, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdc, 0x02, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x12, 0x0f, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x12, - 0x12, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x12, - 0x36, 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x37, 0x0a, 0x09, 0x65, - 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x38, 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa9, 0x03, 0x0a, 0x0f, - 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x12, 0x34, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x38, 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x35, 0x0a, 0x0b, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x37, 0x0a, 0x09, - 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x48, 0x0a, 0x0f, 0x65, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x2c, 0x0a, - 0x0e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x0d, 0x0a, 0x05, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x12, 0x0b, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x05, 0x22, 0x94, 0x05, 0x0a, 0x14, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x12, 0x0e, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x12, 0x3a, - 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x38, - 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x11, 0x0a, 0x09, - 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x12, 0x10, 0x0a, 0x08, 0x65, - 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x12, 0x15, 0x0a, 0x0d, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x12, 0x2e, 0x0a, 0x07, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xb6, 0x02, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, - 0x4c, 0x4f, 0x41, 0x54, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x36, 0x34, - 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x04, 0x12, - 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x05, 0x12, 0x10, 0x0a, 0x0c, 0x54, - 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, - 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x08, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, - 0x47, 0x10, 0x09, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x0a, 0x12, - 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x0b, 0x12, 0x0e, 0x0a, - 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x53, 0x10, 0x0c, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x0d, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, - 0x4e, 0x55, 0x4d, 0x10, 0x0e, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, - 0x33, 0x32, 0x10, 0x0f, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, - 0x34, 0x10, 0x10, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x11, - 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x12, 0x22, 0x43, 0x0a, - 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4f, 0x50, 0x54, 0x49, - 0x4f, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, - 0x49, 0x52, 0x45, 0x44, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x50, 0x45, - 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x22, 0x8c, 0x01, 0x0a, 0x13, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x12, 0x38, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, - 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, - 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x6c, 0x0a, 0x18, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x12, 0x0e, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x12, 0x32, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, - 0x90, 0x01, 0x0a, 0x16, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, - 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x12, 0x36, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x30, 0x0a, 0x07, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x7f, 0x0a, 0x15, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x12, 0x12, 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x12, 0x13, 0x0a, 0x0b, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x12, 0x2f, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x88, 0x03, 0x0a, 0x0b, - 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x0c, 0x6a, 0x61, 0x76, 0x61, 0x5f, - 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x12, 0x1c, 0x0a, 0x14, 0x6a, 0x61, 0x76, - 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x09, 0x12, 0x22, 0x0a, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, - 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x12, - 0x4a, 0x0a, 0x0c, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, - 0x4d, 0x6f, 0x64, 0x65, 0x3a, 0x09, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x49, 0x5a, 0x45, 0x12, 0x19, 0x0a, 0x10, 0x63, - 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0xe8, 0x07, 0x20, 0x01, - 0x28, 0x09, 0x12, 0x1e, 0x0a, 0x15, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x63, 0x6c, - 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0xe9, 0x07, 0x20, 0x01, 0x28, 0x09, 0x12, 0x25, 0x0a, 0x15, 0x63, 0x73, - 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, - 0xea, 0x07, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x13, 0x63, 0x73, 0x68, - 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x18, 0xeb, 0x07, 0x20, - 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x15, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, - 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x18, 0xec, 0x07, 0x20, 0x01, - 0x28, 0x08, 0x3a, 0x04, 0x74, 0x72, 0x75, 0x65, 0x22, 0x28, 0x0a, 0x0c, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, - 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x43, - 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x49, 0x5a, 0x45, 0x10, 0x02, 0x22, 0x38, 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x17, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, - 0x73, 0x65, 0x74, 0x5f, 0x77, 0x69, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x22, 0x85, 0x01, 0x0a, 0x0c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x32, 0x0a, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, - 0x14, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x5f, 0x6d, 0x61, 0x70, 0x5f, 0x6b, 0x65, - 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x22, 0x23, 0x0a, 0x05, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, - 0x43, 0x4f, 0x52, 0x44, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x49, 0x45, - 0x43, 0x45, 0x10, 0x02, 0x22, 0x0d, 0x0a, 0x0b, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, - 0x12, 0x0a, 0x10, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, - 0x10, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x0f, 0x0a, - 0x0d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x72, 0x0a, 0x13, 0x63, 0x6f, - 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x10, 0x44, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x48, 0x01, 0xc2, 0x3e, 0x27, - 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x42, 0x75, 0x66, 0x66, 0x65, - 0x72, 0x73, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0xca, - 0x3e, 0x13, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x69, 0x6c, - 0x65, 0xd0, 0x3e, 0x00, 0xd8, 0x3e, 0x00, 0xe0, 0x3e, 0x01, - }, new pbd::FileDescriptor[] { + get { return descriptor; } + } + private static readonly pbd::FileDescriptor descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom( + global::System.Convert.FromBase64String( + "CiBnb29nbGUvcHJvdG9idWYvZGVzY3JpcHRvci5wcm90bxIPZ29vZ2xlLnBy" + + "b3RvYnVmIkcKEUZpbGVEZXNjcmlwdG9yU2V0EjIKBGZpbGUYASADKAsyJC5n" + + "b29nbGUucHJvdG9idWYuRmlsZURlc2NyaXB0b3JQcm90byLcAgoTRmlsZURl" + + "c2NyaXB0b3JQcm90bxIMCgRuYW1lGAEgASgJEg8KB3BhY2thZ2UYAiABKAkS" + + "EgoKZGVwZW5kZW5jeRgDIAMoCRI2CgxtZXNzYWdlX3R5cGUYBCADKAsyIC5n" + + "b29nbGUucHJvdG9idWYuRGVzY3JpcHRvclByb3RvEjcKCWVudW1fdHlwZRgF" + + "IAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5FbnVtRGVzY3JpcHRvclByb3RvEjgK" + + "B3NlcnZpY2UYBiADKAsyJy5nb29nbGUucHJvdG9idWYuU2VydmljZURlc2Ny" + + "aXB0b3JQcm90bxI4CglleHRlbnNpb24YByADKAsyJS5nb29nbGUucHJvdG9i" + + "dWYuRmllbGREZXNjcmlwdG9yUHJvdG8SLQoHb3B0aW9ucxgIIAEoCzIcLmdv" + + "b2dsZS5wcm90b2J1Zi5GaWxlT3B0aW9ucyKpAwoPRGVzY3JpcHRvclByb3Rv" + + "EgwKBG5hbWUYASABKAkSNAoFZmllbGQYAiADKAsyJS5nb29nbGUucHJvdG9i" + + "dWYuRmllbGREZXNjcmlwdG9yUHJvdG8SOAoJZXh0ZW5zaW9uGAYgAygLMiUu" + + "Z29vZ2xlLnByb3RvYnVmLkZpZWxkRGVzY3JpcHRvclByb3RvEjUKC25lc3Rl" + + "ZF90eXBlGAMgAygLMiAuZ29vZ2xlLnByb3RvYnVmLkRlc2NyaXB0b3JQcm90" + + "bxI3CgllbnVtX3R5cGUYBCADKAsyJC5nb29nbGUucHJvdG9idWYuRW51bURl" + + "c2NyaXB0b3JQcm90bxJICg9leHRlbnNpb25fcmFuZ2UYBSADKAsyLy5nb29n" + + "bGUucHJvdG9idWYuRGVzY3JpcHRvclByb3RvLkV4dGVuc2lvblJhbmdlEjAK" + + "B29wdGlvbnMYByABKAsyHy5nb29nbGUucHJvdG9idWYuTWVzc2FnZU9wdGlv" + + "bnMaLAoORXh0ZW5zaW9uUmFuZ2USDQoFc3RhcnQYASABKAUSCwoDZW5kGAIg" + + "ASgFIpQFChRGaWVsZERlc2NyaXB0b3JQcm90bxIMCgRuYW1lGAEgASgJEg4K" + + "Bm51bWJlchgDIAEoBRI6CgVsYWJlbBgEIAEoDjIrLmdvb2dsZS5wcm90b2J1" + + "Zi5GaWVsZERlc2NyaXB0b3JQcm90by5MYWJlbBI4CgR0eXBlGAUgASgOMiou" + + "Z29vZ2xlLnByb3RvYnVmLkZpZWxkRGVzY3JpcHRvclByb3RvLlR5cGUSEQoJ" + + "dHlwZV9uYW1lGAYgASgJEhAKCGV4dGVuZGVlGAIgASgJEhUKDWRlZmF1bHRf" + + "dmFsdWUYByABKAkSLgoHb3B0aW9ucxgIIAEoCzIdLmdvb2dsZS5wcm90b2J1" + + "Zi5GaWVsZE9wdGlvbnMitgIKBFR5cGUSDwoLVFlQRV9ET1VCTEUQARIOCgpU" + + "WVBFX0ZMT0FUEAISDgoKVFlQRV9JTlQ2NBADEg8KC1RZUEVfVUlOVDY0EAQS" + + "DgoKVFlQRV9JTlQzMhAFEhAKDFRZUEVfRklYRUQ2NBAGEhAKDFRZUEVfRklY" + + "RUQzMhAHEg0KCVRZUEVfQk9PTBAIEg8KC1RZUEVfU1RSSU5HEAkSDgoKVFlQ" + + "RV9HUk9VUBAKEhAKDFRZUEVfTUVTU0FHRRALEg4KClRZUEVfQllURVMQDBIP" + + "CgtUWVBFX1VJTlQzMhANEg0KCVRZUEVfRU5VTRAOEhEKDVRZUEVfU0ZJWEVE" + + "MzIQDxIRCg1UWVBFX1NGSVhFRDY0EBASDwoLVFlQRV9TSU5UMzIQERIPCgtU" + + "WVBFX1NJTlQ2NBASIkMKBUxhYmVsEhIKDkxBQkVMX09QVElPTkFMEAESEgoO" + + "TEFCRUxfUkVRVUlSRUQQAhISCg5MQUJFTF9SRVBFQVRFRBADIowBChNFbnVt" + + "RGVzY3JpcHRvclByb3RvEgwKBG5hbWUYASABKAkSOAoFdmFsdWUYAiADKAsy" + + "KS5nb29nbGUucHJvdG9idWYuRW51bVZhbHVlRGVzY3JpcHRvclByb3RvEi0K" + + "B29wdGlvbnMYAyABKAsyHC5nb29nbGUucHJvdG9idWYuRW51bU9wdGlvbnMi" + + "bAoYRW51bVZhbHVlRGVzY3JpcHRvclByb3RvEgwKBG5hbWUYASABKAkSDgoG" + + "bnVtYmVyGAIgASgFEjIKB29wdGlvbnMYAyABKAsyIS5nb29nbGUucHJvdG9i" + + "dWYuRW51bVZhbHVlT3B0aW9ucyKQAQoWU2VydmljZURlc2NyaXB0b3JQcm90" + + "bxIMCgRuYW1lGAEgASgJEjYKBm1ldGhvZBgCIAMoCzImLmdvb2dsZS5wcm90" + + "b2J1Zi5NZXRob2REZXNjcmlwdG9yUHJvdG8SMAoHb3B0aW9ucxgDIAEoCzIf" + + "Lmdvb2dsZS5wcm90b2J1Zi5TZXJ2aWNlT3B0aW9ucyJ/ChVNZXRob2REZXNj" + + "cmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRISCgppbnB1dF90eXBlGAIgASgJ" + + "EhMKC291dHB1dF90eXBlGAMgASgJEi8KB29wdGlvbnMYBCABKAsyHi5nb29n" + + "bGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucyKrAgoLRmlsZU9wdGlvbnMSFAoM" + + "amF2YV9wYWNrYWdlGAEgASgJEhwKFGphdmFfb3V0ZXJfY2xhc3NuYW1lGAgg" + + "ASgJEiIKE2phdmFfbXVsdGlwbGVfZmlsZXMYCiABKAg6BWZhbHNlEkoKDG9w" + + "dGltaXplX2ZvchgJIAEoDjIpLmdvb2dsZS5wcm90b2J1Zi5GaWxlT3B0aW9u" + + "cy5PcHRpbWl6ZU1vZGU6CUNPREVfU0laRRJDChR1bmludGVycHJldGVkX29w" + + "dGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9w" + + "dGlvbiIoCgxPcHRpbWl6ZU1vZGUSCQoFU1BFRUQQARINCglDT0RFX1NJWkUQ" + + "AioJCOgHEICAgIACIogBCg5NZXNzYWdlT3B0aW9ucxImChdtZXNzYWdlX3Nl" + + "dF93aXJlX2Zvcm1hdBgBIAEoCDoFZmFsc2USQwoUdW5pbnRlcnByZXRlZF9v" + + "cHRpb24Y5wcgAygLMiQuZ29vZ2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRP" + + "cHRpb24qCQjoBxCAgICAAiLVAQoMRmllbGRPcHRpb25zEjIKBWN0eXBlGAEg" + + "ASgOMiMuZ29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9ucy5DVHlwZRIcChRl" + + "eHBlcmltZW50YWxfbWFwX2tleRgJIAEoCRJDChR1bmludGVycHJldGVkX29w" + + "dGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9w" + + "dGlvbiIjCgVDVHlwZRIICgRDT1JEEAESEAoMU1RSSU5HX1BJRUNFEAIqCQjo" + + "BxCAgICAAiJdCgtFbnVtT3B0aW9ucxJDChR1bmludGVycHJldGVkX29wdGlv" + + "bhjnByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlv" + + "bioJCOgHEICAgIACImIKEEVudW1WYWx1ZU9wdGlvbnMSQwoUdW5pbnRlcnBy" + + "ZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnByb3RvYnVmLlVuaW50ZXJw" + + "cmV0ZWRPcHRpb24qCQjoBxCAgICAAiJgCg5TZXJ2aWNlT3B0aW9ucxJDChR1" + + "bmludGVycHJldGVkX29wdGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYu" + + "VW5pbnRlcnByZXRlZE9wdGlvbioJCOgHEICAgIACIl8KDU1ldGhvZE9wdGlv" + + "bnMSQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnBy" + + "b3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24qCQjoBxCAgICAAiKFAgoTVW5p" + + "bnRlcnByZXRlZE9wdGlvbhI7CgRuYW1lGAIgAygLMi0uZ29vZ2xlLnByb3Rv" + + "YnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24uTmFtZVBhcnQSGAoQaWRlbnRpZmll" + + "cl92YWx1ZRgDIAEoCRIaChJwb3NpdGl2ZV9pbnRfdmFsdWUYBCABKAQSGgoS" + + "bmVnYXRpdmVfaW50X3ZhbHVlGAUgASgDEhQKDGRvdWJsZV92YWx1ZRgGIAEo" + + "ARIUCgxzdHJpbmdfdmFsdWUYByABKAwaMwoITmFtZVBhcnQSEQoJbmFtZV9w" + + "YXJ0GAEgAigJEhQKDGlzX2V4dGVuc2lvbhgCIAIoCEIpChNjb20uZ29vZ2xl" + + "LnByb3RvYnVmQhBEZXNjcmlwdG9yUHJvdG9zSAE="), + new pbd::FileDescriptor[] { }); #endregion - #region Extensions - #endregion - #region Static variables - internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_FileDescriptorSet__Descriptor + internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_FileDescriptorSet__Descriptor = Descriptor.MessageTypes[0]; internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_FileDescriptorSet__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_FileDescriptorSet__Descriptor, new string[] { "File", }); - internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_FileDescriptorProto__Descriptor + internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_FileDescriptorProto__Descriptor = Descriptor.MessageTypes[1]; internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_FileDescriptorProto__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_FileDescriptorProto__Descriptor, new string[] { "Name", "Package", "Dependency", "MessageType", "EnumType", "Service", "Extension", "Options", }); - internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_DescriptorProto__Descriptor + internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_DescriptorProto__Descriptor = Descriptor.MessageTypes[2]; internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_DescriptorProto__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_DescriptorProto__Descriptor, new string[] { "Name", "Field", "Extension", "NestedType", "EnumType", "ExtensionRange", "Options", }); - internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_DescriptorProto_ExtensionRange__Descriptor + internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_DescriptorProto_ExtensionRange__Descriptor = internal__static_google_protobuf_DescriptorProto__Descriptor.NestedTypes[0]; internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_DescriptorProto_ExtensionRange__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_DescriptorProto_ExtensionRange__Descriptor, new string[] { "Start", "End", }); - internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_FieldDescriptorProto__Descriptor + internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_FieldDescriptorProto__Descriptor = Descriptor.MessageTypes[3]; internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_FieldDescriptorProto__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_FieldDescriptorProto__Descriptor, new string[] { "Name", "Number", "Label", "Type", "TypeName", "Extendee", "DefaultValue", "Options", }); - internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_EnumDescriptorProto__Descriptor + internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_EnumDescriptorProto__Descriptor = Descriptor.MessageTypes[4]; internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_EnumDescriptorProto__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_EnumDescriptorProto__Descriptor, new string[] { "Name", "Value", "Options", }); - internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_EnumValueDescriptorProto__Descriptor + internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_EnumValueDescriptorProto__Descriptor = Descriptor.MessageTypes[5]; internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_EnumValueDescriptorProto__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_EnumValueDescriptorProto__Descriptor, new string[] { "Name", "Number", "Options", }); - internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_ServiceDescriptorProto__Descriptor + internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_ServiceDescriptorProto__Descriptor = Descriptor.MessageTypes[6]; internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_ServiceDescriptorProto__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_ServiceDescriptorProto__Descriptor, new string[] { "Name", "Method", "Options", }); - internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_MethodDescriptorProto__Descriptor + internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_MethodDescriptorProto__Descriptor = Descriptor.MessageTypes[7]; internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_MethodDescriptorProto__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_MethodDescriptorProto__Descriptor, new string[] { "Name", "InputType", "OutputType", "Options", }); - internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_FileOptions__Descriptor + internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_FileOptions__Descriptor = Descriptor.MessageTypes[8]; internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_FileOptions__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_FileOptions__Descriptor, - new string[] { "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "OptimizeFor", "CsharpNamespace", "CsharpFileClassname", "CsharpMultipleFiles", "CsharpNestClasses", "CsharpPublicClasses", }); - internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_MessageOptions__Descriptor + new string[] { "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "OptimizeFor", "UninterpretedOption", }); + internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_MessageOptions__Descriptor = Descriptor.MessageTypes[9]; internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_MessageOptions__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_MessageOptions__Descriptor, - new string[] { "MessageSetWireFormat", }); - internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_FieldOptions__Descriptor + new string[] { "MessageSetWireFormat", "UninterpretedOption", }); + internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_FieldOptions__Descriptor = Descriptor.MessageTypes[10]; internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_FieldOptions__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_FieldOptions__Descriptor, - new string[] { "Ctype", "ExperimentalMapKey", }); - internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_EnumOptions__Descriptor + new string[] { "Ctype", "ExperimentalMapKey", "UninterpretedOption", }); + internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_EnumOptions__Descriptor = Descriptor.MessageTypes[11]; internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_EnumOptions__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_EnumOptions__Descriptor, - new string[] { }); - internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_EnumValueOptions__Descriptor + new string[] { "UninterpretedOption", }); + internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_EnumValueOptions__Descriptor = Descriptor.MessageTypes[12]; internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_EnumValueOptions__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_EnumValueOptions__Descriptor, - new string[] { }); - internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_ServiceOptions__Descriptor + new string[] { "UninterpretedOption", }); + internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_ServiceOptions__Descriptor = Descriptor.MessageTypes[13]; internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_ServiceOptions__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_ServiceOptions__Descriptor, - new string[] { }); - internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_MethodOptions__Descriptor + new string[] { "UninterpretedOption", }); + internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_MethodOptions__Descriptor = Descriptor.MessageTypes[14]; internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_MethodOptions__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_MethodOptions__Descriptor, - new string[] { }); + new string[] { "UninterpretedOption", }); + internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_UninterpretedOption__Descriptor + = Descriptor.MessageTypes[15]; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_UninterpretedOption__FieldAccessorTable + = new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_UninterpretedOption__Descriptor, + new string[] { "Name", "IdentifierValue", "PositiveIntValue", "NegativeIntValue", "DoubleValue", "StringValue", }); + internal static readonly pbd::MessageDescriptor internal__static_google_protobuf_UninterpretedOption_NamePart__Descriptor + = internal__static_google_protobuf_UninterpretedOption__Descriptor.NestedTypes[0]; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_UninterpretedOption_NamePart__FieldAccessorTable + = new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_UninterpretedOption_NamePart__Descriptor, + new string[] { "NamePart", "IsExtension", }); #endregion - } - - #region Enums - #endregion - #region Messages public sealed partial class FileDescriptorSet : pb::GeneratedMessage { private static readonly FileDescriptorSet defaultInstance = new Builder().BuildPartial(); @@ -276,20 +211,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_FileDescriptorSet__FieldAccessorTable; } } - // repeated .google.protobuf.FileDescriptorProto file = 1; private pbc::PopsicleList file_ = new pbc::PopsicleList(); public scg::IList FileList { - get { return file_; } + get { return file_; } } - public int FileCount - { get { return file_.Count; } + public int FileCount { + get { return file_.Count; } } public global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto GetFile(int index) { - return file_ [index]; + return file_[index]; } public override bool IsInitialized { get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto element in FileList) { + if (!element.IsInitialized) return false; + } return true; } } @@ -317,62 +254,50 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet ParseFrom(pb::ByteString data) { + public static FileDescriptorSet ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet ParseFrom(pb::ByteString data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static FileDescriptorSet ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet ParseFrom(byte[] data) { + public static FileDescriptorSet ParseFrom(byte[] data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet ParseFrom(byte[] data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static FileDescriptorSet ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet ParseFrom(global::System.IO.Stream input) { + public static FileDescriptorSet ParseFrom(global::System.IO.Stream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet ParseFrom( - global::System.IO.Stream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static FileDescriptorSet ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet ParseFrom(pb::CodedInputStream input) { + public static FileDescriptorSet ParseFrom(pb::CodedInputStream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet ParseFrom(pb::CodedInputStream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static FileDescriptorSet ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static Builder CreateBuilder() { return new Builder(); } public override Builder CreateBuilderForType() { return new Builder(); } - public static Builder CreateBuilder(global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet prototype) { + public static Builder CreateBuilder(FileDescriptorSet prototype) { return (Builder) new Builder().MergeFrom(prototype); } - public sealed partial class Builder : pb::GeneratedBuilder { + public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } } - - // Construct using global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet.CreateBuilder() public Builder() {} - global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet result = new global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet(); + FileDescriptorSet result = new FileDescriptorSet(); - protected override global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet MessageBeingBuilt { + protected override FileDescriptorSet MessageBeingBuilt { get { return result; } } public override Builder Clear() { - result = new global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet(); + result = new FileDescriptorSet(); return this; } @@ -381,31 +306,31 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override pbd::MessageDescriptor DescriptorForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet.Descriptor; } + get { return FileDescriptorSet.Descriptor; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet DefaultInstanceForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet.DefaultInstance; } + public override FileDescriptorSet DefaultInstanceForType { + get { return FileDescriptorSet.DefaultInstance; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet BuildPartial() { + public override FileDescriptorSet BuildPartial() { result.file_.MakeReadOnly(); - global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet returnMe = result; + FileDescriptorSet returnMe = result; result = null; return returnMe; } public override Builder MergeFrom(pb::IMessage other) { - if (other is global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet) { - return MergeFrom((global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet) other); + if (other is FileDescriptorSet) { + return MergeFrom((FileDescriptorSet) other); } else { base.MergeFrom(other); return this; } } - public override Builder MergeFrom(global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet other) { - if (other == global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet.DefaultInstance) return this; + public override Builder MergeFrom(FileDescriptorSet other) { + if (other == FileDescriptorSet.DefaultInstance) return this; if (other.file_.Count != 0) { base.AddRange(other.file_, result.file_); } @@ -418,17 +343,16 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { - pb::UnknownFieldSet.Builder unknownFields = - pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); while (true) { uint tag = input.ReadTag(); switch (tag) { - case 0: + case 0: { this.UnknownFields = unknownFields.Build(); return this; + } default: { - if (!ParseUnknownField(input, unknownFields, - extensionRegistry, tag)) { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.UnknownFields = unknownFields.Build(); return this; } @@ -445,7 +369,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } - // repeated .google.protobuf.FileDescriptorProto file = 1; public scg::IList FileList { get { return result.file_; } } @@ -504,7 +427,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_FileDescriptorProto__FieldAccessorTable; } } - // optional string name = 1; private bool hasName; private string name_ = ""; public bool HasName { @@ -514,7 +436,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return name_; } } - // optional string package = 2; private bool hasPackage; private string package_ = ""; public bool HasPackage { @@ -524,10 +445,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return package_; } } - // repeated string dependency = 3; private pbc::PopsicleList dependency_ = new pbc::PopsicleList(); public scg::IList DependencyList { - get { return dependency_; } + get { return pbc::Lists.AsReadOnly(dependency_); } } public int DependencyCount { get { return dependency_.Count; } @@ -536,55 +456,50 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return dependency_[index]; } - // repeated .google.protobuf.DescriptorProto message_type = 4; private pbc::PopsicleList messageType_ = new pbc::PopsicleList(); public scg::IList MessageTypeList { - get { return messageType_; } + get { return messageType_; } } - public int MessageTypeCount - { get { return messageType_.Count; } + public int MessageTypeCount { + get { return messageType_.Count; } } public global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto GetMessageType(int index) { - return messageType_ [index]; + return messageType_[index]; } - // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; private pbc::PopsicleList enumType_ = new pbc::PopsicleList(); public scg::IList EnumTypeList { - get { return enumType_; } + get { return enumType_; } } - public int EnumTypeCount - { get { return enumType_.Count; } + public int EnumTypeCount { + get { return enumType_.Count; } } public global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto GetEnumType(int index) { - return enumType_ [index]; + return enumType_[index]; } - // repeated .google.protobuf.ServiceDescriptorProto service = 6; private pbc::PopsicleList service_ = new pbc::PopsicleList(); public scg::IList ServiceList { - get { return service_; } + get { return service_; } } - public int ServiceCount - { get { return service_.Count; } + public int ServiceCount { + get { return service_.Count; } } public global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto GetService(int index) { - return service_ [index]; + return service_[index]; } - // repeated .google.protobuf.FieldDescriptorProto extension = 7; private pbc::PopsicleList extension_ = new pbc::PopsicleList(); public scg::IList ExtensionList { - get { return extension_; } + get { return extension_; } } - public int ExtensionCount - { get { return extension_.Count; } + public int ExtensionCount { + get { return extension_.Count; } } public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto GetExtension(int index) { - return extension_ [index]; + return extension_[index]; } - // optional .google.protobuf.FileOptions options = 8; private bool hasOptions; private global::Google.ProtocolBuffers.DescriptorProtos.FileOptions options_ = global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.DefaultInstance; public bool HasOptions { @@ -596,6 +511,21 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override bool IsInitialized { get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto element in MessageTypeList) { + if (!element.IsInitialized) return false; + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto element in EnumTypeList) { + if (!element.IsInitialized) return false; + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto element in ServiceList) { + if (!element.IsInitialized) return false; + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto element in ExtensionList) { + if (!element.IsInitialized) return false; + } + if (HasOptions) { + if (!Options.IsInitialized) return false; + } return true; } } @@ -642,8 +572,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { size += pb::CodedOutputStream.ComputeStringSize(2, Package); } foreach (string element in DependencyList) { - size += pb::CodedOutputStream - .ComputeStringSize(3, element); + size += pb::CodedOutputStream.ComputeStringSize(3, element); } foreach (global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto element in MessageTypeList) { size += pb::CodedOutputStream.ComputeMessageSize(4, element); @@ -666,62 +595,50 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto ParseFrom(pb::ByteString data) { + public static FileDescriptorProto ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto ParseFrom(pb::ByteString data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static FileDescriptorProto ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto ParseFrom(byte[] data) { + public static FileDescriptorProto ParseFrom(byte[] data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto ParseFrom(byte[] data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static FileDescriptorProto ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto ParseFrom(global::System.IO.Stream input) { + public static FileDescriptorProto ParseFrom(global::System.IO.Stream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto ParseFrom( - global::System.IO.Stream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static FileDescriptorProto ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto ParseFrom(pb::CodedInputStream input) { + public static FileDescriptorProto ParseFrom(pb::CodedInputStream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto ParseFrom(pb::CodedInputStream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static FileDescriptorProto ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static Builder CreateBuilder() { return new Builder(); } public override Builder CreateBuilderForType() { return new Builder(); } - public static Builder CreateBuilder(global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto prototype) { + public static Builder CreateBuilder(FileDescriptorProto prototype) { return (Builder) new Builder().MergeFrom(prototype); } - public sealed partial class Builder : pb::GeneratedBuilder { + public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } } - - // Construct using global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto.CreateBuilder() public Builder() {} - global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto result = new global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto(); + FileDescriptorProto result = new FileDescriptorProto(); - protected override global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto MessageBeingBuilt { + protected override FileDescriptorProto MessageBeingBuilt { get { return result; } } public override Builder Clear() { - result = new global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto(); + result = new FileDescriptorProto(); return this; } @@ -730,35 +647,35 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override pbd::MessageDescriptor DescriptorForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto.Descriptor; } + get { return FileDescriptorProto.Descriptor; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto DefaultInstanceForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto.DefaultInstance; } + public override FileDescriptorProto DefaultInstanceForType { + get { return FileDescriptorProto.DefaultInstance; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto BuildPartial() { + public override FileDescriptorProto BuildPartial() { result.dependency_.MakeReadOnly(); result.messageType_.MakeReadOnly(); result.enumType_.MakeReadOnly(); result.service_.MakeReadOnly(); result.extension_.MakeReadOnly(); - global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto returnMe = result; + FileDescriptorProto returnMe = result; result = null; return returnMe; } public override Builder MergeFrom(pb::IMessage other) { - if (other is global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto) { - return MergeFrom((global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto) other); + if (other is FileDescriptorProto) { + return MergeFrom((FileDescriptorProto) other); } else { base.MergeFrom(other); return this; } } - public override Builder MergeFrom(global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto other) { - if (other == global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto.DefaultInstance) return this; + public override Builder MergeFrom(FileDescriptorProto other) { + if (other == FileDescriptorProto.DefaultInstance) return this; if (other.HasName) { Name = other.Name; } @@ -792,17 +709,16 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { - pb::UnknownFieldSet.Builder unknownFields = - pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); while (true) { uint tag = input.ReadTag(); switch (tag) { - case 0: + case 0: { this.UnknownFields = unknownFields.Build(); return this; + } default: { - if (!ParseUnknownField(input, unknownFields, - extensionRegistry, tag)) { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.UnknownFields = unknownFields.Build(); return this; } @@ -858,7 +774,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } - // optional string name = 1; public bool HasName { get { return result.HasName; } } @@ -877,7 +792,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional string package = 2; public bool HasPackage { get { return result.HasPackage; } } @@ -896,7 +810,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // repeated string dependency = 3; public scg::IList DependencyList { get { return result.dependency_; } } @@ -923,7 +836,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // repeated .google.protobuf.DescriptorProto message_type = 4; public scg::IList MessageTypeList { get { return result.messageType_; } } @@ -958,7 +870,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; public scg::IList EnumTypeList { get { return result.enumType_; } } @@ -993,7 +904,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // repeated .google.protobuf.ServiceDescriptorProto service = 6; public scg::IList ServiceList { get { return result.service_; } } @@ -1028,7 +938,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // repeated .google.protobuf.FieldDescriptorProto extension = 7; public scg::IList ExtensionList { get { return result.extension_; } } @@ -1063,9 +972,8 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional .google.protobuf.FileOptions options = 8; public bool HasOptions { - get { return result.HasOptions; } + get { return result.HasOptions; } } public global::Google.ProtocolBuffers.DescriptorProtos.FileOptions Options { get { return result.Options; } @@ -1084,8 +992,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.FileOptions value) { if (result.HasOptions && result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.DefaultInstance) { - result.options_ = - global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); + result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); } else { result.options_ = value; } @@ -1146,7 +1053,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_DescriptorProto_ExtensionRange__FieldAccessorTable; } } - // optional int32 start = 1; private bool hasStart; private int start_ = 0; public bool HasStart { @@ -1156,7 +1062,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return start_; } } - // optional int32 end = 2; private bool hasEnd; private int end_ = 0; public bool HasEnd { @@ -1201,62 +1106,50 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } } - public static global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange ParseFrom(pb::ByteString data) { + public static ExtensionRange ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange ParseFrom(pb::ByteString data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static ExtensionRange ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange ParseFrom(byte[] data) { + public static ExtensionRange ParseFrom(byte[] data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange ParseFrom(byte[] data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static ExtensionRange ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange ParseFrom(global::System.IO.Stream input) { + public static ExtensionRange ParseFrom(global::System.IO.Stream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange ParseFrom( - global::System.IO.Stream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static ExtensionRange ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange ParseFrom(pb::CodedInputStream input) { + public static ExtensionRange ParseFrom(pb::CodedInputStream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange ParseFrom(pb::CodedInputStream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static ExtensionRange ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static Builder CreateBuilder() { return new Builder(); } public override Builder CreateBuilderForType() { return new Builder(); } - public static Builder CreateBuilder(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange prototype) { + public static Builder CreateBuilder(ExtensionRange prototype) { return (Builder) new Builder().MergeFrom(prototype); } - public sealed partial class Builder : pb::GeneratedBuilder { + public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } } - - // Construct using global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange.CreateBuilder() public Builder() {} - global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange result = new global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange(); + ExtensionRange result = new ExtensionRange(); - protected override global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange MessageBeingBuilt { + protected override ExtensionRange MessageBeingBuilt { get { return result; } } public override Builder Clear() { - result = new global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange(); + result = new ExtensionRange(); return this; } @@ -1265,30 +1158,30 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override pbd::MessageDescriptor DescriptorForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange.Descriptor; } + get { return ExtensionRange.Descriptor; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange DefaultInstanceForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange.DefaultInstance; } + public override ExtensionRange DefaultInstanceForType { + get { return ExtensionRange.DefaultInstance; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange BuildPartial() { - global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange returnMe = result; + public override ExtensionRange BuildPartial() { + ExtensionRange returnMe = result; result = null; return returnMe; } public override Builder MergeFrom(pb::IMessage other) { - if (other is global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange) { - return MergeFrom((global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange) other); + if (other is ExtensionRange) { + return MergeFrom((ExtensionRange) other); } else { base.MergeFrom(other); return this; } } - public override Builder MergeFrom(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange other) { - if (other == global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange.DefaultInstance) return this; + public override Builder MergeFrom(ExtensionRange other) { + if (other == ExtensionRange.DefaultInstance) return this; if (other.HasStart) { Start = other.Start; } @@ -1304,17 +1197,16 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { - pb::UnknownFieldSet.Builder unknownFields = - pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); while (true) { uint tag = input.ReadTag(); switch (tag) { - case 0: + case 0: { this.UnknownFields = unknownFields.Build(); return this; + } default: { - if (!ParseUnknownField(input, unknownFields, - extensionRegistry, tag)) { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.UnknownFields = unknownFields.Build(); return this; } @@ -1333,7 +1225,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } - // optional int32 start = 1; public bool HasStart { get { return result.HasStart; } } @@ -1352,7 +1243,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional int32 end = 2; public bool HasEnd { get { return result.HasEnd; } } @@ -1376,7 +1266,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } #endregion - // optional string name = 1; private bool hasName; private string name_ = ""; public bool HasName { @@ -1386,67 +1275,61 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return name_; } } - // repeated .google.protobuf.FieldDescriptorProto field = 2; private pbc::PopsicleList field_ = new pbc::PopsicleList(); public scg::IList FieldList { - get { return field_; } + get { return field_; } } - public int FieldCount - { get { return field_.Count; } + public int FieldCount { + get { return field_.Count; } } public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto GetField(int index) { - return field_ [index]; + return field_[index]; } - // repeated .google.protobuf.FieldDescriptorProto extension = 6; private pbc::PopsicleList extension_ = new pbc::PopsicleList(); public scg::IList ExtensionList { - get { return extension_; } + get { return extension_; } } - public int ExtensionCount - { get { return extension_.Count; } + public int ExtensionCount { + get { return extension_.Count; } } public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto GetExtension(int index) { - return extension_ [index]; + return extension_[index]; } - // repeated .google.protobuf.DescriptorProto nested_type = 3; private pbc::PopsicleList nestedType_ = new pbc::PopsicleList(); public scg::IList NestedTypeList { - get { return nestedType_; } + get { return nestedType_; } } - public int NestedTypeCount - { get { return nestedType_.Count; } + public int NestedTypeCount { + get { return nestedType_.Count; } } public global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto GetNestedType(int index) { - return nestedType_ [index]; + return nestedType_[index]; } - // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; private pbc::PopsicleList enumType_ = new pbc::PopsicleList(); public scg::IList EnumTypeList { - get { return enumType_; } + get { return enumType_; } } - public int EnumTypeCount - { get { return enumType_.Count; } + public int EnumTypeCount { + get { return enumType_.Count; } } public global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto GetEnumType(int index) { - return enumType_ [index]; + return enumType_[index]; } - // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; private pbc::PopsicleList extensionRange_ = new pbc::PopsicleList(); public scg::IList ExtensionRangeList { - get { return extensionRange_; } + get { return extensionRange_; } } - public int ExtensionRangeCount - { get { return extensionRange_.Count; } + public int ExtensionRangeCount { + get { return extensionRange_.Count; } } public global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange GetExtensionRange(int index) { - return extensionRange_ [index]; + return extensionRange_[index]; } - // optional .google.protobuf.MessageOptions options = 7; private bool hasOptions; private global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions options_ = global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.DefaultInstance; public bool HasOptions { @@ -1458,6 +1341,21 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override bool IsInitialized { get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto element in FieldList) { + if (!element.IsInitialized) return false; + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto element in ExtensionList) { + if (!element.IsInitialized) return false; + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto element in NestedTypeList) { + if (!element.IsInitialized) return false; + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto element in EnumTypeList) { + if (!element.IsInitialized) return false; + } + if (HasOptions) { + if (!Options.IsInitialized) return false; + } return true; } } @@ -1500,6 +1398,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos { foreach (global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto element in FieldList) { size += pb::CodedOutputStream.ComputeMessageSize(2, element); } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto element in ExtensionList) { + size += pb::CodedOutputStream.ComputeMessageSize(6, element); + } foreach (global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto element in NestedTypeList) { size += pb::CodedOutputStream.ComputeMessageSize(3, element); } @@ -1509,9 +1410,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { foreach (global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange element in ExtensionRangeList) { size += pb::CodedOutputStream.ComputeMessageSize(5, element); } - foreach (global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto element in ExtensionList) { - size += pb::CodedOutputStream.ComputeMessageSize(6, element); - } if (HasOptions) { size += pb::CodedOutputStream.ComputeMessageSize(7, Options); } @@ -1521,62 +1419,50 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } } - public static global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto ParseFrom(pb::ByteString data) { + public static DescriptorProto ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto ParseFrom(pb::ByteString data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static DescriptorProto ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto ParseFrom(byte[] data) { + public static DescriptorProto ParseFrom(byte[] data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto ParseFrom(byte[] data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static DescriptorProto ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto ParseFrom(global::System.IO.Stream input) { + public static DescriptorProto ParseFrom(global::System.IO.Stream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto ParseFrom( - global::System.IO.Stream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static DescriptorProto ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto ParseFrom(pb::CodedInputStream input) { + public static DescriptorProto ParseFrom(pb::CodedInputStream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto ParseFrom(pb::CodedInputStream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static DescriptorProto ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static Builder CreateBuilder() { return new Builder(); } public override Builder CreateBuilderForType() { return new Builder(); } - public static Builder CreateBuilder(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto prototype) { + public static Builder CreateBuilder(DescriptorProto prototype) { return (Builder) new Builder().MergeFrom(prototype); } - public sealed partial class Builder : pb::GeneratedBuilder { + public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } } - - // Construct using global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.CreateBuilder() public Builder() {} - global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto result = new global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto(); + DescriptorProto result = new DescriptorProto(); - protected override global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto MessageBeingBuilt { + protected override DescriptorProto MessageBeingBuilt { get { return result; } } public override Builder Clear() { - result = new global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto(); + result = new DescriptorProto(); return this; } @@ -1585,35 +1471,35 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override pbd::MessageDescriptor DescriptorForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Descriptor; } + get { return DescriptorProto.Descriptor; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto DefaultInstanceForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.DefaultInstance; } + public override DescriptorProto DefaultInstanceForType { + get { return DescriptorProto.DefaultInstance; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto BuildPartial() { + public override DescriptorProto BuildPartial() { result.field_.MakeReadOnly(); result.extension_.MakeReadOnly(); result.nestedType_.MakeReadOnly(); result.enumType_.MakeReadOnly(); result.extensionRange_.MakeReadOnly(); - global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto returnMe = result; + DescriptorProto returnMe = result; result = null; return returnMe; } public override Builder MergeFrom(pb::IMessage other) { - if (other is global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto) { - return MergeFrom((global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto) other); + if (other is DescriptorProto) { + return MergeFrom((DescriptorProto) other); } else { base.MergeFrom(other); return this; } } - public override Builder MergeFrom(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto other) { - if (other == global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.DefaultInstance) return this; + public override Builder MergeFrom(DescriptorProto other) { + if (other == DescriptorProto.DefaultInstance) return this; if (other.HasName) { Name = other.Name; } @@ -1644,17 +1530,16 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { - pb::UnknownFieldSet.Builder unknownFields = - pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); while (true) { uint tag = input.ReadTag(); switch (tag) { - case 0: + case 0: { this.UnknownFields = unknownFields.Build(); return this; + } default: { - if (!ParseUnknownField(input, unknownFields, - extensionRegistry, tag)) { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.UnknownFields = unknownFields.Build(); return this; } @@ -1708,7 +1593,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } - // optional string name = 1; public bool HasName { get { return result.HasName; } } @@ -1727,7 +1611,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // repeated .google.protobuf.FieldDescriptorProto field = 2; public scg::IList FieldList { get { return result.field_; } } @@ -1762,7 +1645,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // repeated .google.protobuf.FieldDescriptorProto extension = 6; public scg::IList ExtensionList { get { return result.extension_; } } @@ -1797,7 +1679,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // repeated .google.protobuf.DescriptorProto nested_type = 3; public scg::IList NestedTypeList { get { return result.nestedType_; } } @@ -1832,7 +1713,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; public scg::IList EnumTypeList { get { return result.enumType_; } } @@ -1867,7 +1747,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; public scg::IList ExtensionRangeList { get { return result.extensionRange_; } } @@ -1902,9 +1781,8 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional .google.protobuf.MessageOptions options = 7; public bool HasOptions { - get { return result.HasOptions; } + get { return result.HasOptions; } } public global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions Options { get { return result.Options; } @@ -1923,8 +1801,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions value) { if (result.HasOptions && result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.DefaultInstance) { - result.options_ = - global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); + result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); } else { result.options_ = value; } @@ -1993,7 +1870,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } #endregion - // optional string name = 1; private bool hasName; private string name_ = ""; public bool HasName { @@ -2003,7 +1879,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return name_; } } - // optional int32 number = 3; private bool hasNumber; private int number_ = 0; public bool HasNumber { @@ -2013,23 +1888,24 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return number_; } } - // optional .google.protobuf.FieldDescriptorProto.Label label = 4; private bool hasLabel; private global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Label label_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL; public bool HasLabel { get { return hasLabel; } } - public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Label Label { get { return label_; }} + public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Label Label { + get { return label_; } + } - // optional .google.protobuf.FieldDescriptorProto.Type type = 5; private bool hasType; private global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Type type_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Type.TYPE_DOUBLE; public bool HasType { get { return hasType; } } - public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Type Type { get { return type_; }} + public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Type Type { + get { return type_; } + } - // optional string type_name = 6; private bool hasTypeName; private string typeName_ = ""; public bool HasTypeName { @@ -2039,7 +1915,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return typeName_; } } - // optional string extendee = 2; private bool hasExtendee; private string extendee_ = ""; public bool HasExtendee { @@ -2049,7 +1924,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return extendee_; } } - // optional string default_value = 7; private bool hasDefaultValue; private string defaultValue_ = ""; public bool HasDefaultValue { @@ -2059,7 +1933,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return defaultValue_; } } - // optional .google.protobuf.FieldOptions options = 8; private bool hasOptions; private global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions options_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.DefaultInstance; public bool HasOptions { @@ -2071,6 +1944,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override bool IsInitialized { get { + if (HasOptions) { + if (!Options.IsInitialized) return false; + } return true; } } @@ -2113,23 +1989,21 @@ namespace Google.ProtocolBuffers.DescriptorProtos { if (HasName) { size += pb::CodedOutputStream.ComputeStringSize(1, Name); } - if (HasExtendee) { - size += pb::CodedOutputStream.ComputeStringSize(2, Extendee); - } if (HasNumber) { size += pb::CodedOutputStream.ComputeInt32Size(3, Number); } if (HasLabel) { - size += pb::CodedOutputStream - .ComputeEnumSize(4, (int) Label); + size += pb::CodedOutputStream.ComputeEnumSize(4, (int) Label); } if (HasType) { - size += pb::CodedOutputStream - .ComputeEnumSize(5, (int) Type); + size += pb::CodedOutputStream.ComputeEnumSize(5, (int) Type); } if (HasTypeName) { size += pb::CodedOutputStream.ComputeStringSize(6, TypeName); } + if (HasExtendee) { + size += pb::CodedOutputStream.ComputeStringSize(2, Extendee); + } if (HasDefaultValue) { size += pb::CodedOutputStream.ComputeStringSize(7, DefaultValue); } @@ -2142,62 +2016,50 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } } - public static global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto ParseFrom(pb::ByteString data) { + public static FieldDescriptorProto ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto ParseFrom(pb::ByteString data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static FieldDescriptorProto ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto ParseFrom(byte[] data) { + public static FieldDescriptorProto ParseFrom(byte[] data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto ParseFrom(byte[] data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static FieldDescriptorProto ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto ParseFrom(global::System.IO.Stream input) { + public static FieldDescriptorProto ParseFrom(global::System.IO.Stream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto ParseFrom( - global::System.IO.Stream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static FieldDescriptorProto ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto ParseFrom(pb::CodedInputStream input) { + public static FieldDescriptorProto ParseFrom(pb::CodedInputStream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto ParseFrom(pb::CodedInputStream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static FieldDescriptorProto ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static Builder CreateBuilder() { return new Builder(); } public override Builder CreateBuilderForType() { return new Builder(); } - public static Builder CreateBuilder(global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto prototype) { + public static Builder CreateBuilder(FieldDescriptorProto prototype) { return (Builder) new Builder().MergeFrom(prototype); } - public sealed partial class Builder : pb::GeneratedBuilder { + public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } } - - // Construct using global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.CreateBuilder() public Builder() {} - global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto result = new global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto(); + FieldDescriptorProto result = new FieldDescriptorProto(); - protected override global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto MessageBeingBuilt { + protected override FieldDescriptorProto MessageBeingBuilt { get { return result; } } public override Builder Clear() { - result = new global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto(); + result = new FieldDescriptorProto(); return this; } @@ -2206,30 +2068,30 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override pbd::MessageDescriptor DescriptorForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Descriptor; } + get { return FieldDescriptorProto.Descriptor; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto DefaultInstanceForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.DefaultInstance; } + public override FieldDescriptorProto DefaultInstanceForType { + get { return FieldDescriptorProto.DefaultInstance; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto BuildPartial() { - global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto returnMe = result; + public override FieldDescriptorProto BuildPartial() { + FieldDescriptorProto returnMe = result; result = null; return returnMe; } public override Builder MergeFrom(pb::IMessage other) { - if (other is global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto) { - return MergeFrom((global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto) other); + if (other is FieldDescriptorProto) { + return MergeFrom((FieldDescriptorProto) other); } else { base.MergeFrom(other); return this; } } - public override Builder MergeFrom(global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto other) { - if (other == global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.DefaultInstance) return this; + public override Builder MergeFrom(FieldDescriptorProto other) { + if (other == FieldDescriptorProto.DefaultInstance) return this; if (other.HasName) { Name = other.Name; } @@ -2263,17 +2125,16 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { - pb::UnknownFieldSet.Builder unknownFields = - pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); while (true) { uint tag = input.ReadTag(); switch (tag) { - case 0: + case 0: { this.UnknownFields = unknownFields.Build(); return this; + } default: { - if (!ParseUnknownField(input, unknownFields, - extensionRegistry, tag)) { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.UnknownFields = unknownFields.Build(); return this; } @@ -2331,7 +2192,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } - // optional string name = 1; public bool HasName { get { return result.HasName; } } @@ -2350,7 +2210,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional int32 number = 3; public bool HasNumber { get { return result.HasNumber; } } @@ -2369,9 +2228,8 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional .google.protobuf.FieldDescriptorProto.Label label = 4; public bool HasLabel { - get { return result.HasLabel; } + get { return result.HasLabel; } } public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Label Label { get { return result.Label; } @@ -2388,9 +2246,8 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional .google.protobuf.FieldDescriptorProto.Type type = 5; public bool HasType { - get { return result.HasType; } + get { return result.HasType; } } public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Type Type { get { return result.Type; } @@ -2407,7 +2264,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional string type_name = 6; public bool HasTypeName { get { return result.HasTypeName; } } @@ -2426,7 +2282,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional string extendee = 2; public bool HasExtendee { get { return result.HasExtendee; } } @@ -2445,7 +2300,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional string default_value = 7; public bool HasDefaultValue { get { return result.HasDefaultValue; } } @@ -2464,9 +2318,8 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional .google.protobuf.FieldOptions options = 8; public bool HasOptions { - get { return result.HasOptions; } + get { return result.HasOptions; } } public global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions Options { get { return result.Options; } @@ -2485,8 +2338,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions value) { if (result.HasOptions && result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.DefaultInstance) { - result.options_ = - global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); + result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); } else { result.options_ = value; } @@ -2523,7 +2375,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_EnumDescriptorProto__FieldAccessorTable; } } - // optional string name = 1; private bool hasName; private string name_ = ""; public bool HasName { @@ -2533,19 +2384,17 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return name_; } } - // repeated .google.protobuf.EnumValueDescriptorProto value = 2; private pbc::PopsicleList value_ = new pbc::PopsicleList(); public scg::IList ValueList { - get { return value_; } + get { return value_; } } - public int ValueCount - { get { return value_.Count; } + public int ValueCount { + get { return value_.Count; } } public global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto GetValue(int index) { - return value_ [index]; + return value_[index]; } - // optional .google.protobuf.EnumOptions options = 3; private bool hasOptions; private global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions options_ = global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.DefaultInstance; public bool HasOptions { @@ -2557,6 +2406,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override bool IsInitialized { get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto element in ValueList) { + if (!element.IsInitialized) return false; + } + if (HasOptions) { + if (!Options.IsInitialized) return false; + } return true; } } @@ -2596,62 +2451,50 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto ParseFrom(pb::ByteString data) { + public static EnumDescriptorProto ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto ParseFrom(pb::ByteString data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static EnumDescriptorProto ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto ParseFrom(byte[] data) { + public static EnumDescriptorProto ParseFrom(byte[] data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto ParseFrom(byte[] data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static EnumDescriptorProto ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto ParseFrom(global::System.IO.Stream input) { + public static EnumDescriptorProto ParseFrom(global::System.IO.Stream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto ParseFrom( - global::System.IO.Stream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static EnumDescriptorProto ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto ParseFrom(pb::CodedInputStream input) { + public static EnumDescriptorProto ParseFrom(pb::CodedInputStream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto ParseFrom(pb::CodedInputStream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static EnumDescriptorProto ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static Builder CreateBuilder() { return new Builder(); } public override Builder CreateBuilderForType() { return new Builder(); } - public static Builder CreateBuilder(global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto prototype) { + public static Builder CreateBuilder(EnumDescriptorProto prototype) { return (Builder) new Builder().MergeFrom(prototype); } - public sealed partial class Builder : pb::GeneratedBuilder { + public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } } - - // Construct using global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto.CreateBuilder() public Builder() {} - global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto result = new global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto(); + EnumDescriptorProto result = new EnumDescriptorProto(); - protected override global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto MessageBeingBuilt { + protected override EnumDescriptorProto MessageBeingBuilt { get { return result; } } public override Builder Clear() { - result = new global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto(); + result = new EnumDescriptorProto(); return this; } @@ -2660,31 +2503,31 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override pbd::MessageDescriptor DescriptorForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto.Descriptor; } + get { return EnumDescriptorProto.Descriptor; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto DefaultInstanceForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto.DefaultInstance; } + public override EnumDescriptorProto DefaultInstanceForType { + get { return EnumDescriptorProto.DefaultInstance; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto BuildPartial() { + public override EnumDescriptorProto BuildPartial() { result.value_.MakeReadOnly(); - global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto returnMe = result; + EnumDescriptorProto returnMe = result; result = null; return returnMe; } public override Builder MergeFrom(pb::IMessage other) { - if (other is global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto) { - return MergeFrom((global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto) other); + if (other is EnumDescriptorProto) { + return MergeFrom((EnumDescriptorProto) other); } else { base.MergeFrom(other); return this; } } - public override Builder MergeFrom(global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto other) { - if (other == global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto.DefaultInstance) return this; + public override Builder MergeFrom(EnumDescriptorProto other) { + if (other == EnumDescriptorProto.DefaultInstance) return this; if (other.HasName) { Name = other.Name; } @@ -2703,17 +2546,16 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { - pb::UnknownFieldSet.Builder unknownFields = - pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); while (true) { uint tag = input.ReadTag(); switch (tag) { - case 0: + case 0: { this.UnknownFields = unknownFields.Build(); return this; + } default: { - if (!ParseUnknownField(input, unknownFields, - extensionRegistry, tag)) { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.UnknownFields = unknownFields.Build(); return this; } @@ -2743,7 +2585,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } - // optional string name = 1; public bool HasName { get { return result.HasName; } } @@ -2762,7 +2603,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // repeated .google.protobuf.EnumValueDescriptorProto value = 2; public scg::IList ValueList { get { return result.value_; } } @@ -2797,9 +2637,8 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional .google.protobuf.EnumOptions options = 3; public bool HasOptions { - get { return result.HasOptions; } + get { return result.HasOptions; } } public global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions Options { get { return result.Options; } @@ -2818,8 +2657,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions value) { if (result.HasOptions && result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.DefaultInstance) { - result.options_ = - global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); + result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); } else { result.options_ = value; } @@ -2856,7 +2694,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_EnumValueDescriptorProto__FieldAccessorTable; } } - // optional string name = 1; private bool hasName; private string name_ = ""; public bool HasName { @@ -2866,7 +2703,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return name_; } } - // optional int32 number = 2; private bool hasNumber; private int number_ = 0; public bool HasNumber { @@ -2876,7 +2712,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return number_; } } - // optional .google.protobuf.EnumValueOptions options = 3; private bool hasOptions; private global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions options_ = global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.DefaultInstance; public bool HasOptions { @@ -2888,6 +2723,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override bool IsInitialized { get { + if (HasOptions) { + if (!Options.IsInitialized) return false; + } return true; } } @@ -2927,62 +2765,50 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto ParseFrom(pb::ByteString data) { + public static EnumValueDescriptorProto ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto ParseFrom(pb::ByteString data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static EnumValueDescriptorProto ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto ParseFrom(byte[] data) { + public static EnumValueDescriptorProto ParseFrom(byte[] data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto ParseFrom(byte[] data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static EnumValueDescriptorProto ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto ParseFrom(global::System.IO.Stream input) { + public static EnumValueDescriptorProto ParseFrom(global::System.IO.Stream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto ParseFrom( - global::System.IO.Stream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static EnumValueDescriptorProto ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto ParseFrom(pb::CodedInputStream input) { + public static EnumValueDescriptorProto ParseFrom(pb::CodedInputStream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto ParseFrom(pb::CodedInputStream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static EnumValueDescriptorProto ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static Builder CreateBuilder() { return new Builder(); } public override Builder CreateBuilderForType() { return new Builder(); } - public static Builder CreateBuilder(global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto prototype) { + public static Builder CreateBuilder(EnumValueDescriptorProto prototype) { return (Builder) new Builder().MergeFrom(prototype); } - public sealed partial class Builder : pb::GeneratedBuilder { + public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } } - - // Construct using global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto.CreateBuilder() public Builder() {} - global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto result = new global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto(); + EnumValueDescriptorProto result = new EnumValueDescriptorProto(); - protected override global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto MessageBeingBuilt { + protected override EnumValueDescriptorProto MessageBeingBuilt { get { return result; } } public override Builder Clear() { - result = new global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto(); + result = new EnumValueDescriptorProto(); return this; } @@ -2991,30 +2817,30 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override pbd::MessageDescriptor DescriptorForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto.Descriptor; } + get { return EnumValueDescriptorProto.Descriptor; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto DefaultInstanceForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto.DefaultInstance; } + public override EnumValueDescriptorProto DefaultInstanceForType { + get { return EnumValueDescriptorProto.DefaultInstance; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto BuildPartial() { - global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto returnMe = result; + public override EnumValueDescriptorProto BuildPartial() { + EnumValueDescriptorProto returnMe = result; result = null; return returnMe; } public override Builder MergeFrom(pb::IMessage other) { - if (other is global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto) { - return MergeFrom((global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto) other); + if (other is EnumValueDescriptorProto) { + return MergeFrom((EnumValueDescriptorProto) other); } else { base.MergeFrom(other); return this; } } - public override Builder MergeFrom(global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto other) { - if (other == global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto.DefaultInstance) return this; + public override Builder MergeFrom(EnumValueDescriptorProto other) { + if (other == EnumValueDescriptorProto.DefaultInstance) return this; if (other.HasName) { Name = other.Name; } @@ -3033,17 +2859,16 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { - pb::UnknownFieldSet.Builder unknownFields = - pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); while (true) { uint tag = input.ReadTag(); switch (tag) { - case 0: + case 0: { this.UnknownFields = unknownFields.Build(); return this; + } default: { - if (!ParseUnknownField(input, unknownFields, - extensionRegistry, tag)) { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.UnknownFields = unknownFields.Build(); return this; } @@ -3071,7 +2896,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } - // optional string name = 1; public bool HasName { get { return result.HasName; } } @@ -3090,7 +2914,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional int32 number = 2; public bool HasNumber { get { return result.HasNumber; } } @@ -3109,9 +2932,8 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional .google.protobuf.EnumValueOptions options = 3; public bool HasOptions { - get { return result.HasOptions; } + get { return result.HasOptions; } } public global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions Options { get { return result.Options; } @@ -3130,8 +2952,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions value) { if (result.HasOptions && result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.DefaultInstance) { - result.options_ = - global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); + result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); } else { result.options_ = value; } @@ -3168,7 +2989,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_ServiceDescriptorProto__FieldAccessorTable; } } - // optional string name = 1; private bool hasName; private string name_ = ""; public bool HasName { @@ -3178,19 +2998,17 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return name_; } } - // repeated .google.protobuf.MethodDescriptorProto method = 2; private pbc::PopsicleList method_ = new pbc::PopsicleList(); public scg::IList MethodList { - get { return method_; } + get { return method_; } } - public int MethodCount - { get { return method_.Count; } + public int MethodCount { + get { return method_.Count; } } public global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto GetMethod(int index) { - return method_ [index]; + return method_[index]; } - // optional .google.protobuf.ServiceOptions options = 3; private bool hasOptions; private global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions options_ = global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.DefaultInstance; public bool HasOptions { @@ -3202,6 +3020,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override bool IsInitialized { get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto element in MethodList) { + if (!element.IsInitialized) return false; + } + if (HasOptions) { + if (!Options.IsInitialized) return false; + } return true; } } @@ -3241,62 +3065,50 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } } - public static global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto ParseFrom(pb::ByteString data) { + public static ServiceDescriptorProto ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto ParseFrom(pb::ByteString data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static ServiceDescriptorProto ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto ParseFrom(byte[] data) { + public static ServiceDescriptorProto ParseFrom(byte[] data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto ParseFrom(byte[] data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static ServiceDescriptorProto ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto ParseFrom(global::System.IO.Stream input) { + public static ServiceDescriptorProto ParseFrom(global::System.IO.Stream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto ParseFrom( - global::System.IO.Stream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static ServiceDescriptorProto ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto ParseFrom(pb::CodedInputStream input) { + public static ServiceDescriptorProto ParseFrom(pb::CodedInputStream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto ParseFrom(pb::CodedInputStream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static ServiceDescriptorProto ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static Builder CreateBuilder() { return new Builder(); } public override Builder CreateBuilderForType() { return new Builder(); } - public static Builder CreateBuilder(global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto prototype) { + public static Builder CreateBuilder(ServiceDescriptorProto prototype) { return (Builder) new Builder().MergeFrom(prototype); } - public sealed partial class Builder : pb::GeneratedBuilder { + public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } } - - // Construct using global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto.CreateBuilder() public Builder() {} - global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto result = new global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto(); + ServiceDescriptorProto result = new ServiceDescriptorProto(); - protected override global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto MessageBeingBuilt { + protected override ServiceDescriptorProto MessageBeingBuilt { get { return result; } } public override Builder Clear() { - result = new global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto(); + result = new ServiceDescriptorProto(); return this; } @@ -3305,31 +3117,31 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override pbd::MessageDescriptor DescriptorForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto.Descriptor; } + get { return ServiceDescriptorProto.Descriptor; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto DefaultInstanceForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto.DefaultInstance; } + public override ServiceDescriptorProto DefaultInstanceForType { + get { return ServiceDescriptorProto.DefaultInstance; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto BuildPartial() { + public override ServiceDescriptorProto BuildPartial() { result.method_.MakeReadOnly(); - global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto returnMe = result; + ServiceDescriptorProto returnMe = result; result = null; return returnMe; } public override Builder MergeFrom(pb::IMessage other) { - if (other is global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto) { - return MergeFrom((global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto) other); + if (other is ServiceDescriptorProto) { + return MergeFrom((ServiceDescriptorProto) other); } else { base.MergeFrom(other); return this; } } - public override Builder MergeFrom(global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto other) { - if (other == global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto.DefaultInstance) return this; + public override Builder MergeFrom(ServiceDescriptorProto other) { + if (other == ServiceDescriptorProto.DefaultInstance) return this; if (other.HasName) { Name = other.Name; } @@ -3348,17 +3160,16 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { - pb::UnknownFieldSet.Builder unknownFields = - pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); while (true) { uint tag = input.ReadTag(); switch (tag) { - case 0: + case 0: { this.UnknownFields = unknownFields.Build(); return this; + } default: { - if (!ParseUnknownField(input, unknownFields, - extensionRegistry, tag)) { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.UnknownFields = unknownFields.Build(); return this; } @@ -3388,7 +3199,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } - // optional string name = 1; public bool HasName { get { return result.HasName; } } @@ -3407,7 +3217,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // repeated .google.protobuf.MethodDescriptorProto method = 2; public scg::IList MethodList { get { return result.method_; } } @@ -3442,9 +3251,8 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional .google.protobuf.ServiceOptions options = 3; public bool HasOptions { - get { return result.HasOptions; } + get { return result.HasOptions; } } public global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions Options { get { return result.Options; } @@ -3463,8 +3271,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions value) { if (result.HasOptions && result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.DefaultInstance) { - result.options_ = - global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); + result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); } else { result.options_ = value; } @@ -3501,7 +3308,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_MethodDescriptorProto__FieldAccessorTable; } } - // optional string name = 1; private bool hasName; private string name_ = ""; public bool HasName { @@ -3511,7 +3317,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return name_; } } - // optional string input_type = 2; private bool hasInputType; private string inputType_ = ""; public bool HasInputType { @@ -3521,7 +3326,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return inputType_; } } - // optional string output_type = 3; private bool hasOutputType; private string outputType_ = ""; public bool HasOutputType { @@ -3531,7 +3335,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return outputType_; } } - // optional .google.protobuf.MethodOptions options = 4; private bool hasOptions; private global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions options_ = global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.DefaultInstance; public bool HasOptions { @@ -3543,6 +3346,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override bool IsInitialized { get { + if (HasOptions) { + if (!Options.IsInitialized) return false; + } return true; } } @@ -3588,62 +3394,50 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } } - public static global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto ParseFrom(pb::ByteString data) { + public static MethodDescriptorProto ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto ParseFrom(pb::ByteString data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static MethodDescriptorProto ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto ParseFrom(byte[] data) { + public static MethodDescriptorProto ParseFrom(byte[] data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto ParseFrom(byte[] data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static MethodDescriptorProto ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto ParseFrom(global::System.IO.Stream input) { + public static MethodDescriptorProto ParseFrom(global::System.IO.Stream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto ParseFrom( - global::System.IO.Stream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static MethodDescriptorProto ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto ParseFrom(pb::CodedInputStream input) { + public static MethodDescriptorProto ParseFrom(pb::CodedInputStream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto ParseFrom(pb::CodedInputStream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static MethodDescriptorProto ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static Builder CreateBuilder() { return new Builder(); } public override Builder CreateBuilderForType() { return new Builder(); } - public static Builder CreateBuilder(global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto prototype) { + public static Builder CreateBuilder(MethodDescriptorProto prototype) { return (Builder) new Builder().MergeFrom(prototype); } - public sealed partial class Builder : pb::GeneratedBuilder { + public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } } - - // Construct using global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto.CreateBuilder() public Builder() {} - global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto result = new global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto(); + MethodDescriptorProto result = new MethodDescriptorProto(); - protected override global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto MessageBeingBuilt { + protected override MethodDescriptorProto MessageBeingBuilt { get { return result; } } public override Builder Clear() { - result = new global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto(); + result = new MethodDescriptorProto(); return this; } @@ -3652,30 +3446,30 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override pbd::MessageDescriptor DescriptorForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto.Descriptor; } + get { return MethodDescriptorProto.Descriptor; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto DefaultInstanceForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto.DefaultInstance; } + public override MethodDescriptorProto DefaultInstanceForType { + get { return MethodDescriptorProto.DefaultInstance; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto BuildPartial() { - global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto returnMe = result; + public override MethodDescriptorProto BuildPartial() { + MethodDescriptorProto returnMe = result; result = null; return returnMe; } public override Builder MergeFrom(pb::IMessage other) { - if (other is global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto) { - return MergeFrom((global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto) other); + if (other is MethodDescriptorProto) { + return MergeFrom((MethodDescriptorProto) other); } else { base.MergeFrom(other); return this; } } - public override Builder MergeFrom(global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto other) { - if (other == global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto.DefaultInstance) return this; + public override Builder MergeFrom(MethodDescriptorProto other) { + if (other == MethodDescriptorProto.DefaultInstance) return this; if (other.HasName) { Name = other.Name; } @@ -3697,17 +3491,16 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { - pb::UnknownFieldSet.Builder unknownFields = - pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); while (true) { uint tag = input.ReadTag(); switch (tag) { - case 0: + case 0: { this.UnknownFields = unknownFields.Build(); return this; + } default: { - if (!ParseUnknownField(input, unknownFields, - extensionRegistry, tag)) { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.UnknownFields = unknownFields.Build(); return this; } @@ -3739,7 +3532,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } - // optional string name = 1; public bool HasName { get { return result.HasName; } } @@ -3758,7 +3550,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional string input_type = 2; public bool HasInputType { get { return result.HasInputType; } } @@ -3777,7 +3568,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional string output_type = 3; public bool HasOutputType { get { return result.HasOutputType; } } @@ -3796,9 +3586,8 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional .google.protobuf.MethodOptions options = 4; public bool HasOptions { - get { return result.HasOptions; } + get { return result.HasOptions; } } public global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions Options { get { return result.Options; } @@ -3817,8 +3606,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions value) { if (result.HasOptions && result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.DefaultInstance) { - result.options_ = - global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); + result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); } else { result.options_ = value; } @@ -3833,7 +3621,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } } - public sealed partial class FileOptions : pb::GeneratedMessage { + public sealed partial class FileOptions : pb::ExtendableMessage { private static readonly FileOptions defaultInstance = new Builder().BuildPartial(); public static FileOptions DefaultInstance { get { return defaultInstance; } @@ -3865,7 +3653,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } #endregion - // optional string java_package = 1; private bool hasJavaPackage; private string javaPackage_ = ""; public bool HasJavaPackage { @@ -3875,7 +3662,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return javaPackage_; } } - // optional string java_outer_classname = 8; private bool hasJavaOuterClassname; private string javaOuterClassname_ = ""; public bool HasJavaOuterClassname { @@ -3885,7 +3671,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return javaOuterClassname_; } } - // optional bool java_multiple_files = 10 [default = false]; private bool hasJavaMultipleFiles; private bool javaMultipleFiles_ = false; public bool HasJavaMultipleFiles { @@ -3895,71 +3680,37 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return javaMultipleFiles_; } } - // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = CODE_SIZE]; private bool hasOptimizeFor; private global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Types.OptimizeMode optimizeFor_ = global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Types.OptimizeMode.CODE_SIZE; public bool HasOptimizeFor { get { return hasOptimizeFor; } } - public global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Types.OptimizeMode OptimizeFor { get { return optimizeFor_; }} - - // optional string csharp_namespace = 1000; - private bool hasCsharpNamespace; - private string csharpNamespace_ = ""; - public bool HasCsharpNamespace { - get { return hasCsharpNamespace; } - } - public string CsharpNamespace { - get { return csharpNamespace_; } - } - - // optional string csharp_file_classname = 1001; - private bool hasCsharpFileClassname; - private string csharpFileClassname_ = ""; - public bool HasCsharpFileClassname { - get { return hasCsharpFileClassname; } - } - public string CsharpFileClassname { - get { return csharpFileClassname_; } + public global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Types.OptimizeMode OptimizeFor { + get { return optimizeFor_; } } - // optional bool csharp_multiple_files = 1002 [default = false]; - private bool hasCsharpMultipleFiles; - private bool csharpMultipleFiles_ = false; - public bool HasCsharpMultipleFiles { - get { return hasCsharpMultipleFiles; } + private pbc::PopsicleList uninterpretedOption_ = new pbc::PopsicleList(); + public scg::IList UninterpretedOptionList { + get { return uninterpretedOption_; } } - public bool CsharpMultipleFiles { - get { return csharpMultipleFiles_; } + public int UninterpretedOptionCount { + get { return uninterpretedOption_.Count; } } - - // optional bool csharp_nest_classes = 1003 [default = false]; - private bool hasCsharpNestClasses; - private bool csharpNestClasses_ = false; - public bool HasCsharpNestClasses { - get { return hasCsharpNestClasses; } - } - public bool CsharpNestClasses { - get { return csharpNestClasses_; } - } - - // optional bool csharp_public_classes = 1004 [default = true]; - private bool hasCsharpPublicClasses; - private bool csharpPublicClasses_ = true; - public bool HasCsharpPublicClasses { - get { return hasCsharpPublicClasses; } - } - public bool CsharpPublicClasses { - get { return csharpPublicClasses_; } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return uninterpretedOption_[index]; } public override bool IsInitialized { get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + if (!element.IsInitialized) return false; + } return true; } } public override void WriteTo(pb::CodedOutputStream output) { + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); if (HasJavaPackage) { output.WriteString(1, JavaPackage); } @@ -3972,21 +3723,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos { if (HasJavaMultipleFiles) { output.WriteBool(10, JavaMultipleFiles); } - if (HasCsharpNamespace) { - output.WriteString(1000, CsharpNamespace); - } - if (HasCsharpFileClassname) { - output.WriteString(1001, CsharpFileClassname); - } - if (HasCsharpMultipleFiles) { - output.WriteBool(1002, CsharpMultipleFiles); - } - if (HasCsharpNestClasses) { - output.WriteBool(1003, CsharpNestClasses); - } - if (HasCsharpPublicClasses) { - output.WriteBool(1004, CsharpPublicClasses); + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + output.WriteMessage(999, element); } + extensionWriter.WriteUntil(536870912, output); UnknownFields.WriteTo(output); } @@ -4003,90 +3743,66 @@ namespace Google.ProtocolBuffers.DescriptorProtos { if (HasJavaOuterClassname) { size += pb::CodedOutputStream.ComputeStringSize(8, JavaOuterClassname); } - if (HasOptimizeFor) { - size += pb::CodedOutputStream - .ComputeEnumSize(9, (int) OptimizeFor); - } if (HasJavaMultipleFiles) { size += pb::CodedOutputStream.ComputeBoolSize(10, JavaMultipleFiles); } - if (HasCsharpNamespace) { - size += pb::CodedOutputStream.ComputeStringSize(1000, CsharpNamespace); - } - if (HasCsharpFileClassname) { - size += pb::CodedOutputStream.ComputeStringSize(1001, CsharpFileClassname); - } - if (HasCsharpMultipleFiles) { - size += pb::CodedOutputStream.ComputeBoolSize(1002, CsharpMultipleFiles); - } - if (HasCsharpNestClasses) { - size += pb::CodedOutputStream.ComputeBoolSize(1003, CsharpNestClasses); + if (HasOptimizeFor) { + size += pb::CodedOutputStream.ComputeEnumSize(9, (int) OptimizeFor); } - if (HasCsharpPublicClasses) { - size += pb::CodedOutputStream.ComputeBoolSize(1004, CsharpPublicClasses); + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); } + size += ExtensionsSerializedSize; size += UnknownFields.SerializedSize; memoizedSerializedSize = size; return size; } } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileOptions ParseFrom(pb::ByteString data) { + public static FileOptions ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileOptions ParseFrom(pb::ByteString data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static FileOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileOptions ParseFrom(byte[] data) { + public static FileOptions ParseFrom(byte[] data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileOptions ParseFrom(byte[] data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static FileOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileOptions ParseFrom(global::System.IO.Stream input) { + public static FileOptions ParseFrom(global::System.IO.Stream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileOptions ParseFrom( - global::System.IO.Stream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static FileOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileOptions ParseFrom(pb::CodedInputStream input) { + public static FileOptions ParseFrom(pb::CodedInputStream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FileOptions ParseFrom(pb::CodedInputStream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static FileOptions ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static Builder CreateBuilder() { return new Builder(); } public override Builder CreateBuilderForType() { return new Builder(); } - public static Builder CreateBuilder(global::Google.ProtocolBuffers.DescriptorProtos.FileOptions prototype) { + public static Builder CreateBuilder(FileOptions prototype) { return (Builder) new Builder().MergeFrom(prototype); } - public sealed partial class Builder : pb::GeneratedBuilder { + public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } } - - // Construct using global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.CreateBuilder() public Builder() {} - global::Google.ProtocolBuffers.DescriptorProtos.FileOptions result = new global::Google.ProtocolBuffers.DescriptorProtos.FileOptions(); + FileOptions result = new FileOptions(); - protected override global::Google.ProtocolBuffers.DescriptorProtos.FileOptions MessageBeingBuilt { + protected override FileOptions MessageBeingBuilt { get { return result; } } public override Builder Clear() { - result = new global::Google.ProtocolBuffers.DescriptorProtos.FileOptions(); + result = new FileOptions(); return this; } @@ -4095,30 +3811,31 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override pbd::MessageDescriptor DescriptorForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Descriptor; } + get { return FileOptions.Descriptor; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.FileOptions DefaultInstanceForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.DefaultInstance; } + public override FileOptions DefaultInstanceForType { + get { return FileOptions.DefaultInstance; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.FileOptions BuildPartial() { - global::Google.ProtocolBuffers.DescriptorProtos.FileOptions returnMe = result; + public override FileOptions BuildPartial() { + result.uninterpretedOption_.MakeReadOnly(); + FileOptions returnMe = result; result = null; return returnMe; } public override Builder MergeFrom(pb::IMessage other) { - if (other is global::Google.ProtocolBuffers.DescriptorProtos.FileOptions) { - return MergeFrom((global::Google.ProtocolBuffers.DescriptorProtos.FileOptions) other); + if (other is FileOptions) { + return MergeFrom((FileOptions) other); } else { base.MergeFrom(other); return this; } } - public override Builder MergeFrom(global::Google.ProtocolBuffers.DescriptorProtos.FileOptions other) { - if (other == global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.DefaultInstance) return this; + public override Builder MergeFrom(FileOptions other) { + if (other == FileOptions.DefaultInstance) return this; if (other.HasJavaPackage) { JavaPackage = other.JavaPackage; } @@ -4131,20 +3848,8 @@ namespace Google.ProtocolBuffers.DescriptorProtos { if (other.HasOptimizeFor) { OptimizeFor = other.OptimizeFor; } - if (other.HasCsharpNamespace) { - CsharpNamespace = other.CsharpNamespace; - } - if (other.HasCsharpFileClassname) { - CsharpFileClassname = other.CsharpFileClassname; - } - if (other.HasCsharpMultipleFiles) { - CsharpMultipleFiles = other.CsharpMultipleFiles; - } - if (other.HasCsharpNestClasses) { - CsharpNestClasses = other.CsharpNestClasses; - } - if (other.HasCsharpPublicClasses) { - CsharpPublicClasses = other.CsharpPublicClasses; + if (other.uninterpretedOption_.Count != 0) { + base.AddRange(other.uninterpretedOption_, result.uninterpretedOption_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -4155,17 +3860,16 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { - pb::UnknownFieldSet.Builder unknownFields = - pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); while (true) { uint tag = input.ReadTag(); switch (tag) { - case 0: + case 0: { this.UnknownFields = unknownFields.Build(); return this; + } default: { - if (!ParseUnknownField(input, unknownFields, - extensionRegistry, tag)) { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.UnknownFields = unknownFields.Build(); return this; } @@ -4192,24 +3896,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos { JavaMultipleFiles = input.ReadBool(); break; } - case 8002: { - CsharpNamespace = input.ReadString(); - break; - } - case 8010: { - CsharpFileClassname = input.ReadString(); - break; - } - case 8016: { - CsharpMultipleFiles = input.ReadBool(); - break; - } - case 8024: { - CsharpNestClasses = input.ReadBool(); - break; - } - case 8032: { - CsharpPublicClasses = input.ReadBool(); + case 7994: { + global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder subBuilder = global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.CreateBuilder(); + input.ReadMessage(subBuilder, extensionRegistry); + AddUninterpretedOption(subBuilder.BuildPartial()); break; } } @@ -4217,7 +3907,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } - // optional string java_package = 1; public bool HasJavaPackage { get { return result.HasJavaPackage; } } @@ -4236,7 +3925,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional string java_outer_classname = 8; public bool HasJavaOuterClassname { get { return result.HasJavaOuterClassname; } } @@ -4255,7 +3943,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional bool java_multiple_files = 10 [default = false]; public bool HasJavaMultipleFiles { get { return result.HasJavaMultipleFiles; } } @@ -4274,9 +3961,8 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = CODE_SIZE]; public bool HasOptimizeFor { - get { return result.HasOptimizeFor; } + get { return result.HasOptimizeFor; } } public global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Types.OptimizeMode OptimizeFor { get { return result.OptimizeFor; } @@ -4293,104 +3979,43 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional string csharp_namespace = 1000; - public bool HasCsharpNamespace { - get { return result.HasCsharpNamespace; } - } - public string CsharpNamespace { - get { return result.CsharpNamespace; } - set { SetCsharpNamespace(value); } - } - public Builder SetCsharpNamespace(string value) { - result.hasCsharpNamespace = true; - result.csharpNamespace_ = value; - return this; - } - public Builder ClearCsharpNamespace() { - result.hasCsharpNamespace = false; - result.csharpNamespace_ = ""; - return this; - } - - // optional string csharp_file_classname = 1001; - public bool HasCsharpFileClassname { - get { return result.HasCsharpFileClassname; } - } - public string CsharpFileClassname { - get { return result.CsharpFileClassname; } - set { SetCsharpFileClassname(value); } + public scg::IList UninterpretedOptionList { + get { return result.uninterpretedOption_; } } - public Builder SetCsharpFileClassname(string value) { - result.hasCsharpFileClassname = true; - result.csharpFileClassname_ = value; - return this; - } - public Builder ClearCsharpFileClassname() { - result.hasCsharpFileClassname = false; - result.csharpFileClassname_ = ""; - return this; - } - - // optional bool csharp_multiple_files = 1002 [default = false]; - public bool HasCsharpMultipleFiles { - get { return result.HasCsharpMultipleFiles; } + public int UninterpretedOptionCount { + get { return result.UninterpretedOptionCount; } } - public bool CsharpMultipleFiles { - get { return result.CsharpMultipleFiles; } - set { SetCsharpMultipleFiles(value); } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return result.GetUninterpretedOption(index); } - public Builder SetCsharpMultipleFiles(bool value) { - result.hasCsharpMultipleFiles = true; - result.csharpMultipleFiles_ = value; + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + result.uninterpretedOption_[index] = value; return this; } - public Builder ClearCsharpMultipleFiles() { - result.hasCsharpMultipleFiles = false; - result.csharpMultipleFiles_ = false; + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + result.uninterpretedOption_[index] = builderForValue.Build(); return this; } - - // optional bool csharp_nest_classes = 1003 [default = false]; - public bool HasCsharpNestClasses { - get { return result.HasCsharpNestClasses; } - } - public bool CsharpNestClasses { - get { return result.CsharpNestClasses; } - set { SetCsharpNestClasses(value); } - } - public Builder SetCsharpNestClasses(bool value) { - result.hasCsharpNestClasses = true; - result.csharpNestClasses_ = value; + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + result.uninterpretedOption_.Add(value); return this; } - public Builder ClearCsharpNestClasses() { - result.hasCsharpNestClasses = false; - result.csharpNestClasses_ = false; + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + result.uninterpretedOption_.Add(builderForValue.Build()); return this; } - - // optional bool csharp_public_classes = 1004 [default = true]; - public bool HasCsharpPublicClasses { - get { return result.HasCsharpPublicClasses; } - } - public bool CsharpPublicClasses { - get { return result.CsharpPublicClasses; } - set { SetCsharpPublicClasses(value); } - } - public Builder SetCsharpPublicClasses(bool value) { - result.hasCsharpPublicClasses = true; - result.csharpPublicClasses_ = value; + public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + base.AddRange(values, result.uninterpretedOption_); return this; } - public Builder ClearCsharpPublicClasses() { - result.hasCsharpPublicClasses = false; - result.csharpPublicClasses_ = true; + public Builder ClearUninterpretedOption() { + result.uninterpretedOption_.Clear(); return this; } } } - public sealed partial class MessageOptions : pb::GeneratedMessage { + public sealed partial class MessageOptions : pb::ExtendableMessage { private static readonly MessageOptions defaultInstance = new Builder().BuildPartial(); public static MessageOptions DefaultInstance { get { return defaultInstance; } @@ -4412,7 +4037,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_MessageOptions__FieldAccessorTable; } } - // optional bool message_set_wire_format = 1 [default = false]; private bool hasMessageSetWireFormat; private bool messageSetWireFormat_ = false; public bool HasMessageSetWireFormat { @@ -4422,16 +4046,35 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return messageSetWireFormat_; } } + private pbc::PopsicleList uninterpretedOption_ = new pbc::PopsicleList(); + public scg::IList UninterpretedOptionList { + get { return uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return uninterpretedOption_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return uninterpretedOption_[index]; + } + public override bool IsInitialized { get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + if (!element.IsInitialized) return false; + } return true; } } public override void WriteTo(pb::CodedOutputStream output) { + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); if (HasMessageSetWireFormat) { output.WriteBool(1, MessageSetWireFormat); } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + output.WriteMessage(999, element); + } + extensionWriter.WriteUntil(536870912, output); UnknownFields.WriteTo(output); } @@ -4445,68 +4088,60 @@ namespace Google.ProtocolBuffers.DescriptorProtos { if (HasMessageSetWireFormat) { size += pb::CodedOutputStream.ComputeBoolSize(1, MessageSetWireFormat); } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } + size += ExtensionsSerializedSize; size += UnknownFields.SerializedSize; memoizedSerializedSize = size; return size; } } - public static global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions ParseFrom(pb::ByteString data) { + public static MessageOptions ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions ParseFrom(pb::ByteString data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static MessageOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions ParseFrom(byte[] data) { + public static MessageOptions ParseFrom(byte[] data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions ParseFrom(byte[] data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static MessageOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions ParseFrom(global::System.IO.Stream input) { + public static MessageOptions ParseFrom(global::System.IO.Stream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions ParseFrom( - global::System.IO.Stream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static MessageOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions ParseFrom(pb::CodedInputStream input) { + public static MessageOptions ParseFrom(pb::CodedInputStream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions ParseFrom(pb::CodedInputStream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static MessageOptions ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static Builder CreateBuilder() { return new Builder(); } public override Builder CreateBuilderForType() { return new Builder(); } - public static Builder CreateBuilder(global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions prototype) { + public static Builder CreateBuilder(MessageOptions prototype) { return (Builder) new Builder().MergeFrom(prototype); } - public sealed partial class Builder : pb::GeneratedBuilder { + public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } } - - // Construct using global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.CreateBuilder() public Builder() {} - global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions result = new global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions(); + MessageOptions result = new MessageOptions(); - protected override global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions MessageBeingBuilt { + protected override MessageOptions MessageBeingBuilt { get { return result; } } public override Builder Clear() { - result = new global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions(); + result = new MessageOptions(); return this; } @@ -4515,33 +4150,37 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override pbd::MessageDescriptor DescriptorForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.Descriptor; } + get { return MessageOptions.Descriptor; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions DefaultInstanceForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.DefaultInstance; } + public override MessageOptions DefaultInstanceForType { + get { return MessageOptions.DefaultInstance; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions BuildPartial() { - global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions returnMe = result; + public override MessageOptions BuildPartial() { + result.uninterpretedOption_.MakeReadOnly(); + MessageOptions returnMe = result; result = null; return returnMe; } public override Builder MergeFrom(pb::IMessage other) { - if (other is global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions) { - return MergeFrom((global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions) other); + if (other is MessageOptions) { + return MergeFrom((MessageOptions) other); } else { base.MergeFrom(other); return this; } } - public override Builder MergeFrom(global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions other) { - if (other == global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.DefaultInstance) return this; + public override Builder MergeFrom(MessageOptions other) { + if (other == MessageOptions.DefaultInstance) return this; if (other.HasMessageSetWireFormat) { MessageSetWireFormat = other.MessageSetWireFormat; } + if (other.uninterpretedOption_.Count != 0) { + base.AddRange(other.uninterpretedOption_, result.uninterpretedOption_); + } this.MergeUnknownFields(other.UnknownFields); return this; } @@ -4551,17 +4190,16 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { - pb::UnknownFieldSet.Builder unknownFields = - pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); while (true) { uint tag = input.ReadTag(); switch (tag) { - case 0: + case 0: { this.UnknownFields = unknownFields.Build(); return this; + } default: { - if (!ParseUnknownField(input, unknownFields, - extensionRegistry, tag)) { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.UnknownFields = unknownFields.Build(); return this; } @@ -4571,12 +4209,17 @@ namespace Google.ProtocolBuffers.DescriptorProtos { MessageSetWireFormat = input.ReadBool(); break; } + case 7994: { + global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder subBuilder = global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.CreateBuilder(); + input.ReadMessage(subBuilder, extensionRegistry); + AddUninterpretedOption(subBuilder.BuildPartial()); + break; + } } } } - // optional bool message_set_wire_format = 1 [default = false]; public bool HasMessageSetWireFormat { get { return result.HasMessageSetWireFormat; } } @@ -4594,10 +4237,44 @@ namespace Google.ProtocolBuffers.DescriptorProtos { result.messageSetWireFormat_ = false; return this; } + + public scg::IList UninterpretedOptionList { + get { return result.uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return result.UninterpretedOptionCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return result.GetUninterpretedOption(index); + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + result.uninterpretedOption_[index] = value; + return this; + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + result.uninterpretedOption_[index] = builderForValue.Build(); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + result.uninterpretedOption_.Add(value); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + result.uninterpretedOption_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + base.AddRange(values, result.uninterpretedOption_); + return this; + } + public Builder ClearUninterpretedOption() { + result.uninterpretedOption_.Clear(); + return this; + } } } - public sealed partial class FieldOptions : pb::GeneratedMessage { + public sealed partial class FieldOptions : pb::ExtendableMessage { private static readonly FieldOptions defaultInstance = new Builder().BuildPartial(); public static FieldOptions DefaultInstance { get { return defaultInstance; } @@ -4629,15 +4306,15 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } #endregion - // optional .google.protobuf.FieldOptions.CType ctype = 1; private bool hasCtype; private global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.Types.CType ctype_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.Types.CType.CORD; public bool HasCtype { get { return hasCtype; } } - public global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.Types.CType Ctype { get { return ctype_; }} + public global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.Types.CType Ctype { + get { return ctype_; } + } - // optional string experimental_map_key = 9; private bool hasExperimentalMapKey; private string experimentalMapKey_ = ""; public bool HasExperimentalMapKey { @@ -4647,19 +4324,38 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return experimentalMapKey_; } } + private pbc::PopsicleList uninterpretedOption_ = new pbc::PopsicleList(); + public scg::IList UninterpretedOptionList { + get { return uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return uninterpretedOption_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return uninterpretedOption_[index]; + } + public override bool IsInitialized { get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + if (!element.IsInitialized) return false; + } return true; } } public override void WriteTo(pb::CodedOutputStream output) { + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); if (HasCtype) { output.WriteEnum(1, (int) Ctype); } if (HasExperimentalMapKey) { output.WriteString(9, ExperimentalMapKey); } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + output.WriteMessage(999, element); + } + extensionWriter.WriteUntil(536870912, output); UnknownFields.WriteTo(output); } @@ -4671,74 +4367,65 @@ namespace Google.ProtocolBuffers.DescriptorProtos { size = 0; if (HasCtype) { - size += pb::CodedOutputStream - .ComputeEnumSize(1, (int) Ctype); + size += pb::CodedOutputStream.ComputeEnumSize(1, (int) Ctype); } if (HasExperimentalMapKey) { size += pb::CodedOutputStream.ComputeStringSize(9, ExperimentalMapKey); } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } + size += ExtensionsSerializedSize; size += UnknownFields.SerializedSize; memoizedSerializedSize = size; return size; } } - public static global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions ParseFrom(pb::ByteString data) { + public static FieldOptions ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions ParseFrom(pb::ByteString data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static FieldOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions ParseFrom(byte[] data) { + public static FieldOptions ParseFrom(byte[] data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions ParseFrom(byte[] data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static FieldOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions ParseFrom(global::System.IO.Stream input) { + public static FieldOptions ParseFrom(global::System.IO.Stream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions ParseFrom( - global::System.IO.Stream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static FieldOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions ParseFrom(pb::CodedInputStream input) { + public static FieldOptions ParseFrom(pb::CodedInputStream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions ParseFrom(pb::CodedInputStream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static FieldOptions ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static Builder CreateBuilder() { return new Builder(); } public override Builder CreateBuilderForType() { return new Builder(); } - public static Builder CreateBuilder(global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions prototype) { + public static Builder CreateBuilder(FieldOptions prototype) { return (Builder) new Builder().MergeFrom(prototype); } - public sealed partial class Builder : pb::GeneratedBuilder { + public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } } - - // Construct using global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.CreateBuilder() public Builder() {} - global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions result = new global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions(); + FieldOptions result = new FieldOptions(); - protected override global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions MessageBeingBuilt { + protected override FieldOptions MessageBeingBuilt { get { return result; } } public override Builder Clear() { - result = new global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions(); + result = new FieldOptions(); return this; } @@ -4747,36 +4434,40 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override pbd::MessageDescriptor DescriptorForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.Descriptor; } + get { return FieldOptions.Descriptor; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions DefaultInstanceForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.DefaultInstance; } + public override FieldOptions DefaultInstanceForType { + get { return FieldOptions.DefaultInstance; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions BuildPartial() { - global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions returnMe = result; + public override FieldOptions BuildPartial() { + result.uninterpretedOption_.MakeReadOnly(); + FieldOptions returnMe = result; result = null; return returnMe; } public override Builder MergeFrom(pb::IMessage other) { - if (other is global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions) { - return MergeFrom((global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions) other); + if (other is FieldOptions) { + return MergeFrom((FieldOptions) other); } else { base.MergeFrom(other); return this; } } - public override Builder MergeFrom(global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions other) { - if (other == global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.DefaultInstance) return this; + public override Builder MergeFrom(FieldOptions other) { + if (other == FieldOptions.DefaultInstance) return this; if (other.HasCtype) { Ctype = other.Ctype; } if (other.HasExperimentalMapKey) { ExperimentalMapKey = other.ExperimentalMapKey; } + if (other.uninterpretedOption_.Count != 0) { + base.AddRange(other.uninterpretedOption_, result.uninterpretedOption_); + } this.MergeUnknownFields(other.UnknownFields); return this; } @@ -4786,17 +4477,16 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { - pb::UnknownFieldSet.Builder unknownFields = - pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); while (true) { uint tag = input.ReadTag(); switch (tag) { - case 0: + case 0: { this.UnknownFields = unknownFields.Build(); return this; + } default: { - if (!ParseUnknownField(input, unknownFields, - extensionRegistry, tag)) { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.UnknownFields = unknownFields.Build(); return this; } @@ -4815,14 +4505,19 @@ namespace Google.ProtocolBuffers.DescriptorProtos { ExperimentalMapKey = input.ReadString(); break; } + case 7994: { + global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder subBuilder = global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.CreateBuilder(); + input.ReadMessage(subBuilder, extensionRegistry); + AddUninterpretedOption(subBuilder.BuildPartial()); + break; + } } } } - // optional .google.protobuf.FieldOptions.CType ctype = 1; public bool HasCtype { - get { return result.HasCtype; } + get { return result.HasCtype; } } public global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.Types.CType Ctype { get { return result.Ctype; } @@ -4839,7 +4534,6 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } - // optional string experimental_map_key = 9; public bool HasExperimentalMapKey { get { return result.HasExperimentalMapKey; } } @@ -4857,10 +4551,44 @@ namespace Google.ProtocolBuffers.DescriptorProtos { result.experimentalMapKey_ = ""; return this; } + + public scg::IList UninterpretedOptionList { + get { return result.uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return result.UninterpretedOptionCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return result.GetUninterpretedOption(index); + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + result.uninterpretedOption_[index] = value; + return this; + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + result.uninterpretedOption_[index] = builderForValue.Build(); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + result.uninterpretedOption_.Add(value); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + result.uninterpretedOption_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + base.AddRange(values, result.uninterpretedOption_); + return this; + } + public Builder ClearUninterpretedOption() { + result.uninterpretedOption_.Clear(); + return this; + } } } - public sealed partial class EnumOptions : pb::GeneratedMessage { + public sealed partial class EnumOptions : pb::ExtendableMessage { private static readonly EnumOptions defaultInstance = new Builder().BuildPartial(); public static EnumOptions DefaultInstance { get { return defaultInstance; } @@ -4882,13 +4610,32 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_EnumOptions__FieldAccessorTable; } } + private pbc::PopsicleList uninterpretedOption_ = new pbc::PopsicleList(); + public scg::IList UninterpretedOptionList { + get { return uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return uninterpretedOption_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return uninterpretedOption_[index]; + } + public override bool IsInitialized { get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + if (!element.IsInitialized) return false; + } return true; } } public override void WriteTo(pb::CodedOutputStream output) { + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + output.WriteMessage(999, element); + } + extensionWriter.WriteUntil(536870912, output); UnknownFields.WriteTo(output); } @@ -4899,68 +4646,60 @@ namespace Google.ProtocolBuffers.DescriptorProtos { if (size != -1) return size; size = 0; + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } + size += ExtensionsSerializedSize; size += UnknownFields.SerializedSize; memoizedSerializedSize = size; return size; } } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions ParseFrom(pb::ByteString data) { + public static EnumOptions ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions ParseFrom(pb::ByteString data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static EnumOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions ParseFrom(byte[] data) { + public static EnumOptions ParseFrom(byte[] data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions ParseFrom(byte[] data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static EnumOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions ParseFrom(global::System.IO.Stream input) { + public static EnumOptions ParseFrom(global::System.IO.Stream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions ParseFrom( - global::System.IO.Stream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static EnumOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions ParseFrom(pb::CodedInputStream input) { + public static EnumOptions ParseFrom(pb::CodedInputStream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions ParseFrom(pb::CodedInputStream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static EnumOptions ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static Builder CreateBuilder() { return new Builder(); } public override Builder CreateBuilderForType() { return new Builder(); } - public static Builder CreateBuilder(global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions prototype) { + public static Builder CreateBuilder(EnumOptions prototype) { return (Builder) new Builder().MergeFrom(prototype); } - public sealed partial class Builder : pb::GeneratedBuilder { + public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } } - - // Construct using global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.CreateBuilder() public Builder() {} - global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions result = new global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions(); + EnumOptions result = new EnumOptions(); - protected override global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions MessageBeingBuilt { + protected override EnumOptions MessageBeingBuilt { get { return result; } } public override Builder Clear() { - result = new global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions(); + result = new EnumOptions(); return this; } @@ -4969,30 +4708,34 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override pbd::MessageDescriptor DescriptorForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.Descriptor; } + get { return EnumOptions.Descriptor; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions DefaultInstanceForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.DefaultInstance; } + public override EnumOptions DefaultInstanceForType { + get { return EnumOptions.DefaultInstance; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions BuildPartial() { - global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions returnMe = result; + public override EnumOptions BuildPartial() { + result.uninterpretedOption_.MakeReadOnly(); + EnumOptions returnMe = result; result = null; return returnMe; } public override Builder MergeFrom(pb::IMessage other) { - if (other is global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions) { - return MergeFrom((global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions) other); + if (other is EnumOptions) { + return MergeFrom((EnumOptions) other); } else { base.MergeFrom(other); return this; } } - public override Builder MergeFrom(global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions other) { - if (other == global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.DefaultInstance) return this; + public override Builder MergeFrom(EnumOptions other) { + if (other == EnumOptions.DefaultInstance) return this; + if (other.uninterpretedOption_.Count != 0) { + base.AddRange(other.uninterpretedOption_, result.uninterpretedOption_); + } this.MergeUnknownFields(other.UnknownFields); return this; } @@ -5002,30 +4745,69 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { - pb::UnknownFieldSet.Builder unknownFields = - pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); while (true) { uint tag = input.ReadTag(); switch (tag) { - case 0: + case 0: { this.UnknownFields = unknownFields.Build(); return this; + } default: { - if (!ParseUnknownField(input, unknownFields, - extensionRegistry, tag)) { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.UnknownFields = unknownFields.Build(); return this; } break; } + case 7994: { + global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder subBuilder = global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.CreateBuilder(); + input.ReadMessage(subBuilder, extensionRegistry); + AddUninterpretedOption(subBuilder.BuildPartial()); + break; + } } } } + + public scg::IList UninterpretedOptionList { + get { return result.uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return result.UninterpretedOptionCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return result.GetUninterpretedOption(index); + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + result.uninterpretedOption_[index] = value; + return this; + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + result.uninterpretedOption_[index] = builderForValue.Build(); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + result.uninterpretedOption_.Add(value); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + result.uninterpretedOption_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + base.AddRange(values, result.uninterpretedOption_); + return this; + } + public Builder ClearUninterpretedOption() { + result.uninterpretedOption_.Clear(); + return this; + } } } - public sealed partial class EnumValueOptions : pb::GeneratedMessage { + public sealed partial class EnumValueOptions : pb::ExtendableMessage { private static readonly EnumValueOptions defaultInstance = new Builder().BuildPartial(); public static EnumValueOptions DefaultInstance { get { return defaultInstance; } @@ -5047,13 +4829,32 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_EnumValueOptions__FieldAccessorTable; } } + private pbc::PopsicleList uninterpretedOption_ = new pbc::PopsicleList(); + public scg::IList UninterpretedOptionList { + get { return uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return uninterpretedOption_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return uninterpretedOption_[index]; + } + public override bool IsInitialized { get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + if (!element.IsInitialized) return false; + } return true; } } public override void WriteTo(pb::CodedOutputStream output) { + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + output.WriteMessage(999, element); + } + extensionWriter.WriteUntil(536870912, output); UnknownFields.WriteTo(output); } @@ -5064,68 +4865,60 @@ namespace Google.ProtocolBuffers.DescriptorProtos { if (size != -1) return size; size = 0; + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } + size += ExtensionsSerializedSize; size += UnknownFields.SerializedSize; memoizedSerializedSize = size; return size; } } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions ParseFrom(pb::ByteString data) { + public static EnumValueOptions ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions ParseFrom(pb::ByteString data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static EnumValueOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions ParseFrom(byte[] data) { + public static EnumValueOptions ParseFrom(byte[] data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions ParseFrom(byte[] data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static EnumValueOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions ParseFrom(global::System.IO.Stream input) { + public static EnumValueOptions ParseFrom(global::System.IO.Stream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions ParseFrom( - global::System.IO.Stream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static EnumValueOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions ParseFrom(pb::CodedInputStream input) { + public static EnumValueOptions ParseFrom(pb::CodedInputStream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions ParseFrom(pb::CodedInputStream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static EnumValueOptions ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static Builder CreateBuilder() { return new Builder(); } public override Builder CreateBuilderForType() { return new Builder(); } - public static Builder CreateBuilder(global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions prototype) { + public static Builder CreateBuilder(EnumValueOptions prototype) { return (Builder) new Builder().MergeFrom(prototype); } - public sealed partial class Builder : pb::GeneratedBuilder { + public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } } - - // Construct using global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.CreateBuilder() public Builder() {} - global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions result = new global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions(); + EnumValueOptions result = new EnumValueOptions(); - protected override global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions MessageBeingBuilt { + protected override EnumValueOptions MessageBeingBuilt { get { return result; } } public override Builder Clear() { - result = new global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions(); + result = new EnumValueOptions(); return this; } @@ -5134,30 +4927,34 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override pbd::MessageDescriptor DescriptorForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.Descriptor; } + get { return EnumValueOptions.Descriptor; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions DefaultInstanceForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.DefaultInstance; } + public override EnumValueOptions DefaultInstanceForType { + get { return EnumValueOptions.DefaultInstance; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions BuildPartial() { - global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions returnMe = result; + public override EnumValueOptions BuildPartial() { + result.uninterpretedOption_.MakeReadOnly(); + EnumValueOptions returnMe = result; result = null; return returnMe; } public override Builder MergeFrom(pb::IMessage other) { - if (other is global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions) { - return MergeFrom((global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions) other); + if (other is EnumValueOptions) { + return MergeFrom((EnumValueOptions) other); } else { base.MergeFrom(other); return this; } } - public override Builder MergeFrom(global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions other) { - if (other == global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.DefaultInstance) return this; + public override Builder MergeFrom(EnumValueOptions other) { + if (other == EnumValueOptions.DefaultInstance) return this; + if (other.uninterpretedOption_.Count != 0) { + base.AddRange(other.uninterpretedOption_, result.uninterpretedOption_); + } this.MergeUnknownFields(other.UnknownFields); return this; } @@ -5167,39 +4964,78 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { - pb::UnknownFieldSet.Builder unknownFields = - pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); while (true) { uint tag = input.ReadTag(); switch (tag) { - case 0: + case 0: { this.UnknownFields = unknownFields.Build(); return this; + } default: { - if (!ParseUnknownField(input, unknownFields, - extensionRegistry, tag)) { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.UnknownFields = unknownFields.Build(); return this; } break; } + case 7994: { + global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder subBuilder = global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.CreateBuilder(); + input.ReadMessage(subBuilder, extensionRegistry); + AddUninterpretedOption(subBuilder.BuildPartial()); + break; + } } } } - } - } - - public sealed partial class ServiceOptions : pb::GeneratedMessage { - private static readonly ServiceOptions defaultInstance = new Builder().BuildPartial(); - public static ServiceOptions DefaultInstance { - get { return defaultInstance; } - } - - public override ServiceOptions DefaultInstanceForType { - get { return defaultInstance; } - } - + + public scg::IList UninterpretedOptionList { + get { return result.uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return result.UninterpretedOptionCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return result.GetUninterpretedOption(index); + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + result.uninterpretedOption_[index] = value; + return this; + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + result.uninterpretedOption_[index] = builderForValue.Build(); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + result.uninterpretedOption_.Add(value); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + result.uninterpretedOption_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + base.AddRange(values, result.uninterpretedOption_); + return this; + } + public Builder ClearUninterpretedOption() { + result.uninterpretedOption_.Clear(); + return this; + } + } + } + + public sealed partial class ServiceOptions : pb::ExtendableMessage { + private static readonly ServiceOptions defaultInstance = new Builder().BuildPartial(); + public static ServiceOptions DefaultInstance { + get { return defaultInstance; } + } + + public override ServiceOptions DefaultInstanceForType { + get { return defaultInstance; } + } + protected override ServiceOptions ThisMessage { get { return this; } } @@ -5212,13 +5048,32 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_ServiceOptions__FieldAccessorTable; } } + private pbc::PopsicleList uninterpretedOption_ = new pbc::PopsicleList(); + public scg::IList UninterpretedOptionList { + get { return uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return uninterpretedOption_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return uninterpretedOption_[index]; + } + public override bool IsInitialized { get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + if (!element.IsInitialized) return false; + } return true; } } public override void WriteTo(pb::CodedOutputStream output) { + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + output.WriteMessage(999, element); + } + extensionWriter.WriteUntil(536870912, output); UnknownFields.WriteTo(output); } @@ -5229,68 +5084,60 @@ namespace Google.ProtocolBuffers.DescriptorProtos { if (size != -1) return size; size = 0; + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } + size += ExtensionsSerializedSize; size += UnknownFields.SerializedSize; memoizedSerializedSize = size; return size; } } - public static global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions ParseFrom(pb::ByteString data) { + public static ServiceOptions ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions ParseFrom(pb::ByteString data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static ServiceOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions ParseFrom(byte[] data) { + public static ServiceOptions ParseFrom(byte[] data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions ParseFrom(byte[] data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static ServiceOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions ParseFrom(global::System.IO.Stream input) { + public static ServiceOptions ParseFrom(global::System.IO.Stream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions ParseFrom( - global::System.IO.Stream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static ServiceOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions ParseFrom(pb::CodedInputStream input) { + public static ServiceOptions ParseFrom(pb::CodedInputStream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions ParseFrom(pb::CodedInputStream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static ServiceOptions ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static Builder CreateBuilder() { return new Builder(); } public override Builder CreateBuilderForType() { return new Builder(); } - public static Builder CreateBuilder(global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions prototype) { + public static Builder CreateBuilder(ServiceOptions prototype) { return (Builder) new Builder().MergeFrom(prototype); } - public sealed partial class Builder : pb::GeneratedBuilder { + public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } } - - // Construct using global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.CreateBuilder() public Builder() {} - global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions result = new global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions(); + ServiceOptions result = new ServiceOptions(); - protected override global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions MessageBeingBuilt { + protected override ServiceOptions MessageBeingBuilt { get { return result; } } public override Builder Clear() { - result = new global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions(); + result = new ServiceOptions(); return this; } @@ -5299,30 +5146,34 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override pbd::MessageDescriptor DescriptorForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.Descriptor; } + get { return ServiceOptions.Descriptor; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions DefaultInstanceForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.DefaultInstance; } + public override ServiceOptions DefaultInstanceForType { + get { return ServiceOptions.DefaultInstance; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions BuildPartial() { - global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions returnMe = result; + public override ServiceOptions BuildPartial() { + result.uninterpretedOption_.MakeReadOnly(); + ServiceOptions returnMe = result; result = null; return returnMe; } public override Builder MergeFrom(pb::IMessage other) { - if (other is global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions) { - return MergeFrom((global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions) other); + if (other is ServiceOptions) { + return MergeFrom((ServiceOptions) other); } else { base.MergeFrom(other); return this; } } - public override Builder MergeFrom(global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions other) { - if (other == global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.DefaultInstance) return this; + public override Builder MergeFrom(ServiceOptions other) { + if (other == ServiceOptions.DefaultInstance) return this; + if (other.uninterpretedOption_.Count != 0) { + base.AddRange(other.uninterpretedOption_, result.uninterpretedOption_); + } this.MergeUnknownFields(other.UnknownFields); return this; } @@ -5332,30 +5183,69 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { - pb::UnknownFieldSet.Builder unknownFields = - pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); while (true) { uint tag = input.ReadTag(); switch (tag) { - case 0: + case 0: { this.UnknownFields = unknownFields.Build(); return this; + } default: { - if (!ParseUnknownField(input, unknownFields, - extensionRegistry, tag)) { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.UnknownFields = unknownFields.Build(); return this; } break; } + case 7994: { + global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder subBuilder = global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.CreateBuilder(); + input.ReadMessage(subBuilder, extensionRegistry); + AddUninterpretedOption(subBuilder.BuildPartial()); + break; + } } } } + + public scg::IList UninterpretedOptionList { + get { return result.uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return result.UninterpretedOptionCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return result.GetUninterpretedOption(index); + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + result.uninterpretedOption_[index] = value; + return this; + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + result.uninterpretedOption_[index] = builderForValue.Build(); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + result.uninterpretedOption_.Add(value); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + result.uninterpretedOption_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + base.AddRange(values, result.uninterpretedOption_); + return this; + } + public Builder ClearUninterpretedOption() { + result.uninterpretedOption_.Clear(); + return this; + } } } - public sealed partial class MethodOptions : pb::GeneratedMessage { + public sealed partial class MethodOptions : pb::ExtendableMessage { private static readonly MethodOptions defaultInstance = new Builder().BuildPartial(); public static MethodOptions DefaultInstance { get { return defaultInstance; } @@ -5377,13 +5267,32 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_MethodOptions__FieldAccessorTable; } } + private pbc::PopsicleList uninterpretedOption_ = new pbc::PopsicleList(); + public scg::IList UninterpretedOptionList { + get { return uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return uninterpretedOption_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return uninterpretedOption_[index]; + } + public override bool IsInitialized { get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + if (!element.IsInitialized) return false; + } return true; } } public override void WriteTo(pb::CodedOutputStream output) { + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + output.WriteMessage(999, element); + } + extensionWriter.WriteUntil(536870912, output); UnknownFields.WriteTo(output); } @@ -5394,68 +5303,590 @@ namespace Google.ProtocolBuffers.DescriptorProtos { if (size != -1) return size; size = 0; + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } + size += ExtensionsSerializedSize; size += UnknownFields.SerializedSize; memoizedSerializedSize = size; return size; } } - public static global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions ParseFrom(pb::ByteString data) { + public static MethodOptions ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions ParseFrom(pb::ByteString data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static MethodOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions ParseFrom(byte[] data) { + public static MethodOptions ParseFrom(byte[] data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions ParseFrom(byte[] data, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)) - .BuildParsed(); + public static MethodOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions ParseFrom(global::System.IO.Stream input) { + public static MethodOptions ParseFrom(global::System.IO.Stream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions ParseFrom( - global::System.IO.Stream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static MethodOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions ParseFrom(pb::CodedInputStream input) { + public static MethodOptions ParseFrom(pb::CodedInputStream input) { return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); } - public static global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions ParseFrom(pb::CodedInputStream input, - pb::ExtensionRegistry extensionRegistry) { - return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)) - .BuildParsed(); + public static MethodOptions ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } - public static Builder CreateBuilder() { return new Builder(); } public override Builder CreateBuilderForType() { return new Builder(); } - public static Builder CreateBuilder(global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions prototype) { + public static Builder CreateBuilder(MethodOptions prototype) { return (Builder) new Builder().MergeFrom(prototype); } - public sealed partial class Builder : pb::GeneratedBuilder { + public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } } + public Builder() {} + + MethodOptions result = new MethodOptions(); + + protected override MethodOptions MessageBeingBuilt { + get { return result; } + } + + public override Builder Clear() { + result = new MethodOptions(); + return this; + } + + public override Builder Clone() { + return new Builder().MergeFrom(result); + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return MethodOptions.Descriptor; } + } + + public override MethodOptions DefaultInstanceForType { + get { return MethodOptions.DefaultInstance; } + } + + public override MethodOptions BuildPartial() { + result.uninterpretedOption_.MakeReadOnly(); + MethodOptions returnMe = result; + result = null; + return returnMe; + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is MethodOptions) { + return MergeFrom((MethodOptions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(MethodOptions other) { + if (other == MethodOptions.DefaultInstance) return this; + if (other.uninterpretedOption_.Count != 0) { + base.AddRange(other.uninterpretedOption_, result.uninterpretedOption_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::CodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + while (true) { + uint tag = input.ReadTag(); + switch (tag) { + case 0: { + this.UnknownFields = unknownFields.Build(); + return this; + } + default: { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { + this.UnknownFields = unknownFields.Build(); + return this; + } + break; + } + case 7994: { + global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder subBuilder = global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.CreateBuilder(); + input.ReadMessage(subBuilder, extensionRegistry); + AddUninterpretedOption(subBuilder.BuildPartial()); + break; + } + } + } + } + + + public scg::IList UninterpretedOptionList { + get { return result.uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return result.UninterpretedOptionCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return result.GetUninterpretedOption(index); + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + result.uninterpretedOption_[index] = value; + return this; + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + result.uninterpretedOption_[index] = builderForValue.Build(); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + result.uninterpretedOption_.Add(value); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + result.uninterpretedOption_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + base.AddRange(values, result.uninterpretedOption_); + return this; + } + public Builder ClearUninterpretedOption() { + result.uninterpretedOption_.Clear(); + return this; + } + } + } + + public sealed partial class UninterpretedOption : pb::GeneratedMessage { + private static readonly UninterpretedOption defaultInstance = new Builder().BuildPartial(); + public static UninterpretedOption DefaultInstance { + get { return defaultInstance; } + } + + public override UninterpretedOption DefaultInstanceForType { + get { return defaultInstance; } + } + + protected override UninterpretedOption ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_UninterpretedOption__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_UninterpretedOption__FieldAccessorTable; } + } + + #region Nested types + public static class Types { + public sealed partial class NamePart : pb::GeneratedMessage { + private static readonly NamePart defaultInstance = new Builder().BuildPartial(); + public static NamePart DefaultInstance { + get { return defaultInstance; } + } + + public override NamePart DefaultInstanceForType { + get { return defaultInstance; } + } + + protected override NamePart ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_UninterpretedOption_NamePart__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_UninterpretedOption_NamePart__FieldAccessorTable; } + } + + private bool hasNamePart; + private string namePart_ = ""; + public bool HasNamePart { + get { return hasNamePart; } + } + public string NamePart_ { + get { return namePart_; } + } + + private bool hasIsExtension; + private bool isExtension_ = false; + public bool HasIsExtension { + get { return hasIsExtension; } + } + public bool IsExtension { + get { return isExtension_; } + } + + public override bool IsInitialized { + get { + if (!hasNamePart) return false; + if (!hasIsExtension) return false; + return true; + } + } + + public override void WriteTo(pb::CodedOutputStream output) { + if (HasNamePart) { + output.WriteString(1, NamePart_); + } + if (HasIsExtension) { + output.WriteBool(2, IsExtension); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (HasNamePart) { + size += pb::CodedOutputStream.ComputeStringSize(1, NamePart_); + } + if (HasIsExtension) { + size += pb::CodedOutputStream.ComputeBoolSize(2, IsExtension); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static NamePart ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NamePart ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NamePart ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NamePart ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NamePart ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NamePart ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static NamePart ParseFrom(pb::CodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NamePart ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Builder CreateBuilder() { return new Builder(); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(NamePart prototype) { + return (Builder) new Builder().MergeFrom(prototype); + } + + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() {} + + NamePart result = new NamePart(); + + protected override NamePart MessageBeingBuilt { + get { return result; } + } + + public override Builder Clear() { + result = new NamePart(); + return this; + } + + public override Builder Clone() { + return new Builder().MergeFrom(result); + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return NamePart.Descriptor; } + } + + public override NamePart DefaultInstanceForType { + get { return NamePart.DefaultInstance; } + } + + public override NamePart BuildPartial() { + NamePart returnMe = result; + result = null; + return returnMe; + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is NamePart) { + return MergeFrom((NamePart) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(NamePart other) { + if (other == NamePart.DefaultInstance) return this; + if (other.HasNamePart) { + NamePart_ = other.NamePart_; + } + if (other.HasIsExtension) { + IsExtension = other.IsExtension; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::CodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + while (true) { + uint tag = input.ReadTag(); + switch (tag) { + case 0: { + this.UnknownFields = unknownFields.Build(); + return this; + } + default: { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { + this.UnknownFields = unknownFields.Build(); + return this; + } + break; + } + case 10: { + NamePart_ = input.ReadString(); + break; + } + case 16: { + IsExtension = input.ReadBool(); + break; + } + } + } + } + + + public bool HasNamePart { + get { return result.HasNamePart; } + } + public string NamePart_ { + get { return result.NamePart_; } + set { SetNamePart(value); } + } + public Builder SetNamePart(string value) { + result.hasNamePart = true; + result.namePart_ = value; + return this; + } + public Builder ClearNamePart() { + result.hasNamePart = false; + result.namePart_ = ""; + return this; + } + + public bool HasIsExtension { + get { return result.HasIsExtension; } + } + public bool IsExtension { + get { return result.IsExtension; } + set { SetIsExtension(value); } + } + public Builder SetIsExtension(bool value) { + result.hasIsExtension = true; + result.isExtension_ = value; + return this; + } + public Builder ClearIsExtension() { + result.hasIsExtension = false; + result.isExtension_ = false; + return this; + } + } + } - // Construct using global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.CreateBuilder() + } + #endregion + + private pbc::PopsicleList name_ = new pbc::PopsicleList(); + public scg::IList NameList { + get { return name_; } + } + public int NameCount { + get { return name_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart GetName(int index) { + return name_[index]; + } + + private bool hasIdentifierValue; + private string identifierValue_ = ""; + public bool HasIdentifierValue { + get { return hasIdentifierValue; } + } + public string IdentifierValue { + get { return identifierValue_; } + } + + private bool hasPositiveIntValue; + private ulong positiveIntValue_ = 0UL; + public bool HasPositiveIntValue { + get { return hasPositiveIntValue; } + } + public ulong PositiveIntValue { + get { return positiveIntValue_; } + } + + private bool hasNegativeIntValue; + private long negativeIntValue_ = 0L; + public bool HasNegativeIntValue { + get { return hasNegativeIntValue; } + } + public long NegativeIntValue { + get { return negativeIntValue_; } + } + + private bool hasDoubleValue; + private double doubleValue_ = 0D; + public bool HasDoubleValue { + get { return hasDoubleValue; } + } + public double DoubleValue { + get { return doubleValue_; } + } + + private bool hasStringValue; + private pb::ByteString stringValue_ = pb::ByteString.Empty; + public bool HasStringValue { + get { return hasStringValue; } + } + public pb::ByteString StringValue { + get { return stringValue_; } + } + + public override bool IsInitialized { + get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart element in NameList) { + if (!element.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::CodedOutputStream output) { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart element in NameList) { + output.WriteMessage(2, element); + } + if (HasIdentifierValue) { + output.WriteString(3, IdentifierValue); + } + if (HasPositiveIntValue) { + output.WriteUInt64(4, PositiveIntValue); + } + if (HasNegativeIntValue) { + output.WriteInt64(5, NegativeIntValue); + } + if (HasDoubleValue) { + output.WriteDouble(6, DoubleValue); + } + if (HasStringValue) { + output.WriteBytes(7, StringValue); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart element in NameList) { + size += pb::CodedOutputStream.ComputeMessageSize(2, element); + } + if (HasIdentifierValue) { + size += pb::CodedOutputStream.ComputeStringSize(3, IdentifierValue); + } + if (HasPositiveIntValue) { + size += pb::CodedOutputStream.ComputeUInt64Size(4, PositiveIntValue); + } + if (HasNegativeIntValue) { + size += pb::CodedOutputStream.ComputeInt64Size(5, NegativeIntValue); + } + if (HasDoubleValue) { + size += pb::CodedOutputStream.ComputeDoubleSize(6, DoubleValue); + } + if (HasStringValue) { + size += pb::CodedOutputStream.ComputeBytesSize(7, StringValue); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static UninterpretedOption ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static UninterpretedOption ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static UninterpretedOption ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static UninterpretedOption ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static UninterpretedOption ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static UninterpretedOption ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static UninterpretedOption ParseFrom(pb::CodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static UninterpretedOption ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Builder CreateBuilder() { return new Builder(); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(UninterpretedOption prototype) { + return (Builder) new Builder().MergeFrom(prototype); + } + + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } public Builder() {} - global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions result = new global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions(); + UninterpretedOption result = new UninterpretedOption(); - protected override global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions MessageBeingBuilt { + protected override UninterpretedOption MessageBeingBuilt { get { return result; } } public override Builder Clear() { - result = new global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions(); + result = new UninterpretedOption(); return this; } @@ -5464,30 +5895,49 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override pbd::MessageDescriptor DescriptorForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.Descriptor; } + get { return UninterpretedOption.Descriptor; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions DefaultInstanceForType { - get { return global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.DefaultInstance; } + public override UninterpretedOption DefaultInstanceForType { + get { return UninterpretedOption.DefaultInstance; } } - public override global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions BuildPartial() { - global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions returnMe = result; + public override UninterpretedOption BuildPartial() { + result.name_.MakeReadOnly(); + UninterpretedOption returnMe = result; result = null; return returnMe; } public override Builder MergeFrom(pb::IMessage other) { - if (other is global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions) { - return MergeFrom((global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions) other); + if (other is UninterpretedOption) { + return MergeFrom((UninterpretedOption) other); } else { base.MergeFrom(other); return this; } } - public override Builder MergeFrom(global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions other) { - if (other == global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.DefaultInstance) return this; + public override Builder MergeFrom(UninterpretedOption other) { + if (other == UninterpretedOption.DefaultInstance) return this; + if (other.name_.Count != 0) { + base.AddRange(other.name_, result.name_); + } + if (other.HasIdentifierValue) { + IdentifierValue = other.IdentifierValue; + } + if (other.HasPositiveIntValue) { + PositiveIntValue = other.PositiveIntValue; + } + if (other.HasNegativeIntValue) { + NegativeIntValue = other.NegativeIntValue; + } + if (other.HasDoubleValue) { + DoubleValue = other.DoubleValue; + } + if (other.HasStringValue) { + StringValue = other.StringValue; + } this.MergeUnknownFields(other.UnknownFields); return this; } @@ -5497,31 +5947,178 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { - pb::UnknownFieldSet.Builder unknownFields = - pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); while (true) { uint tag = input.ReadTag(); switch (tag) { - case 0: + case 0: { this.UnknownFields = unknownFields.Build(); return this; + } default: { - if (!ParseUnknownField(input, unknownFields, - extensionRegistry, tag)) { + if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.UnknownFields = unknownFields.Build(); return this; } break; } + case 18: { + global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart.Builder subBuilder = global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart.CreateBuilder(); + input.ReadMessage(subBuilder, extensionRegistry); + AddName(subBuilder.BuildPartial()); + break; + } + case 26: { + IdentifierValue = input.ReadString(); + break; + } + case 32: { + PositiveIntValue = input.ReadUInt64(); + break; + } + case 40: { + NegativeIntValue = input.ReadInt64(); + break; + } + case 49: { + DoubleValue = input.ReadDouble(); + break; + } + case 58: { + StringValue = input.ReadBytes(); + break; + } } } } + + public scg::IList NameList { + get { return result.name_; } + } + public int NameCount { + get { return result.NameCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart GetName(int index) { + return result.GetName(index); + } + public Builder SetName(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart value) { + result.name_[index] = value; + return this; + } + public Builder SetName(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart.Builder builderForValue) { + result.name_[index] = builderForValue.Build(); + return this; + } + public Builder AddName(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart value) { + result.name_.Add(value); + return this; + } + public Builder AddName(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart.Builder builderForValue) { + result.name_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeName(scg::IEnumerable values) { + base.AddRange(values, result.name_); + return this; + } + public Builder ClearName() { + result.name_.Clear(); + return this; + } + + public bool HasIdentifierValue { + get { return result.HasIdentifierValue; } + } + public string IdentifierValue { + get { return result.IdentifierValue; } + set { SetIdentifierValue(value); } + } + public Builder SetIdentifierValue(string value) { + result.hasIdentifierValue = true; + result.identifierValue_ = value; + return this; + } + public Builder ClearIdentifierValue() { + result.hasIdentifierValue = false; + result.identifierValue_ = ""; + return this; + } + + public bool HasPositiveIntValue { + get { return result.HasPositiveIntValue; } + } + public ulong PositiveIntValue { + get { return result.PositiveIntValue; } + set { SetPositiveIntValue(value); } + } + public Builder SetPositiveIntValue(ulong value) { + result.hasPositiveIntValue = true; + result.positiveIntValue_ = value; + return this; + } + public Builder ClearPositiveIntValue() { + result.hasPositiveIntValue = false; + result.positiveIntValue_ = 0UL; + return this; + } + + public bool HasNegativeIntValue { + get { return result.HasNegativeIntValue; } + } + public long NegativeIntValue { + get { return result.NegativeIntValue; } + set { SetNegativeIntValue(value); } + } + public Builder SetNegativeIntValue(long value) { + result.hasNegativeIntValue = true; + result.negativeIntValue_ = value; + return this; + } + public Builder ClearNegativeIntValue() { + result.hasNegativeIntValue = false; + result.negativeIntValue_ = 0L; + return this; + } + + public bool HasDoubleValue { + get { return result.HasDoubleValue; } + } + public double DoubleValue { + get { return result.DoubleValue; } + set { SetDoubleValue(value); } + } + public Builder SetDoubleValue(double value) { + result.hasDoubleValue = true; + result.doubleValue_ = value; + return this; + } + public Builder ClearDoubleValue() { + result.hasDoubleValue = false; + result.doubleValue_ = 0D; + return this; + } + + public bool HasStringValue { + get { return result.HasStringValue; } + } + public pb::ByteString StringValue { + get { return result.StringValue; } + set { SetStringValue(value); } + } + public Builder SetStringValue(pb::ByteString value) { + result.hasStringValue = true; + result.stringValue_ = value; + return this; + } + public Builder ClearStringValue() { + result.hasStringValue = false; + result.stringValue_ = pb::ByteString.Empty; + return this; + } } } #endregion - #region Services - #endregion } diff --git a/csharp/ProtocolBuffers/DescriptorProtos/PartialClasses.cs b/csharp/ProtocolBuffers/DescriptorProtos/PartialClasses.cs index 66501374..5f414fc2 100644 --- a/csharp/ProtocolBuffers/DescriptorProtos/PartialClasses.cs +++ b/csharp/ProtocolBuffers/DescriptorProtos/PartialClasses.cs @@ -18,6 +18,21 @@ // autogenerated classes, so that they implement // IDescriptorProto namespace Google.ProtocolBuffers.DescriptorProtos { + + // TODO(jonskeet): Find a better way of fixing this. It's needed in order to + // cope with unknown fields during initialization. + public partial class DescriptorProtoFile { + private static readonly bool initialized = false; + + internal static bool Bootstrapping { + get { return !initialized; } + } + + static DescriptorProtoFile() { + initialized = true; + } + } + public partial class DescriptorProto : IDescriptorProto { } public partial class EnumDescriptorProto : IDescriptorProto { } public partial class EnumValueDescriptorProto : IDescriptorProto { } diff --git a/csharp/ProtocolBuffers/Descriptors/FileDescriptor.cs b/csharp/ProtocolBuffers/Descriptors/FileDescriptor.cs index 3fa3360e..abd54e76 100644 --- a/csharp/ProtocolBuffers/Descriptors/FileDescriptor.cs +++ b/csharp/ProtocolBuffers/Descriptors/FileDescriptor.cs @@ -181,7 +181,7 @@ namespace Google.ProtocolBuffers.Descriptors { /// a valid descriptor. This can occur for a number of reasons, such as a field /// having an undefined type or because two messages were defined with the same name. public static FileDescriptor BuildFrom(FileDescriptorProto proto, FileDescriptor[] dependencies) { - // Building decsriptors involves two steps: translating and linking. + // Building descriptors involves two steps: translating and linking. // In the translation step (implemented by FileDescriptor's // constructor), we build an object tree mirroring the // FileDescriptorProto's tree and put all of the descriptors into the @@ -204,9 +204,9 @@ namespace Google.ProtocolBuffers.Descriptors { } for (int i = 0; i < proto.DependencyCount; i++) { if (dependencies[i].Name != proto.DependencyList[i]) { - throw new DescriptorValidationException(result, + /*throw new DescriptorValidationException(result, "Dependencies passed to FileDescriptor.BuildFrom() don't match " + - "those listed in the FileDescriptorProto."); + "those listed in the FileDescriptorProto.");*/ } } diff --git a/csharp/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs b/csharp/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs index 33def0a7..35a2a204 100644 --- a/csharp/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs +++ b/csharp/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs @@ -48,7 +48,7 @@ namespace Google.ProtocolBuffers.FieldAccess { PropertyInfo messageProperty = typeof(TMessage).GetProperty(name + "List"); PropertyInfo builderProperty = typeof(TBuilder).GetProperty(name + "List"); PropertyInfo countProperty = typeof(TMessage).GetProperty(name + "Count"); - MethodInfo clearMethod = typeof(TBuilder).GetMethod("Clear" + name); + MethodInfo clearMethod = typeof(TBuilder).GetMethod("Clear" + name, Type.EmptyTypes); getElementMethod = typeof(TMessage).GetMethod("Get" + name, new Type[] { typeof(int) }); clrType = getElementMethod.ReturnType; MethodInfo addMethod = typeof(TBuilder).GetMethod("Add" + name, new Type[] { ClrType }); diff --git a/csharp/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs b/csharp/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs index ad9e1659..c10936d4 100644 --- a/csharp/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs +++ b/csharp/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs @@ -39,10 +39,13 @@ namespace Google.ProtocolBuffers.FieldAccess { } internal SinglePrimitiveAccessor(string name) { - PropertyInfo messageProperty = typeof(TMessage).GetProperty(name); - PropertyInfo builderProperty = typeof(TBuilder).GetProperty(name); + + string propertyName = name == typeof(TMessage).Name ? name + "_" : name; + PropertyInfo messageProperty = typeof(TMessage).GetProperty(propertyName); + PropertyInfo builderProperty = typeof(TBuilder).GetProperty(name); // FIXME! + if (builderProperty == null) builderProperty = typeof(TBuilder).GetProperty(propertyName); // FIXME! PropertyInfo hasProperty = typeof(TMessage).GetProperty("Has" + name); - MethodInfo clearMethod = typeof(TBuilder).GetMethod("Clear" + name); + MethodInfo clearMethod = typeof(TBuilder).GetMethod("Clear" + name, Type.EmptyTypes); if (messageProperty == null || builderProperty == null || hasProperty == null || clearMethod == null) { throw new ArgumentException("Not all required properties/methods available"); } diff --git a/csharp/ProtocolBuffers/FieldSet.cs b/csharp/ProtocolBuffers/FieldSet.cs index 54d7b1c3..c130d858 100644 --- a/csharp/ProtocolBuffers/FieldSet.cs +++ b/csharp/ProtocolBuffers/FieldSet.cs @@ -33,6 +33,7 @@ namespace Google.ProtocolBuffers { /// be impossible to guarantee if this were a public class, of course. /// /// All repeated fields are stored as IList[object] even + /// TODO(jonskeet): Finish this comment! /// internal sealed class FieldSet { diff --git a/csharp/ProtocolBuffers/ProtocolBuffers.csproj b/csharp/ProtocolBuffers/ProtocolBuffers.csproj index f68e761a..3f76aa7f 100644 --- a/csharp/ProtocolBuffers/ProtocolBuffers.csproj +++ b/csharp/ProtocolBuffers/ProtocolBuffers.csproj @@ -48,6 +48,7 @@ + diff --git a/csharp/ProtocolBuffers/TextGenerator.cs b/csharp/ProtocolBuffers/TextGenerator.cs index 3cb8b490..fb0f66dd 100644 --- a/csharp/ProtocolBuffers/TextGenerator.cs +++ b/csharp/ProtocolBuffers/TextGenerator.cs @@ -97,6 +97,10 @@ namespace Google.ProtocolBuffers { Write(text.Substring(pos)); } + public void Write(string format, params object[] args) { + Write(string.Format(format, args)); + } + private void Write(string data) { if (data.Length == 0) { return; diff --git a/csharp/ProtocolBuffers/UnknownFieldSet.cs b/csharp/ProtocolBuffers/UnknownFieldSet.cs index 3d3e38ea..18eacbe8 100644 --- a/csharp/ProtocolBuffers/UnknownFieldSet.cs +++ b/csharp/ProtocolBuffers/UnknownFieldSet.cs @@ -18,6 +18,7 @@ using System.Collections.Generic; using System.IO; using Google.ProtocolBuffers.Collections; using Google.ProtocolBuffers.Descriptors; +using Google.ProtocolBuffers.DescriptorProtos; namespace Google.ProtocolBuffers { /// @@ -454,6 +455,11 @@ namespace Google.ProtocolBuffers { /// true unless the tag is an end-group tag internal bool MergeFieldFrom(CodedInputStream input, ExtensionRegistry extensionRegistry, IBuilder builder, uint tag) { + + if (DescriptorProtoFile.Bootstrapping) { + return MergeFieldFrom(tag, input); + } + MessageDescriptor type = builder.DescriptorForType; if (type.Options.MessageSetWireFormat && tag == WireFormat.MessageSetTag.ItemStart) { MergeMessageSetExtensionFromCodedStream(input, extensionRegistry, builder); -- cgit v1.2.3