diff options
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qarraydata.h | 12 | ||||
-rw-r--r-- | src/corelib/tools/qchar.cpp | 54 | ||||
-rw-r--r-- | src/corelib/tools/qcontiguouscache.cpp | 11 | ||||
-rw-r--r-- | src/corelib/tools/qcontiguouscache.h | 6 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 1 | ||||
-rw-r--r-- | src/corelib/tools/qregularexpression.cpp | 4 | ||||
-rw-r--r-- | src/corelib/tools/qvector.h | 11 |
7 files changed, 79 insertions, 20 deletions
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h index a67255ad68..7fecbbbeeb 100644 --- a/src/corelib/tools/qarraydata.h +++ b/src/corelib/tools/qarraydata.h @@ -209,12 +209,12 @@ struct QTypedArrayData T *data() { return static_cast<T *>(QArrayData::data()); } const T *data() const { return static_cast<const T *>(QArrayData::data()); } - iterator begin() { return data(); } - iterator end() { return data() + size; } - const_iterator begin() const { return data(); } - const_iterator end() const { return data() + size; } - const_iterator constBegin() const { return data(); } - const_iterator constEnd() const { return data() + size; } + iterator begin(iterator = iterator()) { return data(); } + iterator end(iterator = iterator()) { return data() + size; } + const_iterator begin(const_iterator = const_iterator()) const { return data(); } + const_iterator end(const_iterator = const_iterator()) const { return data() + size; } + const_iterator constBegin(const_iterator = const_iterator()) const { return data(); } + const_iterator constEnd(const_iterator = const_iterator()) const { return data() + size; } class AlignmentDummy { QArrayData header; T data; }; diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp index 0a027fc229..c66962d931 100644 --- a/src/corelib/tools/qchar.cpp +++ b/src/corelib/tools/qchar.cpp @@ -121,7 +121,7 @@ QT_BEGIN_NAMESPACE isDigit() (decimal digits). All of these are wrappers around category() which return the Unicode-defined category of each character. Some of these also calculate the derived properties - (i.e. isSpace() returns true if the character is of category + (for example isSpace() returns true if the character is of category Separator_* or an exceptional code point from Other_Control category). QChar also provides direction(), which indicates the "natural" @@ -766,14 +766,14 @@ bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4) \fn bool QChar::isHighSurrogate() const Returns true if the QChar is the high part of a UTF16 surrogate - (i.e. if its code point is in range [0xd800..0xdbff]); false otherwise. + (for example if its code point is in range [0xd800..0xdbff]); false otherwise. */ /*! \fn bool QChar::isLowSurrogate() const Returns true if the QChar is the low part of a UTF16 surrogate - (i.e. if its code point is in range [0xdc00..0xdfff]); false otherwise. + (for example if its code point is in range [0xdc00..0xdfff]); false otherwise. */ /*! @@ -782,7 +782,7 @@ bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4) Returns true if the QChar contains a code point that is in either the high or the low part of the UTF-16 surrogate range - (i.e. if its code point is in range [0xd800..0xdfff]); false otherwise. + (for example if its code point is in range [0xd800..0xdfff]); false otherwise. */ /*! @@ -806,7 +806,7 @@ bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4) Returns true if the UCS-4-encoded character specified by \a ucs4 is the high part of a UTF16 surrogate - (i.e. if its code point is in range [0xd800..0xdbff]); false otherwise. + (for example if its code point is in range [0xd800..0xdbff]); false otherwise. */ /*! @@ -815,7 +815,7 @@ bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4) Returns true if the UCS-4-encoded character specified by \a ucs4 is the low part of a UTF16 surrogate - (i.e. if its code point is in range [0xdc00..0xdfff]); false otherwise. + (for example if its code point is in range [0xdc00..0xdfff]); false otherwise. */ /*! @@ -825,7 +825,7 @@ bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4) Returns true if the UCS-4-encoded character specified by \a ucs4 contains a code point that is in either the high or the low part of the - UTF-16 surrogate range (i.e. if its code point is in range [0xd800..0xdfff]); + UTF-16 surrogate range (for example if its code point is in range [0xd800..0xdfff]); false otherwise. */ @@ -834,7 +834,7 @@ bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4) Returns true if the UCS-4-encoded character specified by \a ucs4 can be split into the high and low parts of a UTF16 surrogate - (i.e. if its code point is greater than or equals to 0x10000); + (for example if its code point is greater than or equals to 0x10000); false otherwise. */ @@ -969,31 +969,63 @@ bool QChar::hasMirrored(uint ucs4) /*! \fn bool QChar::isLower() const - Returns true if the character is a lowercase letter, i.e. + Returns true if the character is a lowercase letter, for example category() is Letter_Lowercase. \sa isUpper(), toLower(), toUpper() */ /*! + \fn static bool QChar::isLower(uint ucs4) + \overload + \since 5.0 + + Returns true if the UCS-4-encoded character specified by \a ucs4 + is a lowercase letter, for example category() is Letter_Lowercase. + + \sa isUpper(), toLower(), toUpper() +*/ + +/*! \fn bool QChar::isUpper() const - Returns true if the character is an uppercase letter, i.e. + Returns true if the character is an uppercase letter, for example category() is Letter_Uppercase. \sa isLower(), toUpper(), toLower() */ /*! + \fn static bool QChar::isUpper(uint ucs4) + \overload + \since 5.0 + + Returns true if the UCS-4-encoded character specified by \a ucs4 + is an uppercase letter, for example category() is Letter_Uppercase. + + \sa isLower(), toUpper(), toLower() +*/ + +/*! \fn bool QChar::isTitleCase() const - Returns true if the character is a titlecase letter, i.e. + Returns true if the character is a titlecase letter, for example category() is Letter_Titlecase. \sa isLower(), toUpper(), toLower(), toTitleCase() */ /*! + \fn static bool QChar::isTitleCase(uint ucs4) + \overload + \since 5.0 + + Returns true if the UCS-4-encoded character specified by \a ucs4 + is a titlecase letter, for example category() is Letter_Titlecase. + + \sa isLower(), toUpper(), toLower(), toTitleCase() +*/ +/*! \fn QChar QChar::mirroredChar() const Returns the mirrored character if this character is a mirrored diff --git a/src/corelib/tools/qcontiguouscache.cpp b/src/corelib/tools/qcontiguouscache.cpp index 3e325bec59..40edb0fa58 100644 --- a/src/corelib/tools/qcontiguouscache.cpp +++ b/src/corelib/tools/qcontiguouscache.cpp @@ -80,8 +80,15 @@ void QContiguousCacheData::freeData(QContiguousCacheData *data) of matching how user interface views most commonly request data, as a set of rows localized around the current scrolled position. This restriction allows the cache to consume less memory and processor - cycles than QCache. The QContiguousCache class also can provide - an upper bound on memory usage via setCapacity(). + cycles than QCache. + + QContiguousCache operates on a fixed capacity, set with setCapacity() or + passed as a parameter to the constructor. This capacity is the upper bound + on memory usage by the cache itself, not including the memory allocated by + the elements themselves. Note that a cache with a capacity of zero (the + default) means no items will be stored: the insert(), append() and + prepend() operations will effectively be no-ops. Therefore, it's important + to set the capacity to a reasonable value before adding items to the cache. The simplest way of using a contiguous cache is to use the append() and prepend(). diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h index 8713a3407a..e1cc65f10a 100644 --- a/src/corelib/tools/qcontiguouscache.h +++ b/src/corelib/tools/qcontiguouscache.h @@ -341,6 +341,8 @@ void QContiguousCache<T>::freeData(Data *x) template <typename T> void QContiguousCache<T>::append(const T &value) { + if (!d->alloc) + return; // zero capacity detach(); if (QTypeInfo<T>::isComplex) { if (d->count == d->alloc) @@ -362,6 +364,8 @@ void QContiguousCache<T>::append(const T &value) template<typename T> void QContiguousCache<T>::prepend(const T &value) { + if (!d->alloc) + return; // zero capacity detach(); if (d->start) d->start--; @@ -385,6 +389,8 @@ template<typename T> void QContiguousCache<T>::insert(int pos, const T &value) { Q_ASSERT_X(pos >= 0 && pos < INT_MAX, "QContiguousCache<T>::insert", "index out of range"); + if (!d->alloc) + return; // zero capacity detach(); if (containsIndex(pos)) { if (QTypeInfo<T>::isComplex) { diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index cbdd183f33..a9d3095224 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -847,6 +847,7 @@ QString QDate::toString(const QString& format) const If \a y is in the range 0 to 99, it is interpreted as 1900 to 1999. + Returns \c false if the date is invalid. Use setDate() instead. */ diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index 5436d1f94a..5c6b3ff044 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -2345,7 +2345,9 @@ static const char *pcreCompileErrorCodes[] = QT_TRANSLATE_NOOP("QRegularExpression", "\\N is not supported in a class"), QT_TRANSLATE_NOOP("QRegularExpression", "too many forward references"), QT_TRANSLATE_NOOP("QRegularExpression", "disallowed Unicode code point (>= 0xd800 && <= 0xdfff)"), - QT_TRANSLATE_NOOP("QRegularExpression", "invalid UTF-16 string") + QT_TRANSLATE_NOOP("QRegularExpression", "invalid UTF-16 string"), + QT_TRANSLATE_NOOP("QRegularExpression", "name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)"), + QT_TRANSLATE_NOOP("QRegularExpression", "character value in \\u.... sequence is too large") }; #endif // #if 0 diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index c0ae048322..925ad17110 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -151,6 +151,7 @@ public: // STL-style typedef typename Data::iterator iterator; typedef typename Data::const_iterator const_iterator; +#if !defined(QT_STRICT_ITERATORS) || defined(Q_QDOC) inline iterator begin() { detach(); return d->begin(); } inline const_iterator begin() const { return d->constBegin(); } inline const_iterator cbegin() const { return d->constBegin(); } @@ -159,6 +160,16 @@ public: inline const_iterator end() const { return d->constEnd(); } inline const_iterator cend() const { return d->constEnd(); } inline const_iterator constEnd() const { return d->constEnd(); } +#else + inline iterator begin(iterator = iterator()) { detach(); return d->begin(); } + inline const_iterator begin(const_iterator = const_iterator()) const { return d->constBegin(); } + inline const_iterator cbegin(const_iterator = const_iterator()) const { return d->constBegin(); } + inline const_iterator constBegin(const_iterator = const_iterator()) const { return d->constBegin(); } + inline iterator end(iterator = iterator()) { detach(); return d->end(); } + inline const_iterator end(const_iterator = const_iterator()) const { return d->constEnd(); } + inline const_iterator cend(const_iterator = const_iterator()) const { return d->constEnd(); } + inline const_iterator constEnd(const_iterator = const_iterator()) const { return d->constEnd(); } +#endif iterator insert(iterator before, int n, const T &x); inline iterator insert(iterator before, const T &x) { return insert(before, 1, x); } iterator erase(iterator begin, iterator end); |