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 = "proto2"; 9 10import "objectivec/Tests/unittest_import.proto"; 11 12package objc.protobuf.tests; 13 14// Explicit empty prefix, tests some validations code paths also. 15option objc_class_prefix = ""; 16 17enum Proto2MapEnum { 18 PROTO2_MAP_ENUM_FOO = 0; 19 PROTO2_MAP_ENUM_BAR = 1; 20 PROTO2_MAP_ENUM_BAZ = 2; 21} 22 23enum Proto2MapEnumPlusExtra { 24 E_PROTO2_MAP_ENUM_FOO = 0; 25 E_PROTO2_MAP_ENUM_BAR = 1; 26 E_PROTO2_MAP_ENUM_BAZ = 2; 27 E_PROTO2_MAP_ENUM_EXTRA = 3; 28} 29 30message TestEnumMap { 31 map<int32, Proto2MapEnum> known_map_field = 101; 32 map<int32, Proto2MapEnum> unknown_map_field = 102; 33} 34 35message TestEnumMapPlusExtra { 36 map<int32, Proto2MapEnumPlusExtra> known_map_field = 101; 37 map<int32, Proto2MapEnumPlusExtra> unknown_map_field = 102; 38} 39 40message TestImportEnumMap { 41 map<int32, objc.protobuf.tests.import.EnumForMap> import_enum_amp = 1; 42} 43 44message TestIntIntMap { 45 map<int32, int32> m = 1; 46} 47 48// Test all key types: string, plus the non-floating-point scalars. 49message TestMaps { 50 map<int32, TestIntIntMap> m_int32 = 1; 51 map<int64, TestIntIntMap> m_int64 = 2; 52 map<uint32, TestIntIntMap> m_uint32 = 3; 53 map<uint64, TestIntIntMap> m_uint64 = 4; 54 map<sint32, TestIntIntMap> m_sint32 = 5; 55 map<sint64, TestIntIntMap> m_sint64 = 6; 56 map<fixed32, TestIntIntMap> m_fixed32 = 7; 57 map<fixed64, TestIntIntMap> m_fixed64 = 8; 58 map<sfixed32, TestIntIntMap> m_sfixed32 = 9; 59 map<sfixed64, TestIntIntMap> m_sfixed64 = 10; 60 map<bool, TestIntIntMap> m_bool = 11; 61 map<string, TestIntIntMap> m_string = 12; 62} 63 64// Test maps in submessages. 65message TestSubmessageMaps { 66 optional TestMaps m = 1; 67} 68