Eric Snow | 96c6af9 | 2015-05-29 22:21:39 -0600 | [diff] [blame] | 1 | #ifndef Py_ODICTOBJECT_H |
| 2 | #define Py_ODICTOBJECT_H |
| 3 | #ifdef __cplusplus |
| 4 | extern "C" { |
| 5 | #endif |
| 6 | |
| 7 | |
| 8 | /* OrderedDict */ |
| 9 | |
| 10 | #ifndef Py_LIMITED_API |
| 11 | |
| 12 | typedef struct _odictobject PyODictObject; |
| 13 | |
| 14 | PyAPI_DATA(PyTypeObject) PyODict_Type; |
| 15 | PyAPI_DATA(PyTypeObject) PyODictIter_Type; |
| 16 | PyAPI_DATA(PyTypeObject) PyODictKeys_Type; |
| 17 | PyAPI_DATA(PyTypeObject) PyODictItems_Type; |
| 18 | PyAPI_DATA(PyTypeObject) PyODictValues_Type; |
| 19 | |
Eric Snow | 8c7ed01 | 2015-05-30 09:29:53 -0600 | [diff] [blame] | 20 | #define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type) |
Eric Snow | 96c6af9 | 2015-05-29 22:21:39 -0600 | [diff] [blame] | 21 | #define PyODict_CheckExact(op) (Py_TYPE(op) == &PyODict_Type) |
Serhiy Storchaka | 5ab81d7 | 2016-12-16 16:18:57 +0200 | [diff] [blame] | 22 | #define PyODict_SIZE(op) PyDict_GET_SIZE((op)) |
Serhiy Storchaka | 34d0ac8 | 2016-12-27 14:57:39 +0200 | [diff] [blame] | 23 | |
| 24 | #endif /* Py_LIMITED_API */ |
| 25 | |
| 26 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 |
Eric Snow | 96c6af9 | 2015-05-29 22:21:39 -0600 | [diff] [blame] | 27 | |
| 28 | PyAPI_FUNC(PyObject *) PyODict_New(void); |
| 29 | PyAPI_FUNC(int) PyODict_SetItem(PyObject *od, PyObject *key, PyObject *item); |
| 30 | PyAPI_FUNC(int) PyODict_DelItem(PyObject *od, PyObject *key); |
| 31 | |
| 32 | /* wrappers around PyDict* functions */ |
| 33 | #define PyODict_GetItem(od, key) PyDict_GetItem((PyObject *)od, key) |
Eric Snow | a762af7 | 2015-06-01 22:59:08 -0600 | [diff] [blame] | 34 | #define PyODict_GetItemWithError(od, key) \ |
| 35 | PyDict_GetItemWithError((PyObject *)od, key) |
Eric Snow | 96c6af9 | 2015-05-29 22:21:39 -0600 | [diff] [blame] | 36 | #define PyODict_Contains(od, key) PyDict_Contains((PyObject *)od, key) |
| 37 | #define PyODict_Size(od) PyDict_Size((PyObject *)od) |
| 38 | #define PyODict_GetItemString(od, key) \ |
| 39 | PyDict_GetItemString((PyObject *)od, key) |
Eric Snow | 96c6af9 | 2015-05-29 22:21:39 -0600 | [diff] [blame] | 40 | |
Serhiy Storchaka | 34d0ac8 | 2016-12-27 14:57:39 +0200 | [diff] [blame] | 41 | #endif |
| 42 | |
Eric Snow | 96c6af9 | 2015-05-29 22:21:39 -0600 | [diff] [blame] | 43 | #ifdef __cplusplus |
| 44 | } |
| 45 | #endif |
| 46 | #endif /* !Py_ODICTOBJECT_H */ |