@ -93,16 +93,10 @@ class MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type> {
uint8_t * ptr , io : : EpsCopyOutputStream * stream ) ;
uint8_t * ptr , io : : EpsCopyOutputStream * stream ) ;
// Functions to manipulate data on memory. ========================
// Functions to manipulate data on memory. ========================
static inline const Type & GetExternalReference ( const Type * value ) ;
static inline void DeleteNoArena ( const Type * x ) ;
static inline void DeleteNoArena ( const Type * x ) ;
static constexpr TypeOnMemory Constinit ( ) ;
static constexpr TypeOnMemory Constinit ( ) ;
static inline Type * EnsureMutable ( Type * * value , Arena * arena ) ;
static inline Type * EnsureMutable ( Type * * value , Arena * arena ) ;
// Return default instance if value is not initialized when calling const
// reference accessor.
static inline const Type & DefaultIfNotInitialized ( const Type * value ) ;
// Check if all required fields have values set.
static inline bool IsInitialized ( Type * value ) ;
} ;
} ;
# define MAP_HANDLER(FieldType) \
# define MAP_HANDLER(FieldType) \
@ -126,12 +120,7 @@ class MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type> {
static inline uint8_t * Write ( int field , const MapEntryAccessorType & value , \
static inline uint8_t * Write ( int field , const MapEntryAccessorType & value , \
uint8_t * ptr , \
uint8_t * ptr , \
io : : EpsCopyOutputStream * stream ) ; \
io : : EpsCopyOutputStream * stream ) ; \
static inline const MapEntryAccessorType & GetExternalReference ( \
const TypeOnMemory & value ) ; \
static inline void DeleteNoArena ( const TypeOnMemory & x ) ; \
static inline void DeleteNoArena ( const TypeOnMemory & x ) ; \
static inline const MapEntryAccessorType & DefaultIfNotInitialized ( \
const TypeOnMemory & value ) ; \
static inline bool IsInitialized ( const TypeOnMemory & value ) ; \
static void DeleteNoArena ( TypeOnMemory & value ) ; \
static void DeleteNoArena ( TypeOnMemory & value ) ; \
static constexpr TypeOnMemory Constinit ( ) ; \
static constexpr TypeOnMemory Constinit ( ) ; \
static inline MapEntryAccessorType * EnsureMutable ( TypeOnMemory * value , \
static inline MapEntryAccessorType * EnsureMutable ( TypeOnMemory * value , \
@ -420,13 +409,6 @@ READ_METHOD(BOOL)
// Definition for message handler
// Definition for message handler
template < typename Type >
inline const Type &
MapTypeHandler < WireFormatLite : : TYPE_MESSAGE , Type > : : GetExternalReference (
const Type * value ) {
return * value ;
}
template < typename Type >
template < typename Type >
void MapTypeHandler < WireFormatLite : : TYPE_MESSAGE , Type > : : DeleteNoArena (
void MapTypeHandler < WireFormatLite : : TYPE_MESSAGE , Type > : : DeleteNoArena (
const Type * ptr ) {
const Type * ptr ) {
@ -448,29 +430,9 @@ inline Type* MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::EnsureMutable(
return * value ;
return * value ;
}
}
template < typename Type >
inline const Type &
MapTypeHandler < WireFormatLite : : TYPE_MESSAGE , Type > : : DefaultIfNotInitialized (
const Type * value ) {
return value ! = nullptr ? * value : * Type : : internal_default_instance ( ) ;
}
template < typename Type >
inline bool MapTypeHandler < WireFormatLite : : TYPE_MESSAGE , Type > : : IsInitialized (
Type * value ) {
return value ? value - > IsInitialized ( ) : false ;
}
// Definition for string/bytes handler
// Definition for string/bytes handler
# define STRING_OR_BYTES_HANDLER_FUNCTIONS(FieldType) \
# define STRING_OR_BYTES_HANDLER_FUNCTIONS(FieldType) \
template < typename Type > \
inline const typename MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , \
Type > : : MapEntryAccessorType & \
MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , \
Type > : : GetExternalReference ( const TypeOnMemory & value ) { \
return value . Get ( ) ; \
} \
template < typename Type > \
template < typename Type > \
void MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , Type > : : DeleteNoArena ( \
void MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , Type > : : DeleteNoArena ( \
TypeOnMemory & value ) { \
TypeOnMemory & value ) { \
@ -479,7 +441,7 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::IsInitialized(
template < typename Type > \
template < typename Type > \
constexpr auto \
constexpr auto \
MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , Type > : : Constinit ( ) \
MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , Type > : : Constinit ( ) \
- > TypeOnMemory { \
- > TypeOnMemory { \
return TypeOnMemory ( & internal : : fixed_address_empty_string , \
return TypeOnMemory ( & internal : : fixed_address_empty_string , \
ConstantInitialized { } ) ; \
ConstantInitialized { } ) ; \
} \
} \
@ -489,32 +451,12 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::IsInitialized(
MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , Type > : : EnsureMutable ( \
MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , Type > : : EnsureMutable ( \
TypeOnMemory * value , Arena * arena ) { \
TypeOnMemory * value , Arena * arena ) { \
return value - > Mutable ( arena ) ; \
return value - > Mutable ( arena ) ; \
} \
template < typename Type > \
inline const typename MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , \
Type > : : MapEntryAccessorType & \
MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , \
Type > : : DefaultIfNotInitialized ( const TypeOnMemory & value ) { \
return value . Get ( ) ; \
} \
template < typename Type > \
inline bool \
MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , Type > : : IsInitialized ( \
const TypeOnMemory & /* value */ ) { \
return true ; \
}
}
STRING_OR_BYTES_HANDLER_FUNCTIONS ( STRING )
STRING_OR_BYTES_HANDLER_FUNCTIONS ( STRING )
STRING_OR_BYTES_HANDLER_FUNCTIONS ( BYTES )
STRING_OR_BYTES_HANDLER_FUNCTIONS ( BYTES )
# undef STRING_OR_BYTES_HANDLER_FUNCTIONS
# undef STRING_OR_BYTES_HANDLER_FUNCTIONS
# define PRIMITIVE_HANDLER_FUNCTIONS(FieldType) \
# define PRIMITIVE_HANDLER_FUNCTIONS(FieldType) \
template < typename Type > \
inline const typename MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , \
Type > : : MapEntryAccessorType & \
MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , \
Type > : : GetExternalReference ( const TypeOnMemory & value ) { \
return value ; \
} \
template < typename Type > \
template < typename Type > \
inline void MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , \
inline void MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , \
Type > : : DeleteNoArena ( TypeOnMemory & /* x */ ) { } \
Type > : : DeleteNoArena ( TypeOnMemory & /* x */ ) { } \
@ -530,19 +472,6 @@ STRING_OR_BYTES_HANDLER_FUNCTIONS(BYTES)
MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , Type > : : EnsureMutable ( \
MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , Type > : : EnsureMutable ( \
TypeOnMemory * value , Arena * /* arena */ ) { \
TypeOnMemory * value , Arena * /* arena */ ) { \
return value ; \
return value ; \
} \
template < typename Type > \
inline const typename MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , \
Type > : : MapEntryAccessorType & \
MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , \
Type > : : DefaultIfNotInitialized ( const TypeOnMemory & value ) { \
return value ; \
} \
template < typename Type > \
inline bool \
MapTypeHandler < WireFormatLite : : TYPE_ # # FieldType , Type > : : IsInitialized ( \
const TypeOnMemory & /* value */ ) { \
return true ; \
}
}
PRIMITIVE_HANDLER_FUNCTIONS ( INT64 )
PRIMITIVE_HANDLER_FUNCTIONS ( INT64 )
PRIMITIVE_HANDLER_FUNCTIONS ( UINT64 )
PRIMITIVE_HANDLER_FUNCTIONS ( UINT64 )