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 8// This file is mostly equivalent to map_unittest.proto, but imports 9// unittest_proto3.proto instead of unittest.proto, so that it only 10// uses proto3 messages. This makes it suitable for testing 11// implementations which only support proto3. 12// The TestRequiredMessageMap message has been removed as there are no 13// required fields in proto3. 14syntax = "proto3"; 15 16package protobuf_unittest3; 17 18import "csharp/protos/unittest_proto3.proto"; 19 20option csharp_namespace = "Google.Protobuf.TestProtos"; 21 22// Tests maps. 23message TestMap { 24 map<int32, int32> map_int32_int32 = 1; 25 map<int64, int64> map_int64_int64 = 2; 26 map<uint32, uint32> map_uint32_uint32 = 3; 27 map<uint64, uint64> map_uint64_uint64 = 4; 28 map<sint32, sint32> map_sint32_sint32 = 5; 29 map<sint64, sint64> map_sint64_sint64 = 6; 30 map<fixed32, fixed32> map_fixed32_fixed32 = 7; 31 map<fixed64, fixed64> map_fixed64_fixed64 = 8; 32 map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9; 33 map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10; 34 map<int32, float> map_int32_float = 11; 35 map<int32, double> map_int32_double = 12; 36 map<bool, bool> map_bool_bool = 13; 37 map<string, string> map_string_string = 14; 38 map<int32, bytes> map_int32_bytes = 15; 39 map<int32, MapEnum> map_int32_enum = 16; 40 map<int32, ForeignMessage> map_int32_foreign_message = 17; 41} 42 43message TestMapSubmessage { 44 TestMap test_map = 1; 45} 46 47message TestMessageMap { 48 map<int32, TestAllTypes> map_int32_message = 1; 49} 50 51// Two map fields share the same entry default instance. 52message TestSameTypeMap { 53 map<int32, int32> map1 = 1; 54 map<int32, int32> map2 = 2; 55} 56 57enum MapEnum { 58 MAP_ENUM_FOO = 0; 59 MAP_ENUM_BAR = 1; 60 MAP_ENUM_BAZ = 2; 61} 62 63message TestArenaMap { 64 map<int32, int32> map_int32_int32 = 1; 65 map<int64, int64> map_int64_int64 = 2; 66 map<uint32, uint32> map_uint32_uint32 = 3; 67 map<uint64, uint64> map_uint64_uint64 = 4; 68 map<sint32, sint32> map_sint32_sint32 = 5; 69 map<sint64, sint64> map_sint64_sint64 = 6; 70 map<fixed32, fixed32> map_fixed32_fixed32 = 7; 71 map<fixed64, fixed64> map_fixed64_fixed64 = 8; 72 map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9; 73 map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10; 74 map<int32, float> map_int32_float = 11; 75 map<int32, double> map_int32_double = 12; 76 map<bool, bool> map_bool_bool = 13; 77 map<int32, MapEnum> map_int32_enum = 14; 78 map<int32, ForeignMessage> map_int32_foreign_message = 15; 79} 80 81// Previously, message containing enum called Type cannot be used as value of 82// map field. 83message MessageContainingEnumCalledType { 84 enum Type { 85 TYPE_FOO = 0; 86 } 87 map<int32, MessageContainingEnumCalledType> type = 1; 88} 89 90// Previously, message cannot contain map field called "entry". 91message MessageContainingMapCalledEntry { 92 map<int32, int32> entry = 1; 93} 94