QVarLengthArray< T, Prealloc > Class Template Reference
#include <qcontainerfwd.h>
template<class T, int Prealloc>
class QVarLengthArray< T, Prealloc >
Definition at line 64 of file qcontainerfwd.h.
|
| QVarLengthArray (int size=0) |
|
| QVarLengthArray (const QVarLengthArray< T, Prealloc > &other) |
|
| ~QVarLengthArray () |
|
QVarLengthArray< T, Prealloc > & | operator= (const QVarLengthArray< T, Prealloc > &other) |
|
void | removeLast () |
|
int | size () const |
|
int | count () const |
|
bool | isEmpty () const |
|
void | resize (int size) |
|
void | clear () |
|
int | capacity () const |
|
void | reserve (int size) |
|
T & | operator[] (int idx) |
|
const T & | operator[] (int idx) const |
|
const T & | at (int idx) const |
|
T | value (int i) const |
|
T | value (int i, const T &defaultValue) const |
|
void | append (const T &t) |
|
void | append (const T *buf, int size) |
|
QVarLengthArray< T, Prealloc > & | operator<< (const T &t) |
|
QVarLengthArray< T, Prealloc > & | operator+= (const T &t) |
|
void | prepend (const T &t) |
|
void | insert (int i, const T &t) |
|
void | insert (int i, int n, const T &t) |
|
void | replace (int i, const T &t) |
|
void | remove (int i) |
|
void | remove (int i, int n) |
|
T * | data () |
|
const T * | data () const |
|
const T * | constData () const |
|
iterator | begin () |
|
const_iterator | begin () const |
|
const_iterator | constBegin () const |
|
iterator | end () |
|
const_iterator | end () const |
|
const_iterator | constEnd () const |
|
iterator | insert (iterator before, int n, const T &x) |
|
iterator | insert (iterator before, const T &x) |
|
iterator | erase (iterator begin, iterator end) |
|
iterator | erase (iterator pos) |
|
Definition at line 184 of file qvarlengtharray.h.
187 ptr =
reinterpret_cast<T *
>(qMalloc(
s *
sizeof(T)));
191 ptr =
reinterpret_cast<T *
>(
array);
194 if (QTypeInfo<T>::isComplex) {
char array[sizeof(qint64)*(((Prealloc *sizeof(T))/sizeof(qint64))+1)]
GLubyte GLubyte GLubyte a
Definition at line 68 of file qvarlengtharray.h.
69 :
a(Prealloc),
s(0), ptr(reinterpret_cast<T *>(
array))
char array[sizeof(qint64)*(((Prealloc *sizeof(T))/sizeof(qint64))+1)]
const T * constData() const
GLubyte GLubyte GLubyte a
Definition at line 74 of file qvarlengtharray.h.
75 if (QTypeInfo<T>::isComplex) {
80 if (ptr != reinterpret_cast<T *>(
array))
char array[sizeof(qint64)*(((Prealloc *sizeof(T))/sizeof(qint64))+1)]
Q_INLINE_TEMPLATE void resize |
( |
int |
size | ) |
|
|
inline |
Definition at line 202 of file qvarlengtharray.h.
203 { realloc(asize, qMax(asize,
a)); }
GLubyte GLubyte GLubyte a
Q_INLINE_TEMPLATE void reserve |
( |
int |
size | ) |
|
|
inline |
Definition at line 206 of file qvarlengtharray.h.
207 {
if (asize >
a) realloc(
s, asize); }
GLubyte GLubyte GLubyte a
const T& operator[] |
( |
int |
idx | ) |
const |
|
inline |
const T& at |
( |
int |
idx | ) |
const |
|
inline |
Q_OUTOFLINE_TEMPLATE T value |
( |
int |
i | ) |
const |
Q_OUTOFLINE_TEMPLATE T value |
( |
int |
i, |
|
|
const T & |
defaultValue |
|
) |
| const |
Definition at line 300 of file qvarlengtharray.h.
302 return (i < 0 || i >=
size()) ? defaultValue :
at(i);
const T & at(int idx) const
void append |
( |
const T & |
t | ) |
|
|
inline |
Definition at line 118 of file qvarlengtharray.h.
122 if (QTypeInfo<T>::isComplex) {
123 new (ptr + idx) T(
t);
GLubyte GLubyte GLubyte a
Q_OUTOFLINE_TEMPLATE void append |
( |
const T * |
buf, |
|
|
int |
size |
|
) |
| |
Definition at line 210 of file qvarlengtharray.h.
216 const int asize =
s + increment;
219 realloc(
s, qMax(
s*2, asize));
221 if (QTypeInfo<T>::isComplex) {
224 new (ptr+(
s++)) T(*abuf++);
226 qMemCopy(&ptr[
s], abuf, increment *
sizeof(T));
GLubyte GLubyte GLubyte a
void prepend |
( |
const T & |
t | ) |
|
|
inline |
Definition at line 306 of file qvarlengtharray.h.
307 { Q_ASSERT_X(i >= 0 && i <=
s,
"QVarLengthArray::insert",
"index out of range");
void insert(int i, const T &t)
Definition at line 310 of file qvarlengtharray.h.
311 { Q_ASSERT_X(i >= 0 && i <=
s,
"QVarLengthArray::insert",
"index out of range");
void insert(int i, const T &t)
void replace |
( |
int |
i, |
|
|
const T & |
t |
|
) |
| |
|
inline |
Definition at line 326 of file qvarlengtharray.h.
328 Q_ASSERT_X(i >= 0 && i <
s,
"QVarLengthArray::replace",
"index out of range");
Definition at line 318 of file qvarlengtharray.h.
319 { Q_ASSERT_X(i >= 0 && i <
s,
"QVarLengthArray::remove",
"index out of range");
iterator erase(iterator begin, iterator end)
Definition at line 314 of file qvarlengtharray.h.
315 { Q_ASSERT_X(i >= 0 &&
n >= 0 && i +
n <=
s,
"QVarLengthArray::remove",
"index out of range");
iterator erase(iterator begin, iterator end)
const T* constData |
( |
| ) |
const |
|
inline |
Definition at line 335 of file qvarlengtharray.h.
341 if (QTypeInfo<T>::isStatic) {
353 memmove(i, b, (s - offset - n) *
sizeof(T));
unsigned int(APIENTRYP PFNGLXGETAGPOFFSETMESAPROC)(const void *pointer)
Definition at line 362 of file qvarlengtharray.h.
364 int f =
int(abegin - ptr);
365 int l =
int(aend - ptr);
367 if (QTypeInfo<T>::isComplex) {
368 qCopy(ptr + l, ptr +
s, ptr + f);
376 memmove(ptr + f, ptr + l, (s - l) *
sizeof(T));
unsigned int(APIENTRYP PFNGLXGETAGPOFFSETMESAPROC)(const void *pointer)
OutputIterator qCopy(InputIterator begin, InputIterator end, OutputIterator dest)
Definition at line 166 of file qvarlengtharray.h.
166 {
return erase(pos, pos+1); }
iterator erase(iterator begin, iterator end)
char array[sizeof(qint64)*(((Prealloc *sizeof(T))/sizeof(qint64))+1)] |
The documentation for this class was generated from the following files: