Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/corelib/tools/qbytearray.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    4747#include "qlocale.h"
    4848#include "qlocale_p.h"
    49 #include "qunicodetables_p.h"
    5049#include "qscopedpointer.h"
    5150#include <qdatastream.h>
     
    154153    This function assumes that \a dst is at least \a len characters
    155154    long.
     155
     156
     157
     158
    156159
    157160    \sa qstrcpy()
     
    847850    \l{implicitly shared}. This makes returning a QByteArray from a
    848851    function very fast. If a shared instance is modified, it will be
    849     copied (copy-on-write), and that takes \l{linear time}.
     852    copied (copy-on-write), \l{linear time}.
    850853
    851854    \sa operator=()
     
    10621065*/
    10631066
     1067
     1068
     1069
     1070
     1071
    10641072/*! \fn char QByteArray::at(int i) const
    10651073
     
    11781186    \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 12
    11791187
    1180     This operation is typically very fast (\l{constant time}),
    1181     because QByteArray preallocates extra space at the end of the
    1182     character data so it can grow without reallocating the entire
    1183     data each time.
     1188    Note: QByteArray is an \l{implicitly shared} class. Consequently,
     1189    if \e this is an empty QByteArray, then \e this will just share
     1190    the data held in \a ba. In this case, no copying of data is done,
     1191    taking \l{constant time}. If a shared instance is modified, it will
     1192    be copied (copy-on-write), taking \l{linear time}.
     1193
     1194    If \e this is not an empty QByteArray, a deep copy of the data is
     1195    performed, taking \l{linear time}.
     1196
     1197    This operation typically does not suffer from allocation overhead,
     1198    because QByteArray preallocates extra space at the end of the data
     1199    so that it may grow without reallocating for each append operation.
    11841200
    11851201    \sa append(), prepend()
     
    14661482    Note: QByteArray is an \l{implicitly shared} class. Consequently,
    14671483    if \e this is an empty QByteArray, then \e this will just share
    1468     the data held in \a ba. In this case, no copying of data is done.
     1484    the data held in \a ba. In this case, no copying of data is done,
     1485    taking \l{constant time}. If a shared instance is modified, it will
     1486    be copied (copy-on-write), taking \l{linear time}.
     1487
     1488    If \e this is not an empty QByteArray, a deep copy of the data is
     1489    performed, taking \l{linear time}.
    14691490
    14701491    \sa append(), insert()
     
    15391560    This is the same as insert(size(), \a ba).
    15401561
    1541     This operation is typically very fast (\l{constant time}),
    1542     because QByteArray preallocates extra space at the end of the
    1543     character data so it can grow without reallocating the entire
    1544     data each time.
    1545 
    15461562    Note: QByteArray is an \l{implicitly shared} class. Consequently,
    15471563    if \e this is an empty QByteArray, then \e this will just share
    1548     the data held in \a ba. In this case, no copying of data is done.
     1564    the data held in \a ba. In this case, no copying of data is done,
     1565    taking \l{constant time}. If a shared instance is modified, it will
     1566    be copied (copy-on-write), taking \l{linear time}.
     1567
     1568    If \e this is not an empty QByteArray, a deep copy of the data is
     1569    performed, taking \l{linear time}.
     1570
     1571    This operation typically does not suffer from allocation overhead,
     1572    because QByteArray preallocates extra space at the end of the data
     1573    so that it may grow without reallocating for each append operation.
    15491574
    15501575    \sa operator+=(), prepend(), insert()
     
    17881813    } else {
    17891814        QByteArray copy(after);
    1790         // ### optimise me
     1815        // ### optimie me
    17911816        remove(pos, len);
    17921817        return insert(pos, copy);
     
    17971822
    17981823    \overload
     1824
     1825
     1826
     1827
     1828
    17991829*/
    18001830QByteArray &QByteArray::replace(int pos, int len, const char *after)
    18011831{
    1802     int alen = qstrlen(after);
     1832    return replace(pos,len,after,qstrlen(after));
     1833}
     1834
     1835/*! \fn QByteArray &QByteArray::replace(int pos, int len, const char *after, int alen)
     1836
     1837    \overload
     1838
     1839    Replaces \a len bytes from index position \a pos with \a alen bytes
     1840    from the string \a after. \a after is allowed to have '\0' characters.
     1841
     1842    \since 4.7
     1843*/
     1844QByteArray &QByteArray::replace(int pos, int len, const char *after, int alen)
     1845{
    18031846    if (len == alen && (pos + len <= d->size)) {
    18041847        detach();
     
    18111854}
    18121855
    1813 // ### optimise all other replace method, by offering
     1856// ### optimie all other replace method, by offering
    18141857// QByteArray::replace(const char *before, int blen, const char *after, int alen)
    18151858
     
    21262169        return QByteArray(); // not enough memory
    21272170
    2128     qMemCopy(result.d->data, d->data, d->size);
     2171    py(result.d->data, d->data, d->size);
    21292172
    21302173    int sizeSoFar = d->size;
     
    21332176    const int halfResultSize = resultSize >> 1;
    21342177    while (sizeSoFar <= halfResultSize) {
    2135         qMemCopy(end, result.d->data, sizeSoFar);
     2178        py(end, result.d->data, sizeSoFar);
    21362179        end += sizeSoFar;
    21372180        sizeSoFar <<= 1;
    21382181    }
    2139     qMemCopy(end, result.d->data, resultSize - sizeSoFar);
     2182    py(end, result.d->data, resultSize - sizeSoFar);
    21402183    result.d->data[resultSize] = '\0';
    21412184    result.d->size = resultSize;
     
    26602703    to the stream.
    26612704
    2662     \sa {Format of the QDataStream operators}
     2705    \sa {s}
    26632706*/
    26642707
     
    26772720    reference to the stream.
    26782721
    2679     \sa {Format of the QDataStream operators}
     2722    \sa {s}
    26802723*/
    26812724
     
    37933836    fail.
    37943837
    3795     \sa data(), constData()
     3838    \sa data(), constData()
    37963839*/
    37973840
     
    38103853    *x->array = '\0';
    38113854    return QByteArray(x, 0, 0);
     3855
     3856
     3857
     3858
     3859
     3860
     3861
     3862
     3863
     3864
     3865
     3866
     3867
     3868
     3869
     3870
     3871
     3872
     3873
     3874
     3875
     3876
     3877
     3878
     3879
     3880
     3881
     3882
     3883
     3884
     3885
    38123886}
    38133887
     
    42074281
    42084282/*!
    4209     \fn QByteArray& QByteArray::setRawData(const char *a, uint n)
    4210 
    4211     Use fromRawData() instead.
    4212 */
    4213 
    4214 /*!
    42154283    \fn void QByteArray::resetRawData(const char *data, uint n)
    42164284
Note: See TracChangeset for help on using the changeset viewer.