diff options
Diffstat (limited to 'csharp/src/Google.Protobuf/Reflection/Descriptor.cs')
-rw-r--r-- | csharp/src/Google.Protobuf/Reflection/Descriptor.cs | 2185 |
1 files changed, 1650 insertions, 535 deletions
diff --git a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs index 4cbed33b..0c33e63d 100644 --- a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs @@ -351,8 +351,8 @@ namespace Google.Protobuf.Reflection { enumType_ = other.enumType_.Clone(); service_ = other.service_.Clone(); extension_ = other.extension_.Clone(); - options_ = other.options_ != null ? other.options_.Clone() : null; - sourceCodeInfo_ = other.sourceCodeInfo_ != null ? other.sourceCodeInfo_.Clone() : null; + options_ = other.HasOptions ? other.options_.Clone() : null; + sourceCodeInfo_ = other.HasSourceCodeInfo ? other.sourceCodeInfo_.Clone() : null; syntax_ = other.syntax_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -364,31 +364,55 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 1; - private string name_ = ""; + private readonly static string NameDefaultValue = ""; + + private string name_; /// <summary> /// file name, relative to root of source tree /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { - get { return name_; } + get { return name_ ?? NameDefaultValue; } set { name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "name" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasName { + get { return name_ != null; } + } + /// <summary>Clears the value of the "name" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearName() { + name_ = null; + } /// <summary>Field number for the "package" field.</summary> public const int PackageFieldNumber = 2; - private string package_ = ""; + private readonly static string PackageDefaultValue = ""; + + private string package_; /// <summary> /// e.g. "foo", "foo.bar", etc. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Package { - get { return package_; } + get { return package_ ?? PackageDefaultValue; } set { package_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "package" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasPackage { + get { return package_ != null; } + } + /// <summary>Clears the value of the "package" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearPackage() { + package_ = null; + } /// <summary>Field number for the "dependency" field.</summary> public const int DependencyFieldNumber = 3; @@ -483,6 +507,16 @@ namespace Google.Protobuf.Reflection { options_ = value; } } + /// <summary>Gets whether the options field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasOptions { + get { return options_ != null; } + } + /// <summary>Clears the value of the options field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearOptions() { + options_ = null; + } /// <summary>Field number for the "source_code_info" field.</summary> public const int SourceCodeInfoFieldNumber = 9; @@ -500,21 +534,43 @@ namespace Google.Protobuf.Reflection { sourceCodeInfo_ = value; } } + /// <summary>Gets whether the source_code_info field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasSourceCodeInfo { + get { return sourceCodeInfo_ != null; } + } + /// <summary>Clears the value of the source_code_info field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearSourceCodeInfo() { + sourceCodeInfo_ = null; + } /// <summary>Field number for the "syntax" field.</summary> public const int SyntaxFieldNumber = 12; - private string syntax_ = ""; + private readonly static string SyntaxDefaultValue = ""; + + private string syntax_; /// <summary> /// The syntax of the proto file. /// The supported values are "proto2" and "proto3". /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Syntax { - get { return syntax_; } + get { return syntax_ ?? SyntaxDefaultValue; } set { syntax_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "syntax" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasSyntax { + get { return syntax_ != null; } + } + /// <summary>Clears the value of the "syntax" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearSyntax() { + syntax_ = null; + } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -547,8 +603,8 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (Package.Length != 0) hash ^= Package.GetHashCode(); + if (HasName) hash ^= Name.GetHashCode(); + if (HasPackage) hash ^= Package.GetHashCode(); hash ^= dependency_.GetHashCode(); hash ^= publicDependency_.GetHashCode(); hash ^= weakDependency_.GetHashCode(); @@ -556,9 +612,9 @@ namespace Google.Protobuf.Reflection { hash ^= enumType_.GetHashCode(); hash ^= service_.GetHashCode(); hash ^= extension_.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); - if (sourceCodeInfo_ != null) hash ^= SourceCodeInfo.GetHashCode(); - if (Syntax.Length != 0) hash ^= Syntax.GetHashCode(); + if (HasOptions) hash ^= Options.GetHashCode(); + if (HasSourceCodeInfo) hash ^= SourceCodeInfo.GetHashCode(); + if (HasSyntax) hash ^= Syntax.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -572,11 +628,11 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Name.Length != 0) { + if (HasName) { output.WriteRawTag(10); output.WriteString(Name); } - if (Package.Length != 0) { + if (HasPackage) { output.WriteRawTag(18); output.WriteString(Package); } @@ -585,17 +641,17 @@ namespace Google.Protobuf.Reflection { enumType_.WriteTo(output, _repeated_enumType_codec); service_.WriteTo(output, _repeated_service_codec); extension_.WriteTo(output, _repeated_extension_codec); - if (options_ != null) { + if (HasOptions) { output.WriteRawTag(66); output.WriteMessage(Options); } - if (sourceCodeInfo_ != null) { + if (HasSourceCodeInfo) { output.WriteRawTag(74); output.WriteMessage(SourceCodeInfo); } publicDependency_.WriteTo(output, _repeated_publicDependency_codec); weakDependency_.WriteTo(output, _repeated_weakDependency_codec); - if (Syntax.Length != 0) { + if (HasSyntax) { output.WriteRawTag(98); output.WriteString(Syntax); } @@ -607,10 +663,10 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Name.Length != 0) { + if (HasName) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); } - if (Package.Length != 0) { + if (HasPackage) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Package); } size += dependency_.CalculateSize(_repeated_dependency_codec); @@ -620,13 +676,13 @@ namespace Google.Protobuf.Reflection { size += enumType_.CalculateSize(_repeated_enumType_codec); size += service_.CalculateSize(_repeated_service_codec); size += extension_.CalculateSize(_repeated_extension_codec); - if (options_ != null) { + if (HasOptions) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } - if (sourceCodeInfo_ != null) { + if (HasSourceCodeInfo) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceCodeInfo); } - if (Syntax.Length != 0) { + if (HasSyntax) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Syntax); } if (_unknownFields != null) { @@ -640,10 +696,10 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.Name.Length != 0) { + if (other.HasName) { Name = other.Name; } - if (other.Package.Length != 0) { + if (other.HasPackage) { Package = other.Package; } dependency_.Add(other.dependency_); @@ -653,19 +709,19 @@ namespace Google.Protobuf.Reflection { enumType_.Add(other.enumType_); service_.Add(other.service_); extension_.Add(other.extension_); - if (other.options_ != null) { - if (options_ == null) { - options_ = new global::Google.Protobuf.Reflection.FileOptions(); + if (other.HasOptions) { + if (!HasOptions) { + Options = new global::Google.Protobuf.Reflection.FileOptions(); } Options.MergeFrom(other.Options); } - if (other.sourceCodeInfo_ != null) { - if (sourceCodeInfo_ == null) { - sourceCodeInfo_ = new global::Google.Protobuf.Reflection.SourceCodeInfo(); + if (other.HasSourceCodeInfo) { + if (!HasSourceCodeInfo) { + SourceCodeInfo = new global::Google.Protobuf.Reflection.SourceCodeInfo(); } SourceCodeInfo.MergeFrom(other.SourceCodeInfo); } - if (other.Syntax.Length != 0) { + if (other.HasSyntax) { Syntax = other.Syntax; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); @@ -708,17 +764,17 @@ namespace Google.Protobuf.Reflection { break; } case 66: { - if (options_ == null) { - options_ = new global::Google.Protobuf.Reflection.FileOptions(); + if (!HasOptions) { + Options = new global::Google.Protobuf.Reflection.FileOptions(); } - input.ReadMessage(options_); + input.ReadMessage(Options); break; } case 74: { - if (sourceCodeInfo_ == null) { - sourceCodeInfo_ = new global::Google.Protobuf.Reflection.SourceCodeInfo(); + if (!HasSourceCodeInfo) { + SourceCodeInfo = new global::Google.Protobuf.Reflection.SourceCodeInfo(); } - input.ReadMessage(sourceCodeInfo_); + input.ReadMessage(SourceCodeInfo); break; } case 82: @@ -776,7 +832,7 @@ namespace Google.Protobuf.Reflection { enumType_ = other.enumType_.Clone(); extensionRange_ = other.extensionRange_.Clone(); oneofDecl_ = other.oneofDecl_.Clone(); - options_ = other.options_ != null ? other.options_.Clone() : null; + options_ = other.HasOptions ? other.options_.Clone() : null; reservedRange_ = other.reservedRange_.Clone(); reservedName_ = other.reservedName_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); @@ -789,14 +845,26 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 1; - private string name_ = ""; + private readonly static string NameDefaultValue = ""; + + private string name_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { - get { return name_; } + get { return name_ ?? NameDefaultValue; } set { name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "name" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasName { + get { return name_ != null; } + } + /// <summary>Clears the value of the "name" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearName() { + name_ = null; + } /// <summary>Field number for the "field" field.</summary> public const int FieldFieldNumber = 2; @@ -868,6 +936,16 @@ namespace Google.Protobuf.Reflection { options_ = value; } } + /// <summary>Gets whether the options field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasOptions { + get { return options_ != null; } + } + /// <summary>Clears the value of the options field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearOptions() { + options_ = null; + } /// <summary>Field number for the "reserved_range" field.</summary> public const int ReservedRangeFieldNumber = 9; @@ -922,14 +1000,14 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (HasName) hash ^= Name.GetHashCode(); hash ^= field_.GetHashCode(); hash ^= extension_.GetHashCode(); hash ^= nestedType_.GetHashCode(); hash ^= enumType_.GetHashCode(); hash ^= extensionRange_.GetHashCode(); hash ^= oneofDecl_.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); + if (HasOptions) hash ^= Options.GetHashCode(); hash ^= reservedRange_.GetHashCode(); hash ^= reservedName_.GetHashCode(); if (_unknownFields != null) { @@ -945,7 +1023,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Name.Length != 0) { + if (HasName) { output.WriteRawTag(10); output.WriteString(Name); } @@ -954,7 +1032,7 @@ namespace Google.Protobuf.Reflection { enumType_.WriteTo(output, _repeated_enumType_codec); extensionRange_.WriteTo(output, _repeated_extensionRange_codec); extension_.WriteTo(output, _repeated_extension_codec); - if (options_ != null) { + if (HasOptions) { output.WriteRawTag(58); output.WriteMessage(Options); } @@ -969,7 +1047,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Name.Length != 0) { + if (HasName) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); } size += field_.CalculateSize(_repeated_field_codec); @@ -978,7 +1056,7 @@ namespace Google.Protobuf.Reflection { size += enumType_.CalculateSize(_repeated_enumType_codec); size += extensionRange_.CalculateSize(_repeated_extensionRange_codec); size += oneofDecl_.CalculateSize(_repeated_oneofDecl_codec); - if (options_ != null) { + if (HasOptions) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } size += reservedRange_.CalculateSize(_repeated_reservedRange_codec); @@ -994,7 +1072,7 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.Name.Length != 0) { + if (other.HasName) { Name = other.Name; } field_.Add(other.field_); @@ -1003,9 +1081,9 @@ namespace Google.Protobuf.Reflection { enumType_.Add(other.enumType_); extensionRange_.Add(other.extensionRange_); oneofDecl_.Add(other.oneofDecl_); - if (other.options_ != null) { - if (options_ == null) { - options_ = new global::Google.Protobuf.Reflection.MessageOptions(); + if (other.HasOptions) { + if (!HasOptions) { + Options = new global::Google.Protobuf.Reflection.MessageOptions(); } Options.MergeFrom(other.Options); } @@ -1047,10 +1125,10 @@ namespace Google.Protobuf.Reflection { break; } case 58: { - if (options_ == null) { - options_ = new global::Google.Protobuf.Reflection.MessageOptions(); + if (!HasOptions) { + Options = new global::Google.Protobuf.Reflection.MessageOptions(); } - input.ReadMessage(options_); + input.ReadMessage(Options); break; } case 66: { @@ -1076,6 +1154,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class ExtensionRange : pb::IMessage<ExtensionRange> { private static readonly pb::MessageParser<ExtensionRange> _parser = new pb::MessageParser<ExtensionRange>(() => new ExtensionRange()); private pb::UnknownFieldSet _unknownFields; + private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<ExtensionRange> Parser { get { return _parser; } } @@ -1098,9 +1177,10 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ExtensionRange(ExtensionRange other) : this() { + _hasBits0 = other._hasBits0; start_ = other.start_; end_ = other.end_; - options_ = other.options_ != null ? other.options_.Clone() : null; + options_ = other.HasOptions ? other.options_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -1111,25 +1191,51 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "start" field.</summary> public const int StartFieldNumber = 1; + private readonly static int StartDefaultValue = 0; + private int start_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Start { - get { return start_; } + get { if ((_hasBits0 & 1) != 0) { return start_; } else { return StartDefaultValue; } } set { + _hasBits0 |= 1; start_ = value; } } + /// <summary>Gets whether the "start" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasStart { + get { return (_hasBits0 & 1) != 0; } + } + /// <summary>Clears the value of the "start" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearStart() { + _hasBits0 &= ~1; + } /// <summary>Field number for the "end" field.</summary> public const int EndFieldNumber = 2; + private readonly static int EndDefaultValue = 0; + private int end_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int End { - get { return end_; } + get { if ((_hasBits0 & 2) != 0) { return end_; } else { return EndDefaultValue; } } set { + _hasBits0 |= 2; end_ = value; } } + /// <summary>Gets whether the "end" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasEnd { + get { return (_hasBits0 & 2) != 0; } + } + /// <summary>Clears the value of the "end" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearEnd() { + _hasBits0 &= ~2; + } /// <summary>Field number for the "options" field.</summary> public const int OptionsFieldNumber = 3; @@ -1141,6 +1247,16 @@ namespace Google.Protobuf.Reflection { options_ = value; } } + /// <summary>Gets whether the options field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasOptions { + get { return options_ != null; } + } + /// <summary>Clears the value of the options field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearOptions() { + options_ = null; + } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -1164,9 +1280,9 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Start != 0) hash ^= Start.GetHashCode(); - if (End != 0) hash ^= End.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); + if (HasStart) hash ^= Start.GetHashCode(); + if (HasEnd) hash ^= End.GetHashCode(); + if (HasOptions) hash ^= Options.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1180,15 +1296,15 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Start != 0) { + if (HasStart) { output.WriteRawTag(8); output.WriteInt32(Start); } - if (End != 0) { + if (HasEnd) { output.WriteRawTag(16); output.WriteInt32(End); } - if (options_ != null) { + if (HasOptions) { output.WriteRawTag(26); output.WriteMessage(Options); } @@ -1200,13 +1316,13 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Start != 0) { + if (HasStart) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Start); } - if (End != 0) { + if (HasEnd) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(End); } - if (options_ != null) { + if (HasOptions) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } if (_unknownFields != null) { @@ -1220,15 +1336,15 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.Start != 0) { + if (other.HasStart) { Start = other.Start; } - if (other.End != 0) { + if (other.HasEnd) { End = other.End; } - if (other.options_ != null) { - if (options_ == null) { - options_ = new global::Google.Protobuf.Reflection.ExtensionRangeOptions(); + if (other.HasOptions) { + if (!HasOptions) { + Options = new global::Google.Protobuf.Reflection.ExtensionRangeOptions(); } Options.MergeFrom(other.Options); } @@ -1252,10 +1368,10 @@ namespace Google.Protobuf.Reflection { break; } case 26: { - if (options_ == null) { - options_ = new global::Google.Protobuf.Reflection.ExtensionRangeOptions(); + if (!HasOptions) { + Options = new global::Google.Protobuf.Reflection.ExtensionRangeOptions(); } - input.ReadMessage(options_); + input.ReadMessage(Options); break; } } @@ -1272,6 +1388,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class ReservedRange : pb::IMessage<ReservedRange> { private static readonly pb::MessageParser<ReservedRange> _parser = new pb::MessageParser<ReservedRange>(() => new ReservedRange()); private pb::UnknownFieldSet _unknownFields; + private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<ReservedRange> Parser { get { return _parser; } } @@ -1294,6 +1411,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ReservedRange(ReservedRange other) : this() { + _hasBits0 = other._hasBits0; start_ = other.start_; end_ = other.end_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); @@ -1306,31 +1424,57 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "start" field.</summary> public const int StartFieldNumber = 1; + private readonly static int StartDefaultValue = 0; + private int start_; /// <summary> /// Inclusive. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Start { - get { return start_; } + get { if ((_hasBits0 & 1) != 0) { return start_; } else { return StartDefaultValue; } } set { + _hasBits0 |= 1; start_ = value; } } + /// <summary>Gets whether the "start" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasStart { + get { return (_hasBits0 & 1) != 0; } + } + /// <summary>Clears the value of the "start" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearStart() { + _hasBits0 &= ~1; + } /// <summary>Field number for the "end" field.</summary> public const int EndFieldNumber = 2; + private readonly static int EndDefaultValue = 0; + private int end_; /// <summary> /// Exclusive. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int End { - get { return end_; } + get { if ((_hasBits0 & 2) != 0) { return end_; } else { return EndDefaultValue; } } set { + _hasBits0 |= 2; end_ = value; } } + /// <summary>Gets whether the "end" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasEnd { + get { return (_hasBits0 & 2) != 0; } + } + /// <summary>Clears the value of the "end" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearEnd() { + _hasBits0 &= ~2; + } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -1353,8 +1497,8 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Start != 0) hash ^= Start.GetHashCode(); - if (End != 0) hash ^= End.GetHashCode(); + if (HasStart) hash ^= Start.GetHashCode(); + if (HasEnd) hash ^= End.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1368,11 +1512,11 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Start != 0) { + if (HasStart) { output.WriteRawTag(8); output.WriteInt32(Start); } - if (End != 0) { + if (HasEnd) { output.WriteRawTag(16); output.WriteInt32(End); } @@ -1384,10 +1528,10 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Start != 0) { + if (HasStart) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Start); } - if (End != 0) { + if (HasEnd) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(End); } if (_unknownFields != null) { @@ -1401,10 +1545,10 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.Start != 0) { + if (other.HasStart) { Start = other.Start; } - if (other.End != 0) { + if (other.HasEnd) { End = other.End; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); @@ -1567,6 +1711,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class FieldDescriptorProto : pb::IMessage<FieldDescriptorProto> { private static readonly pb::MessageParser<FieldDescriptorProto> _parser = new pb::MessageParser<FieldDescriptorProto>(() => new FieldDescriptorProto()); private pb::UnknownFieldSet _unknownFields; + private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<FieldDescriptorProto> Parser { get { return _parser; } } @@ -1589,6 +1734,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FieldDescriptorProto(FieldDescriptorProto other) : this() { + _hasBits0 = other._hasBits0; name_ = other.name_; number_ = other.number_; label_ = other.label_; @@ -1598,7 +1744,7 @@ namespace Google.Protobuf.Reflection { defaultValue_ = other.defaultValue_; oneofIndex_ = other.oneofIndex_; jsonName_ = other.jsonName_; - options_ = other.options_ != null ? other.options_.Clone() : null; + options_ = other.HasOptions ? other.options_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -1609,55 +1755,108 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 1; - private string name_ = ""; + private readonly static string NameDefaultValue = ""; + + private string name_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { - get { return name_; } + get { return name_ ?? NameDefaultValue; } set { name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "name" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasName { + get { return name_ != null; } + } + /// <summary>Clears the value of the "name" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearName() { + name_ = null; + } /// <summary>Field number for the "number" field.</summary> public const int NumberFieldNumber = 3; + private readonly static int NumberDefaultValue = 0; + private int number_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Number { - get { return number_; } + get { if ((_hasBits0 & 1) != 0) { return number_; } else { return NumberDefaultValue; } } set { + _hasBits0 |= 1; number_ = value; } } + /// <summary>Gets whether the "number" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasNumber { + get { return (_hasBits0 & 1) != 0; } + } + /// <summary>Clears the value of the "number" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearNumber() { + _hasBits0 &= ~1; + } /// <summary>Field number for the "label" field.</summary> public const int LabelFieldNumber = 4; - private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label label_ = 0; + private readonly static global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label LabelDefaultValue = global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label.Optional; + + private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label label_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label Label { - get { return label_; } + get { if ((_hasBits0 & 2) != 0) { return label_; } else { return LabelDefaultValue; } } set { + _hasBits0 |= 2; label_ = value; } } + /// <summary>Gets whether the "label" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasLabel { + get { return (_hasBits0 & 2) != 0; } + } + /// <summary>Clears the value of the "label" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearLabel() { + _hasBits0 &= ~2; + } /// <summary>Field number for the "type" field.</summary> public const int TypeFieldNumber = 5; - private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type type_ = 0; + private readonly static global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type TypeDefaultValue = global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type.Double; + + private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type type_; /// <summary> /// If type_name is set, this need not be set. If both this and type_name /// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type Type { - get { return type_; } + get { if ((_hasBits0 & 4) != 0) { return type_; } else { return TypeDefaultValue; } } set { + _hasBits0 |= 4; type_ = value; } } + /// <summary>Gets whether the "type" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasType { + get { return (_hasBits0 & 4) != 0; } + } + /// <summary>Clears the value of the "type" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearType() { + _hasBits0 &= ~4; + } /// <summary>Field number for the "type_name" field.</summary> public const int TypeNameFieldNumber = 6; - private string typeName_ = ""; + private readonly static string TypeNameDefaultValue = ""; + + private string typeName_; /// <summary> /// For message and enum types, this is the name of the type. If the name /// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping @@ -1667,30 +1866,54 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string TypeName { - get { return typeName_; } + get { return typeName_ ?? TypeNameDefaultValue; } set { typeName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "type_name" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasTypeName { + get { return typeName_ != null; } + } + /// <summary>Clears the value of the "type_name" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearTypeName() { + typeName_ = null; + } /// <summary>Field number for the "extendee" field.</summary> public const int ExtendeeFieldNumber = 2; - private string extendee_ = ""; + private readonly static string ExtendeeDefaultValue = ""; + + private string extendee_; /// <summary> /// For extensions, this is the name of the type being extended. It is /// resolved in the same manner as type_name. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Extendee { - get { return extendee_; } + get { return extendee_ ?? ExtendeeDefaultValue; } set { extendee_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "extendee" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasExtendee { + get { return extendee_ != null; } + } + /// <summary>Clears the value of the "extendee" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearExtendee() { + extendee_ = null; + } /// <summary>Field number for the "default_value" field.</summary> public const int DefaultValueFieldNumber = 7; - private string defaultValue_ = ""; + private readonly static string DefaultValueDefaultValue = ""; + + private string defaultValue_; /// <summary> /// For numeric types, contains the original text representation of the value. /// For booleans, "true" or "false". @@ -1700,14 +1923,26 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string DefaultValue { - get { return defaultValue_; } + get { return defaultValue_ ?? DefaultValueDefaultValue; } set { defaultValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "default_value" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasDefaultValue { + get { return defaultValue_ != null; } + } + /// <summary>Clears the value of the "default_value" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearDefaultValue() { + defaultValue_ = null; + } /// <summary>Field number for the "oneof_index" field.</summary> public const int OneofIndexFieldNumber = 9; + private readonly static int OneofIndexDefaultValue = 0; + private int oneofIndex_; /// <summary> /// If set, gives the index of a oneof in the containing type's oneof_decl @@ -1715,15 +1950,28 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int OneofIndex { - get { return oneofIndex_; } + get { if ((_hasBits0 & 8) != 0) { return oneofIndex_; } else { return OneofIndexDefaultValue; } } set { + _hasBits0 |= 8; oneofIndex_ = value; } } + /// <summary>Gets whether the "oneof_index" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasOneofIndex { + get { return (_hasBits0 & 8) != 0; } + } + /// <summary>Clears the value of the "oneof_index" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearOneofIndex() { + _hasBits0 &= ~8; + } /// <summary>Field number for the "json_name" field.</summary> public const int JsonNameFieldNumber = 10; - private string jsonName_ = ""; + private readonly static string JsonNameDefaultValue = ""; + + private string jsonName_; /// <summary> /// JSON name of this field. The value is set by protocol compiler. If the /// user has set a "json_name" option on this field, that option's value @@ -1732,11 +1980,21 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string JsonName { - get { return jsonName_; } + get { return jsonName_ ?? JsonNameDefaultValue; } set { jsonName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "json_name" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasJsonName { + get { return jsonName_ != null; } + } + /// <summary>Clears the value of the "json_name" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearJsonName() { + jsonName_ = null; + } /// <summary>Field number for the "options" field.</summary> public const int OptionsFieldNumber = 8; @@ -1748,6 +2006,16 @@ namespace Google.Protobuf.Reflection { options_ = value; } } + /// <summary>Gets whether the options field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasOptions { + get { return options_ != null; } + } + /// <summary>Clears the value of the options field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearOptions() { + options_ = null; + } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -1778,16 +2046,16 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (Number != 0) hash ^= Number.GetHashCode(); - if (Label != 0) hash ^= Label.GetHashCode(); - if (Type != 0) hash ^= Type.GetHashCode(); - if (TypeName.Length != 0) hash ^= TypeName.GetHashCode(); - if (Extendee.Length != 0) hash ^= Extendee.GetHashCode(); - if (DefaultValue.Length != 0) hash ^= DefaultValue.GetHashCode(); - if (OneofIndex != 0) hash ^= OneofIndex.GetHashCode(); - if (JsonName.Length != 0) hash ^= JsonName.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); + if (HasName) hash ^= Name.GetHashCode(); + if (HasNumber) hash ^= Number.GetHashCode(); + if (HasLabel) hash ^= Label.GetHashCode(); + if (HasType) hash ^= Type.GetHashCode(); + if (HasTypeName) hash ^= TypeName.GetHashCode(); + if (HasExtendee) hash ^= Extendee.GetHashCode(); + if (HasDefaultValue) hash ^= DefaultValue.GetHashCode(); + if (HasOneofIndex) hash ^= OneofIndex.GetHashCode(); + if (HasJsonName) hash ^= JsonName.GetHashCode(); + if (HasOptions) hash ^= Options.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1801,43 +2069,43 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Name.Length != 0) { + if (HasName) { output.WriteRawTag(10); output.WriteString(Name); } - if (Extendee.Length != 0) { + if (HasExtendee) { output.WriteRawTag(18); output.WriteString(Extendee); } - if (Number != 0) { + if (HasNumber) { output.WriteRawTag(24); output.WriteInt32(Number); } - if (Label != 0) { + if (HasLabel) { output.WriteRawTag(32); output.WriteEnum((int) Label); } - if (Type != 0) { + if (HasType) { output.WriteRawTag(40); output.WriteEnum((int) Type); } - if (TypeName.Length != 0) { + if (HasTypeName) { output.WriteRawTag(50); output.WriteString(TypeName); } - if (DefaultValue.Length != 0) { + if (HasDefaultValue) { output.WriteRawTag(58); output.WriteString(DefaultValue); } - if (options_ != null) { + if (HasOptions) { output.WriteRawTag(66); output.WriteMessage(Options); } - if (OneofIndex != 0) { + if (HasOneofIndex) { output.WriteRawTag(72); output.WriteInt32(OneofIndex); } - if (JsonName.Length != 0) { + if (HasJsonName) { output.WriteRawTag(82); output.WriteString(JsonName); } @@ -1849,34 +2117,34 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Name.Length != 0) { + if (HasName) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); } - if (Number != 0) { + if (HasNumber) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Number); } - if (Label != 0) { + if (HasLabel) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Label); } - if (Type != 0) { + if (HasType) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type); } - if (TypeName.Length != 0) { + if (HasTypeName) { size += 1 + pb::CodedOutputStream.ComputeStringSize(TypeName); } - if (Extendee.Length != 0) { + if (HasExtendee) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Extendee); } - if (DefaultValue.Length != 0) { + if (HasDefaultValue) { size += 1 + pb::CodedOutputStream.ComputeStringSize(DefaultValue); } - if (OneofIndex != 0) { + if (HasOneofIndex) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(OneofIndex); } - if (JsonName.Length != 0) { + if (HasJsonName) { size += 1 + pb::CodedOutputStream.ComputeStringSize(JsonName); } - if (options_ != null) { + if (HasOptions) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } if (_unknownFields != null) { @@ -1890,36 +2158,36 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.Name.Length != 0) { + if (other.HasName) { Name = other.Name; } - if (other.Number != 0) { + if (other.HasNumber) { Number = other.Number; } - if (other.Label != 0) { + if (other.HasLabel) { Label = other.Label; } - if (other.Type != 0) { + if (other.HasType) { Type = other.Type; } - if (other.TypeName.Length != 0) { + if (other.HasTypeName) { TypeName = other.TypeName; } - if (other.Extendee.Length != 0) { + if (other.HasExtendee) { Extendee = other.Extendee; } - if (other.DefaultValue.Length != 0) { + if (other.HasDefaultValue) { DefaultValue = other.DefaultValue; } - if (other.OneofIndex != 0) { + if (other.HasOneofIndex) { OneofIndex = other.OneofIndex; } - if (other.JsonName.Length != 0) { + if (other.HasJsonName) { JsonName = other.JsonName; } - if (other.options_ != null) { - if (options_ == null) { - options_ = new global::Google.Protobuf.Reflection.FieldOptions(); + if (other.HasOptions) { + if (!HasOptions) { + Options = new global::Google.Protobuf.Reflection.FieldOptions(); } Options.MergeFrom(other.Options); } @@ -1947,11 +2215,11 @@ namespace Google.Protobuf.Reflection { break; } case 32: { - label_ = (global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label) input.ReadEnum(); + Label = (global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label) input.ReadEnum(); break; } case 40: { - type_ = (global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type) input.ReadEnum(); + Type = (global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type) input.ReadEnum(); break; } case 50: { @@ -1963,10 +2231,10 @@ namespace Google.Protobuf.Reflection { break; } case 66: { - if (options_ == null) { - options_ = new global::Google.Protobuf.Reflection.FieldOptions(); + if (!HasOptions) { + Options = new global::Google.Protobuf.Reflection.FieldOptions(); } - input.ReadMessage(options_); + input.ReadMessage(Options); break; } case 72: { @@ -2079,7 +2347,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneofDescriptorProto(OneofDescriptorProto other) : this() { name_ = other.name_; - options_ = other.options_ != null ? other.options_.Clone() : null; + options_ = other.HasOptions ? other.options_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -2090,14 +2358,26 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 1; - private string name_ = ""; + private readonly static string NameDefaultValue = ""; + + private string name_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { - get { return name_; } + get { return name_ ?? NameDefaultValue; } set { name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "name" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasName { + get { return name_ != null; } + } + /// <summary>Clears the value of the "name" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearName() { + name_ = null; + } /// <summary>Field number for the "options" field.</summary> public const int OptionsFieldNumber = 2; @@ -2109,6 +2389,16 @@ namespace Google.Protobuf.Reflection { options_ = value; } } + /// <summary>Gets whether the options field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasOptions { + get { return options_ != null; } + } + /// <summary>Clears the value of the options field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearOptions() { + options_ = null; + } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -2131,8 +2421,8 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); + if (HasName) hash ^= Name.GetHashCode(); + if (HasOptions) hash ^= Options.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -2146,11 +2436,11 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Name.Length != 0) { + if (HasName) { output.WriteRawTag(10); output.WriteString(Name); } - if (options_ != null) { + if (HasOptions) { output.WriteRawTag(18); output.WriteMessage(Options); } @@ -2162,10 +2452,10 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Name.Length != 0) { + if (HasName) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); } - if (options_ != null) { + if (HasOptions) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } if (_unknownFields != null) { @@ -2179,12 +2469,12 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.Name.Length != 0) { + if (other.HasName) { Name = other.Name; } - if (other.options_ != null) { - if (options_ == null) { - options_ = new global::Google.Protobuf.Reflection.OneofOptions(); + if (other.HasOptions) { + if (!HasOptions) { + Options = new global::Google.Protobuf.Reflection.OneofOptions(); } Options.MergeFrom(other.Options); } @@ -2204,10 +2494,10 @@ namespace Google.Protobuf.Reflection { break; } case 18: { - if (options_ == null) { - options_ = new global::Google.Protobuf.Reflection.OneofOptions(); + if (!HasOptions) { + Options = new global::Google.Protobuf.Reflection.OneofOptions(); } - input.ReadMessage(options_); + input.ReadMessage(Options); break; } } @@ -2246,7 +2536,7 @@ namespace Google.Protobuf.Reflection { public EnumDescriptorProto(EnumDescriptorProto other) : this() { name_ = other.name_; value_ = other.value_.Clone(); - options_ = other.options_ != null ? other.options_.Clone() : null; + options_ = other.HasOptions ? other.options_.Clone() : null; reservedRange_ = other.reservedRange_.Clone(); reservedName_ = other.reservedName_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); @@ -2259,14 +2549,26 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 1; - private string name_ = ""; + private readonly static string NameDefaultValue = ""; + + private string name_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { - get { return name_; } + get { return name_ ?? NameDefaultValue; } set { name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "name" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasName { + get { return name_ != null; } + } + /// <summary>Clears the value of the "name" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearName() { + name_ = null; + } /// <summary>Field number for the "value" field.</summary> public const int ValueFieldNumber = 2; @@ -2288,6 +2590,16 @@ namespace Google.Protobuf.Reflection { options_ = value; } } + /// <summary>Gets whether the options field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasOptions { + get { return options_ != null; } + } + /// <summary>Clears the value of the options field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearOptions() { + options_ = null; + } /// <summary>Field number for the "reserved_range" field.</summary> public const int ReservedRangeFieldNumber = 4; @@ -2342,9 +2654,9 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (HasName) hash ^= Name.GetHashCode(); hash ^= value_.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); + if (HasOptions) hash ^= Options.GetHashCode(); hash ^= reservedRange_.GetHashCode(); hash ^= reservedName_.GetHashCode(); if (_unknownFields != null) { @@ -2360,12 +2672,12 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Name.Length != 0) { + if (HasName) { output.WriteRawTag(10); output.WriteString(Name); } value_.WriteTo(output, _repeated_value_codec); - if (options_ != null) { + if (HasOptions) { output.WriteRawTag(26); output.WriteMessage(Options); } @@ -2379,11 +2691,11 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Name.Length != 0) { + if (HasName) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); } size += value_.CalculateSize(_repeated_value_codec); - if (options_ != null) { + if (HasOptions) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } size += reservedRange_.CalculateSize(_repeated_reservedRange_codec); @@ -2399,13 +2711,13 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.Name.Length != 0) { + if (other.HasName) { Name = other.Name; } value_.Add(other.value_); - if (other.options_ != null) { - if (options_ == null) { - options_ = new global::Google.Protobuf.Reflection.EnumOptions(); + if (other.HasOptions) { + if (!HasOptions) { + Options = new global::Google.Protobuf.Reflection.EnumOptions(); } Options.MergeFrom(other.Options); } @@ -2431,10 +2743,10 @@ namespace Google.Protobuf.Reflection { break; } case 26: { - if (options_ == null) { - options_ = new global::Google.Protobuf.Reflection.EnumOptions(); + if (!HasOptions) { + Options = new global::Google.Protobuf.Reflection.EnumOptions(); } - input.ReadMessage(options_); + input.ReadMessage(Options); break; } case 34: { @@ -2464,6 +2776,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class EnumReservedRange : pb::IMessage<EnumReservedRange> { private static readonly pb::MessageParser<EnumReservedRange> _parser = new pb::MessageParser<EnumReservedRange>(() => new EnumReservedRange()); private pb::UnknownFieldSet _unknownFields; + private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<EnumReservedRange> Parser { get { return _parser; } } @@ -2486,6 +2799,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumReservedRange(EnumReservedRange other) : this() { + _hasBits0 = other._hasBits0; start_ = other.start_; end_ = other.end_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); @@ -2498,31 +2812,57 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "start" field.</summary> public const int StartFieldNumber = 1; + private readonly static int StartDefaultValue = 0; + private int start_; /// <summary> /// Inclusive. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Start { - get { return start_; } + get { if ((_hasBits0 & 1) != 0) { return start_; } else { return StartDefaultValue; } } set { + _hasBits0 |= 1; start_ = value; } } + /// <summary>Gets whether the "start" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasStart { + get { return (_hasBits0 & 1) != 0; } + } + /// <summary>Clears the value of the "start" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearStart() { + _hasBits0 &= ~1; + } /// <summary>Field number for the "end" field.</summary> public const int EndFieldNumber = 2; + private readonly static int EndDefaultValue = 0; + private int end_; /// <summary> /// Inclusive. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int End { - get { return end_; } + get { if ((_hasBits0 & 2) != 0) { return end_; } else { return EndDefaultValue; } } set { + _hasBits0 |= 2; end_ = value; } } + /// <summary>Gets whether the "end" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasEnd { + get { return (_hasBits0 & 2) != 0; } + } + /// <summary>Clears the value of the "end" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearEnd() { + _hasBits0 &= ~2; + } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -2545,8 +2885,8 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Start != 0) hash ^= Start.GetHashCode(); - if (End != 0) hash ^= End.GetHashCode(); + if (HasStart) hash ^= Start.GetHashCode(); + if (HasEnd) hash ^= End.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -2560,11 +2900,11 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Start != 0) { + if (HasStart) { output.WriteRawTag(8); output.WriteInt32(Start); } - if (End != 0) { + if (HasEnd) { output.WriteRawTag(16); output.WriteInt32(End); } @@ -2576,10 +2916,10 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Start != 0) { + if (HasStart) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Start); } - if (End != 0) { + if (HasEnd) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(End); } if (_unknownFields != null) { @@ -2593,10 +2933,10 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.Start != 0) { + if (other.HasStart) { Start = other.Start; } - if (other.End != 0) { + if (other.HasEnd) { End = other.End; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); @@ -2635,6 +2975,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class EnumValueDescriptorProto : pb::IMessage<EnumValueDescriptorProto> { private static readonly pb::MessageParser<EnumValueDescriptorProto> _parser = new pb::MessageParser<EnumValueDescriptorProto>(() => new EnumValueDescriptorProto()); private pb::UnknownFieldSet _unknownFields; + private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<EnumValueDescriptorProto> Parser { get { return _parser; } } @@ -2657,9 +2998,10 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumValueDescriptorProto(EnumValueDescriptorProto other) : this() { + _hasBits0 = other._hasBits0; name_ = other.name_; number_ = other.number_; - options_ = other.options_ != null ? other.options_.Clone() : null; + options_ = other.HasOptions ? other.options_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -2670,25 +3012,50 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 1; - private string name_ = ""; + private readonly static string NameDefaultValue = ""; + + private string name_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { - get { return name_; } + get { return name_ ?? NameDefaultValue; } set { name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "name" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasName { + get { return name_ != null; } + } + /// <summary>Clears the value of the "name" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearName() { + name_ = null; + } /// <summary>Field number for the "number" field.</summary> public const int NumberFieldNumber = 2; + private readonly static int NumberDefaultValue = 0; + private int number_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Number { - get { return number_; } + get { if ((_hasBits0 & 1) != 0) { return number_; } else { return NumberDefaultValue; } } set { + _hasBits0 |= 1; number_ = value; } } + /// <summary>Gets whether the "number" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasNumber { + get { return (_hasBits0 & 1) != 0; } + } + /// <summary>Clears the value of the "number" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearNumber() { + _hasBits0 &= ~1; + } /// <summary>Field number for the "options" field.</summary> public const int OptionsFieldNumber = 3; @@ -2700,6 +3067,16 @@ namespace Google.Protobuf.Reflection { options_ = value; } } + /// <summary>Gets whether the options field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasOptions { + get { return options_ != null; } + } + /// <summary>Clears the value of the options field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearOptions() { + options_ = null; + } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -2723,9 +3100,9 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (Number != 0) hash ^= Number.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); + if (HasName) hash ^= Name.GetHashCode(); + if (HasNumber) hash ^= Number.GetHashCode(); + if (HasOptions) hash ^= Options.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -2739,15 +3116,15 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Name.Length != 0) { + if (HasName) { output.WriteRawTag(10); output.WriteString(Name); } - if (Number != 0) { + if (HasNumber) { output.WriteRawTag(16); output.WriteInt32(Number); } - if (options_ != null) { + if (HasOptions) { output.WriteRawTag(26); output.WriteMessage(Options); } @@ -2759,13 +3136,13 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Name.Length != 0) { + if (HasName) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); } - if (Number != 0) { + if (HasNumber) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Number); } - if (options_ != null) { + if (HasOptions) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } if (_unknownFields != null) { @@ -2779,15 +3156,15 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.Name.Length != 0) { + if (other.HasName) { Name = other.Name; } - if (other.Number != 0) { + if (other.HasNumber) { Number = other.Number; } - if (other.options_ != null) { - if (options_ == null) { - options_ = new global::Google.Protobuf.Reflection.EnumValueOptions(); + if (other.HasOptions) { + if (!HasOptions) { + Options = new global::Google.Protobuf.Reflection.EnumValueOptions(); } Options.MergeFrom(other.Options); } @@ -2811,10 +3188,10 @@ namespace Google.Protobuf.Reflection { break; } case 26: { - if (options_ == null) { - options_ = new global::Google.Protobuf.Reflection.EnumValueOptions(); + if (!HasOptions) { + Options = new global::Google.Protobuf.Reflection.EnumValueOptions(); } - input.ReadMessage(options_); + input.ReadMessage(Options); break; } } @@ -2853,7 +3230,7 @@ namespace Google.Protobuf.Reflection { public ServiceDescriptorProto(ServiceDescriptorProto other) : this() { name_ = other.name_; method_ = other.method_.Clone(); - options_ = other.options_ != null ? other.options_.Clone() : null; + options_ = other.HasOptions ? other.options_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -2864,14 +3241,26 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 1; - private string name_ = ""; + private readonly static string NameDefaultValue = ""; + + private string name_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { - get { return name_; } + get { return name_ ?? NameDefaultValue; } set { name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "name" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasName { + get { return name_ != null; } + } + /// <summary>Clears the value of the "name" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearName() { + name_ = null; + } /// <summary>Field number for the "method" field.</summary> public const int MethodFieldNumber = 2; @@ -2893,6 +3282,16 @@ namespace Google.Protobuf.Reflection { options_ = value; } } + /// <summary>Gets whether the options field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasOptions { + get { return options_ != null; } + } + /// <summary>Clears the value of the options field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearOptions() { + options_ = null; + } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -2916,9 +3315,9 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (HasName) hash ^= Name.GetHashCode(); hash ^= method_.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); + if (HasOptions) hash ^= Options.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -2932,12 +3331,12 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Name.Length != 0) { + if (HasName) { output.WriteRawTag(10); output.WriteString(Name); } method_.WriteTo(output, _repeated_method_codec); - if (options_ != null) { + if (HasOptions) { output.WriteRawTag(26); output.WriteMessage(Options); } @@ -2949,11 +3348,11 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Name.Length != 0) { + if (HasName) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); } size += method_.CalculateSize(_repeated_method_codec); - if (options_ != null) { + if (HasOptions) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } if (_unknownFields != null) { @@ -2967,13 +3366,13 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.Name.Length != 0) { + if (other.HasName) { Name = other.Name; } method_.Add(other.method_); - if (other.options_ != null) { - if (options_ == null) { - options_ = new global::Google.Protobuf.Reflection.ServiceOptions(); + if (other.HasOptions) { + if (!HasOptions) { + Options = new global::Google.Protobuf.Reflection.ServiceOptions(); } Options.MergeFrom(other.Options); } @@ -2997,10 +3396,10 @@ namespace Google.Protobuf.Reflection { break; } case 26: { - if (options_ == null) { - options_ = new global::Google.Protobuf.Reflection.ServiceOptions(); + if (!HasOptions) { + Options = new global::Google.Protobuf.Reflection.ServiceOptions(); } - input.ReadMessage(options_); + input.ReadMessage(Options); break; } } @@ -3015,6 +3414,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class MethodDescriptorProto : pb::IMessage<MethodDescriptorProto> { private static readonly pb::MessageParser<MethodDescriptorProto> _parser = new pb::MessageParser<MethodDescriptorProto>(() => new MethodDescriptorProto()); private pb::UnknownFieldSet _unknownFields; + private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<MethodDescriptorProto> Parser { get { return _parser; } } @@ -3037,10 +3437,11 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MethodDescriptorProto(MethodDescriptorProto other) : this() { + _hasBits0 = other._hasBits0; name_ = other.name_; inputType_ = other.inputType_; outputType_ = other.outputType_; - options_ = other.options_ != null ? other.options_.Clone() : null; + options_ = other.HasOptions ? other.options_.Clone() : null; clientStreaming_ = other.clientStreaming_; serverStreaming_ = other.serverStreaming_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); @@ -3053,40 +3454,76 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 1; - private string name_ = ""; + private readonly static string NameDefaultValue = ""; + + private string name_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { - get { return name_; } + get { return name_ ?? NameDefaultValue; } set { name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "name" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasName { + get { return name_ != null; } + } + /// <summary>Clears the value of the "name" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearName() { + name_ = null; + } /// <summary>Field number for the "input_type" field.</summary> public const int InputTypeFieldNumber = 2; - private string inputType_ = ""; + private readonly static string InputTypeDefaultValue = ""; + + private string inputType_; /// <summary> /// Input and output type names. These are resolved in the same way as /// FieldDescriptorProto.type_name, but must refer to a message type. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string InputType { - get { return inputType_; } + get { return inputType_ ?? InputTypeDefaultValue; } set { inputType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "input_type" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasInputType { + get { return inputType_ != null; } + } + /// <summary>Clears the value of the "input_type" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearInputType() { + inputType_ = null; + } /// <summary>Field number for the "output_type" field.</summary> public const int OutputTypeFieldNumber = 3; - private string outputType_ = ""; + private readonly static string OutputTypeDefaultValue = ""; + + private string outputType_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string OutputType { - get { return outputType_; } + get { return outputType_ ?? OutputTypeDefaultValue; } set { outputType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "output_type" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasOutputType { + get { return outputType_ != null; } + } + /// <summary>Clears the value of the "output_type" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearOutputType() { + outputType_ = null; + } /// <summary>Field number for the "options" field.</summary> public const int OptionsFieldNumber = 4; @@ -3098,34 +3535,70 @@ namespace Google.Protobuf.Reflection { options_ = value; } } + /// <summary>Gets whether the options field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasOptions { + get { return options_ != null; } + } + /// <summary>Clears the value of the options field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearOptions() { + options_ = null; + } /// <summary>Field number for the "client_streaming" field.</summary> public const int ClientStreamingFieldNumber = 5; + private readonly static bool ClientStreamingDefaultValue = false; + private bool clientStreaming_; /// <summary> /// Identifies if client streams multiple client messages /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool ClientStreaming { - get { return clientStreaming_; } + get { if ((_hasBits0 & 1) != 0) { return clientStreaming_; } else { return ClientStreamingDefaultValue; } } set { + _hasBits0 |= 1; clientStreaming_ = value; } } + /// <summary>Gets whether the "client_streaming" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasClientStreaming { + get { return (_hasBits0 & 1) != 0; } + } + /// <summary>Clears the value of the "client_streaming" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearClientStreaming() { + _hasBits0 &= ~1; + } /// <summary>Field number for the "server_streaming" field.</summary> public const int ServerStreamingFieldNumber = 6; + private readonly static bool ServerStreamingDefaultValue = false; + private bool serverStreaming_; /// <summary> /// Identifies if server streams multiple server messages /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool ServerStreaming { - get { return serverStreaming_; } + get { if ((_hasBits0 & 2) != 0) { return serverStreaming_; } else { return ServerStreamingDefaultValue; } } set { + _hasBits0 |= 2; serverStreaming_ = value; } } + /// <summary>Gets whether the "server_streaming" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasServerStreaming { + get { return (_hasBits0 & 2) != 0; } + } + /// <summary>Clears the value of the "server_streaming" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearServerStreaming() { + _hasBits0 &= ~2; + } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -3152,12 +3625,12 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (InputType.Length != 0) hash ^= InputType.GetHashCode(); - if (OutputType.Length != 0) hash ^= OutputType.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); - if (ClientStreaming != false) hash ^= ClientStreaming.GetHashCode(); - if (ServerStreaming != false) hash ^= ServerStreaming.GetHashCode(); + if (HasName) hash ^= Name.GetHashCode(); + if (HasInputType) hash ^= InputType.GetHashCode(); + if (HasOutputType) hash ^= OutputType.GetHashCode(); + if (HasOptions) hash ^= Options.GetHashCode(); + if (HasClientStreaming) hash ^= ClientStreaming.GetHashCode(); + if (HasServerStreaming) hash ^= ServerStreaming.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -3171,27 +3644,27 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Name.Length != 0) { + if (HasName) { output.WriteRawTag(10); output.WriteString(Name); } - if (InputType.Length != 0) { + if (HasInputType) { output.WriteRawTag(18); output.WriteString(InputType); } - if (OutputType.Length != 0) { + if (HasOutputType) { output.WriteRawTag(26); output.WriteString(OutputType); } - if (options_ != null) { + if (HasOptions) { output.WriteRawTag(34); output.WriteMessage(Options); } - if (ClientStreaming != false) { + if (HasClientStreaming) { output.WriteRawTag(40); output.WriteBool(ClientStreaming); } - if (ServerStreaming != false) { + if (HasServerStreaming) { output.WriteRawTag(48); output.WriteBool(ServerStreaming); } @@ -3203,22 +3676,22 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Name.Length != 0) { + if (HasName) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); } - if (InputType.Length != 0) { + if (HasInputType) { size += 1 + pb::CodedOutputStream.ComputeStringSize(InputType); } - if (OutputType.Length != 0) { + if (HasOutputType) { size += 1 + pb::CodedOutputStream.ComputeStringSize(OutputType); } - if (options_ != null) { + if (HasOptions) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } - if (ClientStreaming != false) { + if (HasClientStreaming) { size += 1 + 1; } - if (ServerStreaming != false) { + if (HasServerStreaming) { size += 1 + 1; } if (_unknownFields != null) { @@ -3232,25 +3705,25 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.Name.Length != 0) { + if (other.HasName) { Name = other.Name; } - if (other.InputType.Length != 0) { + if (other.HasInputType) { InputType = other.InputType; } - if (other.OutputType.Length != 0) { + if (other.HasOutputType) { OutputType = other.OutputType; } - if (other.options_ != null) { - if (options_ == null) { - options_ = new global::Google.Protobuf.Reflection.MethodOptions(); + if (other.HasOptions) { + if (!HasOptions) { + Options = new global::Google.Protobuf.Reflection.MethodOptions(); } Options.MergeFrom(other.Options); } - if (other.ClientStreaming != false) { + if (other.HasClientStreaming) { ClientStreaming = other.ClientStreaming; } - if (other.ServerStreaming != false) { + if (other.HasServerStreaming) { ServerStreaming = other.ServerStreaming; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); @@ -3277,10 +3750,10 @@ namespace Google.Protobuf.Reflection { break; } case 34: { - if (options_ == null) { - options_ = new global::Google.Protobuf.Reflection.MethodOptions(); + if (!HasOptions) { + Options = new global::Google.Protobuf.Reflection.MethodOptions(); } - input.ReadMessage(options_); + input.ReadMessage(Options); break; } case 40: { @@ -3300,6 +3773,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class FileOptions : pb::IMessage<FileOptions> { private static readonly pb::MessageParser<FileOptions> _parser = new pb::MessageParser<FileOptions>(() => new FileOptions()); private pb::UnknownFieldSet _unknownFields; + private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<FileOptions> Parser { get { return _parser; } } @@ -3324,6 +3798,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FileOptions(FileOptions other) : this() { + _hasBits0 = other._hasBits0; javaPackage_ = other.javaPackage_; javaOuterClassname_ = other.javaOuterClassname_; javaMultipleFiles_ = other.javaMultipleFiles_; @@ -3355,7 +3830,9 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "java_package" field.</summary> public const int JavaPackageFieldNumber = 1; - private string javaPackage_ = ""; + private readonly static string JavaPackageDefaultValue = ""; + + private string javaPackage_; /// <summary> /// Sets the Java package where classes generated from this .proto will be /// placed. By default, the proto package is used, but this is often @@ -3364,15 +3841,27 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string JavaPackage { - get { return javaPackage_; } + get { return javaPackage_ ?? JavaPackageDefaultValue; } set { javaPackage_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "java_package" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasJavaPackage { + get { return javaPackage_ != null; } + } + /// <summary>Clears the value of the "java_package" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearJavaPackage() { + javaPackage_ = null; + } /// <summary>Field number for the "java_outer_classname" field.</summary> public const int JavaOuterClassnameFieldNumber = 8; - private string javaOuterClassname_ = ""; + private readonly static string JavaOuterClassnameDefaultValue = ""; + + private string javaOuterClassname_; /// <summary> /// If set, all the classes from the .proto file are wrapped in a single /// outer class with the given name. This applies to both Proto1 @@ -3382,14 +3871,26 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string JavaOuterClassname { - get { return javaOuterClassname_; } + get { return javaOuterClassname_ ?? JavaOuterClassnameDefaultValue; } set { javaOuterClassname_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "java_outer_classname" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasJavaOuterClassname { + get { return javaOuterClassname_ != null; } + } + /// <summary>Clears the value of the "java_outer_classname" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearJavaOuterClassname() { + javaOuterClassname_ = null; + } /// <summary>Field number for the "java_multiple_files" field.</summary> public const int JavaMultipleFilesFieldNumber = 10; + private readonly static bool JavaMultipleFilesDefaultValue = false; + private bool javaMultipleFiles_; /// <summary> /// If set true, then the Java code generator will generate a separate .java @@ -3401,14 +3902,27 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool JavaMultipleFiles { - get { return javaMultipleFiles_; } + get { if ((_hasBits0 & 2) != 0) { return javaMultipleFiles_; } else { return JavaMultipleFilesDefaultValue; } } set { + _hasBits0 |= 2; javaMultipleFiles_ = value; } } + /// <summary>Gets whether the "java_multiple_files" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasJavaMultipleFiles { + get { return (_hasBits0 & 2) != 0; } + } + /// <summary>Clears the value of the "java_multiple_files" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearJavaMultipleFiles() { + _hasBits0 &= ~2; + } /// <summary>Field number for the "java_generate_equals_and_hash" field.</summary> public const int JavaGenerateEqualsAndHashFieldNumber = 20; + private readonly static bool JavaGenerateEqualsAndHashDefaultValue = false; + private bool javaGenerateEqualsAndHash_; /// <summary> /// This option does nothing. @@ -3416,14 +3930,29 @@ namespace Google.Protobuf.Reflection { [global::System.ObsoleteAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool JavaGenerateEqualsAndHash { - get { return javaGenerateEqualsAndHash_; } + get { if ((_hasBits0 & 32) != 0) { return javaGenerateEqualsAndHash_; } else { return JavaGenerateEqualsAndHashDefaultValue; } } set { + _hasBits0 |= 32; javaGenerateEqualsAndHash_ = value; } } + /// <summary>Gets whether the "java_generate_equals_and_hash" field is set</summary> + [global::System.ObsoleteAttribute] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasJavaGenerateEqualsAndHash { + get { return (_hasBits0 & 32) != 0; } + } + /// <summary>Clears the value of the "java_generate_equals_and_hash" field</summary> + [global::System.ObsoleteAttribute] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearJavaGenerateEqualsAndHash() { + _hasBits0 &= ~32; + } /// <summary>Field number for the "java_string_check_utf8" field.</summary> public const int JavaStringCheckUtf8FieldNumber = 27; + private readonly static bool JavaStringCheckUtf8DefaultValue = false; + private bool javaStringCheckUtf8_; /// <summary> /// If set true, then the Java2 code generator will generate code that @@ -3435,26 +3964,52 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool JavaStringCheckUtf8 { - get { return javaStringCheckUtf8_; } + get { if ((_hasBits0 & 128) != 0) { return javaStringCheckUtf8_; } else { return JavaStringCheckUtf8DefaultValue; } } set { + _hasBits0 |= 128; javaStringCheckUtf8_ = value; } } + /// <summary>Gets whether the "java_string_check_utf8" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasJavaStringCheckUtf8 { + get { return (_hasBits0 & 128) != 0; } + } + /// <summary>Clears the value of the "java_string_check_utf8" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearJavaStringCheckUtf8() { + _hasBits0 &= ~128; + } /// <summary>Field number for the "optimize_for" field.</summary> public const int OptimizeForFieldNumber = 9; - private global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode optimizeFor_ = 0; + private readonly static global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode OptimizeForDefaultValue = global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode.Speed; + + private global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode optimizeFor_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode OptimizeFor { - get { return optimizeFor_; } + get { if ((_hasBits0 & 1) != 0) { return optimizeFor_; } else { return OptimizeForDefaultValue; } } set { + _hasBits0 |= 1; optimizeFor_ = value; } } + /// <summary>Gets whether the "optimize_for" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasOptimizeFor { + get { return (_hasBits0 & 1) != 0; } + } + /// <summary>Clears the value of the "optimize_for" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearOptimizeFor() { + _hasBits0 &= ~1; + } /// <summary>Field number for the "go_package" field.</summary> public const int GoPackageFieldNumber = 11; - private string goPackage_ = ""; + private readonly static string GoPackageDefaultValue = ""; + + private string goPackage_; /// <summary> /// Sets the Go package where structs generated from this .proto will be /// placed. If omitted, the Go package will be derived from the following: @@ -3464,14 +4019,26 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string GoPackage { - get { return goPackage_; } + get { return goPackage_ ?? GoPackageDefaultValue; } set { goPackage_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "go_package" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasGoPackage { + get { return goPackage_ != null; } + } + /// <summary>Clears the value of the "go_package" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearGoPackage() { + goPackage_ = null; + } /// <summary>Field number for the "cc_generic_services" field.</summary> public const int CcGenericServicesFieldNumber = 16; + private readonly static bool CcGenericServicesDefaultValue = false; + private bool ccGenericServices_; /// <summary> /// Should generic services be generated in each language? "Generic" services @@ -3487,47 +4054,99 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool CcGenericServices { - get { return ccGenericServices_; } + get { if ((_hasBits0 & 4) != 0) { return ccGenericServices_; } else { return CcGenericServicesDefaultValue; } } set { + _hasBits0 |= 4; ccGenericServices_ = value; } } + /// <summary>Gets whether the "cc_generic_services" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasCcGenericServices { + get { return (_hasBits0 & 4) != 0; } + } + /// <summary>Clears the value of the "cc_generic_services" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearCcGenericServices() { + _hasBits0 &= ~4; + } /// <summary>Field number for the "java_generic_services" field.</summary> public const int JavaGenericServicesFieldNumber = 17; + private readonly static bool JavaGenericServicesDefaultValue = false; + private bool javaGenericServices_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool JavaGenericServices { - get { return javaGenericServices_; } + get { if ((_hasBits0 & 8) != 0) { return javaGenericServices_; } else { return JavaGenericServicesDefaultValue; } } set { + _hasBits0 |= 8; javaGenericServices_ = value; } } + /// <summary>Gets whether the "java_generic_services" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasJavaGenericServices { + get { return (_hasBits0 & 8) != 0; } + } + /// <summary>Clears the value of the "java_generic_services" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearJavaGenericServices() { + _hasBits0 &= ~8; + } /// <summary>Field number for the "py_generic_services" field.</summary> public const int PyGenericServicesFieldNumber = 18; + private readonly static bool PyGenericServicesDefaultValue = false; + private bool pyGenericServices_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool PyGenericServices { - get { return pyGenericServices_; } + get { if ((_hasBits0 & 16) != 0) { return pyGenericServices_; } else { return PyGenericServicesDefaultValue; } } set { + _hasBits0 |= 16; pyGenericServices_ = value; } } + /// <summary>Gets whether the "py_generic_services" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasPyGenericServices { + get { return (_hasBits0 & 16) != 0; } + } + /// <summary>Clears the value of the "py_generic_services" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearPyGenericServices() { + _hasBits0 &= ~16; + } /// <summary>Field number for the "php_generic_services" field.</summary> public const int PhpGenericServicesFieldNumber = 42; + private readonly static bool PhpGenericServicesDefaultValue = false; + private bool phpGenericServices_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool PhpGenericServices { - get { return phpGenericServices_; } + get { if ((_hasBits0 & 512) != 0) { return phpGenericServices_; } else { return PhpGenericServicesDefaultValue; } } set { + _hasBits0 |= 512; phpGenericServices_ = value; } } + /// <summary>Gets whether the "php_generic_services" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasPhpGenericServices { + get { return (_hasBits0 & 512) != 0; } + } + /// <summary>Clears the value of the "php_generic_services" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearPhpGenericServices() { + _hasBits0 &= ~512; + } /// <summary>Field number for the "deprecated" field.</summary> public const int DeprecatedFieldNumber = 23; + private readonly static bool DeprecatedDefaultValue = false; + private bool deprecated_; /// <summary> /// Is this file deprecated? @@ -3537,14 +4156,27 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { - get { return deprecated_; } + get { if ((_hasBits0 & 64) != 0) { return deprecated_; } else { return DeprecatedDefaultValue; } } set { + _hasBits0 |= 64; deprecated_ = value; } } + /// <summary>Gets whether the "deprecated" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasDeprecated { + get { return (_hasBits0 & 64) != 0; } + } + /// <summary>Clears the value of the "deprecated" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearDeprecated() { + _hasBits0 &= ~64; + } /// <summary>Field number for the "cc_enable_arenas" field.</summary> public const int CcEnableArenasFieldNumber = 31; + private readonly static bool CcEnableArenasDefaultValue = false; + private bool ccEnableArenas_; /// <summary> /// Enables the use of arenas for the proto messages in this file. This applies @@ -3552,44 +4184,81 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool CcEnableArenas { - get { return ccEnableArenas_; } + get { if ((_hasBits0 & 256) != 0) { return ccEnableArenas_; } else { return CcEnableArenasDefaultValue; } } set { + _hasBits0 |= 256; ccEnableArenas_ = value; } } + /// <summary>Gets whether the "cc_enable_arenas" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasCcEnableArenas { + get { return (_hasBits0 & 256) != 0; } + } + /// <summary>Clears the value of the "cc_enable_arenas" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearCcEnableArenas() { + _hasBits0 &= ~256; + } /// <summary>Field number for the "objc_class_prefix" field.</summary> public const int ObjcClassPrefixFieldNumber = 36; - private string objcClassPrefix_ = ""; + private readonly static string ObjcClassPrefixDefaultValue = ""; + + private string objcClassPrefix_; /// <summary> /// Sets the objective c class prefix which is prepended to all objective c /// generated classes from this .proto. There is no default. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string ObjcClassPrefix { - get { return objcClassPrefix_; } + get { return objcClassPrefix_ ?? ObjcClassPrefixDefaultValue; } set { objcClassPrefix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "objc_class_prefix" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasObjcClassPrefix { + get { return objcClassPrefix_ != null; } + } + /// <summary>Clears the value of the "objc_class_prefix" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearObjcClassPrefix() { + objcClassPrefix_ = null; + } /// <summary>Field number for the "csharp_namespace" field.</summary> public const int CsharpNamespaceFieldNumber = 37; - private string csharpNamespace_ = ""; + private readonly static string CsharpNamespaceDefaultValue = ""; + + private string csharpNamespace_; /// <summary> /// Namespace for generated classes; defaults to the package. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string CsharpNamespace { - get { return csharpNamespace_; } + get { return csharpNamespace_ ?? CsharpNamespaceDefaultValue; } set { csharpNamespace_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "csharp_namespace" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasCsharpNamespace { + get { return csharpNamespace_ != null; } + } + /// <summary>Clears the value of the "csharp_namespace" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearCsharpNamespace() { + csharpNamespace_ = null; + } /// <summary>Field number for the "swift_prefix" field.</summary> public const int SwiftPrefixFieldNumber = 39; - private string swiftPrefix_ = ""; + private readonly static string SwiftPrefixDefaultValue = ""; + + private string swiftPrefix_; /// <summary> /// By default Swift generators will take the proto package and CamelCase it /// replacing '.' with underscore and use that to prefix the types/symbols @@ -3598,30 +4267,54 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string SwiftPrefix { - get { return swiftPrefix_; } + get { return swiftPrefix_ ?? SwiftPrefixDefaultValue; } set { swiftPrefix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "swift_prefix" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasSwiftPrefix { + get { return swiftPrefix_ != null; } + } + /// <summary>Clears the value of the "swift_prefix" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearSwiftPrefix() { + swiftPrefix_ = null; + } /// <summary>Field number for the "php_class_prefix" field.</summary> public const int PhpClassPrefixFieldNumber = 40; - private string phpClassPrefix_ = ""; + private readonly static string PhpClassPrefixDefaultValue = ""; + + private string phpClassPrefix_; /// <summary> /// Sets the php class prefix which is prepended to all php generated classes /// from this .proto. Default is empty. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string PhpClassPrefix { - get { return phpClassPrefix_; } + get { return phpClassPrefix_ ?? PhpClassPrefixDefaultValue; } set { phpClassPrefix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "php_class_prefix" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasPhpClassPrefix { + get { return phpClassPrefix_ != null; } + } + /// <summary>Clears the value of the "php_class_prefix" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearPhpClassPrefix() { + phpClassPrefix_ = null; + } /// <summary>Field number for the "php_namespace" field.</summary> public const int PhpNamespaceFieldNumber = 41; - private string phpNamespace_ = ""; + private readonly static string PhpNamespaceDefaultValue = ""; + + private string phpNamespace_; /// <summary> /// Use this option to change the namespace of php generated classes. Default /// is empty. When this option is empty, the package name will be used for @@ -3629,15 +4322,27 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string PhpNamespace { - get { return phpNamespace_; } + get { return phpNamespace_ ?? PhpNamespaceDefaultValue; } set { phpNamespace_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "php_namespace" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasPhpNamespace { + get { return phpNamespace_ != null; } + } + /// <summary>Clears the value of the "php_namespace" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearPhpNamespace() { + phpNamespace_ = null; + } /// <summary>Field number for the "php_metadata_namespace" field.</summary> public const int PhpMetadataNamespaceFieldNumber = 44; - private string phpMetadataNamespace_ = ""; + private readonly static string PhpMetadataNamespaceDefaultValue = ""; + + private string phpMetadataNamespace_; /// <summary> /// Use this option to change the namespace of php generated metadata classes. /// Default is empty. When this option is empty, the proto file name will be used @@ -3645,15 +4350,27 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string PhpMetadataNamespace { - get { return phpMetadataNamespace_; } + get { return phpMetadataNamespace_ ?? PhpMetadataNamespaceDefaultValue; } set { phpMetadataNamespace_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "php_metadata_namespace" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasPhpMetadataNamespace { + get { return phpMetadataNamespace_ != null; } + } + /// <summary>Clears the value of the "php_metadata_namespace" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearPhpMetadataNamespace() { + phpMetadataNamespace_ = null; + } /// <summary>Field number for the "ruby_package" field.</summary> public const int RubyPackageFieldNumber = 45; - private string rubyPackage_ = ""; + private readonly static string RubyPackageDefaultValue = ""; + + private string rubyPackage_; /// <summary> /// Use this option to change the package of ruby generated classes. Default /// is empty. When this option is not set, the package name will be used for @@ -3661,11 +4378,21 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string RubyPackage { - get { return rubyPackage_; } + get { return rubyPackage_ ?? RubyPackageDefaultValue; } set { rubyPackage_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "ruby_package" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasRubyPackage { + get { return rubyPackage_ != null; } + } + /// <summary>Clears the value of the "ruby_package" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearRubyPackage() { + rubyPackage_ = null; + } /// <summary>Field number for the "uninterpreted_option" field.</summary> public const int UninterpretedOptionFieldNumber = 999; @@ -3721,26 +4448,26 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (JavaPackage.Length != 0) hash ^= JavaPackage.GetHashCode(); - if (JavaOuterClassname.Length != 0) hash ^= JavaOuterClassname.GetHashCode(); - if (JavaMultipleFiles != false) hash ^= JavaMultipleFiles.GetHashCode(); - if (JavaGenerateEqualsAndHash != false) hash ^= JavaGenerateEqualsAndHash.GetHashCode(); - if (JavaStringCheckUtf8 != false) hash ^= JavaStringCheckUtf8.GetHashCode(); - if (OptimizeFor != 0) hash ^= OptimizeFor.GetHashCode(); - if (GoPackage.Length != 0) hash ^= GoPackage.GetHashCode(); - if (CcGenericServices != false) hash ^= CcGenericServices.GetHashCode(); - if (JavaGenericServices != false) hash ^= JavaGenericServices.GetHashCode(); - if (PyGenericServices != false) hash ^= PyGenericServices.GetHashCode(); - if (PhpGenericServices != false) hash ^= PhpGenericServices.GetHashCode(); - if (Deprecated != false) hash ^= Deprecated.GetHashCode(); - if (CcEnableArenas != false) hash ^= CcEnableArenas.GetHashCode(); - if (ObjcClassPrefix.Length != 0) hash ^= ObjcClassPrefix.GetHashCode(); - if (CsharpNamespace.Length != 0) hash ^= CsharpNamespace.GetHashCode(); - if (SwiftPrefix.Length != 0) hash ^= SwiftPrefix.GetHashCode(); - if (PhpClassPrefix.Length != 0) hash ^= PhpClassPrefix.GetHashCode(); - if (PhpNamespace.Length != 0) hash ^= PhpNamespace.GetHashCode(); - if (PhpMetadataNamespace.Length != 0) hash ^= PhpMetadataNamespace.GetHashCode(); - if (RubyPackage.Length != 0) hash ^= RubyPackage.GetHashCode(); + if (HasJavaPackage) hash ^= JavaPackage.GetHashCode(); + if (HasJavaOuterClassname) hash ^= JavaOuterClassname.GetHashCode(); + if (HasJavaMultipleFiles) hash ^= JavaMultipleFiles.GetHashCode(); + if (HasJavaGenerateEqualsAndHash) hash ^= JavaGenerateEqualsAndHash.GetHashCode(); + if (HasJavaStringCheckUtf8) hash ^= JavaStringCheckUtf8.GetHashCode(); + if (HasOptimizeFor) hash ^= OptimizeFor.GetHashCode(); + if (HasGoPackage) hash ^= GoPackage.GetHashCode(); + if (HasCcGenericServices) hash ^= CcGenericServices.GetHashCode(); + if (HasJavaGenericServices) hash ^= JavaGenericServices.GetHashCode(); + if (HasPyGenericServices) hash ^= PyGenericServices.GetHashCode(); + if (HasPhpGenericServices) hash ^= PhpGenericServices.GetHashCode(); + if (HasDeprecated) hash ^= Deprecated.GetHashCode(); + if (HasCcEnableArenas) hash ^= CcEnableArenas.GetHashCode(); + if (HasObjcClassPrefix) hash ^= ObjcClassPrefix.GetHashCode(); + if (HasCsharpNamespace) hash ^= CsharpNamespace.GetHashCode(); + if (HasSwiftPrefix) hash ^= SwiftPrefix.GetHashCode(); + if (HasPhpClassPrefix) hash ^= PhpClassPrefix.GetHashCode(); + if (HasPhpNamespace) hash ^= PhpNamespace.GetHashCode(); + if (HasPhpMetadataNamespace) hash ^= PhpMetadataNamespace.GetHashCode(); + if (HasRubyPackage) hash ^= RubyPackage.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -3755,83 +4482,83 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (JavaPackage.Length != 0) { + if (HasJavaPackage) { output.WriteRawTag(10); output.WriteString(JavaPackage); } - if (JavaOuterClassname.Length != 0) { + if (HasJavaOuterClassname) { output.WriteRawTag(66); output.WriteString(JavaOuterClassname); } - if (OptimizeFor != 0) { + if (HasOptimizeFor) { output.WriteRawTag(72); output.WriteEnum((int) OptimizeFor); } - if (JavaMultipleFiles != false) { + if (HasJavaMultipleFiles) { output.WriteRawTag(80); output.WriteBool(JavaMultipleFiles); } - if (GoPackage.Length != 0) { + if (HasGoPackage) { output.WriteRawTag(90); output.WriteString(GoPackage); } - if (CcGenericServices != false) { + if (HasCcGenericServices) { output.WriteRawTag(128, 1); output.WriteBool(CcGenericServices); } - if (JavaGenericServices != false) { + if (HasJavaGenericServices) { output.WriteRawTag(136, 1); output.WriteBool(JavaGenericServices); } - if (PyGenericServices != false) { + if (HasPyGenericServices) { output.WriteRawTag(144, 1); output.WriteBool(PyGenericServices); } - if (JavaGenerateEqualsAndHash != false) { + if (HasJavaGenerateEqualsAndHash) { output.WriteRawTag(160, 1); output.WriteBool(JavaGenerateEqualsAndHash); } - if (Deprecated != false) { + if (HasDeprecated) { output.WriteRawTag(184, 1); output.WriteBool(Deprecated); } - if (JavaStringCheckUtf8 != false) { + if (HasJavaStringCheckUtf8) { output.WriteRawTag(216, 1); output.WriteBool(JavaStringCheckUtf8); } - if (CcEnableArenas != false) { + if (HasCcEnableArenas) { output.WriteRawTag(248, 1); output.WriteBool(CcEnableArenas); } - if (ObjcClassPrefix.Length != 0) { + if (HasObjcClassPrefix) { output.WriteRawTag(162, 2); output.WriteString(ObjcClassPrefix); } - if (CsharpNamespace.Length != 0) { + if (HasCsharpNamespace) { output.WriteRawTag(170, 2); output.WriteString(CsharpNamespace); } - if (SwiftPrefix.Length != 0) { + if (HasSwiftPrefix) { output.WriteRawTag(186, 2); output.WriteString(SwiftPrefix); } - if (PhpClassPrefix.Length != 0) { + if (HasPhpClassPrefix) { output.WriteRawTag(194, 2); output.WriteString(PhpClassPrefix); } - if (PhpNamespace.Length != 0) { + if (HasPhpNamespace) { output.WriteRawTag(202, 2); output.WriteString(PhpNamespace); } - if (PhpGenericServices != false) { + if (HasPhpGenericServices) { output.WriteRawTag(208, 2); output.WriteBool(PhpGenericServices); } - if (PhpMetadataNamespace.Length != 0) { + if (HasPhpMetadataNamespace) { output.WriteRawTag(226, 2); output.WriteString(PhpMetadataNamespace); } - if (RubyPackage.Length != 0) { + if (HasRubyPackage) { output.WriteRawTag(234, 2); output.WriteString(RubyPackage); } @@ -3844,64 +4571,64 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (JavaPackage.Length != 0) { + if (HasJavaPackage) { size += 1 + pb::CodedOutputStream.ComputeStringSize(JavaPackage); } - if (JavaOuterClassname.Length != 0) { + if (HasJavaOuterClassname) { size += 1 + pb::CodedOutputStream.ComputeStringSize(JavaOuterClassname); } - if (JavaMultipleFiles != false) { + if (HasJavaMultipleFiles) { size += 1 + 1; } - if (JavaGenerateEqualsAndHash != false) { + if (HasJavaGenerateEqualsAndHash) { size += 2 + 1; } - if (JavaStringCheckUtf8 != false) { + if (HasJavaStringCheckUtf8) { size += 2 + 1; } - if (OptimizeFor != 0) { + if (HasOptimizeFor) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) OptimizeFor); } - if (GoPackage.Length != 0) { + if (HasGoPackage) { size += 1 + pb::CodedOutputStream.ComputeStringSize(GoPackage); } - if (CcGenericServices != false) { + if (HasCcGenericServices) { size += 2 + 1; } - if (JavaGenericServices != false) { + if (HasJavaGenericServices) { size += 2 + 1; } - if (PyGenericServices != false) { + if (HasPyGenericServices) { size += 2 + 1; } - if (PhpGenericServices != false) { + if (HasPhpGenericServices) { size += 2 + 1; } - if (Deprecated != false) { + if (HasDeprecated) { size += 2 + 1; } - if (CcEnableArenas != false) { + if (HasCcEnableArenas) { size += 2 + 1; } - if (ObjcClassPrefix.Length != 0) { + if (HasObjcClassPrefix) { size += 2 + pb::CodedOutputStream.ComputeStringSize(ObjcClassPrefix); } - if (CsharpNamespace.Length != 0) { + if (HasCsharpNamespace) { size += 2 + pb::CodedOutputStream.ComputeStringSize(CsharpNamespace); } - if (SwiftPrefix.Length != 0) { + if (HasSwiftPrefix) { size += 2 + pb::CodedOutputStream.ComputeStringSize(SwiftPrefix); } - if (PhpClassPrefix.Length != 0) { + if (HasPhpClassPrefix) { size += 2 + pb::CodedOutputStream.ComputeStringSize(PhpClassPrefix); } - if (PhpNamespace.Length != 0) { + if (HasPhpNamespace) { size += 2 + pb::CodedOutputStream.ComputeStringSize(PhpNamespace); } - if (PhpMetadataNamespace.Length != 0) { + if (HasPhpMetadataNamespace) { size += 2 + pb::CodedOutputStream.ComputeStringSize(PhpMetadataNamespace); } - if (RubyPackage.Length != 0) { + if (HasRubyPackage) { size += 2 + pb::CodedOutputStream.ComputeStringSize(RubyPackage); } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); @@ -3916,64 +4643,64 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.JavaPackage.Length != 0) { + if (other.HasJavaPackage) { JavaPackage = other.JavaPackage; } - if (other.JavaOuterClassname.Length != 0) { + if (other.HasJavaOuterClassname) { JavaOuterClassname = other.JavaOuterClassname; } - if (other.JavaMultipleFiles != false) { + if (other.HasJavaMultipleFiles) { JavaMultipleFiles = other.JavaMultipleFiles; } - if (other.JavaGenerateEqualsAndHash != false) { + if (other.HasJavaGenerateEqualsAndHash) { JavaGenerateEqualsAndHash = other.JavaGenerateEqualsAndHash; } - if (other.JavaStringCheckUtf8 != false) { + if (other.HasJavaStringCheckUtf8) { JavaStringCheckUtf8 = other.JavaStringCheckUtf8; } - if (other.OptimizeFor != 0) { + if (other.HasOptimizeFor) { OptimizeFor = other.OptimizeFor; } - if (other.GoPackage.Length != 0) { + if (other.HasGoPackage) { GoPackage = other.GoPackage; } - if (other.CcGenericServices != false) { + if (other.HasCcGenericServices) { CcGenericServices = other.CcGenericServices; } - if (other.JavaGenericServices != false) { + if (other.HasJavaGenericServices) { JavaGenericServices = other.JavaGenericServices; } - if (other.PyGenericServices != false) { + if (other.HasPyGenericServices) { PyGenericServices = other.PyGenericServices; } - if (other.PhpGenericServices != false) { + if (other.HasPhpGenericServices) { PhpGenericServices = other.PhpGenericServices; } - if (other.Deprecated != false) { + if (other.HasDeprecated) { Deprecated = other.Deprecated; } - if (other.CcEnableArenas != false) { + if (other.HasCcEnableArenas) { CcEnableArenas = other.CcEnableArenas; } - if (other.ObjcClassPrefix.Length != 0) { + if (other.HasObjcClassPrefix) { ObjcClassPrefix = other.ObjcClassPrefix; } - if (other.CsharpNamespace.Length != 0) { + if (other.HasCsharpNamespace) { CsharpNamespace = other.CsharpNamespace; } - if (other.SwiftPrefix.Length != 0) { + if (other.HasSwiftPrefix) { SwiftPrefix = other.SwiftPrefix; } - if (other.PhpClassPrefix.Length != 0) { + if (other.HasPhpClassPrefix) { PhpClassPrefix = other.PhpClassPrefix; } - if (other.PhpNamespace.Length != 0) { + if (other.HasPhpNamespace) { PhpNamespace = other.PhpNamespace; } - if (other.PhpMetadataNamespace.Length != 0) { + if (other.HasPhpMetadataNamespace) { PhpMetadataNamespace = other.PhpMetadataNamespace; } - if (other.RubyPackage.Length != 0) { + if (other.HasRubyPackage) { RubyPackage = other.RubyPackage; } uninterpretedOption_.Add(other.uninterpretedOption_); @@ -3997,7 +4724,7 @@ namespace Google.Protobuf.Reflection { break; } case 72: { - optimizeFor_ = (global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) input.ReadEnum(); + OptimizeFor = (global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) input.ReadEnum(); break; } case 80: { @@ -4106,6 +4833,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class MessageOptions : pb::IMessage<MessageOptions> { private static readonly pb::MessageParser<MessageOptions> _parser = new pb::MessageParser<MessageOptions>(() => new MessageOptions()); private pb::UnknownFieldSet _unknownFields; + private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<MessageOptions> Parser { get { return _parser; } } @@ -4130,6 +4858,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MessageOptions(MessageOptions other) : this() { + _hasBits0 = other._hasBits0; messageSetWireFormat_ = other.messageSetWireFormat_; noStandardDescriptorAccessor_ = other.noStandardDescriptorAccessor_; deprecated_ = other.deprecated_; @@ -4145,6 +4874,8 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "message_set_wire_format" field.</summary> public const int MessageSetWireFormatFieldNumber = 1; + private readonly static bool MessageSetWireFormatDefaultValue = false; + private bool messageSetWireFormat_; /// <summary> /// Set true to use the old proto1 MessageSet wire format for extensions. @@ -4168,14 +4899,27 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool MessageSetWireFormat { - get { return messageSetWireFormat_; } + get { if ((_hasBits0 & 1) != 0) { return messageSetWireFormat_; } else { return MessageSetWireFormatDefaultValue; } } set { + _hasBits0 |= 1; messageSetWireFormat_ = value; } } + /// <summary>Gets whether the "message_set_wire_format" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasMessageSetWireFormat { + get { return (_hasBits0 & 1) != 0; } + } + /// <summary>Clears the value of the "message_set_wire_format" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearMessageSetWireFormat() { + _hasBits0 &= ~1; + } /// <summary>Field number for the "no_standard_descriptor_accessor" field.</summary> public const int NoStandardDescriptorAccessorFieldNumber = 2; + private readonly static bool NoStandardDescriptorAccessorDefaultValue = false; + private bool noStandardDescriptorAccessor_; /// <summary> /// Disables the generation of the standard "descriptor()" accessor, which can @@ -4184,14 +4928,27 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool NoStandardDescriptorAccessor { - get { return noStandardDescriptorAccessor_; } + get { if ((_hasBits0 & 2) != 0) { return noStandardDescriptorAccessor_; } else { return NoStandardDescriptorAccessorDefaultValue; } } set { + _hasBits0 |= 2; noStandardDescriptorAccessor_ = value; } } + /// <summary>Gets whether the "no_standard_descriptor_accessor" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasNoStandardDescriptorAccessor { + get { return (_hasBits0 & 2) != 0; } + } + /// <summary>Clears the value of the "no_standard_descriptor_accessor" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearNoStandardDescriptorAccessor() { + _hasBits0 &= ~2; + } /// <summary>Field number for the "deprecated" field.</summary> public const int DeprecatedFieldNumber = 3; + private readonly static bool DeprecatedDefaultValue = false; + private bool deprecated_; /// <summary> /// Is this message deprecated? @@ -4201,14 +4958,27 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { - get { return deprecated_; } + get { if ((_hasBits0 & 4) != 0) { return deprecated_; } else { return DeprecatedDefaultValue; } } set { + _hasBits0 |= 4; deprecated_ = value; } } + /// <summary>Gets whether the "deprecated" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasDeprecated { + get { return (_hasBits0 & 4) != 0; } + } + /// <summary>Clears the value of the "deprecated" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearDeprecated() { + _hasBits0 &= ~4; + } /// <summary>Field number for the "map_entry" field.</summary> public const int MapEntryFieldNumber = 7; + private readonly static bool MapEntryDefaultValue = false; + private bool mapEntry_; /// <summary> /// Whether the message is an automatically generated map entry type for the @@ -4235,11 +5005,22 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool MapEntry { - get { return mapEntry_; } + get { if ((_hasBits0 & 8) != 0) { return mapEntry_; } else { return MapEntryDefaultValue; } } set { + _hasBits0 |= 8; mapEntry_ = value; } } + /// <summary>Gets whether the "map_entry" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasMapEntry { + get { return (_hasBits0 & 8) != 0; } + } + /// <summary>Clears the value of the "map_entry" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearMapEntry() { + _hasBits0 &= ~8; + } /// <summary>Field number for the "uninterpreted_option" field.</summary> public const int UninterpretedOptionFieldNumber = 999; @@ -4278,10 +5059,10 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (MessageSetWireFormat != false) hash ^= MessageSetWireFormat.GetHashCode(); - if (NoStandardDescriptorAccessor != false) hash ^= NoStandardDescriptorAccessor.GetHashCode(); - if (Deprecated != false) hash ^= Deprecated.GetHashCode(); - if (MapEntry != false) hash ^= MapEntry.GetHashCode(); + if (HasMessageSetWireFormat) hash ^= MessageSetWireFormat.GetHashCode(); + if (HasNoStandardDescriptorAccessor) hash ^= NoStandardDescriptorAccessor.GetHashCode(); + if (HasDeprecated) hash ^= Deprecated.GetHashCode(); + if (HasMapEntry) hash ^= MapEntry.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -4296,19 +5077,19 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (MessageSetWireFormat != false) { + if (HasMessageSetWireFormat) { output.WriteRawTag(8); output.WriteBool(MessageSetWireFormat); } - if (NoStandardDescriptorAccessor != false) { + if (HasNoStandardDescriptorAccessor) { output.WriteRawTag(16); output.WriteBool(NoStandardDescriptorAccessor); } - if (Deprecated != false) { + if (HasDeprecated) { output.WriteRawTag(24); output.WriteBool(Deprecated); } - if (MapEntry != false) { + if (HasMapEntry) { output.WriteRawTag(56); output.WriteBool(MapEntry); } @@ -4321,16 +5102,16 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (MessageSetWireFormat != false) { + if (HasMessageSetWireFormat) { size += 1 + 1; } - if (NoStandardDescriptorAccessor != false) { + if (HasNoStandardDescriptorAccessor) { size += 1 + 1; } - if (Deprecated != false) { + if (HasDeprecated) { size += 1 + 1; } - if (MapEntry != false) { + if (HasMapEntry) { size += 1 + 1; } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); @@ -4345,16 +5126,16 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.MessageSetWireFormat != false) { + if (other.HasMessageSetWireFormat) { MessageSetWireFormat = other.MessageSetWireFormat; } - if (other.NoStandardDescriptorAccessor != false) { + if (other.HasNoStandardDescriptorAccessor) { NoStandardDescriptorAccessor = other.NoStandardDescriptorAccessor; } - if (other.Deprecated != false) { + if (other.HasDeprecated) { Deprecated = other.Deprecated; } - if (other.MapEntry != false) { + if (other.HasMapEntry) { MapEntry = other.MapEntry; } uninterpretedOption_.Add(other.uninterpretedOption_); @@ -4398,6 +5179,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class FieldOptions : pb::IMessage<FieldOptions> { private static readonly pb::MessageParser<FieldOptions> _parser = new pb::MessageParser<FieldOptions>(() => new FieldOptions()); private pb::UnknownFieldSet _unknownFields; + private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<FieldOptions> Parser { get { return _parser; } } @@ -4422,6 +5204,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FieldOptions(FieldOptions other) : this() { + _hasBits0 = other._hasBits0; ctype_ = other.ctype_; packed_ = other.packed_; jstype_ = other.jstype_; @@ -4439,7 +5222,9 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "ctype" field.</summary> public const int CtypeFieldNumber = 1; - private global::Google.Protobuf.Reflection.FieldOptions.Types.CType ctype_ = 0; + private readonly static global::Google.Protobuf.Reflection.FieldOptions.Types.CType CtypeDefaultValue = global::Google.Protobuf.Reflection.FieldOptions.Types.CType.String; + + private global::Google.Protobuf.Reflection.FieldOptions.Types.CType ctype_; /// <summary> /// The ctype option instructs the C++ code generator to use a different /// representation of the field than it normally would. See the specific @@ -4448,14 +5233,27 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.FieldOptions.Types.CType Ctype { - get { return ctype_; } + get { if ((_hasBits0 & 1) != 0) { return ctype_; } else { return CtypeDefaultValue; } } set { + _hasBits0 |= 1; ctype_ = value; } } + /// <summary>Gets whether the "ctype" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasCtype { + get { return (_hasBits0 & 1) != 0; } + } + /// <summary>Clears the value of the "ctype" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearCtype() { + _hasBits0 &= ~1; + } /// <summary>Field number for the "packed" field.</summary> public const int PackedFieldNumber = 2; + private readonly static bool PackedDefaultValue = false; + private bool packed_; /// <summary> /// The packed option can be enabled for repeated primitive fields to enable @@ -4466,15 +5264,28 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Packed { - get { return packed_; } + get { if ((_hasBits0 & 2) != 0) { return packed_; } else { return PackedDefaultValue; } } set { + _hasBits0 |= 2; packed_ = value; } } + /// <summary>Gets whether the "packed" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasPacked { + get { return (_hasBits0 & 2) != 0; } + } + /// <summary>Clears the value of the "packed" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearPacked() { + _hasBits0 &= ~2; + } /// <summary>Field number for the "jstype" field.</summary> public const int JstypeFieldNumber = 6; - private global::Google.Protobuf.Reflection.FieldOptions.Types.JSType jstype_ = 0; + private readonly static global::Google.Protobuf.Reflection.FieldOptions.Types.JSType JstypeDefaultValue = global::Google.Protobuf.Reflection.FieldOptions.Types.JSType.JsNormal; + + private global::Google.Protobuf.Reflection.FieldOptions.Types.JSType jstype_; /// <summary> /// The jstype option determines the JavaScript type used for values of the /// field. The option is permitted only for 64 bit integral and fixed types @@ -4490,14 +5301,27 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.FieldOptions.Types.JSType Jstype { - get { return jstype_; } + get { if ((_hasBits0 & 16) != 0) { return jstype_; } else { return JstypeDefaultValue; } } set { + _hasBits0 |= 16; jstype_ = value; } } + /// <summary>Gets whether the "jstype" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasJstype { + get { return (_hasBits0 & 16) != 0; } + } + /// <summary>Clears the value of the "jstype" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearJstype() { + _hasBits0 &= ~16; + } /// <summary>Field number for the "lazy" field.</summary> public const int LazyFieldNumber = 5; + private readonly static bool LazyDefaultValue = false; + private bool lazy_; /// <summary> /// Should this field be parsed lazily? Lazy applies only to message-type @@ -4530,14 +5354,27 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Lazy { - get { return lazy_; } + get { if ((_hasBits0 & 8) != 0) { return lazy_; } else { return LazyDefaultValue; } } set { + _hasBits0 |= 8; lazy_ = value; } } + /// <summary>Gets whether the "lazy" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasLazy { + get { return (_hasBits0 & 8) != 0; } + } + /// <summary>Clears the value of the "lazy" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearLazy() { + _hasBits0 &= ~8; + } /// <summary>Field number for the "deprecated" field.</summary> public const int DeprecatedFieldNumber = 3; + private readonly static bool DeprecatedDefaultValue = false; + private bool deprecated_; /// <summary> /// Is this field deprecated? @@ -4547,25 +5384,49 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { - get { return deprecated_; } + get { if ((_hasBits0 & 4) != 0) { return deprecated_; } else { return DeprecatedDefaultValue; } } set { + _hasBits0 |= 4; deprecated_ = value; } } + /// <summary>Gets whether the "deprecated" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasDeprecated { + get { return (_hasBits0 & 4) != 0; } + } + /// <summary>Clears the value of the "deprecated" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearDeprecated() { + _hasBits0 &= ~4; + } /// <summary>Field number for the "weak" field.</summary> public const int WeakFieldNumber = 10; + private readonly static bool WeakDefaultValue = false; + private bool weak_; /// <summary> /// For Google-internal migration only. Do not use. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Weak { - get { return weak_; } + get { if ((_hasBits0 & 32) != 0) { return weak_; } else { return WeakDefaultValue; } } set { + _hasBits0 |= 32; weak_ = value; } } + /// <summary>Gets whether the "weak" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasWeak { + get { return (_hasBits0 & 32) != 0; } + } + /// <summary>Clears the value of the "weak" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearWeak() { + _hasBits0 &= ~32; + } /// <summary>Field number for the "uninterpreted_option" field.</summary> public const int UninterpretedOptionFieldNumber = 999; @@ -4606,12 +5467,12 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Ctype != 0) hash ^= Ctype.GetHashCode(); - if (Packed != false) hash ^= Packed.GetHashCode(); - if (Jstype != 0) hash ^= Jstype.GetHashCode(); - if (Lazy != false) hash ^= Lazy.GetHashCode(); - if (Deprecated != false) hash ^= Deprecated.GetHashCode(); - if (Weak != false) hash ^= Weak.GetHashCode(); + if (HasCtype) hash ^= Ctype.GetHashCode(); + if (HasPacked) hash ^= Packed.GetHashCode(); + if (HasJstype) hash ^= Jstype.GetHashCode(); + if (HasLazy) hash ^= Lazy.GetHashCode(); + if (HasDeprecated) hash ^= Deprecated.GetHashCode(); + if (HasWeak) hash ^= Weak.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -4626,27 +5487,27 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Ctype != 0) { + if (HasCtype) { output.WriteRawTag(8); output.WriteEnum((int) Ctype); } - if (Packed != false) { + if (HasPacked) { output.WriteRawTag(16); output.WriteBool(Packed); } - if (Deprecated != false) { + if (HasDeprecated) { output.WriteRawTag(24); output.WriteBool(Deprecated); } - if (Lazy != false) { + if (HasLazy) { output.WriteRawTag(40); output.WriteBool(Lazy); } - if (Jstype != 0) { + if (HasJstype) { output.WriteRawTag(48); output.WriteEnum((int) Jstype); } - if (Weak != false) { + if (HasWeak) { output.WriteRawTag(80); output.WriteBool(Weak); } @@ -4659,22 +5520,22 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Ctype != 0) { + if (HasCtype) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Ctype); } - if (Packed != false) { + if (HasPacked) { size += 1 + 1; } - if (Jstype != 0) { + if (HasJstype) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Jstype); } - if (Lazy != false) { + if (HasLazy) { size += 1 + 1; } - if (Deprecated != false) { + if (HasDeprecated) { size += 1 + 1; } - if (Weak != false) { + if (HasWeak) { size += 1 + 1; } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); @@ -4689,22 +5550,22 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.Ctype != 0) { + if (other.HasCtype) { Ctype = other.Ctype; } - if (other.Packed != false) { + if (other.HasPacked) { Packed = other.Packed; } - if (other.Jstype != 0) { + if (other.HasJstype) { Jstype = other.Jstype; } - if (other.Lazy != false) { + if (other.HasLazy) { Lazy = other.Lazy; } - if (other.Deprecated != false) { + if (other.HasDeprecated) { Deprecated = other.Deprecated; } - if (other.Weak != false) { + if (other.HasWeak) { Weak = other.Weak; } uninterpretedOption_.Add(other.uninterpretedOption_); @@ -4720,7 +5581,7 @@ namespace Google.Protobuf.Reflection { CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); break; case 8: { - ctype_ = (global::Google.Protobuf.Reflection.FieldOptions.Types.CType) input.ReadEnum(); + Ctype = (global::Google.Protobuf.Reflection.FieldOptions.Types.CType) input.ReadEnum(); break; } case 16: { @@ -4736,7 +5597,7 @@ namespace Google.Protobuf.Reflection { break; } case 48: { - jstype_ = (global::Google.Protobuf.Reflection.FieldOptions.Types.JSType) input.ReadEnum(); + Jstype = (global::Google.Protobuf.Reflection.FieldOptions.Types.JSType) input.ReadEnum(); break; } case 80: { @@ -4913,6 +5774,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class EnumOptions : pb::IMessage<EnumOptions> { private static readonly pb::MessageParser<EnumOptions> _parser = new pb::MessageParser<EnumOptions>(() => new EnumOptions()); private pb::UnknownFieldSet _unknownFields; + private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<EnumOptions> Parser { get { return _parser; } } @@ -4937,6 +5799,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumOptions(EnumOptions other) : this() { + _hasBits0 = other._hasBits0; allowAlias_ = other.allowAlias_; deprecated_ = other.deprecated_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); @@ -4950,6 +5813,8 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "allow_alias" field.</summary> public const int AllowAliasFieldNumber = 2; + private readonly static bool AllowAliasDefaultValue = false; + private bool allowAlias_; /// <summary> /// Set this option to true to allow mapping different tag names to the same @@ -4957,14 +5822,27 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool AllowAlias { - get { return allowAlias_; } + get { if ((_hasBits0 & 1) != 0) { return allowAlias_; } else { return AllowAliasDefaultValue; } } set { + _hasBits0 |= 1; allowAlias_ = value; } } + /// <summary>Gets whether the "allow_alias" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasAllowAlias { + get { return (_hasBits0 & 1) != 0; } + } + /// <summary>Clears the value of the "allow_alias" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearAllowAlias() { + _hasBits0 &= ~1; + } /// <summary>Field number for the "deprecated" field.</summary> public const int DeprecatedFieldNumber = 3; + private readonly static bool DeprecatedDefaultValue = false; + private bool deprecated_; /// <summary> /// Is this enum deprecated? @@ -4974,11 +5852,22 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { - get { return deprecated_; } + get { if ((_hasBits0 & 2) != 0) { return deprecated_; } else { return DeprecatedDefaultValue; } } set { + _hasBits0 |= 2; deprecated_ = value; } } + /// <summary>Gets whether the "deprecated" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasDeprecated { + get { return (_hasBits0 & 2) != 0; } + } + /// <summary>Clears the value of the "deprecated" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearDeprecated() { + _hasBits0 &= ~2; + } /// <summary>Field number for the "uninterpreted_option" field.</summary> public const int UninterpretedOptionFieldNumber = 999; @@ -5015,8 +5904,8 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (AllowAlias != false) hash ^= AllowAlias.GetHashCode(); - if (Deprecated != false) hash ^= Deprecated.GetHashCode(); + if (HasAllowAlias) hash ^= AllowAlias.GetHashCode(); + if (HasDeprecated) hash ^= Deprecated.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -5031,11 +5920,11 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (AllowAlias != false) { + if (HasAllowAlias) { output.WriteRawTag(16); output.WriteBool(AllowAlias); } - if (Deprecated != false) { + if (HasDeprecated) { output.WriteRawTag(24); output.WriteBool(Deprecated); } @@ -5048,10 +5937,10 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (AllowAlias != false) { + if (HasAllowAlias) { size += 1 + 1; } - if (Deprecated != false) { + if (HasDeprecated) { size += 1 + 1; } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); @@ -5066,10 +5955,10 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.AllowAlias != false) { + if (other.HasAllowAlias) { AllowAlias = other.AllowAlias; } - if (other.Deprecated != false) { + if (other.HasDeprecated) { Deprecated = other.Deprecated; } uninterpretedOption_.Add(other.uninterpretedOption_); @@ -5105,6 +5994,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class EnumValueOptions : pb::IMessage<EnumValueOptions> { private static readonly pb::MessageParser<EnumValueOptions> _parser = new pb::MessageParser<EnumValueOptions>(() => new EnumValueOptions()); private pb::UnknownFieldSet _unknownFields; + private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<EnumValueOptions> Parser { get { return _parser; } } @@ -5129,6 +6019,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumValueOptions(EnumValueOptions other) : this() { + _hasBits0 = other._hasBits0; deprecated_ = other.deprecated_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); @@ -5141,6 +6032,8 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "deprecated" field.</summary> public const int DeprecatedFieldNumber = 1; + private readonly static bool DeprecatedDefaultValue = false; + private bool deprecated_; /// <summary> /// Is this enum value deprecated? @@ -5150,11 +6043,22 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { - get { return deprecated_; } + get { if ((_hasBits0 & 1) != 0) { return deprecated_; } else { return DeprecatedDefaultValue; } } set { + _hasBits0 |= 1; deprecated_ = value; } } + /// <summary>Gets whether the "deprecated" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasDeprecated { + get { return (_hasBits0 & 1) != 0; } + } + /// <summary>Clears the value of the "deprecated" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearDeprecated() { + _hasBits0 &= ~1; + } /// <summary>Field number for the "uninterpreted_option" field.</summary> public const int UninterpretedOptionFieldNumber = 999; @@ -5190,7 +6094,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Deprecated != false) hash ^= Deprecated.GetHashCode(); + if (HasDeprecated) hash ^= Deprecated.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -5205,7 +6109,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Deprecated != false) { + if (HasDeprecated) { output.WriteRawTag(8); output.WriteBool(Deprecated); } @@ -5218,7 +6122,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Deprecated != false) { + if (HasDeprecated) { size += 1 + 1; } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); @@ -5233,7 +6137,7 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.Deprecated != false) { + if (other.HasDeprecated) { Deprecated = other.Deprecated; } uninterpretedOption_.Add(other.uninterpretedOption_); @@ -5265,6 +6169,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class ServiceOptions : pb::IMessage<ServiceOptions> { private static readonly pb::MessageParser<ServiceOptions> _parser = new pb::MessageParser<ServiceOptions>(() => new ServiceOptions()); private pb::UnknownFieldSet _unknownFields; + private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<ServiceOptions> Parser { get { return _parser; } } @@ -5289,6 +6194,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ServiceOptions(ServiceOptions other) : this() { + _hasBits0 = other._hasBits0; deprecated_ = other.deprecated_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); @@ -5301,6 +6207,8 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "deprecated" field.</summary> public const int DeprecatedFieldNumber = 33; + private readonly static bool DeprecatedDefaultValue = false; + private bool deprecated_; /// <summary> /// Is this service deprecated? @@ -5310,11 +6218,22 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { - get { return deprecated_; } + get { if ((_hasBits0 & 1) != 0) { return deprecated_; } else { return DeprecatedDefaultValue; } } set { + _hasBits0 |= 1; deprecated_ = value; } } + /// <summary>Gets whether the "deprecated" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasDeprecated { + get { return (_hasBits0 & 1) != 0; } + } + /// <summary>Clears the value of the "deprecated" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearDeprecated() { + _hasBits0 &= ~1; + } /// <summary>Field number for the "uninterpreted_option" field.</summary> public const int UninterpretedOptionFieldNumber = 999; @@ -5350,7 +6269,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Deprecated != false) hash ^= Deprecated.GetHashCode(); + if (HasDeprecated) hash ^= Deprecated.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -5365,7 +6284,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Deprecated != false) { + if (HasDeprecated) { output.WriteRawTag(136, 2); output.WriteBool(Deprecated); } @@ -5378,7 +6297,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Deprecated != false) { + if (HasDeprecated) { size += 2 + 1; } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); @@ -5393,7 +6312,7 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.Deprecated != false) { + if (other.HasDeprecated) { Deprecated = other.Deprecated; } uninterpretedOption_.Add(other.uninterpretedOption_); @@ -5425,6 +6344,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class MethodOptions : pb::IMessage<MethodOptions> { private static readonly pb::MessageParser<MethodOptions> _parser = new pb::MessageParser<MethodOptions>(() => new MethodOptions()); private pb::UnknownFieldSet _unknownFields; + private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<MethodOptions> Parser { get { return _parser; } } @@ -5449,6 +6369,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MethodOptions(MethodOptions other) : this() { + _hasBits0 = other._hasBits0; deprecated_ = other.deprecated_; idempotencyLevel_ = other.idempotencyLevel_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); @@ -5462,6 +6383,8 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "deprecated" field.</summary> public const int DeprecatedFieldNumber = 33; + private readonly static bool DeprecatedDefaultValue = false; + private bool deprecated_; /// <summary> /// Is this method deprecated? @@ -5471,22 +6394,46 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { - get { return deprecated_; } + get { if ((_hasBits0 & 1) != 0) { return deprecated_; } else { return DeprecatedDefaultValue; } } set { + _hasBits0 |= 1; deprecated_ = value; } } + /// <summary>Gets whether the "deprecated" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasDeprecated { + get { return (_hasBits0 & 1) != 0; } + } + /// <summary>Clears the value of the "deprecated" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearDeprecated() { + _hasBits0 &= ~1; + } /// <summary>Field number for the "idempotency_level" field.</summary> public const int IdempotencyLevelFieldNumber = 34; - private global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel idempotencyLevel_ = 0; + private readonly static global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel IdempotencyLevelDefaultValue = global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel.IdempotencyUnknown; + + private global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel idempotencyLevel_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel IdempotencyLevel { - get { return idempotencyLevel_; } + get { if ((_hasBits0 & 2) != 0) { return idempotencyLevel_; } else { return IdempotencyLevelDefaultValue; } } set { + _hasBits0 |= 2; idempotencyLevel_ = value; } } + /// <summary>Gets whether the "idempotency_level" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasIdempotencyLevel { + get { return (_hasBits0 & 2) != 0; } + } + /// <summary>Clears the value of the "idempotency_level" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearIdempotencyLevel() { + _hasBits0 &= ~2; + } /// <summary>Field number for the "uninterpreted_option" field.</summary> public const int UninterpretedOptionFieldNumber = 999; @@ -5523,8 +6470,8 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Deprecated != false) hash ^= Deprecated.GetHashCode(); - if (IdempotencyLevel != 0) hash ^= IdempotencyLevel.GetHashCode(); + if (HasDeprecated) hash ^= Deprecated.GetHashCode(); + if (HasIdempotencyLevel) hash ^= IdempotencyLevel.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -5539,11 +6486,11 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Deprecated != false) { + if (HasDeprecated) { output.WriteRawTag(136, 2); output.WriteBool(Deprecated); } - if (IdempotencyLevel != 0) { + if (HasIdempotencyLevel) { output.WriteRawTag(144, 2); output.WriteEnum((int) IdempotencyLevel); } @@ -5556,10 +6503,10 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Deprecated != false) { + if (HasDeprecated) { size += 2 + 1; } - if (IdempotencyLevel != 0) { + if (HasIdempotencyLevel) { size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) IdempotencyLevel); } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); @@ -5574,10 +6521,10 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.Deprecated != false) { + if (other.HasDeprecated) { Deprecated = other.Deprecated; } - if (other.IdempotencyLevel != 0) { + if (other.HasIdempotencyLevel) { IdempotencyLevel = other.IdempotencyLevel; } uninterpretedOption_.Add(other.uninterpretedOption_); @@ -5597,7 +6544,7 @@ namespace Google.Protobuf.Reflection { break; } case 272: { - idempotencyLevel_ = (global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel) input.ReadEnum(); + IdempotencyLevel = (global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel) input.ReadEnum(); break; } case 7994: { @@ -5645,6 +6592,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class UninterpretedOption : pb::IMessage<UninterpretedOption> { private static readonly pb::MessageParser<UninterpretedOption> _parser = new pb::MessageParser<UninterpretedOption>(() => new UninterpretedOption()); private pb::UnknownFieldSet _unknownFields; + private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<UninterpretedOption> Parser { get { return _parser; } } @@ -5667,6 +6615,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public UninterpretedOption(UninterpretedOption other) : this() { + _hasBits0 = other._hasBits0; name_ = other.name_.Clone(); identifierValue_ = other.identifierValue_; positiveIntValue_ = other.positiveIntValue_; @@ -5694,73 +6643,148 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "identifier_value" field.</summary> public const int IdentifierValueFieldNumber = 3; - private string identifierValue_ = ""; + private readonly static string IdentifierValueDefaultValue = ""; + + private string identifierValue_; /// <summary> /// The value of the uninterpreted option, in whatever type the tokenizer /// identified it as during parsing. Exactly one of these should be set. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string IdentifierValue { - get { return identifierValue_; } + get { return identifierValue_ ?? IdentifierValueDefaultValue; } set { identifierValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "identifier_value" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasIdentifierValue { + get { return identifierValue_ != null; } + } + /// <summary>Clears the value of the "identifier_value" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearIdentifierValue() { + identifierValue_ = null; + } /// <summary>Field number for the "positive_int_value" field.</summary> public const int PositiveIntValueFieldNumber = 4; + private readonly static ulong PositiveIntValueDefaultValue = 0UL; + private ulong positiveIntValue_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ulong PositiveIntValue { - get { return positiveIntValue_; } + get { if ((_hasBits0 & 1) != 0) { return positiveIntValue_; } else { return PositiveIntValueDefaultValue; } } set { + _hasBits0 |= 1; positiveIntValue_ = value; } } + /// <summary>Gets whether the "positive_int_value" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasPositiveIntValue { + get { return (_hasBits0 & 1) != 0; } + } + /// <summary>Clears the value of the "positive_int_value" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearPositiveIntValue() { + _hasBits0 &= ~1; + } /// <summary>Field number for the "negative_int_value" field.</summary> public const int NegativeIntValueFieldNumber = 5; + private readonly static long NegativeIntValueDefaultValue = 0L; + private long negativeIntValue_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public long NegativeIntValue { - get { return negativeIntValue_; } + get { if ((_hasBits0 & 2) != 0) { return negativeIntValue_; } else { return NegativeIntValueDefaultValue; } } set { + _hasBits0 |= 2; negativeIntValue_ = value; } } + /// <summary>Gets whether the "negative_int_value" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasNegativeIntValue { + get { return (_hasBits0 & 2) != 0; } + } + /// <summary>Clears the value of the "negative_int_value" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearNegativeIntValue() { + _hasBits0 &= ~2; + } /// <summary>Field number for the "double_value" field.</summary> public const int DoubleValueFieldNumber = 6; + private readonly static double DoubleValueDefaultValue = 0D; + private double doubleValue_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double DoubleValue { - get { return doubleValue_; } + get { if ((_hasBits0 & 4) != 0) { return doubleValue_; } else { return DoubleValueDefaultValue; } } set { + _hasBits0 |= 4; doubleValue_ = value; } } + /// <summary>Gets whether the "double_value" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasDoubleValue { + get { return (_hasBits0 & 4) != 0; } + } + /// <summary>Clears the value of the "double_value" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearDoubleValue() { + _hasBits0 &= ~4; + } /// <summary>Field number for the "string_value" field.</summary> public const int StringValueFieldNumber = 7; - private pb::ByteString stringValue_ = pb::ByteString.Empty; + private readonly static pb::ByteString StringValueDefaultValue = pb::ByteString.Empty; + + private pb::ByteString stringValue_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pb::ByteString StringValue { - get { return stringValue_; } + get { return stringValue_ ?? StringValueDefaultValue; } set { stringValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "string_value" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasStringValue { + get { return stringValue_ != null; } + } + /// <summary>Clears the value of the "string_value" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearStringValue() { + stringValue_ = null; + } /// <summary>Field number for the "aggregate_value" field.</summary> public const int AggregateValueFieldNumber = 8; - private string aggregateValue_ = ""; + private readonly static string AggregateValueDefaultValue = ""; + + private string aggregateValue_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string AggregateValue { - get { return aggregateValue_; } + get { return aggregateValue_ ?? AggregateValueDefaultValue; } set { aggregateValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "aggregate_value" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasAggregateValue { + get { return aggregateValue_ != null; } + } + /// <summary>Clears the value of the "aggregate_value" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearAggregateValue() { + aggregateValue_ = null; + } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -5789,12 +6813,12 @@ namespace Google.Protobuf.Reflection { public override int GetHashCode() { int hash = 1; hash ^= name_.GetHashCode(); - if (IdentifierValue.Length != 0) hash ^= IdentifierValue.GetHashCode(); - if (PositiveIntValue != 0UL) hash ^= PositiveIntValue.GetHashCode(); - if (NegativeIntValue != 0L) hash ^= NegativeIntValue.GetHashCode(); - if (DoubleValue != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(DoubleValue); - if (StringValue.Length != 0) hash ^= StringValue.GetHashCode(); - if (AggregateValue.Length != 0) hash ^= AggregateValue.GetHashCode(); + if (HasIdentifierValue) hash ^= IdentifierValue.GetHashCode(); + if (HasPositiveIntValue) hash ^= PositiveIntValue.GetHashCode(); + if (HasNegativeIntValue) hash ^= NegativeIntValue.GetHashCode(); + if (HasDoubleValue) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(DoubleValue); + if (HasStringValue) hash ^= StringValue.GetHashCode(); + if (HasAggregateValue) hash ^= AggregateValue.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -5809,27 +6833,27 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { name_.WriteTo(output, _repeated_name_codec); - if (IdentifierValue.Length != 0) { + if (HasIdentifierValue) { output.WriteRawTag(26); output.WriteString(IdentifierValue); } - if (PositiveIntValue != 0UL) { + if (HasPositiveIntValue) { output.WriteRawTag(32); output.WriteUInt64(PositiveIntValue); } - if (NegativeIntValue != 0L) { + if (HasNegativeIntValue) { output.WriteRawTag(40); output.WriteInt64(NegativeIntValue); } - if (DoubleValue != 0D) { + if (HasDoubleValue) { output.WriteRawTag(49); output.WriteDouble(DoubleValue); } - if (StringValue.Length != 0) { + if (HasStringValue) { output.WriteRawTag(58); output.WriteBytes(StringValue); } - if (AggregateValue.Length != 0) { + if (HasAggregateValue) { output.WriteRawTag(66); output.WriteString(AggregateValue); } @@ -5842,22 +6866,22 @@ namespace Google.Protobuf.Reflection { public int CalculateSize() { int size = 0; size += name_.CalculateSize(_repeated_name_codec); - if (IdentifierValue.Length != 0) { + if (HasIdentifierValue) { size += 1 + pb::CodedOutputStream.ComputeStringSize(IdentifierValue); } - if (PositiveIntValue != 0UL) { + if (HasPositiveIntValue) { size += 1 + pb::CodedOutputStream.ComputeUInt64Size(PositiveIntValue); } - if (NegativeIntValue != 0L) { + if (HasNegativeIntValue) { size += 1 + pb::CodedOutputStream.ComputeInt64Size(NegativeIntValue); } - if (DoubleValue != 0D) { + if (HasDoubleValue) { size += 1 + 8; } - if (StringValue.Length != 0) { + if (HasStringValue) { size += 1 + pb::CodedOutputStream.ComputeBytesSize(StringValue); } - if (AggregateValue.Length != 0) { + if (HasAggregateValue) { size += 1 + pb::CodedOutputStream.ComputeStringSize(AggregateValue); } if (_unknownFields != null) { @@ -5872,22 +6896,22 @@ namespace Google.Protobuf.Reflection { return; } name_.Add(other.name_); - if (other.IdentifierValue.Length != 0) { + if (other.HasIdentifierValue) { IdentifierValue = other.IdentifierValue; } - if (other.PositiveIntValue != 0UL) { + if (other.HasPositiveIntValue) { PositiveIntValue = other.PositiveIntValue; } - if (other.NegativeIntValue != 0L) { + if (other.HasNegativeIntValue) { NegativeIntValue = other.NegativeIntValue; } - if (other.DoubleValue != 0D) { + if (other.HasDoubleValue) { DoubleValue = other.DoubleValue; } - if (other.StringValue.Length != 0) { + if (other.HasStringValue) { StringValue = other.StringValue; } - if (other.AggregateValue.Length != 0) { + if (other.HasAggregateValue) { AggregateValue = other.AggregateValue; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); @@ -5947,6 +6971,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class NamePart : pb::IMessage<NamePart> { private static readonly pb::MessageParser<NamePart> _parser = new pb::MessageParser<NamePart>(() => new NamePart()); private pb::UnknownFieldSet _unknownFields; + private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<NamePart> Parser { get { return _parser; } } @@ -5969,6 +6994,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NamePart(NamePart other) : this() { + _hasBits0 = other._hasBits0; namePart_ = other.namePart_; isExtension_ = other.isExtension_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); @@ -5981,25 +7007,50 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "name_part" field.</summary> public const int NamePart_FieldNumber = 1; - private string namePart_ = ""; + private readonly static string NamePart_DefaultValue = ""; + + private string namePart_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string NamePart_ { - get { return namePart_; } + get { return namePart_ ?? NamePart_DefaultValue; } set { namePart_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "name_part" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasNamePart_ { + get { return namePart_ != null; } + } + /// <summary>Clears the value of the "name_part" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearNamePart_() { + namePart_ = null; + } /// <summary>Field number for the "is_extension" field.</summary> public const int IsExtensionFieldNumber = 2; + private readonly static bool IsExtensionDefaultValue = false; + private bool isExtension_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool IsExtension { - get { return isExtension_; } + get { if ((_hasBits0 & 1) != 0) { return isExtension_; } else { return IsExtensionDefaultValue; } } set { + _hasBits0 |= 1; isExtension_ = value; } } + /// <summary>Gets whether the "is_extension" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasIsExtension { + get { return (_hasBits0 & 1) != 0; } + } + /// <summary>Clears the value of the "is_extension" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearIsExtension() { + _hasBits0 &= ~1; + } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -6022,8 +7073,8 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (NamePart_.Length != 0) hash ^= NamePart_.GetHashCode(); - if (IsExtension != false) hash ^= IsExtension.GetHashCode(); + if (HasNamePart_) hash ^= NamePart_.GetHashCode(); + if (HasIsExtension) hash ^= IsExtension.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -6037,11 +7088,11 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (NamePart_.Length != 0) { + if (HasNamePart_) { output.WriteRawTag(10); output.WriteString(NamePart_); } - if (IsExtension != false) { + if (HasIsExtension) { output.WriteRawTag(16); output.WriteBool(IsExtension); } @@ -6053,10 +7104,10 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (NamePart_.Length != 0) { + if (HasNamePart_) { size += 1 + pb::CodedOutputStream.ComputeStringSize(NamePart_); } - if (IsExtension != false) { + if (HasIsExtension) { size += 1 + 1; } if (_unknownFields != null) { @@ -6070,10 +7121,10 @@ namespace Google.Protobuf.Reflection { if (other == null) { return; } - if (other.NamePart_.Length != 0) { + if (other.HasNamePart_) { NamePart_ = other.NamePart_; } - if (other.IsExtension != false) { + if (other.HasIsExtension) { IsExtension = other.IsExtension; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); @@ -6370,7 +7421,9 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "leading_comments" field.</summary> public const int LeadingCommentsFieldNumber = 3; - private string leadingComments_ = ""; + private readonly static string LeadingCommentsDefaultValue = ""; + + private string leadingComments_; /// <summary> /// If this SourceCodeInfo represents a complete declaration, these are any /// comments appearing before and after the declaration which appear to be @@ -6422,22 +7475,44 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string LeadingComments { - get { return leadingComments_; } + get { return leadingComments_ ?? LeadingCommentsDefaultValue; } set { leadingComments_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "leading_comments" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasLeadingComments { + get { return leadingComments_ != null; } + } + /// <summary>Clears the value of the "leading_comments" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearLeadingComments() { + leadingComments_ = null; + } /// <summary>Field number for the "trailing_comments" field.</summary> public const int TrailingCommentsFieldNumber = 4; - private string trailingComments_ = ""; + private readonly static string TrailingCommentsDefaultValue = ""; + + private string trailingComments_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string TrailingComments { - get { return trailingComments_; } + get { return trailingComments_ ?? TrailingCommentsDefaultValue; } set { trailingComments_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "trailing_comments" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasTrailingComments { + get { return trailingComments_ != null; } + } + /// <summary>Clears the value of the "trailing_comments" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearTrailingComments() { + trailingComments_ = null; + } /// <summary>Field number for the "leading_detached_comments" field.</summary> public const int LeadingDetachedCommentsFieldNumber = 6; @@ -6475,8 +7550,8 @@ namespace Google.Protobuf.Reflection { int hash = 1; hash ^= path_.GetHashCode(); hash ^= span_.GetHashCode(); - if (LeadingComments.Length != 0) hash ^= LeadingComments.GetHashCode(); - if (TrailingComments.Length != 0) hash ^= TrailingComments.GetHashCode(); + if (HasLeadingComments) hash ^= LeadingComments.GetHashCode(); + if (HasTrailingComments) hash ^= TrailingComments.GetHashCode(); hash ^= leadingDetachedComments_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -6493,11 +7568,11 @@ namespace Google.Protobuf.Reflection { public void WriteTo(pb::CodedOutputStream output) { path_.WriteTo(output, _repeated_path_codec); span_.WriteTo(output, _repeated_span_codec); - if (LeadingComments.Length != 0) { + if (HasLeadingComments) { output.WriteRawTag(26); output.WriteString(LeadingComments); } - if (TrailingComments.Length != 0) { + if (HasTrailingComments) { output.WriteRawTag(34); output.WriteString(TrailingComments); } @@ -6512,10 +7587,10 @@ namespace Google.Protobuf.Reflection { int size = 0; size += path_.CalculateSize(_repeated_path_codec); size += span_.CalculateSize(_repeated_span_codec); - if (LeadingComments.Length != 0) { + if (HasLeadingComments) { size += 1 + pb::CodedOutputStream.ComputeStringSize(LeadingComments); } - if (TrailingComments.Length != 0) { + if (HasTrailingComments) { size += 1 + pb::CodedOutputStream.ComputeStringSize(TrailingComments); } size += leadingDetachedComments_.CalculateSize(_repeated_leadingDetachedComments_codec); @@ -6532,10 +7607,10 @@ namespace Google.Protobuf.Reflection { } path_.Add(other.path_); span_.Add(other.span_); - if (other.LeadingComments.Length != 0) { + if (other.HasLeadingComments) { LeadingComments = other.LeadingComments; } - if (other.TrailingComments.Length != 0) { + if (other.HasTrailingComments) { TrailingComments = other.TrailingComments; } leadingDetachedComments_.Add(other.leadingDetachedComments_); @@ -6718,6 +7793,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class Annotation : pb::IMessage<Annotation> { private static readonly pb::MessageParser<Annotation> _parser = new pb::MessageParser<Annotation>(() => new Annotation()); private pb::UnknownFieldSet _unknownFields; + private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<Annotation> Parser { get { return _parser; } } @@ -6740,6 +7816,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Annotation(Annotation other) : this() { + _hasBits0 = other._hasBits0; path_ = other.path_.Clone(); sourceFile_ = other.sourceFile_; begin_ = other.begin_; @@ -6768,20 +7845,34 @@ namespace Google.Protobuf.Reflection { /// <summary>Field number for the "source_file" field.</summary> public const int SourceFileFieldNumber = 2; - private string sourceFile_ = ""; + private readonly static string SourceFileDefaultValue = ""; + + private string sourceFile_; /// <summary> /// Identifies the filesystem path to the original source .proto. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string SourceFile { - get { return sourceFile_; } + get { return sourceFile_ ?? SourceFileDefaultValue; } set { sourceFile_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } + /// <summary>Gets whether the "source_file" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasSourceFile { + get { return sourceFile_ != null; } + } + /// <summary>Clears the value of the "source_file" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearSourceFile() { + sourceFile_ = null; + } /// <summary>Field number for the "begin" field.</summary> public const int BeginFieldNumber = 3; + private readonly static int BeginDefaultValue = 0; + private int begin_; /// <summary> /// Identifies the starting offset in bytes in the generated code @@ -6789,14 +7880,27 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Begin { - get { return begin_; } + get { if ((_hasBits0 & 1) != 0) { return begin_; } else { return BeginDefaultValue; } } set { + _hasBits0 |= 1; begin_ = value; } } + /// <summary>Gets whether the "begin" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasBegin { + get { return (_hasBits0 & 1) != 0; } + } + /// <summary>Clears the value of the "begin" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearBegin() { + _hasBits0 &= ~1; + } /// <summary>Field number for the "end" field.</summary> public const int EndFieldNumber = 4; + private readonly static int EndDefaultValue = 0; + private int end_; /// <summary> /// Identifies the ending offset in bytes in the generated code that @@ -6805,11 +7909,22 @@ namespace Google.Protobuf.Reflection { /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int End { - get { return end_; } + get { if ((_hasBits0 & 2) != 0) { return end_; } else { return EndDefaultValue; } } set { + _hasBits0 |= 2; end_ = value; } } + /// <summary>Gets whether the "end" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasEnd { + get { return (_hasBits0 & 2) != 0; } + } + /// <summary>Clears the value of the "end" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearEnd() { + _hasBits0 &= ~2; + } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -6835,9 +7950,9 @@ namespace Google.Protobuf.Reflection { public override int GetHashCode() { int hash = 1; hash ^= path_.GetHashCode(); - if (SourceFile.Length != 0) hash ^= SourceFile.GetHashCode(); - if (Begin != 0) hash ^= Begin.GetHashCode(); - if (End != 0) hash ^= End.GetHashCode(); + if (HasSourceFile) hash ^= SourceFile.GetHashCode(); + if (HasBegin) hash ^= Begin.GetHashCode(); + if (HasEnd) hash ^= End.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -6852,15 +7967,15 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { path_.WriteTo(output, _repeated_path_codec); - if (SourceFile.Length != 0) { + if (HasSourceFile) { output.WriteRawTag(18); output.WriteString(SourceFile); } - if (Begin != 0) { + if (HasBegin) { output.WriteRawTag(24); output.WriteInt32(Begin); } - if (End != 0) { + if (HasEnd) { output.WriteRawTag(32); output.WriteInt32(End); } @@ -6873,13 +7988,13 @@ namespace Google.Protobuf.Reflection { public int CalculateSize() { int size = 0; size += path_.CalculateSize(_repeated_path_codec); - if (SourceFile.Length != 0) { + if (HasSourceFile) { size += 1 + pb::CodedOutputStream.ComputeStringSize(SourceFile); } - if (Begin != 0) { + if (HasBegin) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Begin); } - if (End != 0) { + if (HasEnd) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(End); } if (_unknownFields != null) { @@ -6894,13 +8009,13 @@ namespace Google.Protobuf.Reflection { return; } path_.Add(other.path_); - if (other.SourceFile.Length != 0) { + if (other.HasSourceFile) { SourceFile = other.SourceFile; } - if (other.Begin != 0) { + if (other.HasBegin) { Begin = other.Begin; } - if (other.End != 0) { + if (other.HasEnd) { End = other.End; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); |