Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends

QByteArray Class Reference

Search for all occurrences

Detailed Description

Examples:

PLYImport/Importer.cpp, PtexExtractor/PtexPaintExporter.cpp, PtexExtractor/PtexUtilizer.cpp, PtexImporter/PtexImporter.cpp, SampleViewportFilter/SampleViewportFilter.cpp, and ToonMaterial/ToonMaterial.cpp.

Definition at line 123 of file qbytearray.h.

#include <qbytearray.h>

List of all members.

Classes

struct   Data

Public Types

typedef char *  iterator
typedef const char *  const_iterator
typedef iterator  Iterator
typedef const_iterator  ConstIterator
typedef const char &  const_reference
typedef char &  reference
typedef char  value_type
typedef Data *  DataPtr

Public Member Functions

  QByteArray ()
  QByteArray (const char *)
  QByteArray (const char *, int size)
  QByteArray (int size, char c)
  QByteArray (int size, Qt::Initialization)
  QByteArray (const QByteArray &)
  ~QByteArray ()
QByteArray operator= (const QByteArray &)
QByteArray operator= (const char *str)
int  size () const
bool  isEmpty () const
void  resize (int size)
QByteArray fill (char c, int size=-1)
int  capacity () const
void  reserve (int size)
void  squeeze ()
  operator const char * () const
  operator const void * () const
char *  data ()
const char *  data () const
const char *  constData () const
void  detach ()
bool  isDetached () const
bool  isSharedWith (const QByteArray &other) const
void  clear ()
char  at (int i) const
char  operator[] (int i) const
char  operator[] (uint i) const
QByteRef  operator[] (int i)
QByteRef  operator[] (uint i)
int  indexOf (char c, int from=0) const
int  indexOf (const char *c, int from=0) const
int  indexOf (const QByteArray &a, int from=0) const
int  lastIndexOf (char c, int from=-1) const
int  lastIndexOf (const char *c, int from=-1) const
int  lastIndexOf (const QByteArray &a, int from=-1) const
QBool  contains (char c) const
QBool  contains (const char *a) const
QBool  contains (const QByteArray &a) const
int  count (char c) const
int  count (const char *a) 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  startsWith (char c) const
bool  startsWith (const char *c) const
bool  endsWith (const QByteArray &a) const
bool  endsWith (char c) const
bool  endsWith (const char *c) 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 (char c)
QByteArray prepend (const char *s)
QByteArray prepend (const char *s, int len)
QByteArray prepend (const QByteArray &a)
QByteArray append (char c)
QByteArray append (const char *s)
QByteArray append (const char *s, int len)
QByteArray append (const QByteArray &a)
QByteArray insert (int i, char c)
QByteArray insert (int i, const char *s)
QByteArray insert (int i, const char *s, int len)
QByteArray insert (int i, const QByteArray &a)
QByteArray remove (int index, int len)
QByteArray replace (int index, int len, const char *s)
QByteArray replace (int index, int len, const char *s, int alen)
QByteArray replace (int index, int len, const QByteArray &s)
QByteArray replace (char before, const char *after)
QByteArray replace (char before, const QByteArray &after)
QByteArray replace (const char *before, const char *after)
QByteArray replace (const char *before, int bsize, const char *after, int asize)
QByteArray replace (const QByteArray &before, const QByteArray &after)
QByteArray replace (const QByteArray &before, const char *after)
QByteArray replace (const char *before, const QByteArray &after)
QByteArray replace (char before, char after)
QByteArray operator+= (char c)
QByteArray operator+= (const char *s)
QByteArray operator+= (const QByteArray &a)
QList< QByteArray split (char sep) const
QByteArray  repeated (int times) const
QT_ASCII_CAST_WARN QByteArray append (const QString &s)
QT_ASCII_CAST_WARN QByteArray insert (int i, const QString &s)
QT_ASCII_CAST_WARN QByteArray replace (const QString &before, const char *after)
QT_ASCII_CAST_WARN QByteArray replace (char c, const QString &after)
QT_ASCII_CAST_WARN QByteArray replace (const QString &before, const QByteArray &after)
QT_ASCII_CAST_WARN QByteArray operator+= (const QString &s)
QT_ASCII_CAST_WARN int  indexOf (const QString &s, int from=0) const
QT_ASCII_CAST_WARN int  lastIndexOf (const QString &s, int from=-1) const
QT_ASCII_CAST_WARN bool  operator== (const QString &s2) const
QT_ASCII_CAST_WARN bool  operator!= (const QString &s2) const
QT_ASCII_CAST_WARN bool  operator< (const QString &s2) const
QT_ASCII_CAST_WARN bool  operator> (const QString &s2) const
QT_ASCII_CAST_WARN bool  operator<= (const QString &s2) const
QT_ASCII_CAST_WARN 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  toHex () const
QByteArray  toPercentEncoding (const QByteArray &exclude=QByteArray(), const QByteArray &include=QByteArray(), char percent= '%') const
QByteArray setNum (short, int base=10)
QByteArray setNum (ushort, int base=10)
QByteArray setNum (int, int base=10)
QByteArray setNum (uint, int base=10)
QByteArray setNum (qlonglong, int base=10)
QByteArray setNum (qulonglong, int base=10)
QByteArray setNum (float, char f= 'g', int prec=6)
QByteArray setNum (double, char f= 'g', int prec=6)
QByteArray setRawData (const char *a, uint n)
iterator  begin ()
const_iterator  begin () const
const_iterator  constBegin () const
iterator  end ()
const_iterator  end () const
const_iterator  constEnd () const
void  push_back (char c)
void  push_back (const char *c)
void  push_back (const QByteArray &a)
void  push_front (char c)
void  push_front (const char *c)
void  push_front (const QByteArray &a)
int  count () const
int  length () const
bool  isNull () const
DataPtr data_ptr ()

