aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/reflection.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/reflection.h')
-rw-r--r--[-rwxr-xr-x]src/google/protobuf/reflection.h26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/google/protobuf/reflection.h b/src/google/protobuf/reflection.h
index 5d0fc42b..094701f7 100755..100644
--- a/src/google/protobuf/reflection.h
+++ b/src/google/protobuf/reflection.h
@@ -38,6 +38,12 @@
#include <google/protobuf/message.h>
#include <google/protobuf/generated_enum_util.h>
+#ifdef SWIG
+#error "You cannot SWIG proto headers"
+#endif
+
+#include <google/protobuf/port_def.inc>
+
namespace google {
namespace protobuf {
namespace internal {
@@ -340,14 +346,13 @@ namespace internal {
//
// You can map from T to the actual type using RefTypeTraits:
// typedef RefTypeTraits<T>::AccessorValueType ActualType;
-class LIBPROTOBUF_EXPORT RepeatedFieldAccessor {
+class PROTOBUF_EXPORT RepeatedFieldAccessor {
public:
// Typedefs for clarity.
typedef void Field;
typedef void Value;
typedef void Iterator;
- virtual ~RepeatedFieldAccessor();
virtual bool IsEmpty(const Field* data) const = 0;
virtual int Size(const Field* data) const = 0;
// Depends on the underlying representation of the repeated field, this
@@ -425,6 +430,13 @@ class LIBPROTOBUF_EXPORT RepeatedFieldAccessor {
ActualType tmp = static_cast<ActualType>(value);
Add(data, static_cast<const Value*>(&tmp));
}
+
+ protected:
+ // We want the destructor to be completely trivial as to allow it to be
+ // a function local static. Hence we make it non-virtual and protected,
+ // this class only live as part of a global singleton and should not be
+ // deleted.
+ ~RepeatedFieldAccessor() = default;
};
// Implement (Mutable)RepeatedFieldRef::iterator
@@ -563,12 +575,12 @@ struct RefTypeTraits<
template<typename T>
struct RefTypeTraits<
- T, typename std::enable_if<std::is_same<string, T>::value>::type> {
+ T, typename std::enable_if<std::is_same<std::string, T>::value>::type> {
typedef RepeatedFieldRefIterator<T> iterator;
typedef RepeatedFieldAccessor AccessorType;
- typedef string AccessorValueType;
- typedef const string IteratorValueType;
- typedef const string* IteratorPointerType;
+ typedef std::string AccessorValueType;
+ typedef const std::string IteratorValueType;
+ typedef const std::string* IteratorPointerType;
static const FieldDescriptor::CppType cpp_type =
FieldDescriptor::CPPTYPE_STRING;
static const Descriptor* GetMessageFieldDescriptor() {
@@ -607,4 +619,6 @@ struct RefTypeTraits<
} // namespace protobuf
} // namespace google
+#include <google/protobuf/port_undef.inc>
+
#endif // GOOGLE_PROTOBUF_REFLECTION_H__