|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef GOOGLE_PROTOBUF_GENERATED_MESSAGE_TABLE_DRIVEN_H__
|
|
|
#define GOOGLE_PROTOBUF_GENERATED_MESSAGE_TABLE_DRIVEN_H__
|
|
|
|
|
|
#include <google/protobuf/map.h>
|
|
|
#include <google/protobuf/map_entry_lite.h>
|
|
|
#include <google/protobuf/map_field_lite.h>
|
|
|
#include <google/protobuf/message_lite.h>
|
|
|
#include <google/protobuf/wire_format_lite.h>
|
|
|
#include <google/protobuf/wire_format_lite_inl.h>
|
|
|
|
|
|
#if LANG_CXX11
|
|
|
#define PROTOBUF_CONSTEXPR constexpr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(__clang__) || (defined(_MSC_VER) && _MSC_VER >= 1911)
|
|
|
#define PROTOBUF_CONSTEXPR_VAR constexpr
|
|
|
#else
|
|
|
#define PROTOBUF_CONSTEXPR_VAR
|
|
|
#endif
|
|
|
|
|
|
#else
|
|
|
#define PROTOBUF_CONSTEXPR
|
|
|
#define PROTOBUF_CONSTEXPR_VAR
|
|
|
#endif
|
|
|
|
|
|
namespace google {
|
|
|
namespace protobuf {
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
|
static PROTOBUF_CONSTEXPR const unsigned char kOneofMask = 0x40;
|
|
|
static PROTOBUF_CONSTEXPR const unsigned char kRepeatedMask = 0x20;
|
|
|
|
|
|
|
|
|
static PROTOBUF_CONSTEXPR const unsigned char kTypeMask = 0x1f;
|
|
|
|
|
|
|
|
|
static PROTOBUF_CONSTEXPR const unsigned char kNotPackedMask = 0x10;
|
|
|
static PROTOBUF_CONSTEXPR const unsigned char kInvalidMask = 0x20;
|
|
|
|
|
|
enum ProcessingTypes {
|
|
|
TYPE_STRING_CORD = 19,
|
|
|
TYPE_STRING_STRING_PIECE = 20,
|
|
|
TYPE_BYTES_CORD = 21,
|
|
|
TYPE_BYTES_STRING_PIECE = 22,
|
|
|
TYPE_MAP = 23,
|
|
|
};
|
|
|
|
|
|
#if LANG_CXX11
|
|
|
static_assert(TYPE_MAP < kRepeatedMask, "Invalid enum");
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct ParseTableField {
|
|
|
uint32 offset;
|
|
|
|
|
|
|
|
|
uint32 presence_index;
|
|
|
unsigned char normal_wiretype;
|
|
|
unsigned char packed_wiretype;
|
|
|
|
|
|
|
|
|
|
|
|
unsigned char processing_type;
|
|
|
|
|
|
unsigned char tag_size;
|
|
|
};
|
|
|
|
|
|
struct ParseTable;
|
|
|
|
|
|
union AuxillaryParseTableField {
|
|
|
typedef bool (*EnumValidator)(int);
|
|
|
|
|
|
|
|
|
struct enum_aux {
|
|
|
EnumValidator validator;
|
|
|
};
|
|
|
enum_aux enums;
|
|
|
|
|
|
struct message_aux {
|
|
|
|
|
|
|
|
|
|
|
|
const void* default_message_void;
|
|
|
const MessageLite* default_message() const {
|
|
|
return static_cast<const MessageLite*>(default_message_void);
|
|
|
}
|
|
|
const ParseTable* parse_table;
|
|
|
};
|
|
|
message_aux messages;
|
|
|
|
|
|
struct string_aux {
|
|
|
const void* default_ptr;
|
|
|
const char* field_name;
|
|
|
};
|
|
|
string_aux strings;
|
|
|
|
|
|
struct map_aux {
|
|
|
bool (*parse_map)(io::CodedInputStream*, void*);
|
|
|
};
|
|
|
map_aux maps;
|
|
|
|
|
|
#if LANG_CXX11
|
|
|
AuxillaryParseTableField() = default;
|
|
|
#else
|
|
|
AuxillaryParseTableField() { }
|
|
|
#endif
|
|
|
PROTOBUF_CONSTEXPR AuxillaryParseTableField(
|
|
|
AuxillaryParseTableField::enum_aux e) : enums(e) {}
|
|
|
PROTOBUF_CONSTEXPR AuxillaryParseTableField(
|
|
|
AuxillaryParseTableField::message_aux m) : messages(m) {}
|
|
|
PROTOBUF_CONSTEXPR AuxillaryParseTableField(
|
|
|
AuxillaryParseTableField::string_aux s) : strings(s) {}
|
|
|
PROTOBUF_CONSTEXPR AuxillaryParseTableField(
|
|
|
AuxillaryParseTableField::map_aux m)
|
|
|
: maps(m) {}
|
|
|
};
|
|
|
|
|
|
struct ParseTable {
|
|
|
const ParseTableField* fields;
|
|
|
const AuxillaryParseTableField* aux;
|
|
|
int max_field_number;
|
|
|
|
|
|
|
|
|
|
|
|
int64 has_bits_offset;
|
|
|
int64 oneof_case_offset;
|
|
|
int64 extension_offset;
|
|
|
int64 arena_offset;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const void* default_instance_void;
|
|
|
const MessageLite* default_instance() const {
|
|
|
return static_cast<const MessageLite*>(default_instance_void);
|
|
|
}
|
|
|
|
|
|
bool unknown_field_set;
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#if LANG_CXX11 && !defined(__NVCC__)
|
|
|
static_assert(sizeof(ParseTableField) <= 16, "ParseTableField is too large");
|
|
|
|
|
|
|
|
|
static_assert(std::is_pod<ParseTableField>::value, "");
|
|
|
static_assert(std::is_pod<AuxillaryParseTableField>::value, "");
|
|
|
static_assert(std::is_pod<AuxillaryParseTableField::enum_aux>::value, "");
|
|
|
static_assert(std::is_pod<AuxillaryParseTableField::message_aux>::value, "");
|
|
|
static_assert(std::is_pod<AuxillaryParseTableField::string_aux>::value, "");
|
|
|
static_assert(std::is_pod<ParseTable>::value, "");
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
bool MergePartialFromCodedStream(MessageLite* msg, const ParseTable& table,
|
|
|
io::CodedInputStream* input);
|
|
|
bool MergePartialFromCodedStreamLite(MessageLite* msg, const ParseTable& table,
|
|
|
io::CodedInputStream* input);
|
|
|
|
|
|
template <typename Entry>
|
|
|
bool ParseMap(io::CodedInputStream* input, void* map_field) {
|
|
|
typedef typename MapEntryToMapField<Entry>::MapFieldType MapFieldType;
|
|
|
typedef google::protobuf::Map<typename Entry::EntryKeyType,
|
|
|
typename Entry::EntryValueType>
|
|
|
MapType;
|
|
|
typedef typename Entry::template Parser<MapFieldType, MapType> ParserType;
|
|
|
|
|
|
ParserType parser(static_cast<MapFieldType*>(map_field));
|
|
|
return ::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(input,
|
|
|
&parser);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
#endif
|
|
|
|