aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/repeated_field.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/repeated_field.h')
-rw-r--r--src/google/protobuf/repeated_field.h81
1 files changed, 41 insertions, 40 deletions
diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h
index 63062c10..42144222 100644
--- a/src/google/protobuf/repeated_field.h
+++ b/src/google/protobuf/repeated_field.h
@@ -433,7 +433,7 @@ struct TypeImplementsMergeBehavior< ::std::string> {
// // Only needs to be implemented if SpaceUsedExcludingSelf() is called.
// static int SpaceUsedLong(const Type&);
// };
-class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase {
+class PROTOBUF_EXPORT RepeatedPtrFieldBase {
protected:
RepeatedPtrFieldBase();
explicit RepeatedPtrFieldBase(Arena* arena);
@@ -501,8 +501,7 @@ class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase {
const typename TypeHandler::Type* const* data() const;
template <typename TypeHandler>
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void Swap(
- RepeatedPtrFieldBase* other);
+ PROTOBUF_ALWAYS_INLINE void Swap(RepeatedPtrFieldBase* other);
void SwapElements(int index1, int index2);
@@ -547,10 +546,10 @@ class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase {
void AddAllocatedInternal(typename TypeHandler::Type* value, std::false_type);
template <typename TypeHandler>
- GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE void AddAllocatedSlowWithCopy(
+ PROTOBUF_NOINLINE void AddAllocatedSlowWithCopy(
typename TypeHandler::Type* value, Arena* value_arena, Arena* my_arena);
template <typename TypeHandler>
- GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE void AddAllocatedSlowWithoutCopy(
+ PROTOBUF_NOINLINE void AddAllocatedSlowWithoutCopy(
typename TypeHandler::Type* value);
template <typename TypeHandler>
@@ -559,7 +558,7 @@ class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase {
typename TypeHandler::Type* ReleaseLastInternal(std::false_type);
template <typename TypeHandler>
- GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE void SwapFallback(
+ PROTOBUF_NOINLINE void SwapFallback(
RepeatedPtrFieldBase* other);
inline Arena* GetArenaNoVirtual() const {
@@ -671,7 +670,7 @@ class GenericTypeHandler {
}
static inline void Clear(GenericType* value) { value->Clear(); }
- GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
+ PROTOBUF_NOINLINE
static void Merge(const GenericType& from, GenericType* to);
static inline size_t SpaceUsedLong(const GenericType& value) {
return value.SpaceUsedLong();
@@ -708,23 +707,25 @@ template <>
void GenericTypeHandler<MessageLite>::Merge(const MessageLite& from,
MessageLite* to);
template<>
-inline void GenericTypeHandler<string>::Clear(string* value) {
+inline void GenericTypeHandler<std::string>::Clear(std::string* value) {
value->clear();
}
template<>
-void GenericTypeHandler<string>::Merge(const string& from,
- string* to);
+void GenericTypeHandler<std::string>::Merge(const std::string& from,
+ std::string* to);
// Declarations of the specialization as we cannot define them here, as the
// header that defines ProtocolMessage depends on types defined in this header.
-#define DECLARE_SPECIALIZATIONS_FOR_BASE_PROTO_TYPES(TypeName) \
- template <> LIBPROTOBUF_EXPORT \
- TypeName* GenericTypeHandler<TypeName>::NewFromPrototype( \
- const TypeName* prototype, Arena* arena); \
- template <> LIBPROTOBUF_EXPORT \
- Arena* GenericTypeHandler<TypeName>::GetArena(TypeName* value); \
- template <> LIBPROTOBUF_EXPORT \
- void* GenericTypeHandler<TypeName>::GetMaybeArenaPointer(TypeName* value);
+#define DECLARE_SPECIALIZATIONS_FOR_BASE_PROTO_TYPES(TypeName) \
+ template <> \
+ PROTOBUF_EXPORT TypeName* GenericTypeHandler<TypeName>::NewFromPrototype( \
+ const TypeName* prototype, Arena* arena); \
+ template <> \
+ PROTOBUF_EXPORT Arena* GenericTypeHandler<TypeName>::GetArena( \
+ TypeName* value); \
+ template <> \
+ PROTOBUF_EXPORT void* GenericTypeHandler<TypeName>::GetMaybeArenaPointer( \
+ TypeName* value);
// Message specialization bodies defined in message.cc. This split is necessary
// to allow proto2-lite (which includes this header) to be independent of
@@ -736,32 +737,32 @@ DECLARE_SPECIALIZATIONS_FOR_BASE_PROTO_TYPES(Message)
class StringTypeHandler {
public:
- typedef string Type;
- typedef string WeakType;
+ typedef std::string Type;
+ typedef std::string WeakType;
static const bool Moveable = std::is_move_constructible<Type>::value &&
std::is_move_assignable<Type>::value;
- static inline string* New(Arena* arena) {
- return Arena::Create<string>(arena);
+ static inline std::string* New(Arena* arena) {
+ return Arena::Create<std::string>(arena);
}
- static inline string* New(Arena* arena, string&& value) {
- return Arena::Create<string>(arena, std::move(value));
+ static inline std::string* New(Arena* arena, std::string&& value) {
+ return Arena::Create<std::string>(arena, std::move(value));
}
- static inline string* NewFromPrototype(const string*, Arena* arena) {
+ static inline std::string* NewFromPrototype(const std::string*, Arena* arena) {
return New(arena);
}
- static inline Arena* GetArena(string*) { return NULL; }
- static inline void* GetMaybeArenaPointer(string* /* value */) {
+ static inline Arena* GetArena(std::string*) { return NULL; }
+ static inline void* GetMaybeArenaPointer(std::string* /* value */) {
return NULL;
}
- static inline void Delete(string* value, Arena* arena) {
+ static inline void Delete(std::string* value, Arena* arena) {
if (arena == NULL) {
delete value;
}
}
- static inline void Clear(string* value) { value->clear(); }
- static inline void Merge(const string& from, string* to) { *to = from; }
- static size_t SpaceUsedLong(const string& value) {
+ static inline void Clear(std::string* value) { value->clear(); }
+ static inline void Merge(const std::string& from, std::string* to) { *to = from; }
+ static size_t SpaceUsedLong(const std::string& value) {
return sizeof(value) + StringSpaceUsedExcludingSelfLong(value);
}
};
@@ -1885,7 +1886,7 @@ class RepeatedPtrField<Element>::TypeHandler
};
template <>
-class RepeatedPtrField<string>::TypeHandler
+class RepeatedPtrField<std::string>::TypeHandler
: public internal::StringTypeHandler {
};
@@ -2630,14 +2631,14 @@ UnsafeArenaAllocatedRepeatedPtrFieldBackInserter(
}
// Extern declarations of common instantiations to reduce libray bloat.
-extern template class LIBPROTOBUF_EXPORT RepeatedField<bool>;
-extern template class LIBPROTOBUF_EXPORT RepeatedField<int32>;
-extern template class LIBPROTOBUF_EXPORT RepeatedField<uint32>;
-extern template class LIBPROTOBUF_EXPORT RepeatedField<int64>;
-extern template class LIBPROTOBUF_EXPORT RepeatedField<uint64>;
-extern template class LIBPROTOBUF_EXPORT RepeatedField<float>;
-extern template class LIBPROTOBUF_EXPORT RepeatedField<double>;
-extern template class LIBPROTOBUF_EXPORT RepeatedPtrField<string>;
+extern template class PROTOBUF_EXPORT RepeatedField<bool>;
+extern template class PROTOBUF_EXPORT RepeatedField<int32>;
+extern template class PROTOBUF_EXPORT RepeatedField<uint32>;
+extern template class PROTOBUF_EXPORT RepeatedField<int64>;
+extern template class PROTOBUF_EXPORT RepeatedField<uint64>;
+extern template class PROTOBUF_EXPORT RepeatedField<float>;
+extern template class PROTOBUF_EXPORT RepeatedField<double>;
+extern template class PROTOBUF_EXPORT RepeatedPtrField<std::string>;
} // namespace protobuf
} // namespace google