chromium/third_party/protobuf/src/google/protobuf/message_lite.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.

// Authors: [email protected] (Wink Saville),
//          [email protected] (Kenton Varda)
//  Based on original Protocol Buffers design by
//  Sanjay Ghemawat, Jeff Dean, and others.

#include <google/protobuf/message_lite.h>

#include <climits>
#include <cstdint>
#include <string>

#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/parse_context.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
#include <google/protobuf/arena.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/generated_message_util.h>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/stubs/stl_util.h>
#include <google/protobuf/stubs/mutex.h>

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

namespace google {
namespace protobuf {

std::string MessageLite::InitializationErrorString() const {}

std::string MessageLite::DebugString() const {}

namespace {

// When serializing, we first compute the byte size, then serialize the message.
// If serialization produces a different number of bytes than expected, we
// call this function, which crashes.  The problem could be due to a bug in the
// protobuf implementation but is more likely caused by concurrent modification
// of the message.  This function attempts to distinguish between the two and
// provide a useful error message.
void ByteSizeConsistencyError(size_t byte_size_before_serialization,
                              size_t byte_size_after_serialization,
                              size_t bytes_produced_by_serialization,
                              const MessageLite& message) {}

std::string InitializationErrorMessage(const char* action,
                                       const MessageLite& message) {}

inline StringPiece as_string_view(const void* data, int size) {}

// Returns true of all required fields are present / have values.
inline bool CheckFieldPresence(const internal::ParseContext& ctx,
                               const MessageLite& msg,
                               MessageLite::ParseFlags parse_flags) {}

}  // namespace

void MessageLite::LogInitializationErrorMessage() const {}

namespace internal {

template <bool aliasing>
bool MergeFromImpl(StringPiece input, MessageLite* msg,
                   MessageLite::ParseFlags parse_flags) {}

template <bool aliasing>
bool MergeFromImpl(io::ZeroCopyInputStream* input, MessageLite* msg,
                   MessageLite::ParseFlags parse_flags) {}

template <bool aliasing>
bool MergeFromImpl(BoundedZCIS input, MessageLite* msg,
                   MessageLite::ParseFlags parse_flags) {}

template bool MergeFromImpl<false>(StringPiece input, MessageLite* msg,
                                   MessageLite::ParseFlags parse_flags);
template bool MergeFromImpl<true>(StringPiece input, MessageLite* msg,
                                  MessageLite::ParseFlags parse_flags);
template bool MergeFromImpl<false>(io::ZeroCopyInputStream* input,
                                   MessageLite* msg,
                                   MessageLite::ParseFlags parse_flags);
template bool MergeFromImpl<true>(io::ZeroCopyInputStream* input,
                                  MessageLite* msg,
                                  MessageLite::ParseFlags parse_flags);
template bool MergeFromImpl<false>(BoundedZCIS input, MessageLite* msg,
                                   MessageLite::ParseFlags parse_flags);
template bool MergeFromImpl<true>(BoundedZCIS input, MessageLite* msg,
                                  MessageLite::ParseFlags parse_flags);

}  // namespace internal

class ZeroCopyCodedInputStream : public io::ZeroCopyInputStream {};

bool MessageLite::MergeFromImpl(io::CodedInputStream* input,
                                MessageLite::ParseFlags parse_flags) {}

bool MessageLite::MergePartialFromCodedStream(io::CodedInputStream* input) {}

bool MessageLite::MergeFromCodedStream(io::CodedInputStream* input) {}

bool MessageLite::ParseFromCodedStream(io::CodedInputStream* input) {}

bool MessageLite::ParsePartialFromCodedStream(io::CodedInputStream* input) {}

bool MessageLite::ParseFromZeroCopyStream(io::ZeroCopyInputStream* input) {}

bool MessageLite::ParsePartialFromZeroCopyStream(
    io::ZeroCopyInputStream* input) {}

bool MessageLite::ParseFromFileDescriptor(int file_descriptor) {}

bool MessageLite::ParsePartialFromFileDescriptor(int file_descriptor) {}

bool MessageLite::ParseFromIstream(std::istream* input) {}

bool MessageLite::ParsePartialFromIstream(std::istream* input) {}

bool MessageLite::MergePartialFromBoundedZeroCopyStream(
    io::ZeroCopyInputStream* input, int size) {}

bool MessageLite::MergeFromBoundedZeroCopyStream(io::ZeroCopyInputStream* input,
                                                 int size) {}

bool MessageLite::ParseFromBoundedZeroCopyStream(io::ZeroCopyInputStream* input,
                                                 int size) {}

bool MessageLite::ParsePartialFromBoundedZeroCopyStream(
    io::ZeroCopyInputStream* input, int size) {}

bool MessageLite::ParseFromString(ConstStringParam data) {}

bool MessageLite::ParsePartialFromString(ConstStringParam data) {}

bool MessageLite::ParseFromArray(const void* data, int size) {}

bool MessageLite::ParsePartialFromArray(const void* data, int size) {}

bool MessageLite::MergeFromString(ConstStringParam data) {}


// ===================================================================

inline uint8_t* SerializeToArrayImpl(const MessageLite& msg, uint8_t* target,
                                     int size) {}

uint8_t* MessageLite::SerializeWithCachedSizesToArray(uint8_t* target) const {}

bool MessageLite::SerializeToCodedStream(io::CodedOutputStream* output) const {}

bool MessageLite::SerializePartialToCodedStream(
    io::CodedOutputStream* output) const {}

bool MessageLite::SerializeToZeroCopyStream(
    io::ZeroCopyOutputStream* output) const {}

bool MessageLite::SerializePartialToZeroCopyStream(
    io::ZeroCopyOutputStream* output) const {}

bool MessageLite::SerializeToFileDescriptor(int file_descriptor) const {}

bool MessageLite::SerializePartialToFileDescriptor(int file_descriptor) const {}

bool MessageLite::SerializeToOstream(std::ostream* output) const {}

bool MessageLite::SerializePartialToOstream(std::ostream* output) const {}

bool MessageLite::AppendToString(std::string* output) const {}

bool MessageLite::AppendPartialToString(std::string* output) const {}

bool MessageLite::SerializeToString(std::string* output) const {}

bool MessageLite::SerializePartialToString(std::string* output) const {}

bool MessageLite::SerializeToArray(void* data, int size) const {}

bool MessageLite::SerializePartialToArray(void* data, int size) const {}

std::string MessageLite::SerializeAsString() const {}

std::string MessageLite::SerializePartialAsString() const {}


namespace internal {

MessageLite* NewFromPrototypeHelper(const MessageLite* prototype,
                                    Arena* arena) {}
template <>
void GenericTypeHandler<MessageLite>::Merge(const MessageLite& from,
                                            MessageLite* to) {}
template <>
void GenericTypeHandler<std::string>::Merge(const std::string& from,
                                            std::string* to) {}

// Non-inline implementations of InternalMetadata destructor
// This is moved out of the header because the GOOGLE_DCHECK produces a lot of code.
void InternalMetadata::CheckedDestruct() {}

// Non-inline variants of std::string specializations for
// various InternalMetadata routines.
template <>
void InternalMetadata::DoClear<std::string>() {}

template <>
void InternalMetadata::DoMergeFrom<std::string>(const std::string& other) {}

template <>
void InternalMetadata::DoSwap<std::string>(std::string* other) {}

}  // namespace internal


// ===================================================================
// Shutdown support.

namespace internal {

struct ShutdownData {};

static void RunZeroArgFunc(const void* arg) {}

void OnShutdown(void (*func)()) {}

void OnShutdownRun(void (*f)(const void*), const void* arg) {}

}  // namespace internal

void ShutdownProtobufLibrary() {}


}  // namespace protobuf
}  // namespace google

#include <google/protobuf/port_undef.inc>