UnittestProto3Optional.cs 72 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948
  1. // <auto-generated>
  2. // Generated by the protocol buffer compiler. DO NOT EDIT!
  3. // source: google/protobuf/unittest_proto3_optional.proto
  4. // </auto-generated>
  5. #pragma warning disable 1591, 0612, 3021
  6. #region Designer generated code
  7. using pb = global::Google.Protobuf;
  8. using pbc = global::Google.Protobuf.Collections;
  9. using pbr = global::Google.Protobuf.Reflection;
  10. using scg = global::System.Collections.Generic;
  11. namespace ProtobufUnittest {
  12. /// <summary>Holder for reflection information generated from google/protobuf/unittest_proto3_optional.proto</summary>
  13. public static partial class UnittestProto3OptionalReflection {
  14. #region Descriptor
  15. /// <summary>File descriptor for google/protobuf/unittest_proto3_optional.proto</summary>
  16. public static pbr::FileDescriptor Descriptor {
  17. get { return descriptor; }
  18. }
  19. private static pbr::FileDescriptor descriptor;
  20. static UnittestProto3OptionalReflection() {
  21. byte[] descriptorData = global::System.Convert.FromBase64String(
  22. string.Concat(
  23. "Ci5nb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfcHJvdG8zX29wdGlvbmFsLnBy",
  24. "b3RvEhFwcm90b2J1Zl91bml0dGVzdBogZ29vZ2xlL3Byb3RvYnVmL2Rlc2Ny",
  25. "aXB0b3IucHJvdG8isQoKElRlc3RQcm90bzNPcHRpb25hbBIbCg5vcHRpb25h",
  26. "bF9pbnQzMhgBIAEoBUgAiAEBEhsKDm9wdGlvbmFsX2ludDY0GAIgASgDSAGI",
  27. "AQESHAoPb3B0aW9uYWxfdWludDMyGAMgASgNSAKIAQESHAoPb3B0aW9uYWxf",
  28. "dWludDY0GAQgASgESAOIAQESHAoPb3B0aW9uYWxfc2ludDMyGAUgASgRSASI",
  29. "AQESHAoPb3B0aW9uYWxfc2ludDY0GAYgASgSSAWIAQESHQoQb3B0aW9uYWxf",
  30. "Zml4ZWQzMhgHIAEoB0gGiAEBEh0KEG9wdGlvbmFsX2ZpeGVkNjQYCCABKAZI",
  31. "B4gBARIeChFvcHRpb25hbF9zZml4ZWQzMhgJIAEoD0gIiAEBEh4KEW9wdGlv",
  32. "bmFsX3NmaXhlZDY0GAogASgQSAmIAQESGwoOb3B0aW9uYWxfZmxvYXQYCyAB",
  33. "KAJICogBARIcCg9vcHRpb25hbF9kb3VibGUYDCABKAFIC4gBARIaCg1vcHRp",
  34. "b25hbF9ib29sGA0gASgISAyIAQESHAoPb3B0aW9uYWxfc3RyaW5nGA4gASgJ",
  35. "SA2IAQESGwoOb3B0aW9uYWxfYnl0ZXMYDyABKAxIDogBARIeCg1vcHRpb25h",
  36. "bF9jb3JkGBAgASgJQgIIAUgPiAEBElkKF29wdGlvbmFsX25lc3RlZF9tZXNz",
  37. "YWdlGBIgASgLMjMucHJvdG9idWZfdW5pdHRlc3QuVGVzdFByb3RvM09wdGlv",
  38. "bmFsLk5lc3RlZE1lc3NhZ2VIEIgBARJZChNsYXp5X25lc3RlZF9tZXNzYWdl",
  39. "GBMgASgLMjMucHJvdG9idWZfdW5pdHRlc3QuVGVzdFByb3RvM09wdGlvbmFs",
  40. "Lk5lc3RlZE1lc3NhZ2VCAigBSBGIAQESUwoUb3B0aW9uYWxfbmVzdGVkX2Vu",
  41. "dW0YFSABKA4yMC5wcm90b2J1Zl91bml0dGVzdC5UZXN0UHJvdG8zT3B0aW9u",
  42. "YWwuTmVzdGVkRW51bUgSiAEBEhYKDnNpbmd1bGFyX2ludDMyGBYgASgFEhYK",
  43. "DnNpbmd1bGFyX2ludDY0GBcgASgDGicKDU5lc3RlZE1lc3NhZ2USDwoCYmIY",
  44. "ASABKAVIAIgBAUIFCgNfYmIiSgoKTmVzdGVkRW51bRIPCgtVTlNQRUNJRklF",
  45. "RBAAEgcKA0ZPTxABEgcKA0JBUhACEgcKA0JBWhADEhAKA05FRxD/////////",
  46. "//8BQhEKD19vcHRpb25hbF9pbnQzMkIRCg9fb3B0aW9uYWxfaW50NjRCEgoQ",
  47. "X29wdGlvbmFsX3VpbnQzMkISChBfb3B0aW9uYWxfdWludDY0QhIKEF9vcHRp",
  48. "b25hbF9zaW50MzJCEgoQX29wdGlvbmFsX3NpbnQ2NEITChFfb3B0aW9uYWxf",
  49. "Zml4ZWQzMkITChFfb3B0aW9uYWxfZml4ZWQ2NEIUChJfb3B0aW9uYWxfc2Zp",
  50. "eGVkMzJCFAoSX29wdGlvbmFsX3NmaXhlZDY0QhEKD19vcHRpb25hbF9mbG9h",
  51. "dEISChBfb3B0aW9uYWxfZG91YmxlQhAKDl9vcHRpb25hbF9ib29sQhIKEF9v",
  52. "cHRpb25hbF9zdHJpbmdCEQoPX29wdGlvbmFsX2J5dGVzQhAKDl9vcHRpb25h",
  53. "bF9jb3JkQhoKGF9vcHRpb25hbF9uZXN0ZWRfbWVzc2FnZUIWChRfbGF6eV9u",
  54. "ZXN0ZWRfbWVzc2FnZUIXChVfb3B0aW9uYWxfbmVzdGVkX2VudW0iiQIKGVRl",
  55. "c3RQcm90bzNPcHRpb25hbE1lc3NhZ2USUgoObmVzdGVkX21lc3NhZ2UYASAB",
  56. "KAsyOi5wcm90b2J1Zl91bml0dGVzdC5UZXN0UHJvdG8zT3B0aW9uYWxNZXNz",
  57. "YWdlLk5lc3RlZE1lc3NhZ2USYAoXb3B0aW9uYWxfbmVzdGVkX21lc3NhZ2UY",
  58. "AiABKAsyOi5wcm90b2J1Zl91bml0dGVzdC5UZXN0UHJvdG8zT3B0aW9uYWxN",
  59. "ZXNzYWdlLk5lc3RlZE1lc3NhZ2VIAIgBARoaCg1OZXN0ZWRNZXNzYWdlEgkK",
  60. "AXMYASABKAlCGgoYX29wdGlvbmFsX25lc3RlZF9tZXNzYWdlIqkBChhQcm90",
  61. "bzNPcHRpb25hbEV4dGVuc2lvbnMyPAoPZXh0X25vX29wdGlvbmFsEh8uZ29v",
  62. "Z2xlLnByb3RvYnVmLk1lc3NhZ2VPcHRpb25zGIjN2akBIAEoBTJBChFleHRf",
  63. "d2l0aF9vcHRpb25hbBIfLmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9u",
  64. "cxiJzdmpASABKAWIAQE6DMDozM0KCMjozM0KEEIlCiFjb20uZ29vZ2xlLnBy",
  65. "b3RvYnVmLnRlc3RpbmcucHJvdG9QAWIGcHJvdG8z"));
  66. descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
  67. new pbr::FileDescriptor[] { global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor, },
  68. new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
  69. new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufUnittest.TestProto3Optional), global::ProtobufUnittest.TestProto3Optional.Parser, new[]{ "OptionalInt32", "OptionalInt64", "OptionalUint32", "OptionalUint64", "OptionalSint32", "OptionalSint64", "OptionalFixed32", "OptionalFixed64", "OptionalSfixed32", "OptionalSfixed64", "OptionalFloat", "OptionalDouble", "OptionalBool", "OptionalString", "OptionalBytes", "OptionalCord", "OptionalNestedMessage", "LazyNestedMessage", "OptionalNestedEnum", "SingularInt32", "SingularInt64" }, new[]{ "OptionalInt32", "OptionalInt64", "OptionalUint32", "OptionalUint64", "OptionalSint32", "OptionalSint64", "OptionalFixed32", "OptionalFixed64", "OptionalSfixed32", "OptionalSfixed64", "OptionalFloat", "OptionalDouble", "OptionalBool", "OptionalString", "OptionalBytes", "OptionalCord", "OptionalNestedMessage", "LazyNestedMessage", "OptionalNestedEnum" }, new[]{ typeof(global::ProtobufUnittest.TestProto3Optional.Types.NestedEnum) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufUnittest.TestProto3Optional.Types.NestedMessage), global::ProtobufUnittest.TestProto3Optional.Types.NestedMessage.Parser, new[]{ "Bb" }, new[]{ "Bb" }, null, null, null)}),
  70. new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufUnittest.TestProto3OptionalMessage), global::ProtobufUnittest.TestProto3OptionalMessage.Parser, new[]{ "NestedMessage", "OptionalNestedMessage" }, new[]{ "OptionalNestedMessage" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufUnittest.TestProto3OptionalMessage.Types.NestedMessage), global::ProtobufUnittest.TestProto3OptionalMessage.Types.NestedMessage.Parser, new[]{ "S" }, null, null, null, null)}),
  71. new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufUnittest.Proto3OptionalExtensions), global::ProtobufUnittest.Proto3OptionalExtensions.Parser, null, null, null, new pb::Extension[] { global::ProtobufUnittest.Proto3OptionalExtensions.Extensions.ExtNoOptional, global::ProtobufUnittest.Proto3OptionalExtensions.Extensions.ExtWithOptional }, null)
  72. }));
  73. }
  74. #endregion
  75. }
  76. #region Messages
  77. public sealed partial class TestProto3Optional : pb::IMessage<TestProto3Optional>
  78. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  79. , pb::IBufferMessage
  80. #endif
  81. {
  82. private static readonly pb::MessageParser<TestProto3Optional> _parser = new pb::MessageParser<TestProto3Optional>(() => new TestProto3Optional());
  83. private pb::UnknownFieldSet _unknownFields;
  84. private int _hasBits0;
  85. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  86. public static pb::MessageParser<TestProto3Optional> Parser { get { return _parser; } }
  87. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  88. public static pbr::MessageDescriptor Descriptor {
  89. get { return global::ProtobufUnittest.UnittestProto3OptionalReflection.Descriptor.MessageTypes[0]; }
  90. }
  91. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  92. pbr::MessageDescriptor pb::IMessage.Descriptor {
  93. get { return Descriptor; }
  94. }
  95. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  96. public TestProto3Optional() {
  97. OnConstruction();
  98. }
  99. partial void OnConstruction();
  100. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  101. public TestProto3Optional(TestProto3Optional other) : this() {
  102. _hasBits0 = other._hasBits0;
  103. optionalInt32_ = other.optionalInt32_;
  104. optionalInt64_ = other.optionalInt64_;
  105. optionalUint32_ = other.optionalUint32_;
  106. optionalUint64_ = other.optionalUint64_;
  107. optionalSint32_ = other.optionalSint32_;
  108. optionalSint64_ = other.optionalSint64_;
  109. optionalFixed32_ = other.optionalFixed32_;
  110. optionalFixed64_ = other.optionalFixed64_;
  111. optionalSfixed32_ = other.optionalSfixed32_;
  112. optionalSfixed64_ = other.optionalSfixed64_;
  113. optionalFloat_ = other.optionalFloat_;
  114. optionalDouble_ = other.optionalDouble_;
  115. optionalBool_ = other.optionalBool_;
  116. optionalString_ = other.optionalString_;
  117. optionalBytes_ = other.optionalBytes_;
  118. optionalCord_ = other.optionalCord_;
  119. optionalNestedMessage_ = other.optionalNestedMessage_ != null ? other.optionalNestedMessage_.Clone() : null;
  120. lazyNestedMessage_ = other.lazyNestedMessage_ != null ? other.lazyNestedMessage_.Clone() : null;
  121. optionalNestedEnum_ = other.optionalNestedEnum_;
  122. singularInt32_ = other.singularInt32_;
  123. singularInt64_ = other.singularInt64_;
  124. _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
  125. }
  126. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  127. public TestProto3Optional Clone() {
  128. return new TestProto3Optional(this);
  129. }
  130. /// <summary>Field number for the "optional_int32" field.</summary>
  131. public const int OptionalInt32FieldNumber = 1;
  132. private int optionalInt32_;
  133. /// <summary>
  134. /// Singular
  135. /// </summary>
  136. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  137. public int OptionalInt32 {
  138. get { if ((_hasBits0 & 1) != 0) { return optionalInt32_; } else { return 0; } }
  139. set {
  140. _hasBits0 |= 1;
  141. optionalInt32_ = value;
  142. }
  143. }
  144. /// <summary>Gets whether the "optional_int32" field is set</summary>
  145. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  146. public bool HasOptionalInt32 {
  147. get { return (_hasBits0 & 1) != 0; }
  148. }
  149. /// <summary>Clears the value of the "optional_int32" field</summary>
  150. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  151. public void ClearOptionalInt32() {
  152. _hasBits0 &= ~1;
  153. }
  154. /// <summary>Field number for the "optional_int64" field.</summary>
  155. public const int OptionalInt64FieldNumber = 2;
  156. private long optionalInt64_;
  157. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  158. public long OptionalInt64 {
  159. get { if ((_hasBits0 & 2) != 0) { return optionalInt64_; } else { return 0L; } }
  160. set {
  161. _hasBits0 |= 2;
  162. optionalInt64_ = value;
  163. }
  164. }
  165. /// <summary>Gets whether the "optional_int64" field is set</summary>
  166. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  167. public bool HasOptionalInt64 {
  168. get { return (_hasBits0 & 2) != 0; }
  169. }
  170. /// <summary>Clears the value of the "optional_int64" field</summary>
  171. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  172. public void ClearOptionalInt64() {
  173. _hasBits0 &= ~2;
  174. }
  175. /// <summary>Field number for the "optional_uint32" field.</summary>
  176. public const int OptionalUint32FieldNumber = 3;
  177. private uint optionalUint32_;
  178. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  179. public uint OptionalUint32 {
  180. get { if ((_hasBits0 & 4) != 0) { return optionalUint32_; } else { return 0; } }
  181. set {
  182. _hasBits0 |= 4;
  183. optionalUint32_ = value;
  184. }
  185. }
  186. /// <summary>Gets whether the "optional_uint32" field is set</summary>
  187. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  188. public bool HasOptionalUint32 {
  189. get { return (_hasBits0 & 4) != 0; }
  190. }
  191. /// <summary>Clears the value of the "optional_uint32" field</summary>
  192. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  193. public void ClearOptionalUint32() {
  194. _hasBits0 &= ~4;
  195. }
  196. /// <summary>Field number for the "optional_uint64" field.</summary>
  197. public const int OptionalUint64FieldNumber = 4;
  198. private ulong optionalUint64_;
  199. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  200. public ulong OptionalUint64 {
  201. get { if ((_hasBits0 & 8) != 0) { return optionalUint64_; } else { return 0UL; } }
  202. set {
  203. _hasBits0 |= 8;
  204. optionalUint64_ = value;
  205. }
  206. }
  207. /// <summary>Gets whether the "optional_uint64" field is set</summary>
  208. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  209. public bool HasOptionalUint64 {
  210. get { return (_hasBits0 & 8) != 0; }
  211. }
  212. /// <summary>Clears the value of the "optional_uint64" field</summary>
  213. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  214. public void ClearOptionalUint64() {
  215. _hasBits0 &= ~8;
  216. }
  217. /// <summary>Field number for the "optional_sint32" field.</summary>
  218. public const int OptionalSint32FieldNumber = 5;
  219. private int optionalSint32_;
  220. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  221. public int OptionalSint32 {
  222. get { if ((_hasBits0 & 16) != 0) { return optionalSint32_; } else { return 0; } }
  223. set {
  224. _hasBits0 |= 16;
  225. optionalSint32_ = value;
  226. }
  227. }
  228. /// <summary>Gets whether the "optional_sint32" field is set</summary>
  229. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  230. public bool HasOptionalSint32 {
  231. get { return (_hasBits0 & 16) != 0; }
  232. }
  233. /// <summary>Clears the value of the "optional_sint32" field</summary>
  234. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  235. public void ClearOptionalSint32() {
  236. _hasBits0 &= ~16;
  237. }
  238. /// <summary>Field number for the "optional_sint64" field.</summary>
  239. public const int OptionalSint64FieldNumber = 6;
  240. private long optionalSint64_;
  241. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  242. public long OptionalSint64 {
  243. get { if ((_hasBits0 & 32) != 0) { return optionalSint64_; } else { return 0L; } }
  244. set {
  245. _hasBits0 |= 32;
  246. optionalSint64_ = value;
  247. }
  248. }
  249. /// <summary>Gets whether the "optional_sint64" field is set</summary>
  250. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  251. public bool HasOptionalSint64 {
  252. get { return (_hasBits0 & 32) != 0; }
  253. }
  254. /// <summary>Clears the value of the "optional_sint64" field</summary>
  255. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  256. public void ClearOptionalSint64() {
  257. _hasBits0 &= ~32;
  258. }
  259. /// <summary>Field number for the "optional_fixed32" field.</summary>
  260. public const int OptionalFixed32FieldNumber = 7;
  261. private uint optionalFixed32_;
  262. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  263. public uint OptionalFixed32 {
  264. get { if ((_hasBits0 & 64) != 0) { return optionalFixed32_; } else { return 0; } }
  265. set {
  266. _hasBits0 |= 64;
  267. optionalFixed32_ = value;
  268. }
  269. }
  270. /// <summary>Gets whether the "optional_fixed32" field is set</summary>
  271. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  272. public bool HasOptionalFixed32 {
  273. get { return (_hasBits0 & 64) != 0; }
  274. }
  275. /// <summary>Clears the value of the "optional_fixed32" field</summary>
  276. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  277. public void ClearOptionalFixed32() {
  278. _hasBits0 &= ~64;
  279. }
  280. /// <summary>Field number for the "optional_fixed64" field.</summary>
  281. public const int OptionalFixed64FieldNumber = 8;
  282. private ulong optionalFixed64_;
  283. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  284. public ulong OptionalFixed64 {
  285. get { if ((_hasBits0 & 128) != 0) { return optionalFixed64_; } else { return 0UL; } }
  286. set {
  287. _hasBits0 |= 128;
  288. optionalFixed64_ = value;
  289. }
  290. }
  291. /// <summary>Gets whether the "optional_fixed64" field is set</summary>
  292. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  293. public bool HasOptionalFixed64 {
  294. get { return (_hasBits0 & 128) != 0; }
  295. }
  296. /// <summary>Clears the value of the "optional_fixed64" field</summary>
  297. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  298. public void ClearOptionalFixed64() {
  299. _hasBits0 &= ~128;
  300. }
  301. /// <summary>Field number for the "optional_sfixed32" field.</summary>
  302. public const int OptionalSfixed32FieldNumber = 9;
  303. private int optionalSfixed32_;
  304. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  305. public int OptionalSfixed32 {
  306. get { if ((_hasBits0 & 256) != 0) { return optionalSfixed32_; } else { return 0; } }
  307. set {
  308. _hasBits0 |= 256;
  309. optionalSfixed32_ = value;
  310. }
  311. }
  312. /// <summary>Gets whether the "optional_sfixed32" field is set</summary>
  313. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  314. public bool HasOptionalSfixed32 {
  315. get { return (_hasBits0 & 256) != 0; }
  316. }
  317. /// <summary>Clears the value of the "optional_sfixed32" field</summary>
  318. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  319. public void ClearOptionalSfixed32() {
  320. _hasBits0 &= ~256;
  321. }
  322. /// <summary>Field number for the "optional_sfixed64" field.</summary>
  323. public const int OptionalSfixed64FieldNumber = 10;
  324. private long optionalSfixed64_;
  325. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  326. public long OptionalSfixed64 {
  327. get { if ((_hasBits0 & 512) != 0) { return optionalSfixed64_; } else { return 0L; } }
  328. set {
  329. _hasBits0 |= 512;
  330. optionalSfixed64_ = value;
  331. }
  332. }
  333. /// <summary>Gets whether the "optional_sfixed64" field is set</summary>
  334. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  335. public bool HasOptionalSfixed64 {
  336. get { return (_hasBits0 & 512) != 0; }
  337. }
  338. /// <summary>Clears the value of the "optional_sfixed64" field</summary>
  339. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  340. public void ClearOptionalSfixed64() {
  341. _hasBits0 &= ~512;
  342. }
  343. /// <summary>Field number for the "optional_float" field.</summary>
  344. public const int OptionalFloatFieldNumber = 11;
  345. private float optionalFloat_;
  346. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  347. public float OptionalFloat {
  348. get { if ((_hasBits0 & 1024) != 0) { return optionalFloat_; } else { return 0F; } }
  349. set {
  350. _hasBits0 |= 1024;
  351. optionalFloat_ = value;
  352. }
  353. }
  354. /// <summary>Gets whether the "optional_float" field is set</summary>
  355. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  356. public bool HasOptionalFloat {
  357. get { return (_hasBits0 & 1024) != 0; }
  358. }
  359. /// <summary>Clears the value of the "optional_float" field</summary>
  360. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  361. public void ClearOptionalFloat() {
  362. _hasBits0 &= ~1024;
  363. }
  364. /// <summary>Field number for the "optional_double" field.</summary>
  365. public const int OptionalDoubleFieldNumber = 12;
  366. private double optionalDouble_;
  367. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  368. public double OptionalDouble {
  369. get { if ((_hasBits0 & 2048) != 0) { return optionalDouble_; } else { return 0D; } }
  370. set {
  371. _hasBits0 |= 2048;
  372. optionalDouble_ = value;
  373. }
  374. }
  375. /// <summary>Gets whether the "optional_double" field is set</summary>
  376. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  377. public bool HasOptionalDouble {
  378. get { return (_hasBits0 & 2048) != 0; }
  379. }
  380. /// <summary>Clears the value of the "optional_double" field</summary>
  381. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  382. public void ClearOptionalDouble() {
  383. _hasBits0 &= ~2048;
  384. }
  385. /// <summary>Field number for the "optional_bool" field.</summary>
  386. public const int OptionalBoolFieldNumber = 13;
  387. private bool optionalBool_;
  388. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  389. public bool OptionalBool {
  390. get { if ((_hasBits0 & 4096) != 0) { return optionalBool_; } else { return false; } }
  391. set {
  392. _hasBits0 |= 4096;
  393. optionalBool_ = value;
  394. }
  395. }
  396. /// <summary>Gets whether the "optional_bool" field is set</summary>
  397. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  398. public bool HasOptionalBool {
  399. get { return (_hasBits0 & 4096) != 0; }
  400. }
  401. /// <summary>Clears the value of the "optional_bool" field</summary>
  402. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  403. public void ClearOptionalBool() {
  404. _hasBits0 &= ~4096;
  405. }
  406. /// <summary>Field number for the "optional_string" field.</summary>
  407. public const int OptionalStringFieldNumber = 14;
  408. private string optionalString_;
  409. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  410. public string OptionalString {
  411. get { return optionalString_ ?? ""; }
  412. set {
  413. optionalString_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
  414. }
  415. }
  416. /// <summary>Gets whether the "optional_string" field is set</summary>
  417. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  418. public bool HasOptionalString {
  419. get { return optionalString_ != null; }
  420. }
  421. /// <summary>Clears the value of the "optional_string" field</summary>
  422. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  423. public void ClearOptionalString() {
  424. optionalString_ = null;
  425. }
  426. /// <summary>Field number for the "optional_bytes" field.</summary>
  427. public const int OptionalBytesFieldNumber = 15;
  428. private pb::ByteString optionalBytes_;
  429. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  430. public pb::ByteString OptionalBytes {
  431. get { return optionalBytes_ ?? pb::ByteString.Empty; }
  432. set {
  433. optionalBytes_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
  434. }
  435. }
  436. /// <summary>Gets whether the "optional_bytes" field is set</summary>
  437. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  438. public bool HasOptionalBytes {
  439. get { return optionalBytes_ != null; }
  440. }
  441. /// <summary>Clears the value of the "optional_bytes" field</summary>
  442. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  443. public void ClearOptionalBytes() {
  444. optionalBytes_ = null;
  445. }
  446. /// <summary>Field number for the "optional_cord" field.</summary>
  447. public const int OptionalCordFieldNumber = 16;
  448. private string optionalCord_;
  449. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  450. public string OptionalCord {
  451. get { return optionalCord_ ?? ""; }
  452. set {
  453. optionalCord_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
  454. }
  455. }
  456. /// <summary>Gets whether the "optional_cord" field is set</summary>
  457. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  458. public bool HasOptionalCord {
  459. get { return optionalCord_ != null; }
  460. }
  461. /// <summary>Clears the value of the "optional_cord" field</summary>
  462. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  463. public void ClearOptionalCord() {
  464. optionalCord_ = null;
  465. }
  466. /// <summary>Field number for the "optional_nested_message" field.</summary>
  467. public const int OptionalNestedMessageFieldNumber = 18;
  468. private global::ProtobufUnittest.TestProto3Optional.Types.NestedMessage optionalNestedMessage_;
  469. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  470. public global::ProtobufUnittest.TestProto3Optional.Types.NestedMessage OptionalNestedMessage {
  471. get { return optionalNestedMessage_; }
  472. set {
  473. optionalNestedMessage_ = value;
  474. }
  475. }
  476. /// <summary>Field number for the "lazy_nested_message" field.</summary>
  477. public const int LazyNestedMessageFieldNumber = 19;
  478. private global::ProtobufUnittest.TestProto3Optional.Types.NestedMessage lazyNestedMessage_;
  479. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  480. public global::ProtobufUnittest.TestProto3Optional.Types.NestedMessage LazyNestedMessage {
  481. get { return lazyNestedMessage_; }
  482. set {
  483. lazyNestedMessage_ = value;
  484. }
  485. }
  486. /// <summary>Field number for the "optional_nested_enum" field.</summary>
  487. public const int OptionalNestedEnumFieldNumber = 21;
  488. private global::ProtobufUnittest.TestProto3Optional.Types.NestedEnum optionalNestedEnum_;
  489. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  490. public global::ProtobufUnittest.TestProto3Optional.Types.NestedEnum OptionalNestedEnum {
  491. get { if ((_hasBits0 & 8192) != 0) { return optionalNestedEnum_; } else { return global::ProtobufUnittest.TestProto3Optional.Types.NestedEnum.Unspecified; } }
  492. set {
  493. _hasBits0 |= 8192;
  494. optionalNestedEnum_ = value;
  495. }
  496. }
  497. /// <summary>Gets whether the "optional_nested_enum" field is set</summary>
  498. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  499. public bool HasOptionalNestedEnum {
  500. get { return (_hasBits0 & 8192) != 0; }
  501. }
  502. /// <summary>Clears the value of the "optional_nested_enum" field</summary>
  503. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  504. public void ClearOptionalNestedEnum() {
  505. _hasBits0 &= ~8192;
  506. }
  507. /// <summary>Field number for the "singular_int32" field.</summary>
  508. public const int SingularInt32FieldNumber = 22;
  509. private int singularInt32_;
  510. /// <summary>
  511. /// Add some non-optional fields to verify we can mix them.
  512. /// </summary>
  513. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  514. public int SingularInt32 {
  515. get { return singularInt32_; }
  516. set {
  517. singularInt32_ = value;
  518. }
  519. }
  520. /// <summary>Field number for the "singular_int64" field.</summary>
  521. public const int SingularInt64FieldNumber = 23;
  522. private long singularInt64_;
  523. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  524. public long SingularInt64 {
  525. get { return singularInt64_; }
  526. set {
  527. singularInt64_ = value;
  528. }
  529. }
  530. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  531. public override bool Equals(object other) {
  532. return Equals(other as TestProto3Optional);
  533. }
  534. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  535. public bool Equals(TestProto3Optional other) {
  536. if (ReferenceEquals(other, null)) {
  537. return false;
  538. }
  539. if (ReferenceEquals(other, this)) {
  540. return true;
  541. }
  542. if (OptionalInt32 != other.OptionalInt32) return false;
  543. if (OptionalInt64 != other.OptionalInt64) return false;
  544. if (OptionalUint32 != other.OptionalUint32) return false;
  545. if (OptionalUint64 != other.OptionalUint64) return false;
  546. if (OptionalSint32 != other.OptionalSint32) return false;
  547. if (OptionalSint64 != other.OptionalSint64) return false;
  548. if (OptionalFixed32 != other.OptionalFixed32) return false;
  549. if (OptionalFixed64 != other.OptionalFixed64) return false;
  550. if (OptionalSfixed32 != other.OptionalSfixed32) return false;
  551. if (OptionalSfixed64 != other.OptionalSfixed64) return false;
  552. if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(OptionalFloat, other.OptionalFloat)) return false;
  553. if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(OptionalDouble, other.OptionalDouble)) return false;
  554. if (OptionalBool != other.OptionalBool) return false;
  555. if (OptionalString != other.OptionalString) return false;
  556. if (OptionalBytes != other.OptionalBytes) return false;
  557. if (OptionalCord != other.OptionalCord) return false;
  558. if (!object.Equals(OptionalNestedMessage, other.OptionalNestedMessage)) return false;
  559. if (!object.Equals(LazyNestedMessage, other.LazyNestedMessage)) return false;
  560. if (OptionalNestedEnum != other.OptionalNestedEnum) return false;
  561. if (SingularInt32 != other.SingularInt32) return false;
  562. if (SingularInt64 != other.SingularInt64) return false;
  563. return Equals(_unknownFields, other._unknownFields);
  564. }
  565. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  566. public override int GetHashCode() {
  567. int hash = 1;
  568. if (HasOptionalInt32) hash ^= OptionalInt32.GetHashCode();
  569. if (HasOptionalInt64) hash ^= OptionalInt64.GetHashCode();
  570. if (HasOptionalUint32) hash ^= OptionalUint32.GetHashCode();
  571. if (HasOptionalUint64) hash ^= OptionalUint64.GetHashCode();
  572. if (HasOptionalSint32) hash ^= OptionalSint32.GetHashCode();
  573. if (HasOptionalSint64) hash ^= OptionalSint64.GetHashCode();
  574. if (HasOptionalFixed32) hash ^= OptionalFixed32.GetHashCode();
  575. if (HasOptionalFixed64) hash ^= OptionalFixed64.GetHashCode();
  576. if (HasOptionalSfixed32) hash ^= OptionalSfixed32.GetHashCode();
  577. if (HasOptionalSfixed64) hash ^= OptionalSfixed64.GetHashCode();
  578. if (HasOptionalFloat) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(OptionalFloat);
  579. if (HasOptionalDouble) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(OptionalDouble);
  580. if (HasOptionalBool) hash ^= OptionalBool.GetHashCode();
  581. if (HasOptionalString) hash ^= OptionalString.GetHashCode();
  582. if (HasOptionalBytes) hash ^= OptionalBytes.GetHashCode();
  583. if (HasOptionalCord) hash ^= OptionalCord.GetHashCode();
  584. if (optionalNestedMessage_ != null) hash ^= OptionalNestedMessage.GetHashCode();
  585. if (lazyNestedMessage_ != null) hash ^= LazyNestedMessage.GetHashCode();
  586. if (HasOptionalNestedEnum) hash ^= OptionalNestedEnum.GetHashCode();
  587. if (SingularInt32 != 0) hash ^= SingularInt32.GetHashCode();
  588. if (SingularInt64 != 0L) hash ^= SingularInt64.GetHashCode();
  589. if (_unknownFields != null) {
  590. hash ^= _unknownFields.GetHashCode();
  591. }
  592. return hash;
  593. }
  594. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  595. public override string ToString() {
  596. return pb::JsonFormatter.ToDiagnosticString(this);
  597. }
  598. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  599. public void WriteTo(pb::CodedOutputStream output) {
  600. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  601. output.WriteRawMessage(this);
  602. #else
  603. if (HasOptionalInt32) {
  604. output.WriteRawTag(8);
  605. output.WriteInt32(OptionalInt32);
  606. }
  607. if (HasOptionalInt64) {
  608. output.WriteRawTag(16);
  609. output.WriteInt64(OptionalInt64);
  610. }
  611. if (HasOptionalUint32) {
  612. output.WriteRawTag(24);
  613. output.WriteUInt32(OptionalUint32);
  614. }
  615. if (HasOptionalUint64) {
  616. output.WriteRawTag(32);
  617. output.WriteUInt64(OptionalUint64);
  618. }
  619. if (HasOptionalSint32) {
  620. output.WriteRawTag(40);
  621. output.WriteSInt32(OptionalSint32);
  622. }
  623. if (HasOptionalSint64) {
  624. output.WriteRawTag(48);
  625. output.WriteSInt64(OptionalSint64);
  626. }
  627. if (HasOptionalFixed32) {
  628. output.WriteRawTag(61);
  629. output.WriteFixed32(OptionalFixed32);
  630. }
  631. if (HasOptionalFixed64) {
  632. output.WriteRawTag(65);
  633. output.WriteFixed64(OptionalFixed64);
  634. }
  635. if (HasOptionalSfixed32) {
  636. output.WriteRawTag(77);
  637. output.WriteSFixed32(OptionalSfixed32);
  638. }
  639. if (HasOptionalSfixed64) {
  640. output.WriteRawTag(81);
  641. output.WriteSFixed64(OptionalSfixed64);
  642. }
  643. if (HasOptionalFloat) {
  644. output.WriteRawTag(93);
  645. output.WriteFloat(OptionalFloat);
  646. }
  647. if (HasOptionalDouble) {
  648. output.WriteRawTag(97);
  649. output.WriteDouble(OptionalDouble);
  650. }
  651. if (HasOptionalBool) {
  652. output.WriteRawTag(104);
  653. output.WriteBool(OptionalBool);
  654. }
  655. if (HasOptionalString) {
  656. output.WriteRawTag(114);
  657. output.WriteString(OptionalString);
  658. }
  659. if (HasOptionalBytes) {
  660. output.WriteRawTag(122);
  661. output.WriteBytes(OptionalBytes);
  662. }
  663. if (HasOptionalCord) {
  664. output.WriteRawTag(130, 1);
  665. output.WriteString(OptionalCord);
  666. }
  667. if (optionalNestedMessage_ != null) {
  668. output.WriteRawTag(146, 1);
  669. output.WriteMessage(OptionalNestedMessage);
  670. }
  671. if (lazyNestedMessage_ != null) {
  672. output.WriteRawTag(154, 1);
  673. output.WriteMessage(LazyNestedMessage);
  674. }
  675. if (HasOptionalNestedEnum) {
  676. output.WriteRawTag(168, 1);
  677. output.WriteEnum((int) OptionalNestedEnum);
  678. }
  679. if (SingularInt32 != 0) {
  680. output.WriteRawTag(176, 1);
  681. output.WriteInt32(SingularInt32);
  682. }
  683. if (SingularInt64 != 0L) {
  684. output.WriteRawTag(184, 1);
  685. output.WriteInt64(SingularInt64);
  686. }
  687. if (_unknownFields != null) {
  688. _unknownFields.WriteTo(output);
  689. }
  690. #endif
  691. }
  692. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  693. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  694. void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
  695. if (HasOptionalInt32) {
  696. output.WriteRawTag(8);
  697. output.WriteInt32(OptionalInt32);
  698. }
  699. if (HasOptionalInt64) {
  700. output.WriteRawTag(16);
  701. output.WriteInt64(OptionalInt64);
  702. }
  703. if (HasOptionalUint32) {
  704. output.WriteRawTag(24);
  705. output.WriteUInt32(OptionalUint32);
  706. }
  707. if (HasOptionalUint64) {
  708. output.WriteRawTag(32);
  709. output.WriteUInt64(OptionalUint64);
  710. }
  711. if (HasOptionalSint32) {
  712. output.WriteRawTag(40);
  713. output.WriteSInt32(OptionalSint32);
  714. }
  715. if (HasOptionalSint64) {
  716. output.WriteRawTag(48);
  717. output.WriteSInt64(OptionalSint64);
  718. }
  719. if (HasOptionalFixed32) {
  720. output.WriteRawTag(61);
  721. output.WriteFixed32(OptionalFixed32);
  722. }
  723. if (HasOptionalFixed64) {
  724. output.WriteRawTag(65);
  725. output.WriteFixed64(OptionalFixed64);
  726. }
  727. if (HasOptionalSfixed32) {
  728. output.WriteRawTag(77);
  729. output.WriteSFixed32(OptionalSfixed32);
  730. }
  731. if (HasOptionalSfixed64) {
  732. output.WriteRawTag(81);
  733. output.WriteSFixed64(OptionalSfixed64);
  734. }
  735. if (HasOptionalFloat) {
  736. output.WriteRawTag(93);
  737. output.WriteFloat(OptionalFloat);
  738. }
  739. if (HasOptionalDouble) {
  740. output.WriteRawTag(97);
  741. output.WriteDouble(OptionalDouble);
  742. }
  743. if (HasOptionalBool) {
  744. output.WriteRawTag(104);
  745. output.WriteBool(OptionalBool);
  746. }
  747. if (HasOptionalString) {
  748. output.WriteRawTag(114);
  749. output.WriteString(OptionalString);
  750. }
  751. if (HasOptionalBytes) {
  752. output.WriteRawTag(122);
  753. output.WriteBytes(OptionalBytes);
  754. }
  755. if (HasOptionalCord) {
  756. output.WriteRawTag(130, 1);
  757. output.WriteString(OptionalCord);
  758. }
  759. if (optionalNestedMessage_ != null) {
  760. output.WriteRawTag(146, 1);
  761. output.WriteMessage(OptionalNestedMessage);
  762. }
  763. if (lazyNestedMessage_ != null) {
  764. output.WriteRawTag(154, 1);
  765. output.WriteMessage(LazyNestedMessage);
  766. }
  767. if (HasOptionalNestedEnum) {
  768. output.WriteRawTag(168, 1);
  769. output.WriteEnum((int) OptionalNestedEnum);
  770. }
  771. if (SingularInt32 != 0) {
  772. output.WriteRawTag(176, 1);
  773. output.WriteInt32(SingularInt32);
  774. }
  775. if (SingularInt64 != 0L) {
  776. output.WriteRawTag(184, 1);
  777. output.WriteInt64(SingularInt64);
  778. }
  779. if (_unknownFields != null) {
  780. _unknownFields.WriteTo(ref output);
  781. }
  782. }
  783. #endif
  784. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  785. public int CalculateSize() {
  786. int size = 0;
  787. if (HasOptionalInt32) {
  788. size += 1 + pb::CodedOutputStream.ComputeInt32Size(OptionalInt32);
  789. }
  790. if (HasOptionalInt64) {
  791. size += 1 + pb::CodedOutputStream.ComputeInt64Size(OptionalInt64);
  792. }
  793. if (HasOptionalUint32) {
  794. size += 1 + pb::CodedOutputStream.ComputeUInt32Size(OptionalUint32);
  795. }
  796. if (HasOptionalUint64) {
  797. size += 1 + pb::CodedOutputStream.ComputeUInt64Size(OptionalUint64);
  798. }
  799. if (HasOptionalSint32) {
  800. size += 1 + pb::CodedOutputStream.ComputeSInt32Size(OptionalSint32);
  801. }
  802. if (HasOptionalSint64) {
  803. size += 1 + pb::CodedOutputStream.ComputeSInt64Size(OptionalSint64);
  804. }
  805. if (HasOptionalFixed32) {
  806. size += 1 + 4;
  807. }
  808. if (HasOptionalFixed64) {
  809. size += 1 + 8;
  810. }
  811. if (HasOptionalSfixed32) {
  812. size += 1 + 4;
  813. }
  814. if (HasOptionalSfixed64) {
  815. size += 1 + 8;
  816. }
  817. if (HasOptionalFloat) {
  818. size += 1 + 4;
  819. }
  820. if (HasOptionalDouble) {
  821. size += 1 + 8;
  822. }
  823. if (HasOptionalBool) {
  824. size += 1 + 1;
  825. }
  826. if (HasOptionalString) {
  827. size += 1 + pb::CodedOutputStream.ComputeStringSize(OptionalString);
  828. }
  829. if (HasOptionalBytes) {
  830. size += 1 + pb::CodedOutputStream.ComputeBytesSize(OptionalBytes);
  831. }
  832. if (HasOptionalCord) {
  833. size += 2 + pb::CodedOutputStream.ComputeStringSize(OptionalCord);
  834. }
  835. if (optionalNestedMessage_ != null) {
  836. size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalNestedMessage);
  837. }
  838. if (lazyNestedMessage_ != null) {
  839. size += 2 + pb::CodedOutputStream.ComputeMessageSize(LazyNestedMessage);
  840. }
  841. if (HasOptionalNestedEnum) {
  842. size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) OptionalNestedEnum);
  843. }
  844. if (SingularInt32 != 0) {
  845. size += 2 + pb::CodedOutputStream.ComputeInt32Size(SingularInt32);
  846. }
  847. if (SingularInt64 != 0L) {
  848. size += 2 + pb::CodedOutputStream.ComputeInt64Size(SingularInt64);
  849. }
  850. if (_unknownFields != null) {
  851. size += _unknownFields.CalculateSize();
  852. }
  853. return size;
  854. }
  855. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  856. public void MergeFrom(TestProto3Optional other) {
  857. if (other == null) {
  858. return;
  859. }
  860. if (other.HasOptionalInt32) {
  861. OptionalInt32 = other.OptionalInt32;
  862. }
  863. if (other.HasOptionalInt64) {
  864. OptionalInt64 = other.OptionalInt64;
  865. }
  866. if (other.HasOptionalUint32) {
  867. OptionalUint32 = other.OptionalUint32;
  868. }
  869. if (other.HasOptionalUint64) {
  870. OptionalUint64 = other.OptionalUint64;
  871. }
  872. if (other.HasOptionalSint32) {
  873. OptionalSint32 = other.OptionalSint32;
  874. }
  875. if (other.HasOptionalSint64) {
  876. OptionalSint64 = other.OptionalSint64;
  877. }
  878. if (other.HasOptionalFixed32) {
  879. OptionalFixed32 = other.OptionalFixed32;
  880. }
  881. if (other.HasOptionalFixed64) {
  882. OptionalFixed64 = other.OptionalFixed64;
  883. }
  884. if (other.HasOptionalSfixed32) {
  885. OptionalSfixed32 = other.OptionalSfixed32;
  886. }
  887. if (other.HasOptionalSfixed64) {
  888. OptionalSfixed64 = other.OptionalSfixed64;
  889. }
  890. if (other.HasOptionalFloat) {
  891. OptionalFloat = other.OptionalFloat;
  892. }
  893. if (other.HasOptionalDouble) {
  894. OptionalDouble = other.OptionalDouble;
  895. }
  896. if (other.HasOptionalBool) {
  897. OptionalBool = other.OptionalBool;
  898. }
  899. if (other.HasOptionalString) {
  900. OptionalString = other.OptionalString;
  901. }
  902. if (other.HasOptionalBytes) {
  903. OptionalBytes = other.OptionalBytes;
  904. }
  905. if (other.HasOptionalCord) {
  906. OptionalCord = other.OptionalCord;
  907. }
  908. if (other.optionalNestedMessage_ != null) {
  909. if (optionalNestedMessage_ == null) {
  910. OptionalNestedMessage = new global::ProtobufUnittest.TestProto3Optional.Types.NestedMessage();
  911. }
  912. OptionalNestedMessage.MergeFrom(other.OptionalNestedMessage);
  913. }
  914. if (other.lazyNestedMessage_ != null) {
  915. if (lazyNestedMessage_ == null) {
  916. LazyNestedMessage = new global::ProtobufUnittest.TestProto3Optional.Types.NestedMessage();
  917. }
  918. LazyNestedMessage.MergeFrom(other.LazyNestedMessage);
  919. }
  920. if (other.HasOptionalNestedEnum) {
  921. OptionalNestedEnum = other.OptionalNestedEnum;
  922. }
  923. if (other.SingularInt32 != 0) {
  924. SingularInt32 = other.SingularInt32;
  925. }
  926. if (other.SingularInt64 != 0L) {
  927. SingularInt64 = other.SingularInt64;
  928. }
  929. _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
  930. }
  931. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  932. public void MergeFrom(pb::CodedInputStream input) {
  933. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  934. input.ReadRawMessage(this);
  935. #else
  936. uint tag;
  937. while ((tag = input.ReadTag()) != 0) {
  938. switch(tag) {
  939. default:
  940. _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
  941. break;
  942. case 8: {
  943. OptionalInt32 = input.ReadInt32();
  944. break;
  945. }
  946. case 16: {
  947. OptionalInt64 = input.ReadInt64();
  948. break;
  949. }
  950. case 24: {
  951. OptionalUint32 = input.ReadUInt32();
  952. break;
  953. }
  954. case 32: {
  955. OptionalUint64 = input.ReadUInt64();
  956. break;
  957. }
  958. case 40: {
  959. OptionalSint32 = input.ReadSInt32();
  960. break;
  961. }
  962. case 48: {
  963. OptionalSint64 = input.ReadSInt64();
  964. break;
  965. }
  966. case 61: {
  967. OptionalFixed32 = input.ReadFixed32();
  968. break;
  969. }
  970. case 65: {
  971. OptionalFixed64 = input.ReadFixed64();
  972. break;
  973. }
  974. case 77: {
  975. OptionalSfixed32 = input.ReadSFixed32();
  976. break;
  977. }
  978. case 81: {
  979. OptionalSfixed64 = input.ReadSFixed64();
  980. break;
  981. }
  982. case 93: {
  983. OptionalFloat = input.ReadFloat();
  984. break;
  985. }
  986. case 97: {
  987. OptionalDouble = input.ReadDouble();
  988. break;
  989. }
  990. case 104: {
  991. OptionalBool = input.ReadBool();
  992. break;
  993. }
  994. case 114: {
  995. OptionalString = input.ReadString();
  996. break;
  997. }
  998. case 122: {
  999. OptionalBytes = input.ReadBytes();
  1000. break;
  1001. }
  1002. case 130: {
  1003. OptionalCord = input.ReadString();
  1004. break;
  1005. }
  1006. case 146: {
  1007. if (optionalNestedMessage_ == null) {
  1008. OptionalNestedMessage = new global::ProtobufUnittest.TestProto3Optional.Types.NestedMessage();
  1009. }
  1010. input.ReadMessage(OptionalNestedMessage);
  1011. break;
  1012. }
  1013. case 154: {
  1014. if (lazyNestedMessage_ == null) {
  1015. LazyNestedMessage = new global::ProtobufUnittest.TestProto3Optional.Types.NestedMessage();
  1016. }
  1017. input.ReadMessage(LazyNestedMessage);
  1018. break;
  1019. }
  1020. case 168: {
  1021. OptionalNestedEnum = (global::ProtobufUnittest.TestProto3Optional.Types.NestedEnum) input.ReadEnum();
  1022. break;
  1023. }
  1024. case 176: {
  1025. SingularInt32 = input.ReadInt32();
  1026. break;
  1027. }
  1028. case 184: {
  1029. SingularInt64 = input.ReadInt64();
  1030. break;
  1031. }
  1032. }
  1033. }
  1034. #endif
  1035. }
  1036. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1037. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1038. void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
  1039. uint tag;
  1040. while ((tag = input.ReadTag()) != 0) {
  1041. switch(tag) {
  1042. default:
  1043. _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
  1044. break;
  1045. case 8: {
  1046. OptionalInt32 = input.ReadInt32();
  1047. break;
  1048. }
  1049. case 16: {
  1050. OptionalInt64 = input.ReadInt64();
  1051. break;
  1052. }
  1053. case 24: {
  1054. OptionalUint32 = input.ReadUInt32();
  1055. break;
  1056. }
  1057. case 32: {
  1058. OptionalUint64 = input.ReadUInt64();
  1059. break;
  1060. }
  1061. case 40: {
  1062. OptionalSint32 = input.ReadSInt32();
  1063. break;
  1064. }
  1065. case 48: {
  1066. OptionalSint64 = input.ReadSInt64();
  1067. break;
  1068. }
  1069. case 61: {
  1070. OptionalFixed32 = input.ReadFixed32();
  1071. break;
  1072. }
  1073. case 65: {
  1074. OptionalFixed64 = input.ReadFixed64();
  1075. break;
  1076. }
  1077. case 77: {
  1078. OptionalSfixed32 = input.ReadSFixed32();
  1079. break;
  1080. }
  1081. case 81: {
  1082. OptionalSfixed64 = input.ReadSFixed64();
  1083. break;
  1084. }
  1085. case 93: {
  1086. OptionalFloat = input.ReadFloat();
  1087. break;
  1088. }
  1089. case 97: {
  1090. OptionalDouble = input.ReadDouble();
  1091. break;
  1092. }
  1093. case 104: {
  1094. OptionalBool = input.ReadBool();
  1095. break;
  1096. }
  1097. case 114: {
  1098. OptionalString = input.ReadString();
  1099. break;
  1100. }
  1101. case 122: {
  1102. OptionalBytes = input.ReadBytes();
  1103. break;
  1104. }
  1105. case 130: {
  1106. OptionalCord = input.ReadString();
  1107. break;
  1108. }
  1109. case 146: {
  1110. if (optionalNestedMessage_ == null) {
  1111. OptionalNestedMessage = new global::ProtobufUnittest.TestProto3Optional.Types.NestedMessage();
  1112. }
  1113. input.ReadMessage(OptionalNestedMessage);
  1114. break;
  1115. }
  1116. case 154: {
  1117. if (lazyNestedMessage_ == null) {
  1118. LazyNestedMessage = new global::ProtobufUnittest.TestProto3Optional.Types.NestedMessage();
  1119. }
  1120. input.ReadMessage(LazyNestedMessage);
  1121. break;
  1122. }
  1123. case 168: {
  1124. OptionalNestedEnum = (global::ProtobufUnittest.TestProto3Optional.Types.NestedEnum) input.ReadEnum();
  1125. break;
  1126. }
  1127. case 176: {
  1128. SingularInt32 = input.ReadInt32();
  1129. break;
  1130. }
  1131. case 184: {
  1132. SingularInt64 = input.ReadInt64();
  1133. break;
  1134. }
  1135. }
  1136. }
  1137. }
  1138. #endif
  1139. #region Nested types
  1140. /// <summary>Container for nested types declared in the TestProto3Optional message type.</summary>
  1141. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1142. public static partial class Types {
  1143. public enum NestedEnum {
  1144. [pbr::OriginalName("UNSPECIFIED")] Unspecified = 0,
  1145. [pbr::OriginalName("FOO")] Foo = 1,
  1146. [pbr::OriginalName("BAR")] Bar = 2,
  1147. [pbr::OriginalName("BAZ")] Baz = 3,
  1148. /// <summary>
  1149. /// Intentionally negative.
  1150. /// </summary>
  1151. [pbr::OriginalName("NEG")] Neg = -1,
  1152. }
  1153. public sealed partial class NestedMessage : pb::IMessage<NestedMessage>
  1154. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1155. , pb::IBufferMessage
  1156. #endif
  1157. {
  1158. private static readonly pb::MessageParser<NestedMessage> _parser = new pb::MessageParser<NestedMessage>(() => new NestedMessage());
  1159. private pb::UnknownFieldSet _unknownFields;
  1160. private int _hasBits0;
  1161. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1162. public static pb::MessageParser<NestedMessage> Parser { get { return _parser; } }
  1163. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1164. public static pbr::MessageDescriptor Descriptor {
  1165. get { return global::ProtobufUnittest.TestProto3Optional.Descriptor.NestedTypes[0]; }
  1166. }
  1167. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1168. pbr::MessageDescriptor pb::IMessage.Descriptor {
  1169. get { return Descriptor; }
  1170. }
  1171. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1172. public NestedMessage() {
  1173. OnConstruction();
  1174. }
  1175. partial void OnConstruction();
  1176. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1177. public NestedMessage(NestedMessage other) : this() {
  1178. _hasBits0 = other._hasBits0;
  1179. bb_ = other.bb_;
  1180. _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
  1181. }
  1182. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1183. public NestedMessage Clone() {
  1184. return new NestedMessage(this);
  1185. }
  1186. /// <summary>Field number for the "bb" field.</summary>
  1187. public const int BbFieldNumber = 1;
  1188. private int bb_;
  1189. /// <summary>
  1190. /// The field name "b" fails to compile in proto1 because it conflicts with
  1191. /// a local variable named "b" in one of the generated methods. Doh.
  1192. /// This file needs to compile in proto1 to test backwards-compatibility.
  1193. /// </summary>
  1194. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1195. public int Bb {
  1196. get { if ((_hasBits0 & 1) != 0) { return bb_; } else { return 0; } }
  1197. set {
  1198. _hasBits0 |= 1;
  1199. bb_ = value;
  1200. }
  1201. }
  1202. /// <summary>Gets whether the "bb" field is set</summary>
  1203. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1204. public bool HasBb {
  1205. get { return (_hasBits0 & 1) != 0; }
  1206. }
  1207. /// <summary>Clears the value of the "bb" field</summary>
  1208. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1209. public void ClearBb() {
  1210. _hasBits0 &= ~1;
  1211. }
  1212. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1213. public override bool Equals(object other) {
  1214. return Equals(other as NestedMessage);
  1215. }
  1216. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1217. public bool Equals(NestedMessage other) {
  1218. if (ReferenceEquals(other, null)) {
  1219. return false;
  1220. }
  1221. if (ReferenceEquals(other, this)) {
  1222. return true;
  1223. }
  1224. if (Bb != other.Bb) return false;
  1225. return Equals(_unknownFields, other._unknownFields);
  1226. }
  1227. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1228. public override int GetHashCode() {
  1229. int hash = 1;
  1230. if (HasBb) hash ^= Bb.GetHashCode();
  1231. if (_unknownFields != null) {
  1232. hash ^= _unknownFields.GetHashCode();
  1233. }
  1234. return hash;
  1235. }
  1236. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1237. public override string ToString() {
  1238. return pb::JsonFormatter.ToDiagnosticString(this);
  1239. }
  1240. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1241. public void WriteTo(pb::CodedOutputStream output) {
  1242. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1243. output.WriteRawMessage(this);
  1244. #else
  1245. if (HasBb) {
  1246. output.WriteRawTag(8);
  1247. output.WriteInt32(Bb);
  1248. }
  1249. if (_unknownFields != null) {
  1250. _unknownFields.WriteTo(output);
  1251. }
  1252. #endif
  1253. }
  1254. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1255. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1256. void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
  1257. if (HasBb) {
  1258. output.WriteRawTag(8);
  1259. output.WriteInt32(Bb);
  1260. }
  1261. if (_unknownFields != null) {
  1262. _unknownFields.WriteTo(ref output);
  1263. }
  1264. }
  1265. #endif
  1266. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1267. public int CalculateSize() {
  1268. int size = 0;
  1269. if (HasBb) {
  1270. size += 1 + pb::CodedOutputStream.ComputeInt32Size(Bb);
  1271. }
  1272. if (_unknownFields != null) {
  1273. size += _unknownFields.CalculateSize();
  1274. }
  1275. return size;
  1276. }
  1277. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1278. public void MergeFrom(NestedMessage other) {
  1279. if (other == null) {
  1280. return;
  1281. }
  1282. if (other.HasBb) {
  1283. Bb = other.Bb;
  1284. }
  1285. _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
  1286. }
  1287. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1288. public void MergeFrom(pb::CodedInputStream input) {
  1289. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1290. input.ReadRawMessage(this);
  1291. #else
  1292. uint tag;
  1293. while ((tag = input.ReadTag()) != 0) {
  1294. switch(tag) {
  1295. default:
  1296. _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
  1297. break;
  1298. case 8: {
  1299. Bb = input.ReadInt32();
  1300. break;
  1301. }
  1302. }
  1303. }
  1304. #endif
  1305. }
  1306. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1307. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1308. void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
  1309. uint tag;
  1310. while ((tag = input.ReadTag()) != 0) {
  1311. switch(tag) {
  1312. default:
  1313. _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
  1314. break;
  1315. case 8: {
  1316. Bb = input.ReadInt32();
  1317. break;
  1318. }
  1319. }
  1320. }
  1321. }
  1322. #endif
  1323. }
  1324. }
  1325. #endregion
  1326. }
  1327. public sealed partial class TestProto3OptionalMessage : pb::IMessage<TestProto3OptionalMessage>
  1328. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1329. , pb::IBufferMessage
  1330. #endif
  1331. {
  1332. private static readonly pb::MessageParser<TestProto3OptionalMessage> _parser = new pb::MessageParser<TestProto3OptionalMessage>(() => new TestProto3OptionalMessage());
  1333. private pb::UnknownFieldSet _unknownFields;
  1334. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1335. public static pb::MessageParser<TestProto3OptionalMessage> Parser { get { return _parser; } }
  1336. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1337. public static pbr::MessageDescriptor Descriptor {
  1338. get { return global::ProtobufUnittest.UnittestProto3OptionalReflection.Descriptor.MessageTypes[1]; }
  1339. }
  1340. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1341. pbr::MessageDescriptor pb::IMessage.Descriptor {
  1342. get { return Descriptor; }
  1343. }
  1344. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1345. public TestProto3OptionalMessage() {
  1346. OnConstruction();
  1347. }
  1348. partial void OnConstruction();
  1349. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1350. public TestProto3OptionalMessage(TestProto3OptionalMessage other) : this() {
  1351. nestedMessage_ = other.nestedMessage_ != null ? other.nestedMessage_.Clone() : null;
  1352. optionalNestedMessage_ = other.optionalNestedMessage_ != null ? other.optionalNestedMessage_.Clone() : null;
  1353. _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
  1354. }
  1355. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1356. public TestProto3OptionalMessage Clone() {
  1357. return new TestProto3OptionalMessage(this);
  1358. }
  1359. /// <summary>Field number for the "nested_message" field.</summary>
  1360. public const int NestedMessageFieldNumber = 1;
  1361. private global::ProtobufUnittest.TestProto3OptionalMessage.Types.NestedMessage nestedMessage_;
  1362. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1363. public global::ProtobufUnittest.TestProto3OptionalMessage.Types.NestedMessage NestedMessage {
  1364. get { return nestedMessage_; }
  1365. set {
  1366. nestedMessage_ = value;
  1367. }
  1368. }
  1369. /// <summary>Field number for the "optional_nested_message" field.</summary>
  1370. public const int OptionalNestedMessageFieldNumber = 2;
  1371. private global::ProtobufUnittest.TestProto3OptionalMessage.Types.NestedMessage optionalNestedMessage_;
  1372. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1373. public global::ProtobufUnittest.TestProto3OptionalMessage.Types.NestedMessage OptionalNestedMessage {
  1374. get { return optionalNestedMessage_; }
  1375. set {
  1376. optionalNestedMessage_ = value;
  1377. }
  1378. }
  1379. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1380. public override bool Equals(object other) {
  1381. return Equals(other as TestProto3OptionalMessage);
  1382. }
  1383. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1384. public bool Equals(TestProto3OptionalMessage other) {
  1385. if (ReferenceEquals(other, null)) {
  1386. return false;
  1387. }
  1388. if (ReferenceEquals(other, this)) {
  1389. return true;
  1390. }
  1391. if (!object.Equals(NestedMessage, other.NestedMessage)) return false;
  1392. if (!object.Equals(OptionalNestedMessage, other.OptionalNestedMessage)) return false;
  1393. return Equals(_unknownFields, other._unknownFields);
  1394. }
  1395. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1396. public override int GetHashCode() {
  1397. int hash = 1;
  1398. if (nestedMessage_ != null) hash ^= NestedMessage.GetHashCode();
  1399. if (optionalNestedMessage_ != null) hash ^= OptionalNestedMessage.GetHashCode();
  1400. if (_unknownFields != null) {
  1401. hash ^= _unknownFields.GetHashCode();
  1402. }
  1403. return hash;
  1404. }
  1405. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1406. public override string ToString() {
  1407. return pb::JsonFormatter.ToDiagnosticString(this);
  1408. }
  1409. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1410. public void WriteTo(pb::CodedOutputStream output) {
  1411. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1412. output.WriteRawMessage(this);
  1413. #else
  1414. if (nestedMessage_ != null) {
  1415. output.WriteRawTag(10);
  1416. output.WriteMessage(NestedMessage);
  1417. }
  1418. if (optionalNestedMessage_ != null) {
  1419. output.WriteRawTag(18);
  1420. output.WriteMessage(OptionalNestedMessage);
  1421. }
  1422. if (_unknownFields != null) {
  1423. _unknownFields.WriteTo(output);
  1424. }
  1425. #endif
  1426. }
  1427. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1428. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1429. void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
  1430. if (nestedMessage_ != null) {
  1431. output.WriteRawTag(10);
  1432. output.WriteMessage(NestedMessage);
  1433. }
  1434. if (optionalNestedMessage_ != null) {
  1435. output.WriteRawTag(18);
  1436. output.WriteMessage(OptionalNestedMessage);
  1437. }
  1438. if (_unknownFields != null) {
  1439. _unknownFields.WriteTo(ref output);
  1440. }
  1441. }
  1442. #endif
  1443. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1444. public int CalculateSize() {
  1445. int size = 0;
  1446. if (nestedMessage_ != null) {
  1447. size += 1 + pb::CodedOutputStream.ComputeMessageSize(NestedMessage);
  1448. }
  1449. if (optionalNestedMessage_ != null) {
  1450. size += 1 + pb::CodedOutputStream.ComputeMessageSize(OptionalNestedMessage);
  1451. }
  1452. if (_unknownFields != null) {
  1453. size += _unknownFields.CalculateSize();
  1454. }
  1455. return size;
  1456. }
  1457. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1458. public void MergeFrom(TestProto3OptionalMessage other) {
  1459. if (other == null) {
  1460. return;
  1461. }
  1462. if (other.nestedMessage_ != null) {
  1463. if (nestedMessage_ == null) {
  1464. NestedMessage = new global::ProtobufUnittest.TestProto3OptionalMessage.Types.NestedMessage();
  1465. }
  1466. NestedMessage.MergeFrom(other.NestedMessage);
  1467. }
  1468. if (other.optionalNestedMessage_ != null) {
  1469. if (optionalNestedMessage_ == null) {
  1470. OptionalNestedMessage = new global::ProtobufUnittest.TestProto3OptionalMessage.Types.NestedMessage();
  1471. }
  1472. OptionalNestedMessage.MergeFrom(other.OptionalNestedMessage);
  1473. }
  1474. _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
  1475. }
  1476. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1477. public void MergeFrom(pb::CodedInputStream input) {
  1478. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1479. input.ReadRawMessage(this);
  1480. #else
  1481. uint tag;
  1482. while ((tag = input.ReadTag()) != 0) {
  1483. switch(tag) {
  1484. default:
  1485. _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
  1486. break;
  1487. case 10: {
  1488. if (nestedMessage_ == null) {
  1489. NestedMessage = new global::ProtobufUnittest.TestProto3OptionalMessage.Types.NestedMessage();
  1490. }
  1491. input.ReadMessage(NestedMessage);
  1492. break;
  1493. }
  1494. case 18: {
  1495. if (optionalNestedMessage_ == null) {
  1496. OptionalNestedMessage = new global::ProtobufUnittest.TestProto3OptionalMessage.Types.NestedMessage();
  1497. }
  1498. input.ReadMessage(OptionalNestedMessage);
  1499. break;
  1500. }
  1501. }
  1502. }
  1503. #endif
  1504. }
  1505. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1506. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1507. void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
  1508. uint tag;
  1509. while ((tag = input.ReadTag()) != 0) {
  1510. switch(tag) {
  1511. default:
  1512. _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
  1513. break;
  1514. case 10: {
  1515. if (nestedMessage_ == null) {
  1516. NestedMessage = new global::ProtobufUnittest.TestProto3OptionalMessage.Types.NestedMessage();
  1517. }
  1518. input.ReadMessage(NestedMessage);
  1519. break;
  1520. }
  1521. case 18: {
  1522. if (optionalNestedMessage_ == null) {
  1523. OptionalNestedMessage = new global::ProtobufUnittest.TestProto3OptionalMessage.Types.NestedMessage();
  1524. }
  1525. input.ReadMessage(OptionalNestedMessage);
  1526. break;
  1527. }
  1528. }
  1529. }
  1530. }
  1531. #endif
  1532. #region Nested types
  1533. /// <summary>Container for nested types declared in the TestProto3OptionalMessage message type.</summary>
  1534. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1535. public static partial class Types {
  1536. public sealed partial class NestedMessage : pb::IMessage<NestedMessage>
  1537. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1538. , pb::IBufferMessage
  1539. #endif
  1540. {
  1541. private static readonly pb::MessageParser<NestedMessage> _parser = new pb::MessageParser<NestedMessage>(() => new NestedMessage());
  1542. private pb::UnknownFieldSet _unknownFields;
  1543. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1544. public static pb::MessageParser<NestedMessage> Parser { get { return _parser; } }
  1545. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1546. public static pbr::MessageDescriptor Descriptor {
  1547. get { return global::ProtobufUnittest.TestProto3OptionalMessage.Descriptor.NestedTypes[0]; }
  1548. }
  1549. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1550. pbr::MessageDescriptor pb::IMessage.Descriptor {
  1551. get { return Descriptor; }
  1552. }
  1553. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1554. public NestedMessage() {
  1555. OnConstruction();
  1556. }
  1557. partial void OnConstruction();
  1558. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1559. public NestedMessage(NestedMessage other) : this() {
  1560. s_ = other.s_;
  1561. _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
  1562. }
  1563. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1564. public NestedMessage Clone() {
  1565. return new NestedMessage(this);
  1566. }
  1567. /// <summary>Field number for the "s" field.</summary>
  1568. public const int SFieldNumber = 1;
  1569. private string s_ = "";
  1570. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1571. public string S {
  1572. get { return s_; }
  1573. set {
  1574. s_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
  1575. }
  1576. }
  1577. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1578. public override bool Equals(object other) {
  1579. return Equals(other as NestedMessage);
  1580. }
  1581. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1582. public bool Equals(NestedMessage other) {
  1583. if (ReferenceEquals(other, null)) {
  1584. return false;
  1585. }
  1586. if (ReferenceEquals(other, this)) {
  1587. return true;
  1588. }
  1589. if (S != other.S) return false;
  1590. return Equals(_unknownFields, other._unknownFields);
  1591. }
  1592. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1593. public override int GetHashCode() {
  1594. int hash = 1;
  1595. if (S.Length != 0) hash ^= S.GetHashCode();
  1596. if (_unknownFields != null) {
  1597. hash ^= _unknownFields.GetHashCode();
  1598. }
  1599. return hash;
  1600. }
  1601. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1602. public override string ToString() {
  1603. return pb::JsonFormatter.ToDiagnosticString(this);
  1604. }
  1605. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1606. public void WriteTo(pb::CodedOutputStream output) {
  1607. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1608. output.WriteRawMessage(this);
  1609. #else
  1610. if (S.Length != 0) {
  1611. output.WriteRawTag(10);
  1612. output.WriteString(S);
  1613. }
  1614. if (_unknownFields != null) {
  1615. _unknownFields.WriteTo(output);
  1616. }
  1617. #endif
  1618. }
  1619. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1620. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1621. void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
  1622. if (S.Length != 0) {
  1623. output.WriteRawTag(10);
  1624. output.WriteString(S);
  1625. }
  1626. if (_unknownFields != null) {
  1627. _unknownFields.WriteTo(ref output);
  1628. }
  1629. }
  1630. #endif
  1631. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1632. public int CalculateSize() {
  1633. int size = 0;
  1634. if (S.Length != 0) {
  1635. size += 1 + pb::CodedOutputStream.ComputeStringSize(S);
  1636. }
  1637. if (_unknownFields != null) {
  1638. size += _unknownFields.CalculateSize();
  1639. }
  1640. return size;
  1641. }
  1642. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1643. public void MergeFrom(NestedMessage other) {
  1644. if (other == null) {
  1645. return;
  1646. }
  1647. if (other.S.Length != 0) {
  1648. S = other.S;
  1649. }
  1650. _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
  1651. }
  1652. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1653. public void MergeFrom(pb::CodedInputStream input) {
  1654. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1655. input.ReadRawMessage(this);
  1656. #else
  1657. uint tag;
  1658. while ((tag = input.ReadTag()) != 0) {
  1659. switch(tag) {
  1660. default:
  1661. _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
  1662. break;
  1663. case 10: {
  1664. S = input.ReadString();
  1665. break;
  1666. }
  1667. }
  1668. }
  1669. #endif
  1670. }
  1671. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1672. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1673. void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
  1674. uint tag;
  1675. while ((tag = input.ReadTag()) != 0) {
  1676. switch(tag) {
  1677. default:
  1678. _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
  1679. break;
  1680. case 10: {
  1681. S = input.ReadString();
  1682. break;
  1683. }
  1684. }
  1685. }
  1686. }
  1687. #endif
  1688. }
  1689. }
  1690. #endregion
  1691. }
  1692. public sealed partial class Proto3OptionalExtensions : pb::IMessage<Proto3OptionalExtensions>
  1693. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1694. , pb::IBufferMessage
  1695. #endif
  1696. {
  1697. private static readonly pb::MessageParser<Proto3OptionalExtensions> _parser = new pb::MessageParser<Proto3OptionalExtensions>(() => new Proto3OptionalExtensions());
  1698. private pb::UnknownFieldSet _unknownFields;
  1699. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1700. public static pb::MessageParser<Proto3OptionalExtensions> Parser { get { return _parser; } }
  1701. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1702. public static pbr::MessageDescriptor Descriptor {
  1703. get { return global::ProtobufUnittest.UnittestProto3OptionalReflection.Descriptor.MessageTypes[2]; }
  1704. }
  1705. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1706. pbr::MessageDescriptor pb::IMessage.Descriptor {
  1707. get { return Descriptor; }
  1708. }
  1709. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1710. public Proto3OptionalExtensions() {
  1711. OnConstruction();
  1712. }
  1713. partial void OnConstruction();
  1714. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1715. public Proto3OptionalExtensions(Proto3OptionalExtensions other) : this() {
  1716. _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
  1717. }
  1718. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1719. public Proto3OptionalExtensions Clone() {
  1720. return new Proto3OptionalExtensions(this);
  1721. }
  1722. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1723. public override bool Equals(object other) {
  1724. return Equals(other as Proto3OptionalExtensions);
  1725. }
  1726. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1727. public bool Equals(Proto3OptionalExtensions other) {
  1728. if (ReferenceEquals(other, null)) {
  1729. return false;
  1730. }
  1731. if (ReferenceEquals(other, this)) {
  1732. return true;
  1733. }
  1734. return Equals(_unknownFields, other._unknownFields);
  1735. }
  1736. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1737. public override int GetHashCode() {
  1738. int hash = 1;
  1739. if (_unknownFields != null) {
  1740. hash ^= _unknownFields.GetHashCode();
  1741. }
  1742. return hash;
  1743. }
  1744. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1745. public override string ToString() {
  1746. return pb::JsonFormatter.ToDiagnosticString(this);
  1747. }
  1748. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1749. public void WriteTo(pb::CodedOutputStream output) {
  1750. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1751. output.WriteRawMessage(this);
  1752. #else
  1753. if (_unknownFields != null) {
  1754. _unknownFields.WriteTo(output);
  1755. }
  1756. #endif
  1757. }
  1758. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1759. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1760. void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
  1761. if (_unknownFields != null) {
  1762. _unknownFields.WriteTo(ref output);
  1763. }
  1764. }
  1765. #endif
  1766. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1767. public int CalculateSize() {
  1768. int size = 0;
  1769. if (_unknownFields != null) {
  1770. size += _unknownFields.CalculateSize();
  1771. }
  1772. return size;
  1773. }
  1774. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1775. public void MergeFrom(Proto3OptionalExtensions other) {
  1776. if (other == null) {
  1777. return;
  1778. }
  1779. _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
  1780. }
  1781. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1782. public void MergeFrom(pb::CodedInputStream input) {
  1783. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1784. input.ReadRawMessage(this);
  1785. #else
  1786. uint tag;
  1787. while ((tag = input.ReadTag()) != 0) {
  1788. switch(tag) {
  1789. default:
  1790. _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
  1791. break;
  1792. }
  1793. }
  1794. #endif
  1795. }
  1796. #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
  1797. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1798. void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
  1799. uint tag;
  1800. while ((tag = input.ReadTag()) != 0) {
  1801. switch(tag) {
  1802. default:
  1803. _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
  1804. break;
  1805. }
  1806. }
  1807. }
  1808. #endif
  1809. #region Extensions
  1810. /// <summary>Container for extensions for other messages declared in the Proto3OptionalExtensions message type.</summary>
  1811. [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  1812. public static partial class Extensions {
  1813. public static readonly pb::Extension<global::Google.Protobuf.Reflection.MessageOptions, int> ExtNoOptional =
  1814. new pb::Extension<global::Google.Protobuf.Reflection.MessageOptions, int>(355886728, pb::FieldCodec.ForInt32(2847093824, 0));
  1815. public static readonly pb::Extension<global::Google.Protobuf.Reflection.MessageOptions, int> ExtWithOptional =
  1816. new pb::Extension<global::Google.Protobuf.Reflection.MessageOptions, int>(355886729, pb::FieldCodec.ForInt32(2847093832, 0));
  1817. }
  1818. #endregion
  1819. }
  1820. #endregion
  1821. }
  1822. #endregion Designer generated code