symbian-qemu-0.9.1-12/python-2.6.1/Doc/c-api/bytearray.rst
changeset 1 2fb8b9db1c86
equal deleted inserted replaced
0:ffa851df0825 1:2fb8b9db1c86
       
     1 .. highlightlang:: c
       
     2 
       
     3 .. _bytearrayobjects:
       
     4 
       
     5 Byte Array Objects
       
     6 ------------------
       
     7 
       
     8 .. index:: object: bytearray
       
     9 
       
    10 .. versionadded:: 2.6
       
    11 
       
    12 
       
    13 .. ctype:: PyByteArrayObject
       
    14 
       
    15    This subtype of :ctype:`PyObject` represents a Python bytearray object.
       
    16 
       
    17 
       
    18 .. cvar:: PyTypeObject PyByteArray_Type
       
    19 
       
    20    This instance of :ctype:`PyTypeObject` represents the Python bytearray type;
       
    21    it is the same object as ``bytearray`` in the Python layer.
       
    22 
       
    23 
       
    24 .. cfunction:: int PyByteArray_Check(PyObject *o)
       
    25 
       
    26    Return true if the object *o* is a bytearray object or an instance of a
       
    27    subtype of the bytearray type.
       
    28 
       
    29 
       
    30 .. cfunction:: int PyByteArray_CheckExact(PyObject *o)
       
    31 
       
    32    Return true if the object *o* is a bytearray object, but not an instance of a
       
    33    subtype of the bytearray type.
       
    34 
       
    35 
       
    36 .. cfunction:: PyObject* PyByteArray_FromObject(PyObject *o)
       
    37 
       
    38    Return a new bytearray object from any object, *o*, that implements the
       
    39    buffer protocol.
       
    40 
       
    41    .. XXX expand about the buffer protocol, at least somewhere
       
    42 
       
    43 
       
    44 .. cfunction:: PyObject* PyByteArray_FromStringAndSize(const char *string, Py_ssize_t len)
       
    45 
       
    46    Create a new bytearray object from *string* and its length, *len*.  On
       
    47    failure, *NULL* is returned.
       
    48 
       
    49 
       
    50 .. cfunction:: Py_ssize_t PyByteArray_Size(PyObject *bytearray)
       
    51 
       
    52    Return the size of *bytearray* after checking for a *NULL* pointer.
       
    53 
       
    54 
       
    55 .. cfunction:: Py_ssize_t PyByteArray_GET_SIZE(PyObject *bytearray)
       
    56 
       
    57    Macro version of :cfunc:`PyByteArray_Size` that doesn't do pointer checking.
       
    58 
       
    59 
       
    60 .. cfunction:: char* PyByteArray_AsString(PyObject *bytearray)
       
    61 
       
    62    Return the contents of *bytearray* as a char array after checking for a
       
    63    *NULL* pointer.
       
    64 
       
    65 
       
    66 .. cfunction:: char* PyByteArray_AS_STRING(PyObject *bytearray)
       
    67 
       
    68    Macro version of :cfunc:`PyByteArray_AsString` that doesn't check pointers.
       
    69 
       
    70 
       
    71 .. cfunction:: PyObject* PyByteArray_Concat(PyObject *a, PyObject *b)
       
    72 
       
    73    Concat bytearrays *a* and *b* and return a new bytearray with the result.
       
    74 
       
    75 
       
    76 .. cfunction:: PyObject* PyByteArray_Resize(PyObject *bytearray, Py_ssize_t len)
       
    77 
       
    78    Resize the internal buffer of *bytearray* to *len*.