Static Public Member Functions

static QByteArray  number (int, int base=10)
static QByteArray  number (uint, int base=10)
static QByteArray  number (qlonglong, int base=10)
static QByteArray  number (qulonglong, int base=10)
static QByteArray  number (double, char f= 'g', int prec=6)
static QByteArray  fromRawData (const char *, int size)
static QByteArray  fromBase64 (const QByteArray &base64)
static QByteArray  fromHex (const QByteArray &hexEncoded)
static QByteArray  fromPercentEncoding (const QByteArray &pctEncoded, char percent= '%')

Friends

class  QByteRef
class  QString
Q_CORE_EXPORT QByteArray  qUncompress (const uchar *data, int nbytes)

Member Typedef Documentation

typedef char* iterator

Definition at line 315 of file qbytearray.h.

typedef const char* const_iterator

Definition at line 316 of file qbytearray.h.

typedef iterator Iterator

Definition at line 317 of file qbytearray.h.

Definition at line 318 of file qbytearray.h.

typedef const char& const_reference

Definition at line 327 of file qbytearray.h.

typedef char& reference

Definition at line 328 of file qbytearray.h.

typedef char value_type

Definition at line 329 of file qbytearray.h.

typedef Data* DataPtr

Definition at line 378 of file qbytearray.h.


Constructor & Destructor Documentation

QByteArray ( ) [inline]

Definition at line 382 of file qbytearray.h.

: d(&shared_null) { d->ref.ref(); }
QByteArray ( const char *  )
QByteArray ( const char *  ,
int  size 
)
QByteArray ( int  size,
char  c 
)
QByteArray ( int  size,
Qt::Initialization   
)
QByteArray ( const QByteArray a ) [inline]

Definition at line 421 of file qbytearray.h.

                                                 : d(a.d)
{ d->ref.ref(); }
~QByteArray ( ) [inline]

Definition at line 383 of file qbytearray.h.

{ if (!d->ref.deref()) qFree(d); }

Member Function Documentation

QByteArray& operator= ( const QByteArray )
QByteArray& operator= ( const char *  str )
int size ( ) const [inline]

Definition at line 384 of file qbytearray.h.

{ return d->size; }
bool isEmpty ( ) const [inline]

Definition at line 403 of file qbytearray.h.

