summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-03-11 01:33:07 -0400
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-13 05:47:37 +0200
commitec64d514fbf7bc6a6ccf5ee2342734a4719fc634 (patch)
tree330e06126f74dc1b3cb12eaf91bf9df053fc52d9 /src/corelib
parentff0fdc04626c9b55e48c959171a8549fdf9870d4 (diff)
Make the QCollator class public
The class missed the feature freeze for Qt 5.0, but has been ready for quite a while. So make it public in time for Qt 5.2. Change-Id: I9ac3f579ff5e371925fad40684762fff7ee4abd8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/tools/qcollator.cpp39
-rw-r--r--src/corelib/tools/qcollator.h (renamed from src/corelib/tools/qcollator_p.h)2
-rw-r--r--src/corelib/tools/qstring.cpp2
-rw-r--r--src/corelib/tools/tools.pri2
4 files changed, 26 insertions, 19 deletions
diff --git a/src/corelib/tools/qcollator.cpp b/src/corelib/tools/qcollator.cpp
index a22d41838c..f41e9d61bf 100644
--- a/src/corelib/tools/qcollator.cpp
+++ b/src/corelib/tools/qcollator.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qcollator_p.h"
+#include "qcollator.h"
#include "qstringlist.h"
#include "qstring.h"
@@ -117,7 +117,7 @@ static const char * const collationStrings[collationStringsCount] = {
\inmodule QtCore
\brief The QCollator class compares strings according to a localized collation algorithm.
- \internal
+ \since 5.2
\reentrant
\ingroup i18n
@@ -133,6 +133,8 @@ static const char * const collationStrings[collationStringsCount] = {
In addition to the locale and collation strategy, several optional flags can be set that influence
the result of the collation.
+
+ QCollator currently depends on Qt being compiled with ICU support enabled.
*/
/*!
@@ -140,7 +142,7 @@ static const char * const collationStrings[collationStringsCount] = {
specified the default collation algorithm for the locale is being used. If
\a locale is not specified QLocale::default() is being used.
- \sa setLocale, setCollation, setOptions
+ \sa setLocale(), setCollation()
*/
QCollator::QCollator(const QLocale &locale, QCollator::Collation collation)
: d(new QCollatorPrivate)
@@ -221,7 +223,6 @@ void QCollator::detach()
}
}
-
/*!
Sets the locale of the collator to \a locale.
*/
@@ -253,6 +254,7 @@ QLocale QCollator::locale() const
\value Default Use the default algorithm for the locale
\value Big5Han
+ \value Dictionary
\value Direct
\value GB2312Han
\value PhoneBook
@@ -266,7 +268,7 @@ QLocale QCollator::locale() const
*/
/*!
- Sets the collation algorithm to be used.
+ Sets the \a collation algorithm to be used.
\sa QCollator::Collation
*/
@@ -298,7 +300,7 @@ QCollator::Collation QCollator::collation() const
This method is helpful to save and restore defined collation
objects.
- \sa fromIdentifier
+ \sa fromIdentifier()
*/
QString QCollator::identifier() const
{
@@ -313,9 +315,9 @@ QString QCollator::identifier() const
}
/*!
- Creates a QCollator from a unique identifier and returns it.
+ Creates a QCollator from a unique \a identifier and returns it.
- \sa identifier
+ \sa identifier()
*/
QCollator QCollator::fromIdentifier(const QString &identifier)
{
@@ -351,20 +353,20 @@ QCollator QCollator::fromIdentifier(const QString &identifier)
*/
/*!
- Sets the case preference of the collator.
+ Sets the case \a preference of the collator.
\sa QCollator::CasePreference
*/
-void QCollator::setCasePreference(CasePreference c)
+void QCollator::setCasePreference(CasePreference preference)
{
if (d->ref.load() != 1)
detach();
#ifdef QT_USE_ICU
UColAttributeValue val = UCOL_OFF;
- if (c == QCollator::CasePreferenceUpper)
+ if (preference == QCollator::CasePreferenceUpper)
val = UCOL_UPPER_FIRST;
- else if (c == QCollator::CasePreferenceLower)
+ else if (preference == QCollator::CasePreferenceLower)
val = UCOL_LOWER_FIRST;
UErrorCode status = U_ZERO_ERROR;
@@ -372,7 +374,7 @@ void QCollator::setCasePreference(CasePreference c)
if (U_FAILURE(status))
qWarning("ucol_setAttribute: Case First failed: %d", status);
#else
- Q_UNUSED(c);
+ Q_UNUSED(preference);
#endif
}
@@ -423,7 +425,7 @@ void QCollator::setNumericMode(bool on)
/*!
Returns true if numeric sorting is enabled, false otherwise.
- \sa setNumericMode
+ \sa setNumericMode()
*/
bool QCollator::numericMode() const
{
@@ -436,7 +438,7 @@ bool QCollator::numericMode() const
}
/*!
- If set to true, punctuation characters and symbols are ignored when determining sort order.
+ If \a on is set to true, punctuation characters and symbols are ignored when determining sort order.
The default is locale dependent.
*/
@@ -458,7 +460,7 @@ void QCollator::setIgnorePunctuation(bool on)
/*!
Returns true if punctuation characters and symbols are ignored when determining sort order.
- \sa setIgnorePunctuation
+ \sa setIgnorePunctuation()
*/
bool QCollator::ignorePunctuation() const
{
@@ -584,4 +586,9 @@ QStringList QCollator::indexCharacters() const
return d->indexCharacters;
}
+/*!
+ \fn bool QCollator::operator()(const QString &s1, const QString &s2) const
+ \internal
+*/
+
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qcollator_p.h b/src/corelib/tools/qcollator.h
index 51de205565..02470c331f 100644
--- a/src/corelib/tools/qcollator_p.h
+++ b/src/corelib/tools/qcollator.h
@@ -89,7 +89,7 @@ public:
};
CasePreference casePreference() const;
- void setCasePreference(CasePreference c);
+ void setCasePreference(CasePreference preference);
void setNumericMode(bool on);
bool numericMode() const;
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index b9b261e27c..48d96e0ed0 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -59,7 +59,7 @@
#include "qhash.h"
#include "qdebug.h"
#include "qendian.h"
-#include "qcollator_p.h"
+#include "qcollator.h"
#ifdef Q_OS_MAC
#include <private/qcore_mac_p.h>
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index 2f3697acb8..d3f87977fc 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -11,9 +11,9 @@ HEADERS += \
tools/qbytedata_p.h \
tools/qcache.h \
tools/qchar.h \
- tools/qcollator_p.h \
tools/qcommandlineoption.h \
tools/qcommandlineparser.h \
+ tools/qcollator.h \
tools/qcontainerfwd.h \
tools/qcryptographichash.h \
tools/qdatetime.h \