| Index: third_party/protobuf/python/google/protobuf/pyext/descriptor_database.h
|
| diff --git a/third_party/protobuf/python/google/protobuf/pyext/python_descriptor.h b/third_party/protobuf/python/google/protobuf/pyext/descriptor_database.h
|
| similarity index 55%
|
| rename from third_party/protobuf/python/google/protobuf/pyext/python_descriptor.h
|
| rename to third_party/protobuf/python/google/protobuf/pyext/descriptor_database.h
|
| index 5232680f36ecfdcaa0b114621ed8741260d70342..fc71c4bcb0b5638b9b486240b5b14a17c0835fbb 100644
|
| --- a/third_party/protobuf/python/google/protobuf/pyext/python_descriptor.h
|
| +++ b/third_party/protobuf/python/google/protobuf/pyext/descriptor_database.h
|
| @@ -1,6 +1,6 @@
|
| // Protocol Buffers - Google's data interchange format
|
| // Copyright 2008 Google Inc. All rights reserved.
|
| -// http://code.google.com/p/protobuf/
|
| +// https://developers.google.com/protocol-buffers/
|
| //
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| @@ -28,60 +28,48 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -// Author: petar@google.com (Petar Petrov)
|
| -
|
| -#ifndef GOOGLE_PROTOBUF_PYTHON_DESCRIPTOR_H__
|
| -#define GOOGLE_PROTOBUF_PYTHON_DESCRIPTOR_H__
|
| +#ifndef GOOGLE_PROTOBUF_PYTHON_CPP_DESCRIPTOR_DATABASE_H__
|
| +#define GOOGLE_PROTOBUF_PYTHON_CPP_DESCRIPTOR_DATABASE_H__
|
|
|
| #include <Python.h>
|
| -#include <structmember.h>
|
| -
|
| -#include <google/protobuf/descriptor.h>
|
|
|
| -#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
|
| -typedef int Py_ssize_t;
|
| -#define PY_SSIZE_T_MAX INT_MAX
|
| -#define PY_SSIZE_T_MIN INT_MIN
|
| -#endif
|
| +#include <google/protobuf/descriptor_database.h>
|
|
|
| namespace google {
|
| namespace protobuf {
|
| namespace python {
|
|
|
| -typedef struct {
|
| - PyObject_HEAD
|
| -
|
| - // The proto2 descriptor that this object represents.
|
| - const google::protobuf::FieldDescriptor* descriptor;
|
| -
|
| - // Full name of the field (PyString).
|
| - PyObject* full_name;
|
| -
|
| - // Name of the field (PyString).
|
| - PyObject* name;
|
| -
|
| - // C++ type of the field (PyLong).
|
| - PyObject* cpp_type;
|
| -
|
| - // Name of the field (PyLong).
|
| - PyObject* label;
|
| +class PyDescriptorDatabase : public DescriptorDatabase {
|
| + public:
|
| + explicit PyDescriptorDatabase(PyObject* py_database);
|
| + ~PyDescriptorDatabase();
|
|
|
| - // Identity of the descriptor (PyLong used as a poiner).
|
| - PyObject* id;
|
| -} CFieldDescriptor;
|
| + // Implement the abstract interface. All these functions fill the output
|
| + // with a copy of FileDescriptorProto.
|
|
|
| -extern PyTypeObject CFieldDescriptor_Type;
|
| + // Find a file by file name.
|
| + bool FindFileByName(const string& filename,
|
| + FileDescriptorProto* output);
|
|
|
| -extern PyTypeObject CDescriptorPool_Type;
|
| + // Find the file that declares the given fully-qualified symbol name.
|
| + bool FindFileContainingSymbol(const string& symbol_name,
|
| + FileDescriptorProto* output);
|
|
|
| + // Find the file which defines an extension extending the given message type
|
| + // with the given field number.
|
| + // Containing_type must be a fully-qualified type name.
|
| + // Python objects are not required to implement this method.
|
| + bool FindFileContainingExtension(const string& containing_type,
|
| + int field_number,
|
| + FileDescriptorProto* output);
|
|
|
| -PyObject* Python_NewCDescriptorPool(PyObject* ignored, PyObject* args);
|
| -PyObject* Python_BuildFile(PyObject* ignored, PyObject* args);
|
| -bool InitDescriptor();
|
| -google::protobuf::DescriptorPool* GetDescriptorPool();
|
| + private:
|
| + // The python object that implements the database. The reference is owned.
|
| + PyObject* py_database_;
|
| +};
|
|
|
| } // namespace python
|
| } // namespace protobuf
|
|
|
| } // namespace google
|
| -#endif // GOOGLE_PROTOBUF_PYTHON_DESCRIPTOR_H__
|
| +#endif // GOOGLE_PROTOBUF_PYTHON_CPP_DESCRIPTOR_DATABASE_H__
|
|
|