| Index: third_party/protobuf/src/google/protobuf/util/internal/object_writer.cc
|
| diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_enum.h b/third_party/protobuf/src/google/protobuf/util/internal/object_writer.cc
|
| similarity index 52%
|
| rename from third_party/protobuf/src/google/protobuf/compiler/java/java_enum.h
|
| rename to third_party/protobuf/src/google/protobuf/util/internal/object_writer.cc
|
| index 9a9e5742ac3b8590e2e2c00de5123e681a53494e..57cc08a1d7a4f333616f8a8cc750880751d69a19 100644
|
| --- a/third_party/protobuf/src/google/protobuf/compiler/java/java_enum.h
|
| +++ b/third_party/protobuf/src/google/protobuf/util/internal/object_writer.cc
|
| @@ -1,6 +1,6 @@
|
| // Protocol Buffers - Google's data interchange format
|
| // Copyright 2008 Google Inc. All rights reserved.
|
| -// http://code.google.com/p/protobuf/
|
| +// 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
|
| @@ -28,59 +28,65 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -// Author: kenton@google.com (Kenton Varda)
|
| -// Based on original Protocol Buffers design by
|
| -// Sanjay Ghemawat, Jeff Dean, and others.
|
| +#include <google/protobuf/util/internal/object_writer.h>
|
|
|
| -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_H__
|
| -#define GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_H__
|
| -
|
| -#include <string>
|
| -#include <vector>
|
| -#include <google/protobuf/descriptor.h>
|
| +#include <google/protobuf/util/internal/datapiece.h>
|
|
|
| namespace google {
|
| namespace protobuf {
|
| - namespace io {
|
| - class Printer; // printer.h
|
| +namespace util {
|
| +namespace converter {
|
| +
|
| +// static
|
| +void ObjectWriter::RenderDataPieceTo(const DataPiece& data, StringPiece name,
|
| + ObjectWriter* ow) {
|
| + switch (data.type()) {
|
| + case DataPiece::TYPE_INT32: {
|
| + ow->RenderInt32(name, data.ToInt32().ValueOrDie());
|
| + break;
|
| + }
|
| + case DataPiece::TYPE_INT64: {
|
| + ow->RenderInt64(name, data.ToInt64().ValueOrDie());
|
| + break;
|
| + }
|
| + case DataPiece::TYPE_UINT32: {
|
| + ow->RenderUint32(name, data.ToUint32().ValueOrDie());
|
| + break;
|
| + }
|
| + case DataPiece::TYPE_UINT64: {
|
| + ow->RenderUint64(name, data.ToUint64().ValueOrDie());
|
| + break;
|
| + }
|
| + case DataPiece::TYPE_DOUBLE: {
|
| + ow->RenderDouble(name, data.ToDouble().ValueOrDie());
|
| + break;
|
| + }
|
| + case DataPiece::TYPE_FLOAT: {
|
| + ow->RenderFloat(name, data.ToFloat().ValueOrDie());
|
| + break;
|
| + }
|
| + case DataPiece::TYPE_BOOL: {
|
| + ow->RenderBool(name, data.ToBool().ValueOrDie());
|
| + break;
|
| + }
|
| + case DataPiece::TYPE_STRING: {
|
| + ow->RenderString(name, data.ToString().ValueOrDie());
|
| + break;
|
| + }
|
| + case DataPiece::TYPE_BYTES: {
|
| + ow->RenderBytes(name, data.ToBytes().ValueOrDie());
|
| + break;
|
| + }
|
| + case DataPiece::TYPE_NULL: {
|
| + ow->RenderNull(name);
|
| + break;
|
| + }
|
| + default:
|
| + break;
|
| }
|
| }
|
|
|
| -namespace protobuf {
|
| -namespace compiler {
|
| -namespace java {
|
| -
|
| -class EnumGenerator {
|
| - public:
|
| - explicit EnumGenerator(const EnumDescriptor* descriptor);
|
| - ~EnumGenerator();
|
| -
|
| - void Generate(io::Printer* printer);
|
| -
|
| - private:
|
| - const EnumDescriptor* descriptor_;
|
| -
|
| - // The proto language allows multiple enum constants to have the same numeric
|
| - // value. Java, however, does not allow multiple enum constants to be
|
| - // considered equivalent. We treat the first defined constant for any
|
| - // given numeric value as "canonical" and the rest as aliases of that
|
| - // canonical value.
|
| - vector<const EnumValueDescriptor*> canonical_values_;
|
| -
|
| - struct Alias {
|
| - const EnumValueDescriptor* value;
|
| - const EnumValueDescriptor* canonical_value;
|
| - };
|
| - vector<Alias> aliases_;
|
| -
|
| - bool CanUseEnumValues();
|
| -
|
| - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator);
|
| -};
|
| -
|
| -} // namespace java
|
| -} // namespace compiler
|
| +} // namespace converter
|
| +} // namespace util
|
| } // namespace protobuf
|
| -
|
| } // namespace google
|
| -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_H__
|
|
|