39 #ifndef GOOGLE_PROTOBUF_MESSAGE_LITE_H__
40 #define GOOGLE_PROTOBUF_MESSAGE_LITE_H__
45 #include <google/protobuf/stubs/common.h>
46 #include <google/protobuf/stubs/logging.h>
47 #include <google/protobuf/io/coded_stream.h>
49 #include <google/protobuf/metadata_lite.h>
50 #include <google/protobuf/stubs/once.h>
51 #include <google/protobuf/port.h>
52 #include <google/protobuf/stubs/strutil.h>
55 #include <google/protobuf/port_def.inc>
58 #error "You cannot SWIG proto headers"
69 class CodedInputStream;
70 class CodedOutputStream;
71 class ZeroCopyInputStream;
72 class ZeroCopyOutputStream;
80 class RepeatedPtrFieldBase;
91 inline int ToCachedSize(
size_t size) {
return static_cast<int>(size); }
100 return static_cast<unsigned int>(size);
107 GOOGLE_DCHECK_LE(size,
static_cast<size_t>(INT_MAX));
108 return static_cast<int>(size);
124 template <
typename T>
129 template <
typename... Args>
131 new (&union_) T(std::forward<Args>(args)...);
136 constexpr
const T&
get()
const {
return reinterpret_cast<const T&
>(union_); }
142 char space[
sizeof(T)];
143 int64 align_to_int64;
150 PROTOBUF_EXPORT
extern ExplicitlyConstructed<std::string>
211 Arena*
GetArena()
const {
return _internal_metadata_.arena(); }
223 return _internal_metadata_.raw_arena_ptr();
407 PROTOBUF_DEPRECATED_MSG(
"Please use ByteSizeLong() instead")
414 output->SetCur(_InternalSerialize(output->Cur(), output->EpsCopy()));
443 internal::ParseContext* ) {
448 template <
typename T>
450 return Arena::CreateMaybeMessage<T>(arena);
453 inline explicit MessageLite(Arena* arena) : _internal_metadata_(arena) {}
463 kMergeWithAliasing = 4,
464 kParseWithAliasing = 5,
465 kMergePartialWithAliasing = 6,
466 kParsePartialWithAliasing = 7
469 template <ParseFlags flags,
typename T>
470 bool ParseFrom(
const T& input);
475 io::EpsCopyOutputStream* stream)
const = 0;
479 if (IsInitialized())
return true;
480 LogInitializationErrorMessage();
486 virtual const void* InternalGetTable()
const {
return NULL; }
488 friend class internal::WireFormatLite;
490 friend class internal::WeakFieldMap;
492 void LogInitializationErrorMessage()
const;
501 template <
bool alias>
511 template <
bool alias>
526 template <
bool alias>
534 template <
typename T>
537 template <
bool alias,
typename T>
540 return input.template MergeInto<alias>(
msg, parse_flags);
545 template <MessageLite::ParseFlags flags,
typename T>
549 return internal::MergeFromImpl<alias>(input,
this, flags);
577 PROTOBUF_EXPORT
void OnShutdownRun(
void (*f)(
const void*),
const void* arg);
579 template <
typename T>
581 OnShutdownRun([](
const void* pp) {
delete static_cast<const T*
>(pp); }, p);
589 #include <google/protobuf/port_undef.inc>
bool SerializePartialToFileDescriptor(int file_descriptor) const
bool MergeFromCodedStream(io::CodedInputStream *input)
std::string ShortDebugString() const
std::string Utf8DebugString() const
bool SerializePartialToOstream(std::ostream *output) const
bool AppendToString(std::string *output) const
bool ParsePartialFromBoundedZeroCopyStream(io::ZeroCopyInputStream *input, int size)
bool SerializePartialToArray(void *data, int size) const
void SerializeWithCachedSizes(io::CodedOutputStream *output) const
MessageLite(Arena *arena)
void * GetMaybeArenaPointer() const
virtual ~MessageLite()=default
virtual int GetCachedSize() const =0
bool ParseFromFileDescriptor(int file_descriptor)
bool ParseFromCodedStream(io::CodedInputStream *input)
bool ParsePartialFromString(const std::string &data)
bool ParsePartialFromCodedStream(io::CodedInputStream *input)
bool ParsePartialFromFileDescriptor(int file_descriptor)
virtual std::string GetTypeName() const =0
virtual MessageLite * New(Arena *arena) const
bool SerializePartialToCodedStream(io::CodedOutputStream *output) const
bool ParseFrom(const T &input)
std::string DebugString() const
virtual void CheckTypeAndMergeFrom(const MessageLite &other)=0
std::string SerializePartialAsString() const
bool IsInitializedWithErrors() const
bool SerializeToOstream(std::ostream *output) const
bool ParsePartialFromIstream(std::istream *input)
virtual uint8 * _InternalSerialize(uint8 *ptr, io::EpsCopyOutputStream *stream) const =0
bool ParsePartialFromArray(const void *data, int size)
bool MergePartialFromBoundedZeroCopyStream(io::ZeroCopyInputStream *input, int size)
bool AppendPartialToString(std::string *output) const
bool SerializeToString(std::string *output) const
bool SerializePartialToString(std::string *output) const
std::string SerializeAsString() const
bool MergeFromBoundedZeroCopyStream(io::ZeroCopyInputStream *input, int size)
bool SerializeToCodedStream(io::CodedOutputStream *output) const
bool ParseFromZeroCopyStream(io::ZeroCopyInputStream *input)
virtual std::string InitializationErrorString() const
bool ParseFromArray(const void *data, int size)
bool ParseFromBoundedZeroCopyStream(io::ZeroCopyInputStream *input, int size)
bool SerializePartialToZeroCopyStream(io::ZeroCopyOutputStream *output) const
bool SerializeToArray(void *data, int size) const
virtual MessageLite * New() const =0
static T * CreateMaybeMessage(Arena *arena)
virtual size_t ByteSizeLong() const =0
bool MergeFromString(const std::string &data)
bool ParsePartialFromZeroCopyStream(io::ZeroCopyInputStream *input)
bool SerializeToZeroCopyStream(io::ZeroCopyOutputStream *output) const
bool MergePartialFromCodedStream(io::CodedInputStream *input)
bool ParseFromIstream(std::istream *input)
bool ParseFromString(const std::string &data)
internal::InternalMetadata _internal_metadata_
virtual bool IsInitialized() const =0
virtual const char * _InternalParse(const char *, internal::ParseContext *)
bool SerializeToFileDescriptor(int file_descriptor) const
uint8 * SerializeWithCachedSizesToArray(uint8 *target) const
constexpr const T & get() const
void Construct(Args &&... args)
std::string str(TimeType value=SystemClock::now< TimeType >())
Returns the provided time (or current time if omitted) as a human-readable string.
extern ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::google::protobuf::MessageOptions, ::PROTOBUF_NAMESPACE_ID::internal::MessageTypeTraits< ::goby::GobyMessageOptions >, 11, false > msg
PROTOBUF_EXPORT size_t StringSpaceUsedExcludingSelfLong(const std::string &str)
PROTOBUF_EXPORT void OnShutdown(void(*func)())
int ToCachedSize(size_t size)
template bool MergeFromImpl< false >(StringPiece input, MessageLite *msg, MessageLite::ParseFlags parse_flags)
T * OnShutdownDelete(T *p)
bool MergeFromImpl(StringPiece input, MessageLite *msg, MessageLite::ParseFlags parse_flags)
PROTOBUF_EXPORT const std::string & GetEmptyStringAlreadyInited()
bool MergeFromImpl(const SourceWrapper< T > &input, MessageLite *msg, MessageLite::ParseFlags parse_flags)
PROTOBUF_EXPORT ExplicitlyConstructed< std::string > fixed_address_empty_string
size_t FromIntSize(int size)
template bool MergeFromImpl< true >(StringPiece input, MessageLite *msg, MessageLite::ParseFlags parse_flags)
int ToIntSize(size_t size)
PROTOBUF_EXPORT void OnShutdownRun(void(*f)(const void *), const void *arg)
PROTOBUF_EXPORT void ShutdownProtobufLibrary()
io::ZeroCopyInputStream * zcis