OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 }; | 105 }; |
106 | 106 |
107 struct MessageMapContainer : public MapContainer { | 107 struct MessageMapContainer : public MapContainer { |
108 // The type used to create new child messages. | 108 // The type used to create new child messages. |
109 CMessageClass* message_class; | 109 CMessageClass* message_class; |
110 | 110 |
111 // A dict mapping Message* -> CMessage. | 111 // A dict mapping Message* -> CMessage. |
112 PyObject* message_dict; | 112 PyObject* message_dict; |
113 }; | 113 }; |
114 | 114 |
115 #if PY_MAJOR_VERSION >= 3 | 115 bool InitMapContainers(); |
116 extern PyObject *MessageMapContainer_Type; | |
117 extern PyType_Spec MessageMapContainer_Type_spec; | |
118 extern PyObject *ScalarMapContainer_Type; | |
119 extern PyType_Spec ScalarMapContainer_Type_spec; | |
120 #else | |
121 extern PyTypeObject MessageMapContainer_Type; | |
122 extern PyTypeObject ScalarMapContainer_Type; | |
123 #endif | |
124 | 116 |
| 117 extern PyTypeObject* MessageMapContainer_Type; |
| 118 extern PyTypeObject* ScalarMapContainer_Type; |
125 extern PyTypeObject MapIterator_Type; // Both map types use the same iterator. | 119 extern PyTypeObject MapIterator_Type; // Both map types use the same iterator. |
126 | 120 |
127 // Builds a MapContainer object, from a parent message and a | 121 // Builds a MapContainer object, from a parent message and a |
128 // field descriptor. | 122 // field descriptor. |
129 extern PyObject* NewScalarMapContainer( | 123 extern PyObject* NewScalarMapContainer( |
130 CMessage* parent, const FieldDescriptor* parent_field_descriptor); | 124 CMessage* parent, const FieldDescriptor* parent_field_descriptor); |
131 | 125 |
132 // Builds a MessageMap object, from a parent message and a | 126 // Builds a MessageMap object, from a parent message and a |
133 // field descriptor. | 127 // field descriptor. |
134 extern PyObject* NewMessageMapContainer( | 128 extern PyObject* NewMessageMapContainer( |
135 CMessage* parent, const FieldDescriptor* parent_field_descriptor, | 129 CMessage* parent, const FieldDescriptor* parent_field_descriptor, |
136 CMessageClass* message_class); | 130 CMessageClass* message_class); |
137 | 131 |
138 } // namespace python | 132 } // namespace python |
139 } // namespace protobuf | 133 } // namespace protobuf |
140 | 134 |
141 } // namespace google | 135 } // namespace google |
142 #endif // GOOGLE_PROTOBUF_PYTHON_CPP_MAP_CONTAINER_H__ | 136 #endif // GOOGLE_PROTOBUF_PYTHON_CPP_MAP_CONTAINER_H__ |
OLD | NEW |