blob: 1d0d235ef543bc31276c5beb051579fcc77ef5c0 [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 */
9
10#ifndef Py_LIMITED_API
11
12typedef struct _odictobject PyODictObject;
13
14PyAPI_DATA(PyTypeObject) PyODict_Type;
15PyAPI_DATA(PyTypeObject) PyODictIter_Type;
16PyAPI_DATA(PyTypeObject) PyODictKeys_Type;
17PyAPI_DATA(PyTypeObject) PyODictItems_Type;
18PyAPI_DATA(PyTypeObject) PyODictValues_Type;
19
20#endif /* Py_LIMITED_API */
21
Eric Snow8c7ed012015-05-30 09:29:53 -060022#define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type)
Eric Snow96c6af92015-05-29 22:21:39 -060023#define PyODict_CheckExact(op) (Py_TYPE(op) == &PyODict_Type)
24#define PyODict_SIZE(op) ((PyDictObject *)op)->ma_used
25#define PyODict_HasKey(od, key) (PyMapping_HasKey(PyObject *)od, key)
26
27PyAPI_FUNC(PyObject *) PyODict_New(void);
28PyAPI_FUNC(int) PyODict_SetItem(PyObject *od, PyObject *key, PyObject *item);
29PyAPI_FUNC(int) PyODict_DelItem(PyObject *od, PyObject *key);
30
31/* wrappers around PyDict* functions */
32#define PyODict_GetItem(od, key) PyDict_GetItem((PyObject *)od, key)
33#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)
37#define Py_ODict_GetItemId(od, key) _PyDict_GetItemId((PyObject *)od, key)
38
39#ifdef __cplusplus
40}
41#endif
42#endif /* !Py_ODICTOBJECT_H */