亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? qlistdata.cpp

?? QT 開發環境里面一個很重要的文件
?? CPP
?? 第 1 頁 / 共 4 頁
字號:
/******************************************************************************** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.**** This file is part of the QtCore module of the Qt Toolkit.**** This file may be used under the terms of the GNU General Public** License version 2.0 as published by the Free Software Foundation** and appearing in the file LICENSE.GPL included in the packaging of** this file.  Please review the following information to ensure GNU** General Public Licensing requirements will be met:** http://www.trolltech.com/products/qt/opensource.html**** If you are unsure which license is appropriate for your use, please** review the following information:** http://www.trolltech.com/products/qt/licensing.html or contact the** sales department at sales@trolltech.com.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#include "qlist.h"#include "qtools_p.h"#include <string.h>/*    QList as an array-list combines the easy-of-use of a random    access interface with fast list operations and the low memory    management overhead of an array. Accessing elements by index,    appending, prepending, and removing elements from both the front    and the back all happen in constant time O(1). Inserting or    removing elements at random index positions \ai happens in linear    time, or more precisly in O(min{i,n-i}) <= O(n/2), with n being    the number of elements in the list.*/QListData::Data QListData::shared_null = { Q_ATOMIC_INIT(1), 0, 0, 0, true, { 0 } };static int grow(int size){    // dear compiler: don't optimize me out.    volatile int x = qAllocMore(size * sizeof(void *), QListData::DataHeaderSize) / sizeof(void *);    return x;}QListData::Data *QListData::detach(){    Q_ASSERT(d->ref != 1);    Data *x = static_cast<Data *>(qMalloc(DataHeaderSize + d->alloc * sizeof(void *)));    ::memcpy(x, d, DataHeaderSize + d->alloc * sizeof(void *));    x->alloc = d->alloc;    x->ref.init(1);    x->sharable = true;    if (!x->alloc)        x->begin = x->end = 0;    x = qAtomicSetPtr(&d, x);    if (!x->ref.deref())        return x;    return 0;}void QListData::realloc(int alloc){    Q_ASSERT(d->ref == 1);    d = static_cast<Data *>(qRealloc(d, DataHeaderSize + alloc * sizeof(void *)));    d->alloc = alloc;    if (!alloc)        d->begin = d->end = 0;}void **QListData::append(){    Q_ASSERT(d->ref == 1);    if (d->end == d->alloc) {        int n = d->end - d->begin;        if (d->begin > 2 * d->alloc / 3) {            ::memcpy(d->array + n, d->array + d->begin, n * sizeof(void *));            d->begin = n;            d->end = n * 2;        } else {            realloc(grow(d->alloc + 1));        }    }    return d->array + d->end++;}void **QListData::append(const QListData& l){    Q_ASSERT(d->ref == 1);    int e = d->end;    int n = l.d->end - l.d->begin;    if (n) {        if (e + n > d->alloc)            realloc(grow(e + l.d->end - l.d->begin));        ::memcpy(d->array + d->end, l.d->array + l.d->begin, n * sizeof(void*));        d->end += n;    }    return d->array + e;}void **QListData::prepend(){    Q_ASSERT(d->ref == 1);    if (d->begin == 0) {        if (d->end >= d->alloc / 3)            realloc(grow(d->alloc + 1));        if (d->end < d->alloc / 3)            d->begin = d->alloc - 2 * d->end;        else            d->begin = d->alloc - d->end;        ::memmove(d->array + d->begin, d->array, d->end * sizeof(void *));        d->end += d->begin;    }    return d->array + --d->begin;}void **QListData::insert(int i){    Q_ASSERT(d->ref == 1);    if (i <= 0)        return prepend();    if (i >= d->end - d->begin)        return append();    bool leftward = false;    int size = d->end - d->begin;    if (d->begin == 0) {        if (d->end == d->alloc) {            // If the array is full, we expand it and move some items rightward            realloc(grow(d->alloc + 1));        } else {            // If there is free space at the end of the array, we move some items rightward        }    } else {        if (d->end == d->alloc) {            // If there is free space at the beginning of the array, we move some items leftward            leftward = true;        } else {            // If there is free space at both ends, we move as few items as possible            leftward = (i < size - i);        }    }    if (leftward) {        --d->begin;        ::memmove(d->array + d->begin, d->array + d->begin + 1, i * sizeof(void *));    } else {        ::memmove(d->array + d->begin + i + 1, d->array + d->begin + i,                  (size - i) * sizeof(void *));        ++d->end;    }    return d->array + d->begin + i;}void QListData::remove(int i){    Q_ASSERT(d->ref == 1);    i += d->begin;    if (i - d->begin < d->end - i) {        if (int offset = i - d->begin)            ::memmove(d->array + d->begin + 1, d->array + d->begin, offset * sizeof(void *));        d->begin++;    } else {        if (int offset = d->end - i - 1)            ::memmove(d->array + i, d->array + i + 1, offset * sizeof(void *));        d->end--;    }}void QListData::remove(int i, int n){    Q_ASSERT(d->ref == 1);    i += d->begin;    int middle = i + n/2;    if (middle - d->begin < d->end - middle) {        ::memmove(d->array + d->begin + n, d->array + d->begin,                   (i - d->begin) * sizeof(void*));        d->begin += n;    } else {        ::memmove(d->array + i, d->array + i + n,                   (d->end - i - n) * sizeof(void*));        d->end -= n;    }}void QListData::move(int from, int to){    Q_ASSERT(d->ref == 1);    if (from == to)        return;    from += d->begin;    to += d->begin;    void *t = d->array[from];    if (from < to) {        if (d->end == d->alloc || 3 * (to - from) < 2 * (d->end - d->begin)) {            ::memmove(d->array + from, d->array + from + 1, (to - from) * sizeof(void *));        } else {            // optimization            if (int offset = from - d->begin)                ::memmove(d->array + d->begin + 1, d->array + d->begin, offset * sizeof(void *));            if (int offset = d->end - (to + 1))                ::memmove(d->array + to + 2, d->array + to + 1, offset * sizeof(void *));            ++d->begin;            ++d->end;            ++to;        }    } else {        if (d->begin == 0 || 3 * (from - to) < 2 * (d->end - d->begin)) {            ::memmove(d->array + to + 1, d->array + to, (from - to) * sizeof(void *));        } else {            // optimization            if (int offset = to - d->begin)                ::memmove(d->array + d->begin - 1, d->array + d->begin, offset * sizeof(void *));            if (int offset = d->end - (from + 1))                ::memmove(d->array + from, d->array + from + 1, offset * sizeof(void *));            --d->begin;            --d->end;            --to;        }    }    d->array[to] = t;}void **QListData::erase(void **xi){    Q_ASSERT(d->ref == 1);    int i = xi - (d->array + d->begin);    remove(i);    return d->array + d->begin + i;}/*! \class QList    \brief The QList class is a template class that provides lists.    \ingroup tools    \ingroup shared    \mainclass    \reentrant    QList\<T\> is one of Qt's generic \l{container classes}. It    stores a list of values and provides fast index-based access as    well as fast insertions and removals.    QList\<T\>, QLinkedList\<T\>, and QVector\<T\> provide similar    functionality. Here's an overview:    \list    \i For most purposes, QList is the right class to use. Its       index-based API is more convenient than QLinkedList's       iterator-based API, and it is usually faster than       QVector because of the way it stores its items in       memory. It also expands to less code in your executable.    \i If you need a real linked list, with guarantees of \l{constant       time} insertions in the middle of the list and iterators to       items rather than indexes, use QLinkedList.    \i If you want the items to occupy adjacent memory positions,       use QVector.    \endlist    Internally, QList\<T\> is represented as an array of pointers to    items. (Exceptionally, if T is a pointer type, a basic type of    the size of a pointer, or one of Qt's \l{shared classes},    QList\<T\> stores the item directly in the pointer.) For lists    under a thousand items, this representation allows for very fast    insertions in the middle, in addition to instantaneous    index-based access. Furthermore, operations like prepend() and    append() are very fast, because QList preallocates memory on both    sides of its internal array. (See \l{Algorithmic Complexity}    for details.)    Here's an example of a QList that stores integers and    a QList that stores QDate values:    \code        QList<int> integerList;        QList<QDate> dateList;    \endcode    Qt includes a QStringList class that inherits QList\<QString\>    and adds a few convenience functions, such as QStringList::join()    and QStringList::find(). (QString::split() creates QStringLists    from strings.)    QList stores a list of items. The default constructor creates an    empty list. To insert items into the list, you can use    operator<<():    \code        QList<QString> list;        list << "one" << "two" << "three";        // list: ["one", "two", "three"]    \endcode    QList provides these basic functions to add, move, and remove    items: insert(), replace(), removeAt(), move(), and swap(). In    addition, it provides the following convenience functions:    append(), prepend(), removeFirst(), and removeLast().    QList uses 0-based indexes, just like C++ arrays. To access the    item at a particular index position, you can use operator[](). On    non-const lists, operator[]() returns a reference to the item and    can be used on the left side of an assignment:    \code        if (list[0] == "Bob")            list[0] = "Robert";    \endcode    Because QList is implemented as an array of pointers, this    operation is very fast (\l{constant time}). For read-only access,    an alternative syntax is to use at():    \code        for (int i = 0; i < list.size(); ++i) {            if (list.at(i) == "Jane")                cout << "Found Jane at position " << i << endl;        }    \endcode    at() can be faster than operator[](), because it never causes a    \l{deep copy} to occur.    A common requirement is to remove an item from a list and do    something with it. For this, QList provides takeAt(), takeFirst(),    and takeLast(). Here's a loop that removes the items from a list    one at a time and calls \c delete on them:    \code        QList<QWidget *> list;        ...        while (!list.isEmpty())            delete list.takeFirst();    \endcode    Inserting and removing items at either ends of the list is very    fast (\l{constant time} in most cases), because QList    preallocates extra space on both sides of its internal buffer to    allow for fast growth at both ends of the list.    If you want to find all occurrences of a particular value in a    list, use indexOf() or lastIndexOf(). The former searches forward    starting from a given index position, the latter searches    backward. Both return the index of a matching item if they find    it; otherwise, they return -1. For example:    \code        int i = list.indexOf("Jane");        if (i != -1)            cout << "First occurrence of Jane is at position " << i << endl;    \endcode    If you simply want to check whether a list contains a particular    value, use contains(). If you want to find out how many times a    particular value occurs in the list, use count(). If you want to    replace all occurrences of a particular value with another, use    replace().    QList's value type must be an \l{assignable data type}. This    covers most data types that are commonly used, but the compiler    won't let you, for example, store a QWidget as a value; instead,    store a QWidget *. A few functions have additional requirements;    for example, indexOf() and lastIndexOf() expect the value type to    support \c operator==(). These requirements are documented on a    per-function basis.    Like the other container classes, QList provides \l{Java-style    iterators} (QListIterator and QMutableListIterator) and    \l{STL-style iterators} (QList::const_iterator and    QList::iterator). In practice, these are rarely used, because    you can use indexes into the QList. QList is implemented in such    a way that direct index-based access is just as fast as using    iterators.    QList does \e not support inserting, prepending, appending or replacing    with references to its own values. Doing so will cause your application to    abort with an error message.    \sa QListIterator, QMutableListIterator, QLinkedList, QVector*//*!    \fn QList<T> QList<T>::mid(int pos, int length) const    Returns a list whose elements are copied from this list,    starting at position \a pos. If \a length is -1 (the default), all    elements after \a pos are copied; otherwise \a length elements (or    all remaining elements if there are less than \a length elements)    are copied.*//*! \fn QList::QList()    Constructs an empty list.*//*! \fn QList::QList(const QList<T> &other)    Constructs a copy of \a other.    This operation takes \l{constant time}, because QList is    \l{implicitly shared}. This makes returning a QList from a    function very fast. If a shared instance is modified, it will be    copied (copy-on-write), and that takes \l{linear time}.    \sa operator=()*//*! \fn QList::~QList()    Destroys the list. References to the values in the list and all    iterators of this list become invalid.*//*! \fn QList<T> &QList::operator=(const QList<T> &other)    Assigns \a other to this list and returns a reference to this    list.*//*! \fn bool QList::operator==(const QList<T> &other) const    Returns true if \a other is equal to this list; otherwise returns    false.    Two lists are considered equal if they contain the same values in    the same order.    This function requires the value type to have an implementation of    \c operator==().

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美色手机在线观看| 亚洲蜜臀av乱码久久精品| 久久网这里都是精品| 亚洲女与黑人做爰| 国产超碰在线一区| 欧美一区二区三区在线视频| 亚洲三级在线观看| 国产成人av电影在线播放| 日韩欧美一区在线| 一区二区三区四区激情 | 亚洲一区二区成人在线观看| 国产精华液一区二区三区| 欧美精品亚洲二区| 亚洲一区免费在线观看| 91免费看视频| 国产精品网站在线| 国产麻豆视频精品| 欧美sm极限捆绑bd| 免费在线观看一区二区三区| 欧洲国内综合视频| 国产精品久久久久久久久久久免费看| 欧美国产日韩a欧美在线观看 | 亚洲成av人影院在线观看网| 福利一区福利二区| 精品美女一区二区三区| 亚洲地区一二三色| 99久久综合狠狠综合久久| 欧美午夜影院一区| 国产欧美日韩一区二区三区在线观看| 亚洲一区二区三区在线看| 国产精品69毛片高清亚洲| 欧美精三区欧美精三区| 亚洲卡通欧美制服中文| 成人一级黄色片| 精品盗摄一区二区三区| 蜜桃一区二区三区在线观看| 色先锋aa成人| 亚洲人成在线播放网站岛国| 国产 欧美在线| 久久久综合九色合综国产精品| 天天综合天天综合色| 91免费国产在线| 亚洲国产精品99久久久久久久久 | 国产精品毛片高清在线完整版| 日韩成人一级片| 欧美精品丝袜中出| 亚洲丰满少妇videoshd| 91美女视频网站| 一区二区三区在线免费视频| 色综合天天综合网天天狠天天| 中文字幕日韩av资源站| 成人蜜臀av电影| 中文字幕在线视频一区| 成人手机在线视频| 亚洲欧洲日韩在线| 91免费视频大全| 亚洲男同性视频| 波多野洁衣一区| 中文字幕亚洲欧美在线不卡| 色噜噜夜夜夜综合网| 亚洲成人黄色影院| 678五月天丁香亚洲综合网| 免费成人性网站| 精品国产免费一区二区三区香蕉| 精品一区二区在线看| 日韩精品一区二区三区视频在线观看 | 精品第一国产综合精品aⅴ| 国产盗摄精品一区二区三区在线| 国产精品热久久久久夜色精品三区| 成人午夜在线免费| 一区二区三区四区视频精品免费 | 国产精品国产三级国产普通话蜜臀| 国产91在线观看| 亚洲摸摸操操av| 91精品国产入口| 国产不卡一区视频| 亚洲男人天堂一区| 日韩一区二区在线看| 国产一区二区在线观看视频| 亚洲色图制服丝袜| 日韩免费高清av| 99久久精品国产毛片| 天天综合色天天综合色h| 久久精品视频在线看| 国产成人精品免费在线| 亚洲视频在线一区观看| 欧美性猛片aaaaaaa做受| 一区二区免费在线| 国产欧美日韩亚州综合 | 日本一区二区电影| 91豆麻精品91久久久久久| 青青国产91久久久久久| 国产精品高潮呻吟| 91精品久久久久久久99蜜桃 | 日韩一区在线免费观看| 欧美日韩不卡在线| 国产99久久久国产精品免费看| 另类专区欧美蜜桃臀第一页| 久久亚洲精品小早川怜子| 国产一区二区三区不卡在线观看| 亚洲一区免费视频| 国产亲近乱来精品视频 | 丁香婷婷综合五月| 丝袜亚洲另类欧美| 中文字幕中文字幕一区二区| 日韩亚洲欧美高清| 一本色道久久加勒比精品| 韩国中文字幕2020精品| 一区二区不卡在线视频 午夜欧美不卡在| 欧美一三区三区四区免费在线看| 91麻豆文化传媒在线观看| 国产夫妻精品视频| 青青草原综合久久大伊人精品 | 亚洲国产精品久久艾草纯爱| 国产欧美精品国产国产专区| 91精品国产福利| 欧美日韩亚洲综合一区二区三区| 99精品黄色片免费大全| 韩国女主播一区二区三区| 日韩精品成人一区二区三区| 中文字幕亚洲综合久久菠萝蜜| 国产欧美日韩三区| 欧美成人a视频| 日韩美女视频在线| 91精品国产色综合久久久蜜香臀| 欧美视频三区在线播放| 色综合视频在线观看| 91一区二区三区在线观看| www.日本不卡| 国产老肥熟一区二区三区| 奇米一区二区三区| 图片区日韩欧美亚洲| 一级做a爱片久久| 亚洲资源在线观看| 亚洲一区欧美一区| 日日夜夜精品视频天天综合网| 亚洲小说欧美激情另类| 亚洲国产成人高清精品| 日韩精品一级中文字幕精品视频免费观看| 亚洲图片另类小说| 亚洲久草在线视频| 夜夜嗨av一区二区三区网页| 亚洲午夜在线视频| 天堂资源在线中文精品| 日本在线不卡视频| 日本网站在线观看一区二区三区| 日韩 欧美一区二区三区| 麻豆精品一区二区| 韩国v欧美v日本v亚洲v| 国产福利一区在线| 91丨porny丨最新| 欧美剧在线免费观看网站| 日韩一区二区影院| 久久色在线视频| 中文字幕一区二区三区不卡在线| 亚洲欧美色一区| 日韩黄色免费电影| 精品写真视频在线观看 | 一区二区三区在线免费视频| 亚洲成人福利片| 国内外成人在线| av在线播放成人| 欧美区视频在线观看| 久久嫩草精品久久久精品一| 国产精品久久久久婷婷| 亚洲精品久久久蜜桃| 三级精品在线观看| 免费在线观看一区| 91在线视频网址| 日韩一区二区三区在线观看| 国产亚洲欧美一区在线观看| 亚洲午夜国产一区99re久久| 精品一区二区三区在线观看国产| 成人福利在线看| 欧美精品久久久久久久多人混战| 国产欧美日韩在线视频| 亚洲成人一区在线| 国产91在线观看| 91精品在线一区二区| 中文字幕制服丝袜成人av| 视频一区二区不卡| 本田岬高潮一区二区三区| 久久综合九色综合97_久久久| 亚洲自拍偷拍网站| 国产mv日韩mv欧美| 欧美大黄免费观看| 亚洲尤物在线视频观看| 一级特黄大欧美久久久| 成人性视频免费网站| 欧美日韩久久不卡| 日韩欧美一区中文| 一区二区三区日韩精品视频| 蜜桃在线一区二区三区| 欧美在线视频日韩| 国产精品美女视频| 日韩av一区二| 欧美男同性恋视频网站| 亚洲欧洲国产日本综合| 国产成人免费视频网站高清观看视频| 欧美高清性hdvideosex|