odictobject.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef Py_ODICTOBJECT_H
  2. #define Py_ODICTOBJECT_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /* OrderedDict */
  7. #ifndef Py_LIMITED_API
  8. typedef struct _odictobject PyODictObject;
  9. PyAPI_DATA(PyTypeObject) PyODict_Type;
  10. PyAPI_DATA(PyTypeObject) PyODictIter_Type;
  11. PyAPI_DATA(PyTypeObject) PyODictKeys_Type;
  12. PyAPI_DATA(PyTypeObject) PyODictItems_Type;
  13. PyAPI_DATA(PyTypeObject) PyODictValues_Type;
  14. #endif /* Py_LIMITED_API */
  15. #define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type)
  16. #define PyODict_CheckExact(op) (Py_TYPE(op) == &PyODict_Type)
  17. #define PyODict_SIZE(op) ((PyDictObject *)op)->ma_used
  18. #define PyODict_HasKey(od, key) (PyMapping_HasKey(PyObject *)od, key)
  19. PyAPI_FUNC(PyObject *) PyODict_New(void);
  20. PyAPI_FUNC(int) PyODict_SetItem(PyObject *od, PyObject *key, PyObject *item);
  21. PyAPI_FUNC(int) PyODict_DelItem(PyObject *od, PyObject *key);
  22. /* wrappers around PyDict* functions */
  23. #define PyODict_GetItem(od, key) PyDict_GetItem((PyObject *)od, key)
  24. #define PyODict_GetItemWithError(od, key) \
  25. PyDict_GetItemWithError((PyObject *)od, key)
  26. #define PyODict_Contains(od, key) PyDict_Contains((PyObject *)od, key)
  27. #define PyODict_Size(od) PyDict_Size((PyObject *)od)
  28. #define PyODict_GetItemString(od, key) \
  29. PyDict_GetItemString((PyObject *)od, key)
  30. #ifdef __cplusplus
  31. }
  32. #endif
  33. #endif /* !Py_ODICTOBJECT_H */