From b7610f129df84d7f823f64d5dce9bfa1578cf49e Mon Sep 17 00:00:00 2001 From: Feng Xiao Date: Tue, 22 Dec 2015 14:36:04 -0800 Subject: Add missing files to EXTRA_DIST. Also delete some unused files. --- .../compiler/cpp/test_large_enum_value.proto | 43 ------ .../util/internal/snake2camel_objectwriter.h | 165 --------------------- .../util/internal/snake2camel_objectwriter_test.cc | 57 ------- .../protobuf/util/message_differencer_unittest.cc | 11 +- 4 files changed, 6 insertions(+), 270 deletions(-) delete mode 100644 src/google/protobuf/compiler/cpp/test_large_enum_value.proto delete mode 100644 src/google/protobuf/util/internal/snake2camel_objectwriter.h delete mode 100644 src/google/protobuf/util/internal/snake2camel_objectwriter_test.cc (limited to 'src/google') diff --git a/src/google/protobuf/compiler/cpp/test_large_enum_value.proto b/src/google/protobuf/compiler/cpp/test_large_enum_value.proto deleted file mode 100644 index cb6ca1b1..00000000 --- a/src/google/protobuf/compiler/cpp/test_large_enum_value.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Test that proto2 compiler can generate valid code when the enum value -// is INT_MAX. Note that this is a compile-only test and this proto is not -// referenced in any C++ code. -syntax = "proto2"; - -package protobuf_unittest; - -message TestLargeEnumValue { - enum EnumWithLargeValue { - VALUE_1 = 1; - VALUE_MAX = 0x7fffffff; - } -} diff --git a/src/google/protobuf/util/internal/snake2camel_objectwriter.h b/src/google/protobuf/util/internal/snake2camel_objectwriter.h deleted file mode 100644 index 9b4ab8a3..00000000 --- a/src/google/protobuf/util/internal/snake2camel_objectwriter.h +++ /dev/null @@ -1,165 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef GOOGLE_PROTOBUF_UTIL_CONVERTER_SNAKE2CAMEL_OBJECTWRITER_H__ -#define GOOGLE_PROTOBUF_UTIL_CONVERTER_SNAKE2CAMEL_OBJECTWRITER_H__ - -#include - -#include -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace util { -namespace converter { - -// Snake2CamelObjectWriter is an ObjectWriter than translates each field name -// from snake_case to camelCase. Typical usage is: -// ProtoStreamObjectSource psos(...); -// JsonObjectWriter jow(...); -// Snake2CamelObjectWriter snake_to_camel(&jow); -// psos.writeTo(&snake_to_camel); -class Snake2CamelObjectWriter : public ObjectWriter { - public: - explicit Snake2CamelObjectWriter(ObjectWriter* ow) - : ow_(ow), normalize_case_(true) {} - virtual ~Snake2CamelObjectWriter() {} - - // ObjectWriter methods. - virtual Snake2CamelObjectWriter* StartObject(StringPiece name) { - ow_->StartObject(name); - return this; - } - - virtual Snake2CamelObjectWriter* EndObject() { - ow_->EndObject(); - return this; - } - - virtual Snake2CamelObjectWriter* StartList(StringPiece name) { - ow_->StartList(name); - return this; - } - - virtual Snake2CamelObjectWriter* EndList() { - ow_->EndList(); - return this; - } - - virtual Snake2CamelObjectWriter* RenderBool(StringPiece name, bool value) { - ow_->RenderBool(name, value); - return this; - } - - virtual Snake2CamelObjectWriter* RenderInt32(StringPiece name, int32 value) { - ow_->RenderInt32(name, value); - return this; - } - - virtual Snake2CamelObjectWriter* RenderUint32(StringPiece name, - uint32 value) { - ow_->RenderUint32(name, value); - return this; - } - - virtual Snake2CamelObjectWriter* RenderInt64(StringPiece name, int64 value) { - ow_->RenderInt64(name, value); - return this; - } - - virtual Snake2CamelObjectWriter* RenderUint64(StringPiece name, - uint64 value) { - ow_->RenderUint64(name, value); - return this; - } - - virtual Snake2CamelObjectWriter* RenderDouble(StringPiece name, - double value) { - ow_->RenderDouble(name, value); - return this; - } - - virtual Snake2CamelObjectWriter* RenderFloat(StringPiece name, float value) { - ow_->RenderFloat(name, value); - return this; - } - - virtual Snake2CamelObjectWriter* RenderString(StringPiece name, - StringPiece value) { - ow_->RenderString(name, value); - return this; - } - - virtual Snake2CamelObjectWriter* RenderBytes(StringPiece name, - StringPiece value) { - ow_->RenderBytes(name, value); - return this; - } - - virtual Snake2CamelObjectWriter* RenderNull(StringPiece name) { - ow_->RenderNull(name); - return this; - } - - virtual Snake2CamelObjectWriter* DisableCaseNormalizationForNextKey() { - normalize_case_ = false; - return this; - } - - private: - ObjectWriter* ow_; - bool normalize_case_; - - bool ShouldNormalizeCase(StringPiece name) { - if (normalize_case_) { - return !IsCamel(name); - } else { - normalize_case_ = true; - return false; - } - } - - bool IsCamel(StringPiece name) { - return name.empty() || (ascii_islower(name[0]) && !name.contains("_")); - } - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Snake2CamelObjectWriter); -}; - -} // namespace converter -} // namespace util -} // namespace protobuf - -} // namespace google -#endif // GOOGLE_PROTOBUF_UTIL_CONVERTER_SNAKE2CAMEL_OBJECTWRITER_H__ diff --git a/src/google/protobuf/util/internal/snake2camel_objectwriter_test.cc b/src/google/protobuf/util/internal/snake2camel_objectwriter_test.cc deleted file mode 100644 index e5db844c..00000000 --- a/src/google/protobuf/util/internal/snake2camel_objectwriter_test.cc +++ /dev/null @@ -1,57 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include -#include -#include - -namespace google { -namespace protobuf { -namespace util { -namespace converter { - -class Snake2CamelObjectWriterTest : public ::testing::Test { - protected: - Snake2CamelObjectWriterTest() : mock_(), expects_(&mock_), testing_(&mock_) {} - virtual ~Snake2CamelObjectWriterTest() {} - - MockObjectWriter mock_; - ExpectingObjectWriter expects_; - Snake2CamelObjectWriter testing_; -}; - -// All tests are deleted as they are no longer needed. This file will be removed -// after the component dependecies are cleaned up. -// TODO(skarvaje): Remove this file. - -} // namespace converter -} // namespace util -} // namespace protobuf -} // namespace google diff --git a/src/google/protobuf/util/message_differencer_unittest.cc b/src/google/protobuf/util/message_differencer_unittest.cc index 4e9ca348..16f151af 100755 --- a/src/google/protobuf/util/message_differencer_unittest.cc +++ b/src/google/protobuf/util/message_differencer_unittest.cc @@ -1454,11 +1454,10 @@ static const char* const kIgnoredFields[] = {"rm.b", "rm.m.b"}; class TestIgnorer : public util::MessageDifferencer::IgnoreCriteria { public: - bool IsIgnored( + virtual bool IsIgnored( const Message& message1, const Message& message2, const FieldDescriptor* field, - const vector& parent_fields) - override { + const vector& parent_fields) { string name = ""; for (int i = 0; i < parent_fields.size(); ++i) { name += parent_fields[i].field->name() + "."; @@ -1500,8 +1499,10 @@ TEST(MessageDifferencerTest, TreatRepeatedFieldAsMapWithIgnoredKeyFields) { class ValueProductMapKeyComparator : public util::MessageDifferencer::MapKeyComparator { public: - virtual bool IsMatch(const Message &message1, - const Message &message2) const { + typedef util::MessageDifferencer::SpecificField SpecificField; + virtual bool IsMatch( + const Message &message1, const Message &message2, + const vector& parent_fields) const { const Reflection* reflection1 = message1.GetReflection(); const Reflection* reflection2 = message2.GetReflection(); // FieldDescriptor for item.ra -- cgit v1.2.3