Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
bytesobject.h67 linesDownload Raw Back to include
1// Bytes object interface2 3#ifndef Py_BYTESOBJECT_H4#define Py_BYTESOBJECT_H5#ifdef __cplusplus6extern "C" {7#endif8 9/*10Type PyBytesObject represents a byte string.  An extra zero byte is11reserved at the end to ensure it is zero-terminated, but a size is12present so strings with null bytes in them can be represented.  This13is an immutable object type.14 15There are functions to create new bytes objects, to test16an object for bytes-ness, and to get the17byte string value.  The latter function returns a null pointer18if the object is not of the proper type.19There is a variant that takes an explicit size as well as a20variant that assumes a zero-terminated string.  Note that none of the21functions should be applied to NULL pointer.22*/23 24PyAPI_DATA(PyTypeObject) PyBytes_Type;25PyAPI_DATA(PyTypeObject) PyBytesIter_Type;26 27#define PyBytes_Check(op) \28                 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS)29#define PyBytes_CheckExact(op) Py_IS_TYPE((op), &PyBytes_Type)30 31PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);32PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *);33PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *);34PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list)35                                Py_GCC_ATTRIBUTE((format(printf, 1, 0)));36PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...)37                                Py_GCC_ATTRIBUTE((format(printf, 1, 2)));38PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *);39PyAPI_FUNC(char *) PyBytes_AsString(PyObject *);40PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int);41PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *);42PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *);43PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t,44                                            const char *, Py_ssize_t,45                                            const char *);46 47/* Provides access to the internal data buffer and size of a bytes object.48   Passing NULL as len parameter will force the string buffer to be49   0-terminated (passing a string with embedded NUL characters will50   cause an exception).  */51PyAPI_FUNC(int) PyBytes_AsStringAndSize(52    PyObject *obj,      /* bytes object */53    char **s,           /* pointer to buffer variable */54    Py_ssize_t *len     /* pointer to length variable or NULL */55    );56 57#ifndef Py_LIMITED_API58#  define Py_CPYTHON_BYTESOBJECT_H59#  include "cpython/bytesobject.h"60#  undef Py_CPYTHON_BYTESOBJECT_H61#endif62 63#ifdef __cplusplus64}65#endif66#endif /* !Py_BYTESOBJECT_H */67 
codekingpro/portable-devtools · Team Ai