diff options
author | David Boddie <dboddie@trolltech.com> | 2010-06-16 10:44:02 (GMT) |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2010-06-16 10:44:02 (GMT) |
commit | 9e7f0b9e45cef278c8874539257b4038a0aa6615 (patch) | |
tree | 6f66ec8ea599e348ea550da76612cb3873478a21 /src/corelib/tools | |
parent | 700a4826cf6bd755df000cb16c259343efb695cd (diff) | |
parent | 5b5785bc564ccea9f6868d02be3d1080cb5039b9 (diff) | |
download | Qt-9e7f0b9e45cef278c8874539257b4038a0aa6615.zip Qt-9e7f0b9e45cef278c8874539257b4038a0aa6615.tar.gz Qt-9e7f0b9e45cef278c8874539257b4038a0aa6615.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 19 | ||||
-rw-r--r-- | src/corelib/tools/qlocale.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 24 | ||||
-rw-r--r-- | src/corelib/tools/qstring.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qvarlengtharray.h | 7 | ||||
-rw-r--r-- | src/corelib/tools/qvarlengtharray.qdoc | 49 |
6 files changed, 93 insertions, 10 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index c000dc8..a51ee81 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -3478,6 +3478,25 @@ QLocale::MeasurementSystem QLocale::measurementSystem() const } /*! + \since 4.7 + + Returns the text direction of the language. +*/ +Qt::LayoutDirection QLocale::textDirection() const +{ + Language lang = language(); + if (lang == QLocale::Arabic || + lang == QLocale::Hebrew || + lang == QLocale::Persian || + lang == QLocale::Urdu || + lang == QLocale::Syriac) + return Qt::RightToLeft; + + return Qt::LeftToRight; +} + + +/*! \since 4.5 Returns the localized name of the "AM" suffix for times specified using diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h index f2fd892..8b424bb 100644 --- a/src/corelib/tools/qlocale.h +++ b/src/corelib/tools/qlocale.h @@ -666,6 +666,8 @@ public: MeasurementSystem measurementSystem() const; + Qt::LayoutDirection textDirection() const; + inline bool operator==(const QLocale &other) const; inline bool operator!=(const QLocale &other) const; diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 1172a7b..57f79a0 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -4768,6 +4768,10 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1, CFRelease(thisString); CFRelease(otherString); return result; +#elif defined(Q_OS_SYMBIAN) + TPtrC p1 = TPtrC16(reinterpret_cast<const TUint16 *>(data1), length1); + TPtrC p2 = TPtrC16(reinterpret_cast<const TUint16 *>(data2), length2); + return p1.CompareC(p2); #elif defined(Q_OS_UNIX) // declared in <string.h> int delta = strcoll(toLocal8Bit_helper(data1, length1), toLocal8Bit_helper(data2, length2)); @@ -6916,20 +6920,23 @@ void QString::updateProperties() const p++; } - p = d->data; - d->righttoleft = false; + d->righttoleft = isRightToLeft(); + d->clean = true; +} + +bool QString::isRightToLeft() const +{ + ushort *p = d->data; + const ushort * const end = p + d->size; + bool righttoleft = false; while (p < end) { switch(QChar::direction(*p)) { case QChar::DirL: - case QChar::DirLRO: - case QChar::DirLRE: goto end; case QChar::DirR: case QChar::DirAL: - case QChar::DirRLO: - case QChar::DirRLE: - d->righttoleft = true; + righttoleft = true; goto end; default: break; @@ -6937,8 +6944,7 @@ void QString::updateProperties() const ++p; } end: - d->clean = true; - return; + return righttoleft; } /*! \fn bool QString::isSimpleText() const diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index a1c4e77..e52f59f 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -590,7 +590,7 @@ public: #endif bool isSimpleText() const { if (!d->clean) updateProperties(); return d->simpletext; } - bool isRightToLeft() const { if (!d->clean) updateProperties(); return d->righttoleft; } + bool isRightToLeft() const; QString(int size, Qt::Initialization); diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index bfede94..4a6bb4b 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -127,6 +127,13 @@ public: inline T *data() { return ptr; } inline const T *data() const { return ptr; } inline const T * constData() const { return ptr; } + typedef int size_type; + typedef T value_type; + typedef value_type *pointer; + typedef const value_type *const_pointer; + typedef value_type &reference; + typedef const value_type &const_reference; + typedef qptrdiff difference_type; private: friend class QPodList<T, Prealloc>; diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc index 38901e5..ef2dc58 100644 --- a/src/corelib/tools/qvarlengtharray.qdoc +++ b/src/corelib/tools/qvarlengtharray.qdoc @@ -302,3 +302,52 @@ \a defaultValue. */ +/*! + \typedef QVarLengthArray::size_type + \since 4.7 + + Typedef for int. Provided for STL compatibility. +*/ + +/*! + \typedef QVarLengthArray::value_type + \since 4.7 + + Typedef for T. Provided for STL compatibility. +*/ + +/*! + \typedef QVarLengthArray::difference_type + \since 4.7 + + Typedef for ptrdiff_t. Provided for STL compatibility. +*/ + +/*! + \typedef QVarLengthArray::pointer + \since 4.7 + + Typedef for T *. Provided for STL compatibility. +*/ + +/*! + \typedef QVarLengthArray::const_pointer + \since 4.7 + + Typedef for const T *. Provided for STL compatibility. +*/ + +/*! + \typedef QVarLengthArray::reference + \since 4.7 + + Typedef for T &. Provided for STL compatibility. +*/ + +/*! + \typedef QVarLengthArray::const_reference + \since 4.7 + + Typedef for const T &. Provided for STL compatibility. +*/ + |