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