• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Protocol Buffers - Google's data interchange format
2// Copyright 2008 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 = "proto3";
9
10import "objectivec/Tests/unittest.proto";
11
12package objc.protobuf.tests;
13
14// Explicit empty prefix, tests some validations code paths also.
15option objc_class_prefix = "";
16
17// Tests maps.
18message TestMap {
19  map<int32, int32> map_int32_int32 = 1;
20  map<int64, int64> map_int64_int64 = 2;
21  map<uint32, uint32> map_uint32_uint32 = 3;
22  map<uint64, uint64> map_uint64_uint64 = 4;
23  map<sint32, sint32> map_sint32_sint32 = 5;
24  map<sint64, sint64> map_sint64_sint64 = 6;
25  map<fixed32, fixed32> map_fixed32_fixed32 = 7;
26  map<fixed64, fixed64> map_fixed64_fixed64 = 8;
27  map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9;
28  map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10;
29  map<int32, float> map_int32_float = 11;
30  map<int32, double> map_int32_double = 12;
31  map<bool, bool> map_bool_bool = 13;
32  map<string, string> map_string_string = 14;
33  map<int32, bytes> map_int32_bytes = 15;
34  map<int32, MapEnum> map_int32_enum = 16;
35  map<int32, ForeignMessage> map_int32_foreign_message = 17;
36  map<string, ForeignMessage> map_string_foreign_message = 18;
37  map<int32, TestAllTypes> map_int32_all_types = 19;
38}
39
40message TestMapSubmessage {
41  TestMap test_map = 1;
42}
43
44message TestMessageMap {
45  map<int32, TestAllTypes> map_int32_message = 1;
46}
47
48// Two map fields share the same entry default instance.
49message TestSameTypeMap {
50  map<int32, int32> map1 = 1;
51  map<int32, int32> map2 = 2;
52}
53
54
55enum MapEnum {
56  MAP_ENUM_FOO = 0;
57  MAP_ENUM_BAR = 1;
58  MAP_ENUM_BAZ = 2;
59}
60
61// Test embedded message with required fields
62message TestRequiredMessageMap {
63  map<int32, TestRequired> map_field = 1;
64}
65
66message TestArenaMap {
67  map<int32, int32> map_int32_int32 = 1;
68  map<int64, int64> map_int64_int64 = 2;
69  map<uint32, uint32> map_uint32_uint32 = 3;
70  map<uint64, uint64> map_uint64_uint64 = 4;
71  map<sint32, sint32> map_sint32_sint32 = 5;
72  map<sint64, sint64> map_sint64_sint64 = 6;
73  map<fixed32, fixed32> map_fixed32_fixed32 = 7;
74  map<fixed64, fixed64> map_fixed64_fixed64 = 8;
75  map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9;
76  map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10;
77  map<int32, float> map_int32_float = 11;
78  map<int32, double> map_int32_double = 12;
79  map<bool, bool> map_bool_bool = 13;
80  map<string, string> map_string_string = 14;
81  map<int32, bytes> map_int32_bytes = 15;
82  map<int32, MapEnum> map_int32_enum = 16;
83  map<int32, ForeignMessage> map_int32_foreign_message = 17;
84}
85
86// Previously, message containing enum called Type cannot be used as value of
87// map field.
88message MessageContainingEnumCalledType {
89  enum Type { TYPE_FOO = 0; }
90  map<string, MessageContainingEnumCalledType> type = 1;
91}
92
93// Previously, message cannot contain map field called "entry".
94message MessageContainingMapCalledEntry {
95  map<int32, int32> entry = 1;
96}
97
98message TestRecursiveMapMessage {
99  map<string, TestRecursiveMapMessage> a = 1;
100}
101