1 // Protocol Buffers - Google's data interchange format 2 // Copyright 2008 Google Inc. All rights reserved. 3 // 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file or at 6 // https://developers.google.com/open-source/licenses/bsd 7 8 // Author: anuraag@google.com (Anuraag Agrawal) 9 // Author: tibell@google.com (Johan Tibell) 10 11 #ifndef GOOGLE_PROTOBUF_PYTHON_CPP_REPEATED_SCALAR_CONTAINER_H__ 12 #define GOOGLE_PROTOBUF_PYTHON_CPP_REPEATED_SCALAR_CONTAINER_H__ 13 14 #define PY_SSIZE_T_CLEAN 15 #include <Python.h> 16 17 #include "google/protobuf/descriptor.h" 18 #include "google/protobuf/pyext/message.h" 19 20 namespace google { 21 namespace protobuf { 22 namespace python { 23 24 typedef struct RepeatedScalarContainer : public ContainerBase { 25 } RepeatedScalarContainer; 26 27 extern PyTypeObject RepeatedScalarContainer_Type; 28 29 namespace repeated_scalar_container { 30 31 // Builds a RepeatedScalarContainer object, from a parent message and a 32 // field descriptor. 33 extern RepeatedScalarContainer* NewContainer( 34 CMessage* parent, const FieldDescriptor* parent_field_descriptor); 35 36 // Appends the scalar 'item' to the end of the container 'self'. 37 // 38 // Returns None if successful; returns NULL and sets an exception if 39 // unsuccessful. 40 PyObject* Append(RepeatedScalarContainer* self, PyObject* item); 41 42 // Appends all the elements in the input iterator to the container. 43 // 44 // Returns None if successful; returns NULL and sets an exception if 45 // unsuccessful. 46 PyObject* Extend(RepeatedScalarContainer* self, PyObject* value); 47 48 } // namespace repeated_scalar_container 49 } // namespace python 50 } // namespace protobuf 51 } // namespace google 52 53 #endif // GOOGLE_PROTOBUF_PYTHON_CPP_REPEATED_SCALAR_CONTAINER_H__ 54