chromium/third_party/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc

// 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 <google/protobuf/util/internal/protostream_objectsource.h>

#include <cstdint>
#include <unordered_map>
#include <utility>

#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/unknown_field_set.h>
#include <google/protobuf/wire_format.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/casts.h>
#include <google/protobuf/stubs/status.h>
#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/stubs/time.h>
#include <google/protobuf/util/internal/constants.h>
#include <google/protobuf/util/internal/field_mask_utility.h>
#include <google/protobuf/util/internal/utility.h>
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/stubs/status_macros.h>


// Must be included last.
#include <google/protobuf/port_def.inc>


namespace google {
namespace protobuf {
namespace util {
namespace converter {

WireFormat;
WireFormatLite;

namespace {

static int kDefaultMaxRecursionDepth =;

// Finds a field with the given number. nullptr if none found.
const google::protobuf::Field* FindFieldByNumber(
    const google::protobuf::Type& type, int number);

// Returns true if the field is packable.
bool IsPackable(const google::protobuf::Field& field);

// Finds an enum value with the given number. nullptr if none found.
const google::protobuf::EnumValue* FindEnumValueByNumber(
    const google::protobuf::Enum& tech_enum, int number);

// Utility function to format nanos.
const std::string FormatNanos(uint32_t nanos, bool with_trailing_zeros);

util::StatusOr<std::string> MapKeyDefaultValueAsString(
    const google::protobuf::Field& field) {}
}  // namespace


ProtoStreamObjectSource::ProtoStreamObjectSource(
    io::CodedInputStream* stream, TypeResolver* type_resolver,
    const google::protobuf::Type& type, const RenderOptions& render_options)
    :{}

ProtoStreamObjectSource::ProtoStreamObjectSource(
    io::CodedInputStream* stream, const TypeInfo* typeinfo,
    const google::protobuf::Type& type, const RenderOptions& render_options)
    :{}

ProtoStreamObjectSource::~ProtoStreamObjectSource() {}

util::Status ProtoStreamObjectSource::NamedWriteTo(StringPiece name,
                                                   ObjectWriter* ow) const {}

const google::protobuf::Field* ProtoStreamObjectSource::FindAndVerifyField(
    const google::protobuf::Type& type, uint32_t tag) const {}

util::Status ProtoStreamObjectSource::WriteMessage(
    const google::protobuf::Type& type, StringPiece name,
    const uint32_t end_tag, bool include_start_and_end,
    ObjectWriter* ow) const {}

util::StatusOr<uint32_t> ProtoStreamObjectSource::RenderList(
    const google::protobuf::Field* field, StringPiece name,
    uint32_t list_tag, ObjectWriter* ow) const {}

util::StatusOr<uint32_t> ProtoStreamObjectSource::RenderMap(
    const google::protobuf::Field* field, StringPiece /* name */,
    uint32_t list_tag, ObjectWriter* ow) const {}

util::Status ProtoStreamObjectSource::RenderPacked(
    const google::protobuf::Field* field, ObjectWriter* ow) const {}

util::Status ProtoStreamObjectSource::RenderTimestamp(
    const ProtoStreamObjectSource* os, const google::protobuf::Type& type,
    StringPiece field_name, ObjectWriter* ow) {}

util::Status ProtoStreamObjectSource::RenderDuration(
    const ProtoStreamObjectSource* os, const google::protobuf::Type& type,
    StringPiece field_name, ObjectWriter* ow) {}

util::Status ProtoStreamObjectSource::RenderDouble(
    const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/,
    StringPiece field_name, ObjectWriter* ow) {}

util::Status ProtoStreamObjectSource::RenderFloat(
    const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/,
    StringPiece field_name, ObjectWriter* ow) {}

util::Status ProtoStreamObjectSource::RenderInt64(
    const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/,
    StringPiece field_name, ObjectWriter* ow) {}

util::Status ProtoStreamObjectSource::RenderUInt64(
    const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/,
    StringPiece field_name, ObjectWriter* ow) {}

util::Status ProtoStreamObjectSource::RenderInt32(
    const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/,
    StringPiece field_name, ObjectWriter* ow) {}

util::Status ProtoStreamObjectSource::RenderUInt32(
    const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/,
    StringPiece field_name, ObjectWriter* ow) {}

util::Status ProtoStreamObjectSource::RenderBool(
    const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/,
    StringPiece field_name, ObjectWriter* ow) {}

util::Status ProtoStreamObjectSource::RenderString(
    const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/,
    StringPiece field_name, ObjectWriter* ow) {}

util::Status ProtoStreamObjectSource::RenderBytes(
    const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/,
    StringPiece field_name, ObjectWriter* ow) {}

util::Status ProtoStreamObjectSource::RenderStruct(
    const ProtoStreamObjectSource* os, const google::protobuf::Type& type,
    StringPiece field_name, ObjectWriter* ow) {}

util::Status ProtoStreamObjectSource::RenderStructValue(
    const ProtoStreamObjectSource* os, const google::protobuf::Type& type,
    StringPiece field_name, ObjectWriter* ow) {}

// TODO(skarvaje): Avoid code duplication of for loops and SkipField logic.
util::Status ProtoStreamObjectSource::RenderStructListValue(
    const ProtoStreamObjectSource* os, const google::protobuf::Type& type,
    StringPiece field_name, ObjectWriter* ow) {}

util::Status ProtoStreamObjectSource::RenderAny(
    const ProtoStreamObjectSource* os, const google::protobuf::Type& type,
    StringPiece field_name, ObjectWriter* ow) {}

util::Status ProtoStreamObjectSource::RenderFieldMask(
    const ProtoStreamObjectSource* os, const google::protobuf::Type& type,
    StringPiece field_name, ObjectWriter* ow) {}


std::unordered_map<std::string, ProtoStreamObjectSource::TypeRenderer>*
    ProtoStreamObjectSource::renderers_ =;
PROTOBUF_NAMESPACE_ID::internal::once_flag source_renderers_init_;


void ProtoStreamObjectSource::InitRendererMap() {}

void ProtoStreamObjectSource::DeleteRendererMap() {}

// static
ProtoStreamObjectSource::TypeRenderer*
ProtoStreamObjectSource::FindTypeRenderer(const std::string& type_url) {}

util::Status ProtoStreamObjectSource::RenderField(
    const google::protobuf::Field* field, StringPiece field_name,
    ObjectWriter* ow) const {}

util::Status ProtoStreamObjectSource::RenderNonMessageField(
    const google::protobuf::Field* field, StringPiece field_name,
    ObjectWriter* ow) const {}

// TODO(skarvaje): Fix this to avoid code duplication.
const std::string ProtoStreamObjectSource::ReadFieldValueAsString(
    const google::protobuf::Field& field) const {}

// Field is a map if it is a repeated message and it has an option "map_type".
// TODO(skarvaje): Consider pre-computing the IsMap() into Field directly.
bool ProtoStreamObjectSource::IsMap(
    const google::protobuf::Field& field) const {}

std::pair<int64_t, int32_t> ProtoStreamObjectSource::ReadSecondsAndNanos(
    const google::protobuf::Type& type) const {}

util::Status ProtoStreamObjectSource::IncrementRecursionDepth(
    StringPiece type_name, StringPiece field_name) const {}

namespace {
// TODO(skarvaje): Speed this up by not doing a linear scan.
const google::protobuf::Field* FindFieldByNumber(
    const google::protobuf::Type& type, int number) {}

// TODO(skarvaje): Replace FieldDescriptor by implementing IsTypePackable()
// using tech Field.
bool IsPackable(const google::protobuf::Field& field) {}

// TODO(skarvaje): Speed this up by not doing a linear scan.
const google::protobuf::EnumValue* FindEnumValueByNumber(
    const google::protobuf::Enum& tech_enum, int number) {}

// TODO(skarvaje): Look into optimizing this by not doing computation on
// double.
const std::string FormatNanos(uint32_t nanos, bool with_trailing_zeros) {}
}  // namespace

}  // namespace converter
}  // namespace util
}  // namespace protobuf
}  // namespace google