unittest_objc.proto 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884
  1. // Protocol Buffers - Google's data interchange format
  2. // Copyright 2011 Google Inc. All rights reserved.
  3. //
  4. // Redistribution and use in source and binary forms, with or without
  5. // modification, are permitted provided that the following conditions are
  6. // met:
  7. //
  8. // * Redistributions of source code must retain the above copyright
  9. // notice, this list of conditions and the following disclaimer.
  10. // * Redistributions in binary form must reproduce the above
  11. // copyright notice, this list of conditions and the following disclaimer
  12. // in the documentation and/or other materials provided with the
  13. // distribution.
  14. // * Neither the name of Google Inc. nor the names of its
  15. // contributors may be used to endorse or promote products derived from
  16. // this software without specific prior written permission.
  17. //
  18. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  22. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  24. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  26. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  28. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. syntax = "proto2";
  30. import "google/protobuf/any.proto";
  31. import "google/protobuf/unittest.proto";
  32. package protobuf_unittest;
  33. // Used to check that Headerdocs and appledoc work correctly. If these comments
  34. // are not handled correctly, Xcode will fail to build the tests.
  35. message TestGeneratedComments {
  36. // This is a string that could contain stuff like
  37. // mime types as image/* or */plain. Maybe twitter usernames
  38. // like @protobuf, @google or @something.
  39. optional string string_field = 1;
  40. }
  41. // Using the messages in unittest.proto, setup for recursive cases for testing
  42. // extensions at various depths.
  43. extend TestAllExtensions {
  44. optional TestAllExtensions recursive_extension = 86;
  45. }
  46. // Recursive message to for testing autocreators at different depths.
  47. message TestRecursiveMessageWithRepeatedField {
  48. optional TestRecursiveMessageWithRepeatedField a = 1;
  49. repeated int32 i = 2;
  50. repeated string str = 3;
  51. map<int32, int32> i_to_i = 4;
  52. map<string, string> str_to_str = 5;
  53. }
  54. // Message with a few types of maps to cover the different custom flows
  55. // in the runtime.
  56. message TestMessageOfMaps {
  57. map<string, string> str_to_str = 1;
  58. map<string, int32> str_to_int = 2;
  59. map<int32, string> int_to_str = 3;
  60. map<int32, int32> int_to_int = 4;
  61. map<string, bool> str_to_bool = 5;
  62. map<bool, string> bool_to_str = 6;
  63. map<bool, bool> bool_to_bool = 7;
  64. map<int32, bool> int_to_bool = 8;
  65. map<bool, int32> bool_to_int = 9;
  66. map<string, TestAllTypes> str_to_msg = 10;
  67. map<int32, TestAllTypes> int_to_msg = 11;
  68. map<bool, TestAllTypes> bool_to_msg = 12;
  69. }
  70. // Recursive message and extension to for testing autocreators at different
  71. // depths.
  72. message TestRecursiveExtension {
  73. optional TestRecursiveExtension recursive_sub_message = 1;
  74. repeated int32 repeated_value = 2;
  75. extensions 1000 to max;
  76. }
  77. extend TestRecursiveExtension {
  78. optional TestRecursiveExtension recursive_message_extension = 1000;
  79. }
  80. message self {
  81. message super {
  82. optional int32 description = 1;
  83. }
  84. enum autorelease {
  85. retain = 1;
  86. release = 2;
  87. retainCount = 3;
  88. }
  89. // Singular
  90. // Objective C Keywords
  91. optional bool id = 1;
  92. optional bool _cmd = 2;
  93. // super is used as submessage above
  94. optional bool in = 4;
  95. optional bool out = 5;
  96. optional bool inout = 6;
  97. optional bool bycopy = 7;
  98. optional bool byref = 8;
  99. optional bool oneway = 9;
  100. optional bool self = 10;
  101. optional bool instancetype = 11;
  102. optional bool nullable = 12;
  103. optional bool nonnull = 13;
  104. optional bool nil = 14;
  105. // Nil and nil can't be in the same message
  106. optional bool YES = 16;
  107. optional bool NO = 17;
  108. optional bool weak = 18;
  109. // Some C/C++ Keywords
  110. optional bool case = 30;
  111. optional bool if = 31;
  112. optional bool and_eq = 32;
  113. optional bool public = 33;
  114. optional bool private = 34;
  115. optional bool typename = 35;
  116. optional bool static_cast = 36;
  117. optional bool typeof = 37;
  118. optional bool restrict = 38;
  119. optional bool NULL = 39;
  120. // Some NSObject Methods
  121. optional bool dealloc = 110;
  122. optional bool isProxy = 111;
  123. optional bool copy = 112;
  124. optional bool description = 113;
  125. optional bool zone = 114;
  126. optional bool className = 115;
  127. optional bool __retain_OA = 116;
  128. optional bool CAMLType = 117;
  129. optional bool isNSDictionary__ = 118;
  130. optional bool accessibilityLabel = 119;
  131. // Some Objc "keywords" that we shouldn't
  132. // have to worry about because they
  133. // can only appear in specialized areas.
  134. optional bool assign = 200;
  135. optional bool getter = 201;
  136. optional bool setter = 202;
  137. optional bool atomic = 203;
  138. optional bool nonatomic = 204;
  139. optional bool strong = 205;
  140. optional bool null_resettable = 206;
  141. optional bool readonly = 207;
  142. // Some GPBMessage methods
  143. optional bool clear = 300;
  144. optional bool data = 301;
  145. optional bool descriptor = 302;
  146. optional bool delimitedData = 303;
  147. // Some MacTypes
  148. optional bool Fixed = 400;
  149. optional bool Point = 401;
  150. optional bool FixedPoint = 402;
  151. optional bool Style = 403;
  152. // C/C++ reserved identifiers
  153. optional bool _Generic = 500;
  154. optional bool __block = 501;
  155. // Try a keyword as a type
  156. optional autorelease SubEnum = 1000;
  157. optional group New = 2000 {
  158. optional string copy = 1;
  159. }
  160. optional group MutableCopy = 2001 {
  161. optional int32 extensionRegistry = 1;
  162. }
  163. extensions 3000 to 3999;
  164. }
  165. enum retain {
  166. count = 4;
  167. initialized = 5;
  168. serializedSize = 6;
  169. }
  170. message ObjCPropertyNaming {
  171. // Test that the properties properly get things all caps.
  172. optional string url = 1;
  173. optional string thumbnail_url = 2;
  174. optional string url_foo = 3;
  175. optional string some_url_blah = 4;
  176. optional string http = 5;
  177. optional string https = 6;
  178. // This one doesn't.
  179. repeated string urls = 7;
  180. }
  181. // EnumValueShortName: The short names shouldn't get suffixes/prefixes.
  182. enum Foo {
  183. SERIALIZED_SIZE = 1;
  184. SIZE = 2;
  185. OTHER = 3;
  186. }
  187. // EnumValueShortName: The enum name gets a prefix.
  188. enum Category {
  189. RED = 1;
  190. BLUE = 2;
  191. }
  192. // EnumValueShortName: Twist case, full name gets PB, but the short names
  193. // should still end up correct.
  194. enum Time {
  195. BASE = 1;
  196. RECORD = 2;
  197. SOMETHING_ELSE = 3;
  198. }
  199. extend self {
  200. repeated int32 debugDescription = 3000 [packed = true];
  201. repeated int64 finalize = 3001 [packed = true];
  202. repeated uint32 hash = 3002 [packed = true];
  203. repeated uint64 classForCoder = 3003 [packed = true];
  204. repeated sint32 byref = 3004 [packed = true];
  205. }
  206. // Test handing of fields that start with init* since Xcode 5's ARC support
  207. // doesn't like messages that look like initializers but aren't.
  208. message ObjCInitFoo {
  209. optional string init_val = 11;
  210. optional int32 init_size = 12;
  211. optional self init_self = 13;
  212. repeated string init_vals = 21;
  213. repeated int32 init_sizes = 22;
  214. repeated self init_selfs = 23;
  215. }
  216. // Test handling of fields that start with retained names.
  217. message ObjCRetainedFoo {
  218. optional string new_val_lower_complex = 11;
  219. optional string new_Val_upper_complex = 12;
  220. optional string newvalue_lower_no_underscore_complex = 13;
  221. optional string newValue_upper_no_underscore_complex = 14;
  222. optional int32 new_val_lower_primitive = 15;
  223. optional int32 new_Val_upper_primitive = 16;
  224. optional int32 newvalue_lower_no_underscore_primitive = 17;
  225. optional int32 newValue_upper_no_underscore_primitive = 18;
  226. optional self new_val_lower_message = 19;
  227. optional self new_Val_upper_message = 20;
  228. optional self newvalue_lower_no_underscore_message = 21;
  229. optional self newValue_upper_no_underscore_message = 22;
  230. optional Foo new_val_lower_enum = 23;
  231. optional Foo new_Val_upper_enum = 24;
  232. optional Foo newvalue_lower_no_underscore_enum = 25;
  233. optional Foo newValue_upper_no_underscore_enum = 26;
  234. repeated string new_val_lower_complex_repeated = 111;
  235. repeated string new_Val_upper_complex_repeated = 112;
  236. repeated string newvalue_lower_no_underscore_complex_repeated = 113;
  237. repeated string newValue_upper_no_underscore_complex_repeated = 114;
  238. repeated int32 new_val_lower_primitive_repeated = 115;
  239. repeated int32 new_Val_upper_primitive_repeated = 116;
  240. repeated int32 newvalue_lower_no_underscore_primitive_repeated = 117;
  241. repeated int32 newValue_upper_no_underscore_primitive_repeated = 118;
  242. repeated self new_val_lower_message_repeated = 119;
  243. repeated self new_Val_upper_message_repeated = 120;
  244. repeated self newvalue_lower_no_underscore_message_repeated = 121;
  245. repeated self newValue_upper_no_underscore_message_repeated = 122;
  246. repeated Foo new_val_lower_enum_repeated = 123;
  247. repeated Foo new_Val_upper_enum_repeated = 124;
  248. repeated Foo newvalue_lower_no_underscore_enum_repeated = 125;
  249. repeated Foo newValue_upper_no_underscore_enum_repeated = 126;
  250. optional string alloc_val_lower_complex = 211;
  251. optional string alloc_Val_upper_complex = 212;
  252. optional string allocvalue_lower_no_underscore_complex = 213;
  253. optional string allocValue_upper_no_underscore_complex = 214;
  254. optional int32 alloc_val_lower_primitive = 215;
  255. optional int32 alloc_Val_upper_primitive = 216;
  256. optional int32 allocvalue_lower_no_underscore_primitive = 217;
  257. optional int32 allocValue_upper_no_underscore_primitive = 218;
  258. optional self alloc_val_lower_message = 219;
  259. optional self alloc_Val_upper_message = 220;
  260. optional self allocvalue_lower_no_underscore_message = 221;
  261. optional self allocValue_upper_no_underscore_message = 222;
  262. optional Foo alloc_val_lower_enum = 223;
  263. optional Foo alloc_Val_upper_enum = 224;
  264. optional Foo allocvalue_lower_no_underscore_enum = 225;
  265. optional Foo allocValue_upper_no_underscore_enum = 226;
  266. repeated string alloc_val_lower_complex_repeated = 311;
  267. repeated string alloc_Val_upper_complex_repeated = 312;
  268. repeated string allocvalue_lower_no_underscore_complex_repeated = 313;
  269. repeated string allocValue_upper_no_underscore_complex_repeated = 314;
  270. repeated int32 alloc_val_lower_primitive_repeated = 315;
  271. repeated int32 alloc_Val_upper_primitive_repeated = 316;
  272. repeated int32 allocvalue_lower_no_underscore_primitive_repeated = 317;
  273. repeated int32 allocValue_upper_no_underscore_primitive_repeated = 318;
  274. repeated self alloc_val_lower_message_repeated = 319;
  275. repeated self alloc_Val_upper_message_repeated = 320;
  276. repeated self allocvalue_lower_no_underscore_message_repeated = 321;
  277. repeated self allocValue_upper_no_underscore_message_repeated = 322;
  278. repeated Foo alloc_val_lower_enum_repeated = 323;
  279. repeated Foo alloc_Val_upper_enum_repeated = 324;
  280. repeated Foo allocvalue_lower_no_underscore_enum_repeated = 325;
  281. repeated Foo allocValue_upper_no_underscore_enum_repeated = 326;
  282. optional string copy_val_lower_complex = 411;
  283. optional string copy_Val_upper_complex = 412;
  284. optional string copyvalue_lower_no_underscore_complex = 413;
  285. optional string copyValue_upper_no_underscore_complex = 414;
  286. optional int32 copy_val_lower_primitive = 415;
  287. optional int32 copy_Val_upper_primitive = 416;
  288. optional int32 copyvalue_lower_no_underscore_primitive = 417;
  289. optional int32 copyValue_upper_no_underscore_primitive = 418;
  290. optional self copy_val_lower_message = 419;
  291. optional self copy_Val_upper_message = 420;
  292. optional self copyvalue_lower_no_underscore_message = 421;
  293. optional self copyValue_upper_no_underscore_message = 422;
  294. optional Foo copy_val_lower_enum = 423;
  295. optional Foo copy_Val_upper_enum = 424;
  296. optional Foo copyvalue_lower_no_underscore_enum = 425;
  297. optional Foo copyValue_upper_no_underscore_enum = 426;
  298. repeated string copy_val_lower_complex_repeated = 511;
  299. repeated string copy_Val_upper_complex_repeated = 512;
  300. repeated string copyvalue_lower_no_underscore_complex_repeated = 513;
  301. repeated string copyValue_upper_no_underscore_complex_repeated = 514;
  302. repeated int32 copy_val_lower_primitive_repeated = 515;
  303. repeated int32 copy_Val_upper_primitive_repeated = 516;
  304. repeated int32 copyvalue_lower_no_underscore_primitive_repeated = 517;
  305. repeated int32 copyValue_upper_no_underscore_primitive_repeated = 518;
  306. repeated self copy_val_lower_message_repeated = 519;
  307. repeated self copy_Val_upper_message_repeated = 520;
  308. repeated self copyvalue_lower_no_underscore_message_repeated = 521;
  309. repeated self copyValue_upper_no_underscore_message_repeated = 522;
  310. repeated Foo copy_val_lower_enum_repeated = 523;
  311. repeated Foo copy_Val_upper_enum_repeated = 524;
  312. repeated Foo copyvalue_lower_no_underscore_enum_repeated = 525;
  313. repeated Foo copyValue_upper_no_underscore_enum_repeated = 526;
  314. optional string mutableCopy_val_lower_complex = 611;
  315. optional string mutableCopy_Val_upper_complex = 612;
  316. optional string mutableCopyvalue_lower_no_underscore_complex = 613;
  317. optional string mutableCopyValue_upper_no_underscore_complex = 614;
  318. optional int32 mutableCopy_val_lower_primitive = 615;
  319. optional int32 mutableCopy_Val_upper_primitive = 616;
  320. optional int32 mutableCopyvalue_lower_no_underscore_primitive = 617;
  321. optional int32 mutableCopyValue_upper_no_underscore_primitive = 618;
  322. optional self mutableCopy_val_lower_message = 619;
  323. optional self mutableCopy_Val_upper_message = 620;
  324. optional self mutableCopyvalue_lower_no_underscore_message = 621;
  325. optional self mutableCopyValue_upper_no_underscore_message = 622;
  326. optional Foo mutableCopy_val_lower_enum = 623;
  327. optional Foo mutableCopy_Val_upper_enum = 624;
  328. optional Foo mutableCopyvalue_lower_no_underscore_enum = 625;
  329. optional Foo mutableCopyValue_upper_no_underscore_enum = 626;
  330. repeated string mutableCopy_val_lower_complex_repeated = 711;
  331. repeated string mutableCopy_Val_upper_complex_repeated = 712;
  332. repeated string mutableCopyvalue_lower_no_underscore_complex_repeated = 713;
  333. repeated string mutableCopyValue_upper_no_underscore_complex_repeated = 714;
  334. repeated int32 mutableCopy_val_lower_primitive_repeated = 715;
  335. repeated int32 mutableCopy_Val_upper_primitive_repeated = 716;
  336. repeated int32 mutableCopyvalue_lower_no_underscore_primitive_repeated = 717;
  337. repeated int32 mutableCopyValue_upper_no_underscore_primitive_repeated = 718;
  338. repeated self mutableCopy_val_lower_message_repeated = 719;
  339. repeated self mutableCopy_Val_upper_message_repeated = 720;
  340. repeated self mutableCopyvalue_lower_no_underscore_message_repeated = 721;
  341. repeated self mutableCopyValue_upper_no_underscore_message_repeated = 722;
  342. repeated Foo mutableCopy_val_lower_enum_repeated = 723;
  343. repeated Foo mutableCopy_Val_upper_enum_repeated = 724;
  344. repeated Foo mutableCopyvalue_lower_no_underscore_enum_repeated = 725;
  345. repeated Foo mutableCopyValue_upper_no_underscore_enum_repeated = 726;
  346. extensions 1000 to 3999;
  347. }
  348. // Extension fields with retained names.
  349. extend ObjCRetainedFoo {
  350. optional string new_val_lower_complex = 1011;
  351. optional string new_Val_upper_complex = 1012;
  352. optional string newvalue_lower_no_underscore_complex = 1013;
  353. optional string newValue_upper_no_underscore_complex = 1014;
  354. optional int32 new_val_lower_primitive = 1015;
  355. optional int32 new_Val_upper_primitive = 1016;
  356. optional int32 newvalue_lower_no_underscore_primitive = 1017;
  357. optional int32 newValue_upper_no_underscore_primitive = 1018;
  358. optional self new_val_lower_message = 1019;
  359. optional self new_Val_upper_message = 1020;
  360. optional self newvalue_lower_no_underscore_message = 1021;
  361. optional self newValue_upper_no_underscore_message = 1022;
  362. optional Foo new_val_lower_enum = 1023;
  363. optional Foo new_Val_upper_enum = 1024;
  364. optional Foo newvalue_lower_no_underscore_enum = 1025;
  365. optional Foo newValue_upper_no_underscore_enum = 1026;
  366. repeated string new_val_lower_complex_repeated = 1111;
  367. repeated string new_Val_upper_complex_repeated = 1112;
  368. repeated string newvalue_lower_no_underscore_complex_repeated = 1113;
  369. repeated string newValue_upper_no_underscore_complex_repeated = 1114;
  370. repeated int32 new_val_lower_primitive_repeated = 1115;
  371. repeated int32 new_Val_upper_primitive_repeated = 1116;
  372. repeated int32 newvalue_lower_no_underscore_primitive_repeated = 1117;
  373. repeated int32 newValue_upper_no_underscore_primitive_repeated = 1118;
  374. repeated self new_val_lower_message_repeated = 1119;
  375. repeated self new_Val_upper_message_repeated = 1120;
  376. repeated self newvalue_lower_no_underscore_message_repeated = 1121;
  377. repeated self newValue_upper_no_underscore_message_repeated = 1122;
  378. repeated Foo new_val_lower_enum_repeated = 1123;
  379. repeated Foo new_Val_upper_enum_repeated = 1124;
  380. repeated Foo newvalue_lower_no_underscore_enum_repeated = 1125;
  381. repeated Foo newValue_upper_no_underscore_enum_repeated = 1126;
  382. optional string alloc_val_lower_complex = 1211;
  383. optional string alloc_Val_upper_complex = 1212;
  384. optional string allocvalue_lower_no_underscore_complex = 1213;
  385. optional string allocValue_upper_no_underscore_complex = 1214;
  386. optional int32 alloc_val_lower_primitive = 1215;
  387. optional int32 alloc_Val_upper_primitive = 1216;
  388. optional int32 allocvalue_lower_no_underscore_primitive = 1217;
  389. optional int32 allocValue_upper_no_underscore_primitive = 1218;
  390. optional self alloc_val_lower_message = 1219;
  391. optional self alloc_Val_upper_message = 1220;
  392. optional self allocvalue_lower_no_underscore_message = 1221;
  393. optional self allocValue_upper_no_underscore_message = 1222;
  394. optional Foo alloc_val_lower_enum = 1223;
  395. optional Foo alloc_Val_upper_enum = 1224;
  396. optional Foo allocvalue_lower_no_underscore_enum = 1225;
  397. optional Foo allocValue_upper_no_underscore_enum = 1226;
  398. repeated string alloc_val_lower_complex_repeated = 1311;
  399. repeated string alloc_Val_upper_complex_repeated = 1312;
  400. repeated string allocvalue_lower_no_underscore_complex_repeated = 1313;
  401. repeated string allocValue_upper_no_underscore_complex_repeated = 1314;
  402. repeated int32 alloc_val_lower_primitive_repeated = 1315;
  403. repeated int32 alloc_Val_upper_primitive_repeated = 1316;
  404. repeated int32 allocvalue_lower_no_underscore_primitive_repeated = 1317;
  405. repeated int32 allocValue_upper_no_underscore_primitive_repeated = 1318;
  406. repeated self alloc_val_lower_message_repeated = 1319;
  407. repeated self alloc_Val_upper_message_repeated = 1320;
  408. repeated self allocvalue_lower_no_underscore_message_repeated = 1321;
  409. repeated self allocValue_upper_no_underscore_message_repeated = 1322;
  410. repeated Foo alloc_val_lower_enum_repeated = 1323;
  411. repeated Foo alloc_Val_upper_enum_repeated = 1324;
  412. repeated Foo allocvalue_lower_no_underscore_enum_repeated = 1325;
  413. repeated Foo allocValue_upper_no_underscore_enum_repeated = 1326;
  414. optional string copy_val_lower_complex = 1411;
  415. optional string copy_Val_upper_complex = 1412;
  416. optional string copyvalue_lower_no_underscore_complex = 1413;
  417. optional string copyValue_upper_no_underscore_complex = 1414;
  418. optional int32 copy_val_lower_primitive = 1415;
  419. optional int32 copy_Val_upper_primitive = 1416;
  420. optional int32 copyvalue_lower_no_underscore_primitive = 1417;
  421. optional int32 copyValue_upper_no_underscore_primitive = 1418;
  422. optional self copy_val_lower_message = 1419;
  423. optional self copy_Val_upper_message = 1420;
  424. optional self copyvalue_lower_no_underscore_message = 1421;
  425. optional self copyValue_upper_no_underscore_message = 1422;
  426. optional Foo copy_val_lower_enum = 1423;
  427. optional Foo copy_Val_upper_enum = 1424;
  428. optional Foo copyvalue_lower_no_underscore_enum = 1425;
  429. optional Foo copyValue_upper_no_underscore_enum = 1426;
  430. repeated string copy_val_lower_complex_repeated = 1511;
  431. repeated string copy_Val_upper_complex_repeated = 1512;
  432. repeated string copyvalue_lower_no_underscore_complex_repeated = 1513;
  433. repeated string copyValue_upper_no_underscore_complex_repeated = 1514;
  434. repeated int32 copy_val_lower_primitive_repeated = 1515;
  435. repeated int32 copy_Val_upper_primitive_repeated = 1516;
  436. repeated int32 copyvalue_lower_no_underscore_primitive_repeated = 1517;
  437. repeated int32 copyValue_upper_no_underscore_primitive_repeated = 1518;
  438. repeated self copy_val_lower_message_repeated = 1519;
  439. repeated self copy_Val_upper_message_repeated = 1520;
  440. repeated self copyvalue_lower_no_underscore_message_repeated = 1521;
  441. repeated self copyValue_upper_no_underscore_message_repeated = 1522;
  442. repeated Foo copy_val_lower_enum_repeated = 1523;
  443. repeated Foo copy_Val_upper_enum_repeated = 1524;
  444. repeated Foo copyvalue_lower_no_underscore_enum_repeated = 1525;
  445. repeated Foo copyValue_upper_no_underscore_enum_repeated = 1526;
  446. optional string mutableCopy_val_lower_complex = 1611;
  447. optional string mutableCopy_Val_upper_complex = 1612;
  448. optional string mutableCopyvalue_lower_no_underscore_complex = 1613;
  449. optional string mutableCopyValue_upper_no_underscore_complex = 1614;
  450. optional int32 mutableCopy_val_lower_primitive = 1615;
  451. optional int32 mutableCopy_Val_upper_primitive = 1616;
  452. optional int32 mutableCopyvalue_lower_no_underscore_primitive = 1617;
  453. optional int32 mutableCopyValue_upper_no_underscore_primitive = 1618;
  454. optional self mutableCopy_val_lower_message = 1619;
  455. optional self mutableCopy_Val_upper_message = 1620;
  456. optional self mutableCopyvalue_lower_no_underscore_message = 1621;
  457. optional self mutableCopyValue_upper_no_underscore_message = 1622;
  458. optional Foo mutableCopy_val_lower_enum = 1623;
  459. optional Foo mutableCopy_Val_upper_enum = 1624;
  460. optional Foo mutableCopyvalue_lower_no_underscore_enum = 1625;
  461. optional Foo mutableCopyValue_upper_no_underscore_enum = 1626;
  462. repeated string mutableCopy_val_lower_complex_repeated = 1711;
  463. repeated string mutableCopy_Val_upper_complex_repeated = 1712;
  464. repeated string mutableCopyvalue_lower_no_underscore_complex_repeated = 1713;
  465. repeated string mutableCopyValue_upper_no_underscore_complex_repeated = 1714;
  466. repeated int32 mutableCopy_val_lower_primitive_repeated = 1715;
  467. repeated int32 mutableCopy_Val_upper_primitive_repeated = 1716;
  468. repeated int32 mutableCopyvalue_lower_no_underscore_primitive_repeated = 1717;
  469. repeated int32 mutableCopyValue_upper_no_underscore_primitive_repeated = 1718;
  470. repeated self mutableCopy_val_lower_message_repeated = 1719;
  471. repeated self mutableCopy_Val_upper_message_repeated = 1720;
  472. repeated self mutableCopyvalue_lower_no_underscore_message_repeated = 1721;
  473. repeated self mutableCopyValue_upper_no_underscore_message_repeated = 1722;
  474. repeated Foo mutableCopy_val_lower_enum_repeated = 1723;
  475. repeated Foo mutableCopy_Val_upper_enum_repeated = 1724;
  476. repeated Foo mutableCopyvalue_lower_no_underscore_enum_repeated = 1725;
  477. repeated Foo mutableCopyValue_upper_no_underscore_enum_repeated = 1726;
  478. }
  479. message JustToScopeExtensions {
  480. extend ObjCRetainedFoo {
  481. optional string new_val_lower_complex = 2011;
  482. optional string new_Val_upper_complex = 2012;
  483. optional string newvalue_lower_no_underscore_complex = 2013;
  484. optional string newValue_upper_no_underscore_complex = 2014;
  485. optional int32 new_val_lower_primitive = 2015;
  486. optional int32 new_Val_upper_primitive = 2016;
  487. optional int32 newvalue_lower_no_underscore_primitive = 2017;
  488. optional int32 newValue_upper_no_underscore_primitive = 2018;
  489. optional self new_val_lower_message = 2019;
  490. optional self new_Val_upper_message = 2020;
  491. optional self newvalue_lower_no_underscore_message = 2021;
  492. optional self newValue_upper_no_underscore_message = 2022;
  493. optional Foo new_val_lower_enum = 2023;
  494. optional Foo new_Val_upper_enum = 2024;
  495. optional Foo newvalue_lower_no_underscore_enum = 2025;
  496. optional Foo newValue_upper_no_underscore_enum = 2026;
  497. repeated string new_val_lower_complex_repeated = 2111;
  498. repeated string new_Val_upper_complex_repeated = 2112;
  499. repeated string newvalue_lower_no_underscore_complex_repeated = 2113;
  500. repeated string newValue_upper_no_underscore_complex_repeated = 2114;
  501. repeated int32 new_val_lower_primitive_repeated = 2115;
  502. repeated int32 new_Val_upper_primitive_repeated = 2116;
  503. repeated int32 newvalue_lower_no_underscore_primitive_repeated = 2117;
  504. repeated int32 newValue_upper_no_underscore_primitive_repeated = 2118;
  505. repeated self new_val_lower_message_repeated = 2119;
  506. repeated self new_Val_upper_message_repeated = 2120;
  507. repeated self newvalue_lower_no_underscore_message_repeated = 2121;
  508. repeated self newValue_upper_no_underscore_message_repeated = 2122;
  509. repeated Foo new_val_lower_enum_repeated = 2123;
  510. repeated Foo new_Val_upper_enum_repeated = 2124;
  511. repeated Foo newvalue_lower_no_underscore_enum_repeated = 2125;
  512. repeated Foo newValue_upper_no_underscore_enum_repeated = 2126;
  513. optional string alloc_val_lower_complex = 2211;
  514. optional string alloc_Val_upper_complex = 2212;
  515. optional string allocvalue_lower_no_underscore_complex = 2213;
  516. optional string allocValue_upper_no_underscore_complex = 2214;
  517. optional int32 alloc_val_lower_primitive = 2215;
  518. optional int32 alloc_Val_upper_primitive = 2216;
  519. optional int32 allocvalue_lower_no_underscore_primitive = 2217;
  520. optional int32 allocValue_upper_no_underscore_primitive = 2218;
  521. optional self alloc_val_lower_message = 2219;
  522. optional self alloc_Val_upper_message = 2220;
  523. optional self allocvalue_lower_no_underscore_message = 2221;
  524. optional self allocValue_upper_no_underscore_message = 2222;
  525. optional Foo alloc_val_lower_enum = 2223;
  526. optional Foo alloc_Val_upper_enum = 2224;
  527. optional Foo allocvalue_lower_no_underscore_enum = 2225;
  528. optional Foo allocValue_upper_no_underscore_enum = 2226;
  529. repeated string alloc_val_lower_complex_repeated = 2311;
  530. repeated string alloc_Val_upper_complex_repeated = 2312;
  531. repeated string allocvalue_lower_no_underscore_complex_repeated = 2313;
  532. repeated string allocValue_upper_no_underscore_complex_repeated = 2314;
  533. repeated int32 alloc_val_lower_primitive_repeated = 2315;
  534. repeated int32 alloc_Val_upper_primitive_repeated = 2316;
  535. repeated int32 allocvalue_lower_no_underscore_primitive_repeated = 2317;
  536. repeated int32 allocValue_upper_no_underscore_primitive_repeated = 2318;
  537. repeated self alloc_val_lower_message_repeated = 2319;
  538. repeated self alloc_Val_upper_message_repeated = 2320;
  539. repeated self allocvalue_lower_no_underscore_message_repeated = 2321;
  540. repeated self allocValue_upper_no_underscore_message_repeated = 2322;
  541. repeated Foo alloc_val_lower_enum_repeated = 2323;
  542. repeated Foo alloc_Val_upper_enum_repeated = 2324;
  543. repeated Foo allocvalue_lower_no_underscore_enum_repeated = 2325;
  544. repeated Foo allocValue_upper_no_underscore_enum_repeated = 2326;
  545. optional string copy_val_lower_complex = 2411;
  546. optional string copy_Val_upper_complex = 2412;
  547. optional string copyvalue_lower_no_underscore_complex = 2413;
  548. optional string copyValue_upper_no_underscore_complex = 2414;
  549. optional int32 copy_val_lower_primitive = 2415;
  550. optional int32 copy_Val_upper_primitive = 2416;
  551. optional int32 copyvalue_lower_no_underscore_primitive = 2417;
  552. optional int32 copyValue_upper_no_underscore_primitive = 2418;
  553. optional self copy_val_lower_message = 2419;
  554. optional self copy_Val_upper_message = 2420;
  555. optional self copyvalue_lower_no_underscore_message = 2421;
  556. optional self copyValue_upper_no_underscore_message = 2422;
  557. optional Foo copy_val_lower_enum = 2423;
  558. optional Foo copy_Val_upper_enum = 2424;
  559. optional Foo copyvalue_lower_no_underscore_enum = 2425;
  560. optional Foo copyValue_upper_no_underscore_enum = 2426;
  561. repeated string copy_val_lower_complex_repeated = 2511;
  562. repeated string copy_Val_upper_complex_repeated = 2512;
  563. repeated string copyvalue_lower_no_underscore_complex_repeated = 2513;
  564. repeated string copyValue_upper_no_underscore_complex_repeated = 2514;
  565. repeated int32 copy_val_lower_primitive_repeated = 2515;
  566. repeated int32 copy_Val_upper_primitive_repeated = 2516;
  567. repeated int32 copyvalue_lower_no_underscore_primitive_repeated = 2517;
  568. repeated int32 copyValue_upper_no_underscore_primitive_repeated = 2518;
  569. repeated self copy_val_lower_message_repeated = 2519;
  570. repeated self copy_Val_upper_message_repeated = 2520;
  571. repeated self copyvalue_lower_no_underscore_message_repeated = 2521;
  572. repeated self copyValue_upper_no_underscore_message_repeated = 2522;
  573. repeated Foo copy_val_lower_enum_repeated = 2523;
  574. repeated Foo copy_Val_upper_enum_repeated = 2524;
  575. repeated Foo copyvalue_lower_no_underscore_enum_repeated = 2525;
  576. repeated Foo copyValue_upper_no_underscore_enum_repeated = 2526;
  577. optional string mutableCopy_val_lower_complex = 2611;
  578. optional string mutableCopy_Val_upper_complex = 2612;
  579. optional string mutableCopyvalue_lower_no_underscore_complex = 2613;
  580. optional string mutableCopyValue_upper_no_underscore_complex = 2614;
  581. optional int32 mutableCopy_val_lower_primitive = 2615;
  582. optional int32 mutableCopy_Val_upper_primitive = 2616;
  583. optional int32 mutableCopyvalue_lower_no_underscore_primitive = 2617;
  584. optional int32 mutableCopyValue_upper_no_underscore_primitive = 2618;
  585. optional self mutableCopy_val_lower_message = 2619;
  586. optional self mutableCopy_Val_upper_message = 2620;
  587. optional self mutableCopyvalue_lower_no_underscore_message = 2621;
  588. optional self mutableCopyValue_upper_no_underscore_message = 2622;
  589. optional Foo mutableCopy_val_lower_enum = 2623;
  590. optional Foo mutableCopy_Val_upper_enum = 2624;
  591. optional Foo mutableCopyvalue_lower_no_underscore_enum = 2625;
  592. optional Foo mutableCopyValue_upper_no_underscore_enum = 2626;
  593. repeated string mutableCopy_val_lower_complex_repeated = 2711;
  594. repeated string mutableCopy_Val_upper_complex_repeated = 2712;
  595. repeated string mutableCopyvalue_lower_no_underscore_complex_repeated = 2713;
  596. repeated string mutableCopyValue_upper_no_underscore_complex_repeated = 2714;
  597. repeated int32 mutableCopy_val_lower_primitive_repeated = 2715;
  598. repeated int32 mutableCopy_Val_upper_primitive_repeated = 2716;
  599. repeated int32 mutableCopyvalue_lower_no_underscore_primitive_repeated = 2717;
  600. repeated int32 mutableCopyValue_upper_no_underscore_primitive_repeated = 2718;
  601. repeated self mutableCopy_val_lower_message_repeated = 2719;
  602. repeated self mutableCopy_Val_upper_message_repeated = 2720;
  603. repeated self mutableCopyvalue_lower_no_underscore_message_repeated = 2721;
  604. repeated self mutableCopyValue_upper_no_underscore_message_repeated = 2722;
  605. repeated Foo mutableCopy_val_lower_enum_repeated = 2723;
  606. repeated Foo mutableCopy_Val_upper_enum_repeated = 2724;
  607. repeated Foo mutableCopyvalue_lower_no_underscore_enum_repeated = 2725;
  608. repeated Foo mutableCopyValue_upper_no_underscore_enum_repeated = 2726;
  609. }
  610. }
  611. // Test handling of fields that are the retained names.
  612. message ObjCRetainedComplex {
  613. optional string new = 1;
  614. optional string alloc = 2;
  615. optional string copy = 3;
  616. optional string mutableCopy = 4;
  617. }
  618. message ObjCRetainedComplexRepeated {
  619. repeated string new = 1;
  620. repeated string alloc = 2;
  621. repeated string copy = 3;
  622. repeated string mutableCopy = 4;
  623. }
  624. message ObjCRetainedPrimitive {
  625. optional int32 new = 1;
  626. optional int32 alloc = 2;
  627. optional int32 copy = 3;
  628. optional int32 mutableCopy = 4;
  629. }
  630. message ObjCRetainedPrimitiveRepeated {
  631. repeated int32 new = 1;
  632. repeated int32 alloc = 2;
  633. repeated int32 copy = 3;
  634. repeated int32 mutableCopy = 4;
  635. }
  636. message ObjCRetainedMessage {
  637. optional self new = 1;
  638. optional self alloc = 2;
  639. optional self copy = 3;
  640. optional self mutableCopy = 4;
  641. }
  642. message ObjCRetainedMessageRepeated {
  643. repeated self new = 1;
  644. repeated self alloc = 2;
  645. repeated self copy = 3;
  646. repeated self mutableCopy = 4;
  647. }
  648. // Test Handling some MacTypes
  649. message Point {
  650. message Rect {
  651. optional int32 TimeValue = 1;
  652. }
  653. }
  654. // Test some weird defaults that we see in protos.
  655. message ObjcWeirdDefaults {
  656. // Set default values that match the protocol buffer defined defaults to
  657. // confirm hasDefault and the default values are set correctly.
  658. optional string foo = 1 [default = ""];
  659. optional bytes bar = 2 [default = ""];
  660. }
  661. // Used to confirm negative enum values work as expected.
  662. message EnumTestMsg {
  663. enum MyEnum {
  664. ZERO = 0;
  665. ONE = 1;
  666. TWO = 2;
  667. NEG_ONE = -1;
  668. NEG_TWO = -2;
  669. }
  670. optional MyEnum foo = 1;
  671. optional MyEnum bar = 2 [default = ONE];
  672. optional MyEnum baz = 3 [default = NEG_ONE];
  673. repeated MyEnum mumble = 4;
  674. }
  675. // Test case for https://github.com/protocolbuffers/protobuf/issues/1453
  676. // Message with no explicit defaults, but a non zero default for an enum.
  677. message MessageWithOneBasedEnum {
  678. enum OneBasedEnum {
  679. ONE = 1;
  680. TWO = 2;
  681. }
  682. optional OneBasedEnum enum_field = 1;
  683. }
  684. // Message with all bools for testing things related to bool storage.
  685. message BoolOnlyMessage {
  686. optional bool bool_field_1 = 1;
  687. optional bool bool_field_2 = 2;
  688. optional bool bool_field_3 = 3;
  689. optional bool bool_field_4 = 4;
  690. optional bool bool_field_5 = 5;
  691. optional bool bool_field_6 = 6;
  692. optional bool bool_field_7 = 7;
  693. optional bool bool_field_8 = 8;
  694. optional bool bool_field_9 = 9;
  695. optional bool bool_field_10 = 10;
  696. optional bool bool_field_11 = 11;
  697. optional bool bool_field_12 = 12;
  698. optional bool bool_field_13 = 13;
  699. optional bool bool_field_14 = 14;
  700. optional bool bool_field_15 = 15;
  701. optional bool bool_field_16 = 16;
  702. optional bool bool_field_17 = 17;
  703. optional bool bool_field_18 = 18;
  704. optional bool bool_field_19 = 19;
  705. optional bool bool_field_20 = 20;
  706. optional bool bool_field_21 = 21;
  707. optional bool bool_field_22 = 22;
  708. optional bool bool_field_23 = 23;
  709. optional bool bool_field_24 = 24;
  710. optional bool bool_field_25 = 25;
  711. optional bool bool_field_26 = 26;
  712. optional bool bool_field_27 = 27;
  713. optional bool bool_field_28 = 28;
  714. optional bool bool_field_29 = 29;
  715. optional bool bool_field_30 = 30;
  716. optional bool bool_field_31 = 31;
  717. optional bool bool_field_32 = 32;
  718. }
  719. // Reference to a WKT to test (via generated code inspection), the handling
  720. // of #imports. Within the WKTs, references to each other are just path
  721. // based imports, but when reference from another proto file, they should be
  722. // conditional to support the framework import style.
  723. message WKTRefereceMessage {
  724. optional google.protobuf.Any an_any = 1;
  725. }
  726. // This is in part a compile test, it ensures that when aliases end up with
  727. // the same ObjC name, we drop them to avoid the duplication names. There
  728. // is a test to ensure the descriptors are still generated to support
  729. // reflection and TextFormat.
  730. enum TestEnumObjCNameCollision {
  731. option allow_alias = true;
  732. FOO = 1;
  733. foo = 1;
  734. BAR = 2;
  735. mumble = 2;
  736. MUMBLE = 2;
  737. }