{ return d->size == 0; }
void resize ( int  size )
QByteArray& fill ( char  c,
int  size = -1 
)
int capacity ( ) const [inline]

Definition at line 428 of file qbytearray.h.

{ return d->alloc; }
void reserve ( int  size ) [inline]

Definition at line 431 of file qbytearray.h.

{ if (d->ref != 1 || asize > d->alloc) realloc(asize); }
void squeeze ( ) [inline]

Definition at line 434 of file qbytearray.h.

{ if (d->size < d->alloc) realloc(d->size); }
operator const char * ( ) const [inline]

Definition at line 406 of file qbytearray.h.

{ return d->data; }
operator const void * ( ) const [inline]

Definition at line 408 of file qbytearray.h.

{ return d->data; }
char * data ( ) [inline]

Definition at line 411 of file qbytearray.h.

{ detach(); return d->data; }
const char * data ( ) const [inline]

Definition at line 413 of file qbytearray.h.

{ return d->data; }
const char * constData ( ) const [inline]
void detach ( ) [inline]

Definition at line 417 of file qbytearray.h.

{ if (d->ref != 1 || d->data != d->array) realloc(d->size); }
bool isDetached ( ) const [inline]

Definition at line 419 of file qbytearray.h.

{ return d->ref == 1; }
bool isSharedWith ( const QByteArray other ) const [inline]

Definition at line 167 of file qbytearray.h.

{ return d == other.d; }
void clear ( )
char at ( int  i ) const [inline]

Definition at line 395 of file qbytearray.h.

{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; }
char operator[] ( int  i ) const [inline]

Definition at line 397 of file qbytearray.h.

{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; }
char operator[] ( uint  i ) const [inline]

Definition at line 399 of file qbytearray.h.

{ Q_ASSERT(i < uint(size())); return d->data[i]; }
QByteRef operator[] ( int  i ) [inline]

Definition at line 471 of file qbytearray.h.

{ Q_ASSERT(i >= 0); return QByteRef(*this, i); }
QByteRef operator[] ( uint  i ) [inline]

Definition at line 473 of file qbytearray.h.

{ return QByteRef(*this, i); }
int indexOf ( char  c,
int  from = 0 
) const
int indexOf ( const char *  c,
int  from = 0 
) const
int indexOf ( const QByteArray a,
int  from = 0 
) const
int lastIndexOf ( char  c,
int  from = -1 
) const
int lastIndexOf ( const char *  c,
int  from = -1 
) const
int lastIndexOf ( const QByteArray a,
int  from = -1 
) const
QBool contains ( char  c ) const [inline]

Definition at line 507 of file qbytearray.h.

{ return QBool(indexOf(c) != -1); }
QBool contains ( const char *  a ) const [inline]

Definition at line 555 of file qbytearray.h.

{ return QBool(indexOf(c) != -1); }
QBool contains ( const QByteArray a ) const [inline]

Definition at line 505 of file qbytearray.h.

{ return QBool(indexOf(a) != -1); }
int count ( char  c ) const
int count ( const char *  a ) 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 startsWith ( char  c ) const
bool startsWith ( const char *  c ) const
bool endsWith ( const QByteArray a ) const
bool endsWith ( char  c ) const
bool endsWith ( const char *  c ) 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 ( char  c )
QByteArray& prepend ( const char *  s )
QByteArray& prepend ( const char *  s,
int  len 
)
QByteArray& prepend ( const QByteArray a )
QByteArray& append ( char  c )
QByteArray& append ( const char *  s )
QByteArray& append ( const char *  s,
int  len 
)
QByteArray& append ( const QByteArray a )
QByteArray& insert ( int  i,
char  c 
)
QByteArray& insert ( int  i,
const char *  s 
)
QByteArray& insert ( int  i,
const char *  s,
int  len 
)
QByteArray& insert ( int  i,
const QByteArray a 
)
QByteArray& remove ( int  index,
int  len 
)
QByteArray& replace ( int  index,
int  len,
const char *  s 
)
QByteArray& replace ( int  index,
int  len,
const char *  s,
int  alen 
)
QByteArray& replace ( int  index,
int  len,
const QByteArray s 
)
QByteArray & replace ( char  before,
const char *  after 
) [inline]

