diff options
Diffstat (limited to 'python/google/protobuf/pyext/repeated_composite_container.h')
-rw-r--r-- | python/google/protobuf/pyext/repeated_composite_container.h | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/python/google/protobuf/pyext/repeated_composite_container.h b/python/google/protobuf/pyext/repeated_composite_container.h index a7b56b61..e5e946aa 100644 --- a/python/google/protobuf/pyext/repeated_composite_container.h +++ b/python/google/protobuf/pyext/repeated_composite_container.h @@ -37,27 +37,19 @@ #include <Python.h> #include <memory> -#ifndef _SHARED_PTR_H -#include <google/protobuf/stubs/shared_ptr.h> -#endif #include <string> #include <vector> +#include <google/protobuf/pyext/message.h> + namespace google { namespace protobuf { class FieldDescriptor; class Message; -#ifdef _SHARED_PTR_H -using std::shared_ptr; -#else -using internal::shared_ptr; -#endif - namespace python { -struct CMessage; struct CMessageClass; // A RepeatedCompositeContainer can be in one of two states: attached @@ -77,7 +69,7 @@ typedef struct RepeatedCompositeContainer { // proto tree. Every Python RepeatedCompositeContainer holds a // reference to it in order to keep it alive as long as there's a // Python object that references any part of the tree. - shared_ptr<Message> owner; + CMessage::OwnerRef owner; // Weak reference to parent object. May be NULL. Used to make sure // the parent is writable before modifying the @@ -148,11 +140,6 @@ int AssignSubscript(RepeatedCompositeContainer* self, PyObject* slice, PyObject* value); -// Releases the messages in the container to the given message. -// -// Returns 0 on success, -1 on failure. -int ReleaseToMessage(RepeatedCompositeContainer* self, Message* new_message); - // Releases the messages in the container to a new message. // // Returns 0 on success, -1 on failure. @@ -160,7 +147,7 @@ int Release(RepeatedCompositeContainer* self); // Returns 0 on success, -1 on failure. int SetOwner(RepeatedCompositeContainer* self, - const shared_ptr<Message>& new_owner); + const CMessage::OwnerRef& new_owner); // Removes the last element of the repeated message field 'field' on // the Message 'parent', and transfers the ownership of the released |