1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
|
// qbytearray.sip generated by MetaSIP on Sat Jul 15 18:43:36 2006
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2006
// Riverbank Computing Limited <info@riverbankcomputing.co.uk>
//
// This file is part of PyQt.
//
// This copy of PyQt is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2, or (at your option) any later
// version.
//
// PyQt is supplied in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// PyQt; see the file LICENSE. If not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
%ModuleHeaderCode
#include <qbytearray.h>
%End
char *qstrdup(const char *);
uint qstrlen(const char *str);
char *qstrcpy(char *dst, const char *src);
char *qstrncpy(char *dst, const char *src, uint len);
int qstrcmp(const char *str1, const char *str2);
int qstrncmp(const char *str1, const char *str2, uint len);
int qstricmp(const char *, const char *);
int qstrnicmp(const char *, const char *, uint len);
quint16 qChecksum(const char *s /Array/, uint len /ArraySize/);
class QByteArray
{
%TypeHeaderCode
#include <qbytearray.h>
%End
%TypeCode
// This is needed by __hash__().
#include <qhash.h>
%End
%ConvertToTypeCode
// Allow a Python string whenever a QByteArray is expected.
if (sipIsErr == NULL)
return (PyString_Check(sipPy) ||
sipCanConvertToInstance(sipPy, sipClass_QByteArray, SIP_NO_CONVERTORS));
if (PyString_Check(sipPy))
{
*sipCppPtr = new QByteArray(PyString_AS_STRING(sipPy), PyString_GET_SIZE(sipPy));
return sipGetState(sipTransferObj);
}
*sipCppPtr = reinterpret_cast<QByteArray *>(sipConvertToInstance(sipPy, sipClass_QByteArray, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr));
return 0;
%End
%BIGetReadBufferCode
if (sipSegment != 0)
{
PyErr_SetString(PyExc_SystemError, "accessing non-existent QByteArray segment");
sipRes = -1;
}
else
{
*sipPtrPtr = (void *)sipCpp->data();
sipRes = sipCpp->size();
}
%End
%BIGetSegCountCode
if (sipLenPtr)
*sipLenPtr = sipCpp->size();
sipRes = 1;
%End
%BIGetCharBufferCode
if (sipSegment != 0)
{
PyErr_SetString(PyExc_SystemError, "accessing non-existent QByteArray segment");
sipRes = -1;
}
else
{
*sipPtrPtr = (void *)sipCpp->data();
sipRes = sipCpp->size();
}
%End
public:
QByteArray();
QByteArray(int size, char c);
QByteArray(const QByteArray &a);
~QByteArray();
void resize(int size);
QByteArray &fill(char c, int size = -1);
void clear();
int indexOf(const QByteArray &a, int from = 0) const;
int indexOf(const QString &s, int from = 0) const;
int lastIndexOf(const QByteArray &a, int from = -1) const;
int lastIndexOf(const QString &s, int from = -1) const;
int count(const QByteArray &a) const;
QByteArray left(int len) const;
QByteArray right(int len) const;
QByteArray mid(int index, int len = -1) const;
bool startsWith(const QByteArray &a) const;
bool endsWith(const QByteArray &a) const;
void truncate(int pos);
void chop(int n);
QByteArray toLower() const;
QByteArray toUpper() const;
QByteArray trimmed() const;
QByteArray simplified() const;
QByteArray leftJustified(int width, char fill = ' ', bool truncate = false) const;
QByteArray rightJustified(int width, char fill = ' ', bool truncate = false) const;
QByteArray &prepend(const QByteArray &a);
QByteArray &append(const QByteArray &a);
QByteArray &append(const QString &s);
QByteArray &insert(int i, const QByteArray &a);
QByteArray &insert(int i, const QString &s);
QByteArray &remove(int index, int len);
QByteArray &replace(int index, int len, const QByteArray &s);
QByteArray &replace(const QByteArray &before, const QByteArray &after);
QByteArray &replace(const QString &before, const QByteArray &after);
QList<QByteArray> split(char sep) const;
QByteArray &operator+=(const QByteArray &a);
QByteArray &operator+=(const QString &s);
bool operator==(const QString &s2) const;
bool operator!=(const QString &s2) const;
bool operator<(const QString &s2) const;
bool operator>(const QString &s2) const;
bool operator<=(const QString &s2) const;
bool operator>=(const QString &s2) const;
short toShort(bool *ok = 0, int base = 10) const;
ushort toUShort(bool *ok = 0, int base = 10) const;
int toInt(bool *ok = 0, int base = 10) const;
uint toUInt(bool *ok = 0, int base = 10) const;
long toLong(bool *ok = 0, int base = 10) const;
ulong toULong(bool *ok = 0, int base = 10) const;
qlonglong toLongLong(bool *ok = 0, int base = 10) const;
qulonglong toULongLong(bool *ok = 0, int base = 10) const;
float toFloat(bool *ok = 0) const;
double toDouble(bool *ok = 0) const;
QByteArray toBase64() const;
QByteArray &setNum(int n /Constrained/, int base = 10);
QByteArray &setNum(double /Constrained/, char f = 'g', int prec = 6);
QByteArray &setNum(qlonglong, int base = 10);
QByteArray &setNum(qulonglong, int base = 10);
static QByteArray number(int /Constrained/, int base = 10);
static QByteArray number(double /Constrained/, char f = 'g', int prec = 6);
static QByteArray number(qlonglong, int base = 10);
static QByteArray number(qulonglong, int base = 10);
static QByteArray fromRawData(const char * /Array/, int size /ArraySize/);
static QByteArray fromBase64(const QByteArray &base64);
int count() const;
int length() const;
bool isNull() const;
int size() const;
const char at(int i) const;
const char operator[](int i) const;
%MethodCode
int len;
len = sipCpp->length();
if ((a0 = sipConvertFromSequenceIndex(a0, len)) < 0)
sipIsErr = 1;
else
sipRes = sipCpp->at(a0);
%End
QByteArray operator[](SIP_PYSLICE slice) const;
%MethodCode
int len, start, stop, step, slicelength;
len = sipCpp->length();
if (sipConvertFromSliceObject(a0, len, &start, &stop, &step, &slicelength) < 0)
sipIsErr = 1;
else
{
sipRes = new QByteArray();
for (int i = 0; i < slicelength; ++i)
{
sipRes -> append(sipCpp->at(start));
start += step;
}
}
%End
int __len__() const;
%MethodCode
sipRes = sipCpp->length();
%End
int __contains__(const QByteArray &a) const;
%MethodCode
// It looks like you can't assign QBool to int.
sipRes = bool(sipCpp->contains(*a0));
%End
long __hash__() const;
%MethodCode
sipRes = qHash(*sipCpp);
%End
SIP_PYOBJECT __str__();
%MethodCode
// QByteArrays may have embedded '\0's so set the size explicitly.
char *data = sipCpp->data();
int len = sipCpp->size();
if (!data)
sipRes = PyString_FromString("");
else
sipRes = PyString_FromStringAndSize(data, len);
%End
QByteArray operator*(int m) const;
%MethodCode
sipRes = new QByteArray();
while (a0-- > 0)
*sipRes += *sipCpp;
%End
QByteArray &operator*=(int m);
%MethodCode
QByteArray orig(*sipCpp);
sipCpp->clear();
while (a0-- > 0)
*sipCpp += orig;
%End
bool isEmpty() const;
SIP_PYOBJECT data();
%MethodCode
// QByteArrays may contain embedded '\0's so set the size explicitly.
char *res = sipCpp->data();
int len = sipCpp->size();
if (res)
{
if ((sipRes = PyString_FromStringAndSize(res, len)) == NULL)
sipIsErr = 1;
}
else
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
%End
int capacity() const;
void reserve(int size);
void squeeze();
void push_back(const QByteArray &a);
void push_front(const QByteArray &a);
QBool contains(const QByteArray &a) const;
};
bool operator==(const QByteArray &a1, const QByteArray &a2);
bool operator!=(const QByteArray &a1, const QByteArray &a2);
bool operator<(const QByteArray &a1, const QByteArray &a2);
bool operator<=(const QByteArray &a1, const QByteArray &a2);
bool operator>(const QByteArray &a1, const QByteArray &a2);
bool operator>=(const QByteArray &a1, const QByteArray &a2);
const QByteArray operator+(const QByteArray &a1, const QByteArray &a2);
QDataStream &operator<<(QDataStream &, const QByteArray & /Constrained/);
QDataStream &operator>>(QDataStream &, QByteArray & /Constrained/);
QByteArray qCompress(const QByteArray &data, int compressionLevel = -1);
QByteArray qUncompress(const QByteArray &data);
|