Definition at line 557 of file qbytearray.h.

{ return replace(&before, 1, c, qstrlen(c)); }
QByteArray& replace ( char  before,
const QByteArray after 
)
QByteArray & replace ( const char *  before,
const char *  after 
) [inline]

Definition at line 561 of file qbytearray.h.

{ return replace(before, qstrlen(before), after, qstrlen(after)); }
QByteArray& replace ( const char *  before,
int  bsize,
const char *  after,
int  asize 
)
QByteArray& replace ( const QByteArray before,
const QByteArray after 
)
QByteArray & replace ( const QByteArray before,
const char *  after 
) [inline]

Definition at line 559 of file qbytearray.h.

{ return replace(before.constData(), before.size(), c, qstrlen(c)); }
QByteArray& replace ( const char *  before,
const QByteArray after 
)
QByteArray& replace ( char  before,
char  after 
)
QByteArray & operator+= ( char  c ) [inline]

Definition at line 487 of file qbytearray.h.

{ return append(c); }
QByteArray & operator+= ( const char *  s ) [inline]

Definition at line 489 of file qbytearray.h.

{ return append(s); }
QByteArray & operator+= ( const QByteArray a ) [inline]

Definition at line 491 of file qbytearray.h.

{ return append(a); }
QList<QByteArray> split ( char  sep ) const
QByteArray repeated ( int  times ) const
QByteArray & append ( const QString s ) [inline]

Definition at line 997 of file qstring.h.

{ return append(s.toAscii()); }
QByteArray & insert ( int  i,
const QString s 
) [inline]

Definition at line 999 of file qstring.h.

{ return insert(i, s.toAscii()); }
QByteArray & replace ( const QString before,
const char *  after 
) [inline]

Definition at line 1003 of file qstring.h.

{ return replace(before.toAscii(), after); }
QByteArray & replace ( char  c,
const QString after 
) [inline]

Definition at line 1001 of file qstring.h.

{ return replace(c, after.toAscii()); }
QByteArray & replace ( const QString before,
const QByteArray after 
) [inline]

Definition at line 1005 of file qstring.h.

{ return replace(before.toAscii(), after); }
QByteArray & operator+= ( const QString s ) [inline]

Definition at line 1007 of file qstring.h.

{ return operator+=(s.toAscii()); }
int indexOf ( const QString s,
int  from = 0 
) const [inline]

Definition at line 1009 of file qstring.h.

{ return indexOf(s.toAscii(), from); }
int lastIndexOf ( const QString s,
int  from = -1 
) const [inline]

Definition at line 1011 of file qstring.h.

{ return lastIndexOf(s.toAscii(), from); }
bool operator== ( const QString s2 ) const [inline]

Definition at line 982 of file qstring.h.

bool operator!= ( const QString s2 ) const [inline]

Definition at line 984 of file qstring.h.

{ return !qStringComparisonHelper(s, constData()); }
bool operator< ( const QString s2 ) const [inline]

Definition at line 986 of file qstring.h.

{ return QString::fromAscii(constData(), size()) < s; }
bool operator> ( const QString s2 ) const [inline]

Definition at line 988 of file qstring.h.

{ return QString::fromAscii(constData(), size()) > s; }
bool operator<= ( const QString s2 ) const [inline]

Definition at line 990 of file qstring.h.

{ return QString::fromAscii(constData(), size()) <= s; }
bool operator>= ( const QString s2 ) const [inline]

Definition at line 992 of file qstring.h.

{ return QString::fromAscii(constData(), size()) >= s; }
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 toHex ( ) const
QByteArray toPercentEncoding ( const QByteArray exclude = QByteArray(),
const QByteArray include = QByteArray(),
char  percent = '%' 
) const
QByteArray & setNum ( short  n,
int  base = 10 
) [inline]

Definition at line 564 of file qbytearray.h.

{ return setNum(qlonglong(n), base); }
QByteArray & setNum ( ushort  n,
int  base = 10 
) [inline]

Definition at line 566 of file qbytearray.h.

