aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/dynamic_message.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/dynamic_message.h')
-rw-r--r--src/google/protobuf/dynamic_message.h28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/google/protobuf/dynamic_message.h b/src/google/protobuf/dynamic_message.h
index d84cc8af..1ea6f66f 100644
--- a/src/google/protobuf/dynamic_message.h
+++ b/src/google/protobuf/dynamic_message.h
@@ -43,9 +43,15 @@
#include <vector>
#include <google/protobuf/message.h>
+#include <google/protobuf/stubs/mutex.h>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/stubs/mutex.h>
+
+#ifdef SWIG
+#error "You cannot SWIG proto headers"
+#endif
+
+#include <google/protobuf/port_def.inc>
namespace google {
namespace protobuf {
@@ -71,7 +77,7 @@ class DescriptorPool; // descriptor.h
// encapsulates this "cache". All DynamicMessages of the same type created
// from the same factory will share the same support data. Any Descriptors
// used with a particular factory must outlive the factory.
-class LIBPROTOBUF_EXPORT DynamicMessageFactory : public MessageFactory {
+class PROTOBUF_EXPORT DynamicMessageFactory : public MessageFactory {
public:
// Construct a DynamicMessageFactory that will search for extensions in
// the DescriptorPool in which the extendee is defined.
@@ -115,20 +121,20 @@ class LIBPROTOBUF_EXPORT DynamicMessageFactory : public MessageFactory {
// outlive the DynamicMessageFactory.
//
// The method is thread-safe.
- const Message* GetPrototype(const Descriptor* type);
+ const Message* GetPrototype(const Descriptor* type) override;
private:
const DescriptorPool* pool_;
bool delegate_to_generated_factory_;
- // This struct just contains a hash_map. We can't #include <google/protobuf/stubs/hash.h> from
+ // This struct just contains a hash_map. We can't #include <hash_map> from
// this header due to hacks needed for hash_map portability in the open source
// release. Namely, stubs/hash.h, which defines hash_map portably, is not a
// public header (for good reason), but dynamic_message.h is, and public
// headers may only #include other public headers.
struct PrototypeMap;
std::unique_ptr<PrototypeMap> prototypes_;
- mutable Mutex prototypes_mutex_;
+ mutable internal::WrappedMutex prototypes_mutex_;
friend class DynamicMessage;
const Message* GetPrototypeNoLock(const Descriptor* type);
@@ -147,7 +153,7 @@ class LIBPROTOBUF_EXPORT DynamicMessageFactory : public MessageFactory {
};
// Helper for computing a sorted list of map entries via reflection.
-class LIBPROTOBUF_EXPORT DynamicMapSorter {
+class PROTOBUF_EXPORT DynamicMapSorter {
public:
static std::vector<const Message*> Sort(const Message& message,
int map_size,
@@ -178,7 +184,7 @@ class LIBPROTOBUF_EXPORT DynamicMapSorter {
}
private:
- class LIBPROTOBUF_EXPORT MapEntryMessageComparator {
+ class PROTOBUF_EXPORT MapEntryMessageComparator {
public:
explicit MapEntryMessageComparator(const Descriptor* descriptor)
: field_(descriptor->field(0)) {}
@@ -212,8 +218,8 @@ class LIBPROTOBUF_EXPORT DynamicMapSorter {
return first < second;
}
case FieldDescriptor::CPPTYPE_STRING: {
- string first = reflection->GetString(*a, field_);
- string second = reflection->GetString(*b, field_);
+ std::string first = reflection->GetString(*a, field_);
+ std::string second = reflection->GetString(*b, field_);
return first < second;
}
default:
@@ -228,6 +234,8 @@ class LIBPROTOBUF_EXPORT DynamicMapSorter {
};
} // namespace protobuf
-
} // namespace google
+
+#include <google/protobuf/port_undef.inc>
+
#endif // GOOGLE_PROTOBUF_DYNAMIC_MESSAGE_H__