bytearrayobject.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* ByteArray object interface */
  2. #ifndef Py_BYTEARRAYOBJECT_H
  3. #define Py_BYTEARRAYOBJECT_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /* Type PyByteArrayObject represents a mutable array of bytes.
  8. * The Python API is that of a sequence;
  9. * the bytes are mapped to ints in [0, 256).
  10. * Bytes are not characters; they may be used to encode characters.
  11. * The only way to go between bytes and str/unicode is via encoding
  12. * and decoding.
  13. * For the convenience of C programmers, the bytes type is considered
  14. * to contain a char pointer, not an unsigned char pointer.
  15. */
  16. /* Type object */
  17. PyAPI_DATA(PyTypeObject) PyByteArray_Type;
  18. PyAPI_DATA(PyTypeObject) PyByteArrayIter_Type;
  19. /* Type check macros */
  20. #define PyByteArray_Check(self) PyObject_TypeCheck((self), &PyByteArray_Type)
  21. #define PyByteArray_CheckExact(self) Py_IS_TYPE((self), &PyByteArray_Type)
  22. /* Direct API functions */
  23. PyAPI_FUNC(PyObject *) PyByteArray_FromObject(PyObject *);
  24. PyAPI_FUNC(PyObject *) PyByteArray_Concat(PyObject *, PyObject *);
  25. PyAPI_FUNC(PyObject *) PyByteArray_FromStringAndSize(const char *, Py_ssize_t);
  26. PyAPI_FUNC(Py_ssize_t) PyByteArray_Size(PyObject *);
  27. PyAPI_FUNC(char *) PyByteArray_AsString(PyObject *);
  28. PyAPI_FUNC(int) PyByteArray_Resize(PyObject *, Py_ssize_t);
  29. #ifndef Py_LIMITED_API
  30. # define Py_CPYTHON_BYTEARRAYOBJECT_H
  31. # include "cpython/bytearrayobject.h"
  32. # undef Py_CPYTHON_BYTEARRAYOBJECT_H
  33. #endif
  34. #ifdef __cplusplus
  35. }
  36. #endif
  37. #endif /* !Py_BYTEARRAYOBJECT_H */