{ return setNum(qulonglong(n), base); }
QByteArray & setNum ( int  n,
int  base = 10 
) [inline]

Definition at line 568 of file qbytearray.h.

{ return setNum(qlonglong(n), base); }
QByteArray & setNum ( uint  n,
int  base = 10 
) [inline]

Definition at line 570 of file qbytearray.h.

{ return setNum(qulonglong(n), base); }
QByteArray& setNum ( qlonglong  ,
int  base = 10 
)
QByteArray& setNum ( qulonglong  ,
int  base = 10 
)
QByteArray & setNum ( float  n,
char  f = 'g',
int  prec = 6 
) [inline]

Definition at line 572 of file qbytearray.h.

{ return setNum(double(n),f,prec); }
QByteArray& setNum ( double  ,
char  f = 'g',
int  prec = 6 
)
QByteArray& setRawData ( const char *  a,
uint  n 
)
static QByteArray number ( int  ,
int  base = 10 
) [static]
static QByteArray number ( uint  ,
int  base = 10 
) [static]
static QByteArray number ( qlonglong  ,
int  base = 10 
) [static]
static QByteArray number ( qulonglong  ,
int  base = 10 
) [static]
static QByteArray number ( double  ,
char  f = 'g',
int  prec = 6 
) [static]
static QByteArray fromRawData ( const char *  ,
int  size 
) [static]
static QByteArray fromBase64 ( const QByteArray base64 ) [static]
static QByteArray fromHex ( const QByteArray hexEncoded ) [static]
static QByteArray fromPercentEncoding ( const QByteArray pctEncoded,
char  percent = '%' 
) [static]
QByteArray::iterator begin ( ) [inline]

Definition at line 475 of file qbytearray.h.

{ detach(); return d->data; }
QByteArray::const_iterator begin ( ) const [inline]

Definition at line 477 of file qbytearray.h.

{ return d->data; }
QByteArray::const_iterator constBegin ( ) const [inline]

Definition at line 479 of file qbytearray.h.

{ return d->data; }
QByteArray::iterator end ( ) [inline]

Definition at line 481 of file qbytearray.h.

{ detach(); return d->data + d->size; }
QByteArray::const_iterator end ( ) const [inline]

Definition at line 483 of file qbytearray.h.

{ return d->data + d->size; }
QByteArray::const_iterator constEnd ( ) const [inline]

Definition at line 485 of file qbytearray.h.

{ return d->data + d->size; }
void push_back ( char  c ) [inline]

Definition at line 493 of file qbytearray.h.

{ append(c); }
void push_back ( const char *  c ) [inline]

Definition at line 495 of file qbytearray.h.

{ append(c); }
void push_back ( const QByteArray a ) [inline]

Definition at line 497 of file qbytearray.h.

{ append(a); }
void push_front ( char  c ) [inline]

Definition at line 499 of file qbytearray.h.

{ prepend(c); }
void push_front ( const char *  c ) [inline]

Definition at line 501 of file qbytearray.h.

{ prepend(c); }
void push_front ( const QByteArray a ) [inline]

Definition at line 503 of file qbytearray.h.

{ prepend(a); }
int count ( ) const [inline]

Definition at line 337 of file qbytearray.h.

{ return d->size; }
int length ( ) const [inline]

Definition at line 338 of file qbytearray.h.

{ return d->size; }
bool isNull ( ) const
DataPtr& data_ptr ( ) [inline]

Definition at line 379 of file qbytearray.h.

{ return d; }

Friends And Related Function Documentation

friend class QByteRef [friend]

Definition at line 374 of file qbytearray.h.

friend class QString [friend]

Definition at line 375 of file qbytearray.h.

Q_CORE_EXPORT QByteArray qUncompress ( const uchar *  data,
int  nbytes 
) [friend]

The documentation for this class was generated from the following files:

QByteArray QByteArray QByteArray QByteArray QByteArray QByteArray QByteArray QByteArray QByteArray QByteArray
QByteArray QByteArray QByteArray QByteArray QByteArray QByteArray QByteArray QByteArray QByteArray QByteArray