blob: 8378dc4bfa45b4c3b573dd274719e09237b9f25d [file] [log] [blame]
Eric Snow96c6af92015-05-29 22:21:39 -06001#ifndef Py_ODICTOBJECT_H
2#define Py_ODICTOBJECT_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7
8/* OrderedDict */
Serhiy Storchaka1b3029a2017-12-25 02:08:42 +02009/* This API is optional and mostly redundant. */
Eric Snow96c6af92015-05-29 22:21:39 -060010
11#ifndef Py_LIMITED_API
12
13typedef struct _odictobject PyODictObject;
14
15PyAPI_DATA(PyTypeObject) PyODict_Type;
16PyAPI_DATA(PyTypeObject) PyODictIter_Type;
17PyAPI_DATA(PyTypeObject) PyODictKeys_Type;
18PyAPI_DATA(PyTypeObject) PyODictItems_Type;
19PyAPI_DATA(PyTypeObject) PyODictValues_Type;
20
Eric Snow8c7ed012015-05-30 09:29:53 -060021#define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type)
Eric Snow96c6af92015-05-29 22:21:39 -060022#define PyODict_CheckExact(op) (Py_TYPE(op) == &PyODict_Type)
Serhiy Storchaka5ab81d72016-12-16 16:18:57 +020023#define PyODict_SIZE(op) PyDict_GET_SIZE((op))
Serhiy Storchaka34d0ac82016-12-27 14:57:39 +020024
Eric Snow96c6af92015-05-29 22:21:39 -060025PyAPI_FUNC(PyObject *) PyODict_New(void);
26PyAPI_FUNC(int) PyODict_SetItem(PyObject *od, PyObject *key, PyObject *item);
27PyAPI_FUNC(int) PyODict_DelItem(PyObject *od, PyObject *key);
28
29/* wrappers around PyDict* functions */
30#define PyODict_GetItem(od, key) PyDict_GetItem((PyObject *)od, key)
Eric Snowa762af72015-06-01 22:59:08 -060031#define PyODict_GetItemWithError(od, key) \
32 PyDict_GetItemWithError((PyObject *)od, key)
Eric Snow96c6af92015-05-29 22:21:39 -060033#define PyODict_Contains(od, key) PyDict_Contains((PyObject *)od, key)
34#define PyODict_Size(od) PyDict_Size((PyObject *)od)
35#define PyODict_GetItemString(od, key) \
36 PyDict_GetItemString((PyObject *)od, key)
Eric Snow96c6af92015-05-29 22:21:39 -060037
Serhiy Storchaka34d0ac82016-12-27 14:57:39 +020038#endif
39
Eric Snow96c6af92015-05-29 22:21:39 -060040#ifdef __cplusplus
41}
42#endif
43#endif /* !Py_ODICTOBJECT_H */