| OLD | NEW |
| 1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
| 2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
| 3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
| 4 // | 4 // |
| 5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
| 6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
| 7 // met: | 7 // met: |
| 8 // | 8 // |
| 9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
| 10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | 30 |
| 31 syntax = "proto2"; | 31 syntax = "proto2"; |
| 32 option cc_enable_arenas = true; | 32 |
| 33 | 33 |
| 34 import "google/protobuf/unittest_import.proto"; | 34 import "google/protobuf/unittest_import.proto"; |
| 35 | 35 |
| 36 // We don't put this in a package within proto2 because we need to make sure | 36 // We don't put this in a package within proto2 because we need to make sure |
| 37 // that the generated code doesn't depend on being in the proto2 namespace. | 37 // that the generated code doesn't depend on being in the proto2 namespace. |
| 38 // In map_test_util.h we do "using namespace unittest = protobuf_unittest". | 38 // In map_test_util.h we do "using namespace unittest = protobuf_unittest". |
| 39 package protobuf_unittest; | 39 package protobuf_unittest; |
| 40 | 40 |
| 41 enum Proto2MapEnum { | 41 enum Proto2MapEnum { |
| 42 PROTO2_MAP_ENUM_FOO = 0; | 42 PROTO2_MAP_ENUM_FOO = 0; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 message TestEnumMapPlusExtra { | 59 message TestEnumMapPlusExtra { |
| 60 map<int32, Proto2MapEnumPlusExtra> known_map_field = 101; | 60 map<int32, Proto2MapEnumPlusExtra> known_map_field = 101; |
| 61 map<int32, Proto2MapEnumPlusExtra> unknown_map_field = 102; | 61 map<int32, Proto2MapEnumPlusExtra> unknown_map_field = 102; |
| 62 } | 62 } |
| 63 | 63 |
| 64 message TestImportEnumMap { | 64 message TestImportEnumMap { |
| 65 map<int32, protobuf_unittest_import.ImportEnumForMap> import_enum_amp = 1; | 65 map<int32, protobuf_unittest_import.ImportEnumForMap> import_enum_amp = 1; |
| 66 } | 66 } |
| 67 | |
| 68 message TestIntIntMap { | |
| 69 map<int32, int32> m = 1; | |
| 70 } | |
| 71 | |
| 72 // Test all key types: string, plus the non-floating-point scalars. | |
| 73 message TestMaps { | |
| 74 map<int32, TestIntIntMap> m_int32 = 1; | |
| 75 map<int64, TestIntIntMap> m_int64 = 2; | |
| 76 map<uint32, TestIntIntMap> m_uint32 = 3; | |
| 77 map<uint64, TestIntIntMap> m_uint64 = 4; | |
| 78 map<sint32, TestIntIntMap> m_sint32 = 5; | |
| 79 map<sint64, TestIntIntMap> m_sint64 = 6; | |
| 80 map<fixed32, TestIntIntMap> m_fixed32 = 7; | |
| 81 map<fixed64, TestIntIntMap> m_fixed64 = 8; | |
| 82 map<sfixed32, TestIntIntMap> m_sfixed32 = 9; | |
| 83 map<sfixed64, TestIntIntMap> m_sfixed64 = 10; | |
| 84 map<bool, TestIntIntMap> m_bool = 11; | |
| 85 map<string, TestIntIntMap> m_string = 12; | |
| 86 } | |
| OLD | NEW |