summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qalgorithms.h5
-rw-r--r--src/corelib/tools/qalgorithms.qdoc4
-rw-r--r--src/corelib/tools/qbitarray.cpp4
-rw-r--r--src/corelib/tools/qbitarray.h5
-rw-r--r--src/corelib/tools/qbytearray.cpp12
-rw-r--r--src/corelib/tools/qbytearray.h23
-rw-r--r--src/corelib/tools/qbytearraymatcher.cpp4
-rw-r--r--src/corelib/tools/qbytearraymatcher.h5
-rw-r--r--src/corelib/tools/qbytedata_p.h4
-rw-r--r--src/corelib/tools/qcache.h5
-rw-r--r--src/corelib/tools/qcache.qdoc4
-rw-r--r--src/corelib/tools/qchar.cpp4
-rw-r--r--src/corelib/tools/qchar.h5
-rw-r--r--src/corelib/tools/qcontainerfwd.h5
-rw-r--r--src/corelib/tools/qcontiguouscache.cpp4
-rw-r--r--src/corelib/tools/qcontiguouscache.h5
-rw-r--r--src/corelib/tools/qcryptographichash.cpp8
-rw-r--r--src/corelib/tools/qcryptographichash.h5
-rw-r--r--src/corelib/tools/qdatetime.cpp643
-rw-r--r--src/corelib/tools/qdatetime.h47
-rw-r--r--src/corelib/tools/qdatetime_p.h11
-rw-r--r--src/corelib/tools/qeasingcurve.cpp4
-rw-r--r--src/corelib/tools/qeasingcurve.h5
-rw-r--r--src/corelib/tools/qelapsedtimer.cpp16
-rw-r--r--src/corelib/tools/qelapsedtimer.h5
-rw-r--r--src/corelib/tools/qelapsedtimer_generic.cpp4
-rw-r--r--src/corelib/tools/qelapsedtimer_mac.cpp4
-rw-r--r--src/corelib/tools/qelapsedtimer_symbian.cpp131
-rw-r--r--src/corelib/tools/qelapsedtimer_unix.cpp4
-rw-r--r--src/corelib/tools/qelapsedtimer_win.cpp12
-rw-r--r--src/corelib/tools/qfreelist.cpp4
-rw-r--r--src/corelib/tools/qfreelist_p.h5
-rw-r--r--src/corelib/tools/qharfbuzz.cpp4
-rw-r--r--src/corelib/tools/qharfbuzz_p.h4
-rw-r--r--src/corelib/tools/qhash.cpp4
-rw-r--r--src/corelib/tools/qhash.h5
-rw-r--r--src/corelib/tools/qiterator.h5
-rw-r--r--src/corelib/tools/qiterator.qdoc4
-rw-r--r--src/corelib/tools/qline.cpp4
-rw-r--r--src/corelib/tools/qline.h5
-rw-r--r--src/corelib/tools/qlinkedlist.cpp4
-rw-r--r--src/corelib/tools/qlinkedlist.h5
-rw-r--r--src/corelib/tools/qlist.cpp6
-rw-r--r--src/corelib/tools/qlist.h13
-rw-r--r--src/corelib/tools/qlocale.cpp84
-rw-r--r--src/corelib/tools/qlocale.h86
-rw-r--r--src/corelib/tools/qlocale.qdoc5
-rw-r--r--src/corelib/tools/qlocale_data_p.h4
-rw-r--r--src/corelib/tools/qlocale_icu.cpp4
-rw-r--r--src/corelib/tools/qlocale_mac.mm4
-rw-r--r--src/corelib/tools/qlocale_p.h90
-rw-r--r--src/corelib/tools/qlocale_symbian.cpp956
-rw-r--r--src/corelib/tools/qlocale_tools.cpp11
-rw-r--r--src/corelib/tools/qlocale_tools_p.h4
-rw-r--r--src/corelib/tools/qlocale_unix.cpp4
-rw-r--r--src/corelib/tools/qlocale_win.cpp8
-rw-r--r--src/corelib/tools/qmap.cpp4
-rw-r--r--src/corelib/tools/qmap.h5
-rw-r--r--src/corelib/tools/qmargins.cpp4
-rw-r--r--src/corelib/tools/qmargins.h5
-rw-r--r--src/corelib/tools/qpair.h5
-rw-r--r--src/corelib/tools/qpair.qdoc4
-rw-r--r--src/corelib/tools/qpodlist_p.h5
-rw-r--r--src/corelib/tools/qpoint.cpp4
-rw-r--r--src/corelib/tools/qpoint.h5
-rw-r--r--src/corelib/tools/qqueue.cpp4
-rw-r--r--src/corelib/tools/qqueue.h5
-rw-r--r--src/corelib/tools/qrect.cpp4
-rw-r--r--src/corelib/tools/qrect.h5
-rw-r--r--src/corelib/tools/qrefcount.cpp4
-rw-r--r--src/corelib/tools/qrefcount.h5
-rw-r--r--src/corelib/tools/qregexp.cpp19
-rw-r--r--src/corelib/tools/qregexp.h8
-rw-r--r--src/corelib/tools/qringbuffer_p.h4
-rw-r--r--src/corelib/tools/qscopedpointer.cpp4
-rw-r--r--src/corelib/tools/qscopedpointer.h9
-rw-r--r--src/corelib/tools/qscopedpointer_p.h5
-rw-r--r--src/corelib/tools/qscopedvaluerollback.cpp4
-rw-r--r--src/corelib/tools/qscopedvaluerollback.h5
-rw-r--r--src/corelib/tools/qset.h5
-rw-r--r--src/corelib/tools/qset.qdoc4
-rw-r--r--src/corelib/tools/qshareddata.cpp4
-rw-r--r--src/corelib/tools/qshareddata.h5
-rw-r--r--src/corelib/tools/qsharedpointer.cpp4
-rw-r--r--src/corelib/tools/qsharedpointer.h5
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h18
-rw-r--r--src/corelib/tools/qsimd.cpp21
-rw-r--r--src/corelib/tools/qsimd_p.h8
-rw-r--r--src/corelib/tools/qsize.cpp4
-rw-r--r--src/corelib/tools/qsize.h5
-rw-r--r--src/corelib/tools/qstack.cpp4
-rw-r--r--src/corelib/tools/qstack.h5
-rw-r--r--src/corelib/tools/qstring.cpp227
-rw-r--r--src/corelib/tools/qstring.h72
-rw-r--r--src/corelib/tools/qstringbuilder.cpp4
-rw-r--r--src/corelib/tools/qstringbuilder.h5
-rw-r--r--src/corelib/tools/qstringlist.cpp14
-rw-r--r--src/corelib/tools/qstringlist.h13
-rw-r--r--src/corelib/tools/qstringmatcher.cpp4
-rw-r--r--src/corelib/tools/qstringmatcher.h5
-rw-r--r--src/corelib/tools/qtextboundaryfinder.cpp4
-rw-r--r--src/corelib/tools/qtextboundaryfinder.h5
-rw-r--r--src/corelib/tools/qtimeline.cpp4
-rw-r--r--src/corelib/tools/qtimeline.h5
-rw-r--r--src/corelib/tools/qtools_p.h4
-rw-r--r--src/corelib/tools/qunicodetables.cpp4
-rw-r--r--src/corelib/tools/qunicodetables_p.h4
-rw-r--r--src/corelib/tools/qvarlengtharray.h5
-rw-r--r--src/corelib/tools/qvarlengtharray.qdoc4
-rw-r--r--src/corelib/tools/qvector.cpp4
-rw-r--r--src/corelib/tools/qvector.h5
-rw-r--r--src/corelib/tools/qvsnprintf.cpp4
-rw-r--r--src/corelib/tools/tools.pri3
113 files changed, 824 insertions, 2122 deletions
diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h
index a1c656934d..9bc56be527 100644
--- a/src/corelib/tools/qalgorithms.h
+++ b/src/corelib/tools/qalgorithms.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
/*
Warning: The contents of QAlgorithmsPrivate is not a part of the public Qt API
diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc
index 3ba86b6838..a16ed8b3dc 100644
--- a/src/corelib/tools/qalgorithms.qdoc
+++ b/src/corelib/tools/qalgorithms.qdoc
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -21,6 +20,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp
index 96811cc179..4cb08a7310 100644
--- a/src/corelib/tools/qbitarray.cpp
+++ b/src/corelib/tools/qbitarray.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qbitarray.h b/src/corelib/tools/qbitarray.h
index 83c81eca90..ac54c2a4f5 100644
--- a/src/corelib/tools/qbitarray.h
+++ b/src/corelib/tools/qbitarray.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QBitRef;
class Q_CORE_EXPORT QBitArray
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index 4173cf28e2..aa22413d94 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -1143,7 +1143,7 @@ QByteArray &QByteArray::operator=(const char *str)
\overload
*/
-/*! \fn QBool QByteArray::contains(const QByteArray &ba) const
+/*! \fn bool QByteArray::contains(const QByteArray &ba) const
Returns true if the byte array contains an occurrence of the byte
array \a ba; otherwise returns false.
@@ -1151,7 +1151,7 @@ QByteArray &QByteArray::operator=(const char *str)
\sa indexOf(), count()
*/
-/*! \fn QBool QByteArray::contains(const char *str) const
+/*! \fn bool QByteArray::contains(const char *str) const
\overload
@@ -1159,7 +1159,7 @@ QByteArray &QByteArray::operator=(const char *str)
otherwise returns false.
*/
-/*! \fn QBool QByteArray::contains(char ch) const
+/*! \fn bool QByteArray::contains(char ch) const
\overload
@@ -2660,7 +2660,7 @@ QByteArray QByteArray::right(int len) const
QByteArray QByteArray::mid(int pos, int len) const
{
- if (d == &shared_null.ba || d == &shared_empty.ba || pos >= d->size)
+ if (d == &shared_null.ba || d == &shared_empty.ba || pos > d->size)
return QByteArray();
if (len < 0)
len = d->size - pos;
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h
index bf75ef6ead..5efeb6025e 100644
--- a/src/corelib/tools/qbytearray.h
+++ b/src/corelib/tools/qbytearray.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -68,7 +68,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
/*****************************************************************************
Safe and portable C string functions; extensions to standard string.h
@@ -232,9 +231,9 @@ public:
int lastIndexOf(const char *c, int from = -1) const;
int lastIndexOf(const QByteArray &a, int from = -1) const;
- QBool contains(char c) const;
- QBool contains(const char *a) const;
- QBool contains(const QByteArray &a) const;
+ bool contains(char c) const;
+ bool contains(const char *a) const;
+ bool contains(const QByteArray &a) const;
int count(char c) const;
int count(const char *a) const;
int count(const QByteArray &a) const;
@@ -524,10 +523,10 @@ inline void QByteArray::push_front(const char *c)
{ prepend(c); }
inline void QByteArray::push_front(const QByteArray &a)
{ prepend(a); }
-inline QBool QByteArray::contains(const QByteArray &a) const
-{ return QBool(indexOf(a) != -1); }
-inline QBool QByteArray::contains(char c) const
-{ return QBool(indexOf(c) != -1); }
+inline bool QByteArray::contains(const QByteArray &a) const
+{ return indexOf(a) != -1; }
+inline bool QByteArray::contains(char c) const
+{ return indexOf(c) != -1; }
inline bool operator==(const QByteArray &a1, const QByteArray &a2)
{ return (a1.size() == a2.size()) && (memcmp(a1.constData(), a2.constData(), a1.size())==0); }
inline bool operator==(const QByteArray &a1, const char *a2)
@@ -576,8 +575,8 @@ inline const QByteArray operator+(const char *a1, const QByteArray &a2)
inline const QByteArray operator+(char a1, const QByteArray &a2)
{ return QByteArray(&a1, 1) += a2; }
#endif // QT_USE_QSTRINGBUILDER
-inline QBool QByteArray::contains(const char *c) const
-{ return QBool(indexOf(c) != -1); }
+inline bool QByteArray::contains(const char *c) const
+{ return indexOf(c) != -1; }
inline QByteArray &QByteArray::replace(char before, const char *c)
{ return replace(&before, 1, c, qstrlen(c)); }
inline QByteArray &QByteArray::replace(const QByteArray &before, const char *c)
diff --git a/src/corelib/tools/qbytearraymatcher.cpp b/src/corelib/tools/qbytearraymatcher.cpp
index fbe54fb9b3..a635db0a15 100644
--- a/src/corelib/tools/qbytearraymatcher.cpp
+++ b/src/corelib/tools/qbytearraymatcher.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qbytearraymatcher.h b/src/corelib/tools/qbytearraymatcher.h
index 9acfa0d581..f95cc98163 100644
--- a/src/corelib/tools/qbytearraymatcher.h
+++ b/src/corelib/tools/qbytearraymatcher.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QByteArrayMatcherPrivate;
diff --git a/src/corelib/tools/qbytedata_p.h b/src/corelib/tools/qbytedata_p.h
index 2708df3d52..763b71c8f3 100644
--- a/src/corelib/tools/qbytedata_p.h
+++ b/src/corelib/tools/qbytedata_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h
index fc5b8a0a9f..7fe1921804 100644
--- a/src/corelib/tools/qcache.h
+++ b/src/corelib/tools/qcache.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
template <class Key, class T>
class QCache
diff --git a/src/corelib/tools/qcache.qdoc b/src/corelib/tools/qcache.qdoc
index 9c8aef15df..80d47ff703 100644
--- a/src/corelib/tools/qcache.qdoc
+++ b/src/corelib/tools/qcache.qdoc
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -21,6 +20,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index 5109bf22a4..01241dce6b 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qchar.h b/src/corelib/tools/qchar.h
index 0e02d109f6..df3d7eac33 100644
--- a/src/corelib/tools/qchar.h
+++ b/src/corelib/tools/qchar.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QString;
diff --git a/src/corelib/tools/qcontainerfwd.h b/src/corelib/tools/qcontainerfwd.h
index 51ba07d856..c949b230f8 100644
--- a/src/corelib/tools/qcontainerfwd.h
+++ b/src/corelib/tools/qcontainerfwd.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
template <class Key, class T> class QCache;
template <class Key, class T> class QHash;
diff --git a/src/corelib/tools/qcontiguouscache.cpp b/src/corelib/tools/qcontiguouscache.cpp
index 29601149e4..6a320b82eb 100644
--- a/src/corelib/tools/qcontiguouscache.cpp
+++ b/src/corelib/tools/qcontiguouscache.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h
index 3c43b3abe7..4dc763f35d 100644
--- a/src/corelib/tools/qcontiguouscache.h
+++ b/src/corelib/tools/qcontiguouscache.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
#undef QT_QCONTIGUOUSCACHE_DEBUG
-QT_MODULE(Core)
struct Q_CORE_EXPORT QContiguousCacheData
diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp
index 350c785e8b..164660f818 100644
--- a/src/corelib/tools/qcryptographichash.cpp
+++ b/src/corelib/tools/qcryptographichash.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,16 +34,13 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <qcryptographichash.h>
-#ifdef Q_OS_SYMBIAN
-#define _MD5_H_ // Needed to disable system header
-#endif
-
#include "../../3rdparty/md5/md5.h"
#include "../../3rdparty/md5/md5.cpp"
#include "../../3rdparty/md4/md4.h"
diff --git a/src/corelib/tools/qcryptographichash.h b/src/corelib/tools/qcryptographichash.h
index 64d54838fa..59314e1963 100644
--- a/src/corelib/tools/qcryptographichash.h
+++ b/src/corelib/tools/qcryptographichash.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QCryptographicHashPrivate;
class QIODevice;
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index d20b07589e..3da7a37066 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,16 +48,16 @@
#include "qdatetime.h"
#include "qregexp.h"
#include "qdebug.h"
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
-#include <qt_windows.h>
-#endif
#ifndef Q_OS_WIN
#include <locale.h>
#endif
#include <time.h>
-#if defined(Q_OS_WINCE)
-#include "qfunctions_wince.h"
+#ifdef Q_OS_WIN
+# include <qt_windows.h>
+# ifdef Q_OS_WINCE
+# include "qfunctions_wince.h"
+# endif
#endif
//#define QDATETIMEPARSER_DEBUG
@@ -73,23 +73,16 @@
#include <private/qcore_mac_p.h>
#endif
-#if defined(Q_OS_SYMBIAN)
-#include <e32std.h>
-#endif
-
QT_BEGIN_NAMESPACE
enum {
- FIRST_YEAR = -4713,
- FIRST_MONTH = 1,
- FIRST_DAY = 2, // ### Qt 5: make FIRST_DAY = 1, by support jd == 0 as valid
SECS_PER_DAY = 86400,
MSECS_PER_DAY = 86400000,
SECS_PER_HOUR = 3600,
MSECS_PER_HOUR = 3600000,
SECS_PER_MIN = 60,
MSECS_PER_MIN = 60000,
- JULIAN_DAY_FOR_EPOCH = 2440588 // result of julianDayFromGregorianDate(1970, 1, 1)
+ JULIAN_DAY_FOR_EPOCH = 2440588 // result of julianDayFromDate(1970, 1, 1)
};
static inline QDate fixedDate(int y, int m, int d)
@@ -99,67 +92,41 @@ static inline QDate fixedDate(int y, int m, int d)
return result;
}
-static inline uint julianDayFromGregorianDate(int year, int month, int day)
+static inline qint64 julianDayFromDate(qint64 year, int month, int day)
{
- // Gregorian calendar starting from October 15, 1582
+ // Gregorian calendar
// Algorithm from Henry F. Fliegel and Thomas C. Van Flandern
- return (1461 * (year + 4800 + (month - 14) / 12)) / 4
- + (367 * (month - 2 - 12 * ((month - 14) / 12))) / 12
- - (3 * ((year + 4900 + (month - 14) / 12) / 100)) / 4
- + day - 32075;
-}
-static uint julianDayFromDate(int year, int month, int day)
-{
if (year < 0)
++year;
- if (year > 1582 || (year == 1582 && (month > 10 || (month == 10 && day >= 15)))) {
- return julianDayFromGregorianDate(year, month, day);
- } else if (year < 1582 || (year == 1582 && (month < 10 || (month == 10 && day <= 4)))) {
- // Julian calendar until October 4, 1582
- // Algorithm from Frequently Asked Questions about Calendars by Claus Toendering
- int a = (14 - month) / 12;
- return (153 * (month + (12 * a) - 3) + 2) / 5
- + (1461 * (year + 4800 - a)) / 4
- + day - 32083;
- } else {
- // the day following October 4, 1582 is October 15, 1582
- return 0;
- }
+ return (1461 * (year + 4800 + (month - 14) / 12)) / 4
+ + (367 * (month - 2 - 12 * ((month - 14) / 12))) / 12
+ - (3 * ((year + 4900 + (month - 14) / 12) / 100)) / 4
+ + day - 32075;
}
-static void getDateFromJulianDay(uint julianDay, int *year, int *month, int *day)
+static void getDateFromJulianDay(qint64 julianDay, int *year, int *month, int *day)
{
int y, m, d;
- if (julianDay >= 2299161) {
- // Gregorian calendar starting from October 15, 1582
- // This algorithm is from Henry F. Fliegel and Thomas C. Van Flandern
- qulonglong ell, n, i, j;
- ell = qulonglong(julianDay) + 68569;
- n = (4 * ell) / 146097;
- ell = ell - (146097 * n + 3) / 4;
- i = (4000 * (ell + 1)) / 1461001;
- ell = ell - (1461 * i) / 4 + 31;
- j = (80 * ell) / 2447;
- d = ell - (2447 * j) / 80;
- ell = j / 11;
- m = j + 2 - (12 * ell);
- y = 100 * (n - 49) + i + ell;
- } else {
- // Julian calendar until October 4, 1582
- // Algorithm from Frequently Asked Questions about Calendars by Claus Toendering
- julianDay += 32082;
- int dd = (4 * julianDay + 3) / 1461;
- int ee = julianDay - (1461 * dd) / 4;
- int mm = ((5 * ee) + 2) / 153;
- d = ee - (153 * mm + 2) / 5 + 1;
- m = mm + 3 - 12 * (mm / 10);
- y = dd - 4800 + (mm / 10);
- if (y <= 0)
- --y;
- }
+ // Gregorian calendar
+ // This algorithm is from Henry F. Fliegel and Thomas C. Van Flandern
+ qint64 ell, n, i, j; //TODO These will need to be bigger to prevent overflow!!!
+ ell = julianDay + 68569;
+ n = (4 * ell) / 146097;
+ ell = ell - (146097 * n + 3) / 4;
+ i = (4000 * (ell + 1)) / 1461001;
+ ell = ell - (1461 * i) / 4 + 31;
+ j = (80 * ell) / 2447;
+ d = ell - (2447 * j) / 80;
+ ell = j / 11;
+ m = j + 2 - (12 * ell);
+ y = 100 * (n - 49) + i + ell;
+
+ if (y<= 0)
+ --y;
+
if (year)
*year = y;
if (month)
@@ -205,12 +172,10 @@ static QString fmtDateTime(const QString& f, const QTime* dt = 0, const QDate* d
A QDate object contains a calendar date, i.e. year, month, and day
- numbers, in the Gregorian calendar. (see \l{QDate G and J} {Use of
- Gregorian and Julian Calendars} for dates prior to 15 October
- 1582). It can read the current date from the system clock. It
- provides functions for comparing dates, and for manipulating
- dates. For example, it is possible to add and subtract days,
- months, and years to dates.
+ numbers, in the Gregorian calendar. It can read the current date
+ from the system clock. It provides functions for comparing dates,
+ and for manipulating dates. For example, it is possible to add
+ and subtract days, months, and years to dates.
A QDate object is typically created either by giving the year,
month, and day numbers explicitly. Note that QDate interprets two
@@ -241,40 +206,31 @@ static QString fmtDateTime(const QString& f, const QTime* dt = 0, const QDate* d
\section1
- \target QDate G and J
- \section2 Use of Gregorian and Julian Calendars
-
- QDate uses the Gregorian calendar in all locales, beginning
- on the date 15 October 1582. For dates up to and including 4
- October 1582, the Julian calendar is used. This means there is a
- 10-day gap in the internal calendar between the 4th and the 15th
- of October 1582. When you use QDateTime for dates in that epoch,
- the day after 4 October 1582 is 15 October 1582, and the dates in
- the gap are invalid.
-
- The Julian to Gregorian changeover date used here is the date when
- the Gregorian calendar was first introduced, by Pope Gregory
- XIII. That change was not universally accepted and some localities
- only executed it at a later date (if at all). QDateTime
- doesn't take any of these historical facts into account. If an
- application must support a locale-specific dating system, it must
- do so on its own, remembering to convert the dates using the
- Julian day.
-
\section2 No Year 0
There is no year 0. Dates in that year are considered invalid. The
year -1 is the year "1 before Christ" or "1 before current era."
- The day before 0001-01-01 is December 31st, 1 BCE.
+ The day before 1 January 1 CE is 31 December 1 BCE.
\section2 Range of Valid Dates
- The range of valid dates is from January 2nd, 4713 BCE, to
- sometime in the year 11 million CE. The Julian Day returned by
- QDate::toJulianDay() is a number in the contiguous range from 1 to
- \e{overflow}, even across QDateTime's "date holes". It is suitable
- for use in applications that must convert a QDateTime to a date in
- another calendar system, e.g., Hebrew, Islamic or Chinese.
+ Dates are stored internally as a Julian Day number, an interger count of
+ every day in a contiguous range, with 24 November 4714 BCE in the Gregorian
+ calendar being Julian Day 0 (1 January 4713 BCE in the Julian calendar).
+ As well as being an efficient and accurate way of storing an absolute date,
+ it is suitable for converting a Date into other calendar systems such as
+ Hebrew, Islamic or Chinese. The Julian Day number can be obtained using
+ QDate::toJulianDay() and can be set using QDate::fromJulianDay().
+
+ The range of dates able to be stored by QDate as a Julian Day number is
+ limited for convenience from std::numeric_limits<qint64>::min() / 2 to
+ std::numeric_limits<qint64>::max() / 2, which on most platforms means
+ from around 2.5 quadrillion BCE to around 2.5 quadrillion CE, effectively
+ covering the full range of astronomical time. The range of Julian Days
+ able to be accurately converted to and from valid YMD form Dates is
+ restricted to 1 January 4800 BCE to 31 December 1400000 CE due to
+ shortcomings in the available conversion formulas. Conversions outside this
+ range are not guaranteed to be correct. This may change in the future.
\sa QTime, QDateTime, QDateEdit, QDateTimeEdit, QCalendarWidget
*/
@@ -291,8 +247,7 @@ static QString fmtDateTime(const QString& f, const QTime* dt = 0, const QDate* d
Constructs a date with year \a y, month \a m and day \a d.
If the specified date is invalid, the date is not set and
- isValid() returns false. A date before 2 January 4713 B.C. is
- considered invalid.
+ isValid() returns false.
\warning Years 0 to 99 are interpreted as is, i.e., years
0-99.
@@ -319,26 +274,28 @@ QDate::QDate(int y, int m, int d)
/*!
+ \fn bool isValid() const
+
Returns true if this date is valid; otherwise returns false.
\sa isNull()
*/
-bool QDate::isValid() const
-{
- return !isNull();
-}
-
/*!
Returns the year of this date. Negative numbers indicate years
- before 1 A.D. = 1 C.E., such that year -44 is 44 B.C.
+ before 1 CE, such that year -44 is 44 BCE.
+
+ Returns 0 if the date is invalid.
\sa month(), day()
*/
int QDate::year() const
{
+ if (isNull())
+ return 0;
+
int y;
getDateFromJulianDay(jd, &y, 0, 0);
return y;
@@ -363,11 +320,16 @@ int QDate::year() const
\i 12 = "December"
\endlist
+ Returns 0 if the date is invalid.
+
\sa year(), day()
*/
int QDate::month() const
{
+ if (isNull())
+ return 0;
+
int m;
getDateFromJulianDay(jd, 0, &m, 0);
return m;
@@ -376,51 +338,76 @@ int QDate::month() const
/*!
Returns the day of the month (1 to 31) of this date.
+ Returns 0 if the date is invalid.
+
\sa year(), month(), dayOfWeek()
*/
int QDate::day() const
{
+ if (isNull())
+ return 0;
+
int d;
getDateFromJulianDay(jd, 0, 0, &d);
return d;
}
/*!
- Returns the weekday (1 to 7) for this date.
+ Returns the weekday (1 = Monday to 7 = Sunday) for this date.
+
+ Returns 0 if the date is invalid.
\sa day(), dayOfYear(), Qt::DayOfWeek
*/
int QDate::dayOfWeek() const
{
- return (jd % 7) + 1;
+ if (isNull())
+ return 0;
+
+ if (jd >= 0)
+ return (jd % 7) + 1;
+ else
+ return ((jd + 1) % 7) + 7;
}
/*!
Returns the day of the year (1 to 365 or 366 on leap years) for
this date.
+ Returns 0 if the date is invalid.
+
\sa day(), dayOfWeek()
*/
int QDate::dayOfYear() const
{
+ if (isNull())
+ return 0;
+
return jd - julianDayFromDate(year(), 1, 1) + 1;
}
/*!
Returns the number of days in the month (28 to 31) for this date.
+ Returns 0 if the date is invalid.
+
\sa day(), daysInYear()
*/
int QDate::daysInMonth() const
{
- int y, m, d;
- getDateFromJulianDay(jd, &y, &m, &d);
+ if (isNull())
+ return 0;
+
+ int y, m;
+ getDateFromJulianDay(jd, &y, &m, 0);
if (m == 2 && isLeapYear(y))
return 29;
+ else if (m < 1 || m > 12)
+ return 0;
else
return monthDays[m];
}
@@ -428,13 +415,18 @@ int QDate::daysInMonth() const
/*!
Returns the number of days in the year (365 or 366) for this date.
+ Returns 0 if the date is invalid.
+
\sa day(), daysInMonth()
*/
int QDate::daysInYear() const
{
- int y, m, d;
- getDateFromJulianDay(jd, &y, &m, &d);
+ if (isNull())
+ return 0;
+
+ int y;
+ getDateFromJulianDay(jd, &y, 0, 0);
return isLeapYear(y) ? 366 : 365;
}
@@ -546,14 +538,16 @@ int QDate::weekNumber(int *yearNumber) const
The month names will be localized according to the system's locale
settings.
+ Returns an empty string if the date is invalid.
+
\sa toString(), longMonthName(), shortDayName(), longDayName()
*/
QString QDate::shortMonthName(int month, QDate::MonthNameType type)
{
- if (month < 1 || month > 12) {
- month = 1;
- }
+ if (month < 1 || month > 12)
+ return QString();
+
switch (type) {
case QDate::DateFormat:
return QLocale::system().monthName(month, QLocale::ShortFormat);
@@ -591,14 +585,16 @@ QString QDate::shortMonthName(int month, QDate::MonthNameType type)
The month names will be localized according to the system's locale
settings.
+ Returns an empty string if the date is invalid.
+
\sa toString(), shortMonthName(), shortDayName(), longDayName()
*/
QString QDate::longMonthName(int month, MonthNameType type)
{
- if (month < 1 || month > 12) {
- month = 1;
- }
+ if (month < 1 || month > 12)
+ return QString();
+
switch (type) {
case QDate::DateFormat:
return QLocale::system().monthName(month, QLocale::LongFormat);
@@ -631,14 +627,16 @@ QString QDate::longMonthName(int month, MonthNameType type)
The day names will be localized according to the system's locale
settings.
+ Returns an empty string if the date is invalid.
+
\sa toString(), shortMonthName(), longMonthName(), longDayName()
*/
QString QDate::shortDayName(int weekday, MonthNameType type)
{
- if (weekday < 1 || weekday > 7) {
- weekday = 1;
- }
+ if (weekday < 1 || weekday > 7)
+ return QString();
+
switch (type) {
case QDate::DateFormat:
return QLocale::system().dayName(weekday, QLocale::ShortFormat);
@@ -671,14 +669,16 @@ QString QDate::shortDayName(int weekday, MonthNameType type)
The day names will be localized according to the system's locale
settings.
+ Returns an empty string if the date is invalid.
+
\sa toString(), shortDayName(), shortMonthName(), longMonthName()
*/
QString QDate::longDayName(int weekday, MonthNameType type)
{
- if (weekday < 1 || weekday > 7) {
- weekday = 1;
- }
+ if (weekday < 1 || weekday > 7)
+ return QString();
+
switch (type) {
case QDate::DateFormat:
return QLocale::system().dayName(weekday, QLocale::LongFormat);
@@ -836,7 +836,9 @@ QString QDate::toString(const QString& format) const
#endif //QT_NO_DATESTRING
/*!
- \obsolete
+ \fn bool setYMD(int y, int m, int d)
+
+ \deprecated in 5.0, use setDate() instead.
Sets the date's year \a y, month \a m, and day \a d.
@@ -846,13 +848,6 @@ QString QDate::toString(const QString& format) const
Use setDate() instead.
*/
-bool QDate::setYMD(int y, int m, int d)
-{
- if (uint(y) <= 99)
- y += 1900;
- return setDate(y, m, d);
-}
-
/*!
\since 4.2
@@ -860,19 +855,21 @@ bool QDate::setYMD(int y, int m, int d)
the date is valid; otherwise returns false.
If the specified date is invalid, the QDate object is set to be
- invalid. Any date before 2 January 4713 B.C. is considered
invalid.
+ Note that any date before 4800 BCE or after about 1.4 million CE
+ may not be accurately stored.
+
\sa isValid()
*/
bool QDate::setDate(int year, int month, int day)
{
- if (!isValid(year, month, day)) {
- jd = 0;
- } else {
+ if (isValid(year, month, day))
jd = julianDayFromDate(year, month, day);
- }
- return jd != 0;
+ else
+ jd = nullJd();
+
+ return isValid();
}
/*!
@@ -881,28 +878,55 @@ bool QDate::setDate(int year, int month, int day)
Extracts the date's year, month, and day, and assigns them to
*\a year, *\a month, and *\a day. The pointers may be null.
+ Returns 0 if the date is invalid.
+
+ Note that any date before 4800 BCE or after about 1.4 million CE
+ may not be accurately stored.
+
\sa year(), month(), day(), isValid()
*/
void QDate::getDate(int *year, int *month, int *day)
{
- getDateFromJulianDay(jd, year, month, day);
+ if (isValid()) {
+ getDateFromJulianDay(jd, year, month, day);
+ } else {
+ if (year)
+ *year = 0;
+ if (month)
+ *month = 0;
+ if (day)
+ *day = 0;
+ }
}
/*!
Returns a QDate object containing a date \a ndays later than the
date of this object (or earlier if \a ndays is negative).
+ Returns a null date if the current date is invalid or the new date is
+ out-of-range.
+
\sa addMonths() addYears() daysTo()
*/
-QDate QDate::addDays(int ndays) const
+QDate QDate::addDays(qint64 ndays) const
{
+ if (isNull())
+ return QDate();
+
QDate d;
+ quint64 diff = 0;
+
// this is basically "d.jd = jd + ndays" with checks for integer overflow
+ // Due to limits on minJd() and maxJd() we know diff will never overflow
if (ndays >= 0)
- d.jd = (jd + ndays >= jd) ? jd + ndays : 0;
+ diff = maxJd() - jd;
else
- d.jd = (jd + ndays < jd) ? jd + ndays : 0;
+ diff = jd - minJd();
+
+ if (abs(ndays) <= diff)
+ d.jd = jd + ndays;
+
return d;
}
@@ -914,11 +938,6 @@ QDate QDate::addDays(int ndays) const
resulting month/year, this function will return a date that is the
latest valid date.
- \warning QDate has a date hole around the days introducing the
- Gregorian calendar (the days 5 to 14 October 1582, inclusive, do
- not exist). If the calculation ends in one of those days, QDate
- will return either October 4 or October 15.
-
\sa addDays() addYears()
*/
@@ -968,10 +987,6 @@ QDate QDate::addMonths(int nmonths) const
// yes, adjust the date by +1 or -1 years
y += increasing ? +1 : -1;
- // did we end up in the Gregorian/Julian conversion hole?
- if (y == 1582 && m == 10 && d > 4 && d < 15)
- d = increasing ? 15 : 4;
-
return fixedDate(y, m, d);
}
@@ -1011,14 +1026,20 @@ QDate QDate::addYears(int nyears) const
Returns the number of days from this date to \a d (which is
negative if \a d is earlier than this date).
+ Returns 0 if either date is invalid.
+
Example:
\snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 0
\sa addDays()
*/
-int QDate::daysTo(const QDate &d) const
+qint64 QDate::daysTo(const QDate &d) const
{
+ if (isNull() || d.isNull())
+ return 0;
+
+ // Due to limits on minJd() and maxJd() we know this will never overflow
return d.jd - jd;
}
@@ -1255,17 +1276,10 @@ QDate QDate::fromString(const QString &string, const QString &format)
bool QDate::isValid(int year, int month, int day)
{
- if (year < FIRST_YEAR
- || (year == FIRST_YEAR &&
- (month < FIRST_MONTH
- || (month == FIRST_MONTH && day < FIRST_DAY)))
- || year == 0) // there is no year 0 in the Julian calendar
+ // there is no year 0 in the Gregorian calendar
+ if (year == 0)
return false;
- // passage from Julian to Gregorian calendar
- if (year == 1582 && month == 10 && day > 4 && day < 15)
- return 0;
-
return (day > 0 && month > 0 && month <= 12) &&
(day <= monthDays[month] || (day == 29 && month == 2 && isLeapYear(year)));
}
@@ -1279,14 +1293,11 @@ bool QDate::isValid(int year, int month, int day)
bool QDate::isLeapYear(int y)
{
- if (y < 1582) {
- if ( y < 1) { // No year 0 in Julian calendar, so -1, -5, -9 etc are leap years
- ++y;
- }
- return y % 4 == 0;
- } else {
- return (y % 4 == 0 && y % 100 != 0) || y % 400 == 0;
- }
+ // No year 0 in Gregorian calendar, so -1, -5, -9 etc are leap years
+ if ( y < 1)
+ ++y;
+
+ return (y % 4 == 0 && y % 100 != 0) || y % 400 == 0;
}
/*! \fn static QDate QDate::fromJulianDay(int jd)
@@ -1403,44 +1414,64 @@ bool QTime::isValid() const
/*!
Returns the hour part (0 to 23) of the time.
+ Returns -1 if the time is invalid.
+
\sa minute(), second(), msec()
*/
int QTime::hour() const
{
+ if (!isValid())
+ return -1;
+
return ds() / MSECS_PER_HOUR;
}
/*!
Returns the minute part (0 to 59) of the time.
+ Returns -1 if the time is invalid.
+
\sa hour(), second(), msec()
*/
int QTime::minute() const
{
+ if (!isValid())
+ return -1;
+
return (ds() % MSECS_PER_HOUR) / MSECS_PER_MIN;
}
/*!
Returns the second part (0 to 59) of the time.
+ Returns -1 if the time is invalid.
+
\sa hour(), minute(), msec()
*/
int QTime::second() const
{
+ if (!isValid())
+ return -1;
+
return (ds() / 1000)%SECS_PER_MIN;
}
/*!
Returns the millisecond part (0 to 999) of the time.
+ Returns -1 if the time is invalid.
+
\sa hour(), minute(), second()
*/
int QTime::msec() const
{
+ if (!isValid())
+ return -1;
+
return ds() % 1000;
}
@@ -1588,6 +1619,8 @@ bool QTime::setHMS(int h, int m, int s, int ms)
Note that the time will wrap if it passes midnight.
+ Returns a null time if this time is invalid.
+
Example:
\snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 5
@@ -1610,11 +1643,16 @@ QTime QTime::addSecs(int s) const
secsTo() does not take into account any milliseconds.
+ Returns 0 if either time is invalid.
+
\sa addSecs(), QDateTime::secsTo()
*/
int QTime::secsTo(const QTime &t) const
{
+ if (!isValid() || !t.isValid())
+ return 0;
+
return (t.ds() - ds()) / 1000;
}
@@ -1625,18 +1663,22 @@ int QTime::secsTo(const QTime &t) const
Note that the time will wrap if it passes midnight. See addSecs()
for an example.
+ Returns a null time if this time is invalid.
+
\sa addSecs(), msecsTo(), QDateTime::addMSecs()
*/
QTime QTime::addMSecs(int ms) const
{
QTime t;
- if (ms < 0) {
- // % not well-defined for -ve, but / is.
- int negdays = (MSECS_PER_DAY - ms) / MSECS_PER_DAY;
- t.mds = (ds() + ms + negdays * MSECS_PER_DAY) % MSECS_PER_DAY;
- } else {
- t.mds = (ds() + ms) % MSECS_PER_DAY;
+ if (isValid()) {
+ if (ms < 0) {
+ // % not well-defined for -ve, but / is.
+ int negdays = (MSECS_PER_DAY - ms) / MSECS_PER_DAY;
+ t.mds = (ds() + ms + negdays * MSECS_PER_DAY) % MSECS_PER_DAY;
+ } else {
+ t.mds = (ds() + ms) % MSECS_PER_DAY;
+ }
}
#if defined(Q_OS_WINCE)
if (startTick > NullTime)
@@ -1654,11 +1696,15 @@ QTime QTime::addMSecs(int ms) const
seconds in a day, the result is always between -86400000 and
86400000 ms.
+ Returns 0 if either time is invalid.
+
\sa secsTo(), addMSecs(), QDateTime::msecsTo()
*/
int QTime::msecsTo(const QTime &t) const
{
+ if (!isValid() || !t.isValid())
+ return 0;
#if defined(Q_OS_WINCE)
// GetLocalTime() for Windows CE has no milliseconds resolution
if (t.startTick > NullTime && startTick > NullTime)
@@ -1979,50 +2025,31 @@ int QTime::elapsed() const
\section1
- \target QDateTime G and J
- \section2 Use of Gregorian and Julian Calendars
-
- QDate uses the Gregorian calendar in all locales, beginning
- on the date 15 October 1582. For dates up to and including 4
- October 1582, the Julian calendar is used. This means there is a
- 10-day gap in the internal calendar between the 4th and the 15th
- of October 1582. When you use QDateTime for dates in that epoch,
- the day after 4 October 1582 is 15 October 1582, and the dates in
- the gap are invalid.
-
- The Julian to Gregorian changeover date used here is the date when
- the Gregorian calendar was first introduced, by Pope Gregory
- XIII. That change was not universally accepted and some localities
- only executed it at a later date (if at all). QDateTime
- doesn't take any of these historical facts into account. If an
- application must support a locale-specific dating system, it must
- do so on its own, remembering to convert the dates using the
- Julian day.
-
\section2 No Year 0
There is no year 0. Dates in that year are considered invalid. The
year -1 is the year "1 before Christ" or "1 before current era."
- The day before 0001-01-01 is December 31st, 1 BCE.
+ The day before 1 January 1 CE is 31 December 1 BCE.
\section2 Range of Valid Dates
- The range of valid dates is from January 2nd, 4713 BCE, to
- sometime in the year 11 million CE. The Julian Day returned by
- QDate::toJulianDay() is a number in the contiguous range from 1 to
- \e{overflow}, even across QDateTime's "date holes". It is suitable
- for use in applications that must convert a QDateTime to a date in
- another calendar system, e.g., Hebrew, Islamic or Chinese.
-
- The Gregorian calendar was introduced in different places around
- the world on different dates. QDateTime uses QDate to store the
- date, so it uses the Gregorian calendar for all locales, beginning
- on the date 15 October 1582. For dates up to and including 4
- October 1582, QDateTime uses the Julian calendar. This means
- there is a 10-day gap in the QDateTime calendar between the 4th
- and the 15th of October 1582. When you use QDateTime for dates in
- that epoch, the day after 4 October 1582 is 15 October 1582, and
- the dates in the gap are invalid.
+ Dates are stored internally as a Julian Day number, an interger count of
+ every day in a contiguous range, with 24 November 4714 BCE in the Gregorian
+ calendar being Julian Day 0 (1 January 4713 BCE in the Julian calendar).
+ As well as being an efficient and accurate way of storing an absolute date,
+ it is suitable for converting a Date into other calendar systems such as
+ Hebrew, Islamic or Chinese. The Julian Day number can be obtained using
+ QDate::toJulianDay() and can be set using QDate::fromJulianDay().
+
+ The range of dates able to be stored by QDate as a Julian Day number is
+ limited for convenience from std::numeric_limits<qint64>::min() / 2 to
+ std::numeric_limits<qint64>::max() / 2, which on most platforms means
+ from around 2.5 quadrillion BCE to around 2.5 quadrillion CE, effectively
+ covering the full range of astronomical time. The range of Julian Days
+ able to be accurately converted to and from valid YMD form Dates is
+ restricted to 1 January 4800 BCE to 31 December 1400000 CE due to
+ shortcomings in the available conversion formulas. Conversions outside this
+ range are not guaranteed to be correct. This may change in the future.
\section2
Use of System Timezone
@@ -2269,7 +2296,7 @@ qint64 QDateTime::toMSecsSinceEpoch() const
QTime utcTime;
d->getUTC(utcDate, utcTime);
- return toMSecsSinceEpoch_helper(utcDate.jd, utcTime.ds());
+ return toMSecsSinceEpoch_helper(utcDate.toJulianDay(), QTime(0, 0, 0).msecsTo(utcTime));
}
/*!
@@ -2331,7 +2358,7 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs)
}
d->date = QDate(1970, 1, 1).addDays(ddays);
- d->time = QTime().addMSecs(msecs);
+ d->time = QTime(0, 0, 0).addMSecs(msecs);
d->spec = QDateTimePrivate::UTC;
if (oldSpec != QDateTimePrivate::UTC)
@@ -2356,7 +2383,7 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC)
QDateTimePrivate::Spec oldSpec = d->spec;
d->date = QDate(1970, 1, 1).addDays(secsSince1Jan1970UTC / SECS_PER_DAY);
- d->time = QTime().addSecs(secsSince1Jan1970UTC % SECS_PER_DAY);
+ d->time = QTime(0, 0, 0).addSecs(secsSince1Jan1970UTC % SECS_PER_DAY);
d->spec = QDateTimePrivate::UTC;
if (oldSpec != QDateTimePrivate::UTC)
@@ -2563,7 +2590,7 @@ QString QDateTime::toString(const QString& format) const
\sa daysTo(), addMonths(), addYears(), addSecs()
*/
-QDateTime QDateTime::addDays(int ndays) const
+QDateTime QDateTime::addDays(qint64 ndays) const
{
return QDateTime(d->date.addDays(ndays), d->time, timeSpec());
}
@@ -2614,8 +2641,8 @@ QDateTime QDateTimePrivate::addMSecs(const QDateTime &dt, qint64 msecs)
*/
void QDateTimePrivate::addMSecs(QDate &utcDate, QTime &utcTime, qint64 msecs)
{
- uint dd = utcDate.jd;
- int tt = utcTime.ds();
+ qint64 dd = utcDate.toJulianDay();
+ int tt = QTime(0, 0, 0).msecsTo(utcTime);
int sign = 1;
if (msecs < 0) {
msecs = -msecs;
@@ -2637,8 +2664,8 @@ void QDateTimePrivate::addMSecs(QDate &utcDate, QTime &utcTime, qint64 msecs)
tt = tt % MSECS_PER_DAY;
}
- utcDate.jd = dd;
- utcTime.mds = tt;
+ utcDate = QDate::fromJulianDay(dd);
+ utcTime = QTime(0, 0, 0).addMSecs(tt);
}
/*!
@@ -2674,7 +2701,7 @@ QDateTime QDateTime::addMSecs(qint64 msecs) const
\sa addDays(), secsTo(), msecsTo()
*/
-int QDateTime::daysTo(const QDateTime &other) const
+qint64 QDateTime::daysTo(const QDateTime &other) const
{
return d->date.daysTo(other.d->date);
}
@@ -2688,6 +2715,8 @@ int QDateTime::daysTo(const QDateTime &other) const
to Qt::UTC to ensure that the result is correct if one of the two
datetimes has daylight saving time (DST) and the other doesn't.
+ Returns 0 if either time is invalid.
+
Example:
\snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 11
@@ -2696,6 +2725,9 @@ int QDateTime::daysTo(const QDateTime &other) const
int QDateTime::secsTo(const QDateTime &other) const
{
+ if (!isValid() || !other.isValid())
+ return 0;
+
QDate date1, date2;
QTime time1, time2;
@@ -2714,11 +2746,16 @@ int QDateTime::secsTo(const QDateTime &other) const
to Qt::UTC to ensure that the result is correct if one of the two
datetimes has daylight saving time (DST) and the other doesn't.
+ Returns 0 if either time is null.
+
\sa addMSecs(), daysTo(), QTime::msecsTo()
*/
qint64 QDateTime::msecsTo(const QDateTime &other) const
{
+ if (!isValid() || !other.isValid())
+ return 0;
+
QDate selfDate;
QDate otherDate;
QTime selfTime;
@@ -2882,7 +2919,7 @@ QTime QTime::currentTime()
SYSTEMTIME st;
memset(&st, 0, sizeof(SYSTEMTIME));
GetLocalTime(&st);
- ct.mds = msecsFromDecomposed(st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
+ ct.setHMS(st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
#if defined(Q_OS_WINCE)
ct.startTick = GetTickCount() % MSECS_PER_DAY;
#endif
@@ -2922,78 +2959,8 @@ qint64 QDateTime::currentMSecsSinceEpoch()
GetSystemTime(&st);
return msecsFromDecomposed(st.wHour, st.wMinute, st.wSecond, st.wMilliseconds) +
- qint64(julianDayFromGregorianDate(st.wYear, st.wMonth, st.wDay)
- - julianDayFromGregorianDate(1970, 1, 1)) * Q_INT64_C(86400000);
-}
-
-#elif defined(Q_OS_SYMBIAN)
-QDate QDate::currentDate()
-{
- QDate d;
- TTime localTime;
- localTime.HomeTime();
- TDateTime localDateTime = localTime.DateTime();
- // months and days are zero indexed
- d.jd = julianDayFromDate(localDateTime.Year(), localDateTime.Month() + 1, localDateTime.Day() + 1 );
- return d;
-}
-
-QTime QTime::currentTime()
-{
- QTime ct;
- TTime localTime;
- localTime.HomeTime();
- TDateTime localDateTime = localTime.DateTime();
- ct.mds = msecsFromDecomposed(localDateTime.Hour(), localDateTime.Minute(),
- localDateTime.Second(), localDateTime.MicroSecond() / 1000);
- return ct;
-}
-
-QDateTime QDateTime::currentDateTime()
-{
- QDate d;
- QTime ct;
- TTime localTime;
- localTime.HomeTime();
- TDateTime localDateTime = localTime.DateTime();
- // months and days are zero indexed
- d.jd = julianDayFromDate(localDateTime.Year(), localDateTime.Month() + 1, localDateTime.Day() + 1);
- ct.mds = msecsFromDecomposed(localDateTime.Hour(), localDateTime.Minute(),
- localDateTime.Second(), localDateTime.MicroSecond() / 1000);
- return QDateTime(d, ct);
-}
-
-QDateTime QDateTime::currentDateTimeUtc()
-{
- QDate d;
- QTime ct;
- TTime gmTime;
- gmTime.UniversalTime();
- TDateTime gmtDateTime = gmTime.DateTime();
- // months and days are zero indexed
- d.jd = julianDayFromDate(gmtDateTime.Year(), gmtDateTime.Month() + 1, gmtDateTime.Day() + 1);
- ct.mds = msecsFromDecomposed(gmtDateTime.Hour(), gmtDateTime.Minute(),
- gmtDateTime.Second(), gmtDateTime.MicroSecond() / 1000);
- return QDateTime(d, ct, Qt::UTC);
-}
-
-qint64 QDateTime::currentMSecsSinceEpoch()
-{
- QDate d;
- QTime ct;
- TTime gmTime;
- gmTime.UniversalTime();
- TDateTime gmtDateTime = gmTime.DateTime();
-
- // according to the documentation, the value is:
- // "a date and time as a number of microseconds since midnight, January 1st, 0 AD nominal Gregorian"
- qint64 value = gmTime.Int64();
-
- // whereas 1970-01-01T00:00:00 is (in the same representation):
- // ((1970 * 365) + (1970 / 4) - (1970 / 100) + (1970 / 400) - 13) * 86400 * 1000000
- static const qint64 unixEpoch = Q_INT64_C(0xdcddb30f2f8000);
-
- return (value - unixEpoch) / 1000;
+ qint64(julianDayFromDate(st.wYear, st.wMonth, st.wDay)
+ - julianDayFromDate(1970, 1, 1)) * Q_INT64_C(86400000);
}
#elif defined(Q_OS_UNIX)
@@ -3544,7 +3511,7 @@ void QDateTime::detach()
QDataStream &operator<<(QDataStream &out, const QDate &date)
{
- return out << (quint32)(date.jd);
+ return out << (qint64)(date.jd);
}
/*!
@@ -3557,7 +3524,7 @@ QDataStream &operator<<(QDataStream &out, const QDate &date)
QDataStream &operator>>(QDataStream &in, QDate &date)
{
- quint32 jd;
+ qint64 jd;
in >> jd;
date.jd = jd;
return in;
@@ -3859,7 +3826,7 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time)
QDate fakeDate = adjustDate(date);
// won't overflow because of fakeDate
- time_t secsSince1Jan1970UTC = toMSecsSinceEpoch_helper(fakeDate.toJulianDay(), QTime().msecsTo(time)) / 1000;
+ time_t secsSince1Jan1970UTC = toMSecsSinceEpoch_helper(fakeDate.toJulianDay(), QTime(0, 0, 0).msecsTo(time)) / 1000;
tm *brokenDown = 0;
#if defined(Q_OS_WINCE)
@@ -3877,27 +3844,6 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time)
res.tm_mon = sysTime.wMonth - 1;
res.tm_year = sysTime.wYear - 1900;
brokenDown = &res;
-#elif defined(Q_OS_SYMBIAN)
- // months and days are zero index based
- _LIT(KUnixEpoch, "19700000:000000.000000");
- TTimeIntervalSeconds utcOffset = User::UTCOffset();
- TTimeIntervalSeconds tTimeIntervalSecsSince1Jan1970UTC(secsSince1Jan1970UTC);
- TTime epochTTime;
- TInt err = epochTTime.Set(KUnixEpoch);
- tm res;
- if(err == KErrNone) {
- TTime utcTTime = epochTTime + tTimeIntervalSecsSince1Jan1970UTC;
- utcTTime = utcTTime + utcOffset;
- TDateTime utcDateTime = utcTTime.DateTime();
- res.tm_sec = utcDateTime.Second();
- res.tm_min = utcDateTime.Minute();
- res.tm_hour = utcDateTime.Hour();
- res.tm_mday = utcDateTime.Day() + 1; // non-zero based index for tm struct
- res.tm_mon = utcDateTime.Month();
- res.tm_year = utcDateTime.Year() - 1900;
- res.tm_isdst = 0;
- brokenDown = &res;
- }
#elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
// use the reentrant version of localtime() where available
tzset();
@@ -3943,7 +3889,7 @@ static void localToUtc(QDate &date, QTime &time, int isdst)
localTM.tm_mon = fakeDate.month() - 1;
localTM.tm_year = fakeDate.year() - 1900;
localTM.tm_isdst = (int)isdst;
-#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WINCE)
time_t secsSince1Jan1970UTC = (toMSecsSinceEpoch_helper(fakeDate.toJulianDay(), QTime().msecsTo(time)) / 1000);
#else
#if defined(Q_OS_WIN)
@@ -3968,27 +3914,6 @@ static void localToUtc(QDate &date, QTime &time, int isdst)
res.tm_year = sysTime.wYear - 1900;
res.tm_isdst = (int)isdst;
brokenDown = &res;
-#elif defined(Q_OS_SYMBIAN)
- // months and days are zero index based
- _LIT(KUnixEpoch, "19700000:000000.000000");
- TTimeIntervalSeconds utcOffset = TTimeIntervalSeconds(0 - User::UTCOffset().Int());
- TTimeIntervalSeconds tTimeIntervalSecsSince1Jan1970UTC(secsSince1Jan1970UTC);
- TTime epochTTime;
- TInt err = epochTTime.Set(KUnixEpoch);
- tm res;
- if(err == KErrNone) {
- TTime utcTTime = epochTTime + tTimeIntervalSecsSince1Jan1970UTC;
- utcTTime = utcTTime + utcOffset;
- TDateTime utcDateTime = utcTTime.DateTime();
- res.tm_sec = utcDateTime.Second();
- res.tm_min = utcDateTime.Minute();
- res.tm_hour = utcDateTime.Hour();
- res.tm_mday = utcDateTime.Day() + 1; // non-zero based index for tm struct
- res.tm_mon = utcDateTime.Month();
- res.tm_year = utcDateTime.Year() - 1900;
- res.tm_isdst = (int)isdst;
- brokenDown = &res;
- }
#elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
// use the reentrant version of gmtime() where available
tm res;
@@ -4772,7 +4697,7 @@ int QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionInde
const int max = qMin(sectionmaxsize, sectiontextSize);
for (int digits = max; digits >= 1; --digits) {
digitsStr.truncate(digits);
- int tmp = (int)loc.toUInt(digitsStr, &ok, 10);
+ int tmp = (int)loc.toUInt(digitsStr, &ok);
if (ok && sn.type == Hour12Section) {
if (tmp > 12) {
tmp = -1;
@@ -5710,42 +5635,6 @@ bool operator==(const QDateTimeParser::SectionNode &s1, const QDateTimeParser::S
return (s1.type == s2.type) && (s1.pos == s2.pos) && (s1.count == s2.count);
}
-#ifdef Q_OS_SYMBIAN
-const static TTime UnixEpochOffset(I64LIT(0xdcddb30f2f8000));
-const static TInt64 MinimumMillisecondTime(KMinTInt64 / 1000);
-const static TInt64 MaximumMillisecondTime(KMaxTInt64 / 1000);
-QDateTime qt_symbian_TTime_To_QDateTime(const TTime& time)
-{
- TTimeIntervalMicroSeconds absolute = time.MicroSecondsFrom(UnixEpochOffset);
-
- return QDateTime::fromMSecsSinceEpoch(absolute.Int64() / 1000);
-}
-
-TTime qt_symbian_QDateTime_To_TTime(const QDateTime& datetime)
-{
- qint64 absolute = datetime.toMSecsSinceEpoch();
- if(absolute > MaximumMillisecondTime)
- return TTime(KMaxTInt64);
- if(absolute < MinimumMillisecondTime)
- return TTime(KMinTInt64);
- return TTime(absolute * 1000);
-}
-
-time_t qt_symbian_TTime_To_time_t(const TTime& time)
-{
- TTimeIntervalSeconds interval;
- TInt err = time.SecondsFrom(UnixEpochOffset, interval);
- if (err || interval.Int() < 0)
- return (time_t) 0;
- return (time_t) interval.Int();
-}
-
-TTime qt_symbian_time_t_To_TTime(time_t time)
-{
- return UnixEpochOffset + TTimeIntervalSeconds(time);
-}
-#endif //Q_OS_SYMBIAN
-
#endif // QT_BOOTSTRAPPED
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index ba52f7455c..af257eaa40 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -46,11 +46,21 @@
#include <QtCore/qnamespace.h>
#include <QtCore/qsharedpointer.h>
+// windows.h defines these identifiers, so undefine it
+// ### figure out where in Qt we include it too soon
+#ifdef max
+# undef max
+#endif
+#ifdef min
+# undef min
+#endif
+
+#include <limits>
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class Q_CORE_EXPORT QDate
{
@@ -60,11 +70,11 @@ public:
StandaloneFormat
};
public:
- QDate() { jd = 0; }
+ QDate() { jd = nullJd(); }
QDate(int y, int m, int d);
- bool isNull() const { return jd == 0; }
- bool isValid() const;
+ bool isNull() const { return !isValid(); }
+ bool isValid() const { return jd >= minJd() && jd <= maxJd(); }
int year() const;
int month() const;
@@ -85,15 +95,19 @@ public:
QString toString(Qt::DateFormat f = Qt::TextDate) const;
QString toString(const QString &format) const;
#endif
- bool setYMD(int y, int m, int d);
+#if QT_DEPRECATED_SINCE(5,0)
+QT_DEPRECATED inline bool setYMD(int y, int m, int d)
+{ if (uint(y) <= 99) y += 1900; return setDate(y, m, d); }
+#endif
+
bool setDate(int year, int month, int day);
void getDate(int *year, int *month, int *day);
- QDate addDays(int days) const;
+ QDate addDays(qint64 days) const;
QDate addMonths(int months) const;
QDate addYears(int years) const;
- int daysTo(const QDate &) const;
+ qint64 daysTo(const QDate &) const;
bool operator==(const QDate &other) const { return jd == other.jd; }
bool operator!=(const QDate &other) const { return jd != other.jd; }
@@ -110,11 +124,16 @@ public:
static bool isValid(int y, int m, int d);
static bool isLeapYear(int year);
- static inline QDate fromJulianDay(int jd) { QDate d; d.jd = jd; return d; }
- inline int toJulianDay() const { return jd; }
+ static inline QDate fromJulianDay(qint64 jd)
+ { QDate d; if (jd >= minJd() && jd <= maxJd()) d.jd = jd; return d; }
+ inline qint64 toJulianDay() const { return jd; }
private:
- uint jd;
+ static inline qint64 nullJd() { return std::numeric_limits<qint64>::min(); }
+ static inline qint64 minJd() { return std::numeric_limits<qint64>::min() / 2; }
+ static inline qint64 maxJd() { return (std::numeric_limits<qint64>::max()) / 2; }
+
+ qint64 jd;
friend class QDateTime;
friend class QDateTimePrivate;
@@ -217,7 +236,7 @@ public:
QString toString(Qt::DateFormat f = Qt::TextDate) const;
QString toString(const QString &format) const;
#endif
- QDateTime addDays(int days) const;
+ QDateTime addDays(qint64 days) const;
QDateTime addMonths(int months) const;
QDateTime addYears(int years) const;
QDateTime addSecs(int secs) const;
@@ -225,7 +244,7 @@ public:
QDateTime toTimeSpec(Qt::TimeSpec spec) const;
inline QDateTime toLocalTime() const { return toTimeSpec(Qt::LocalTime); }
inline QDateTime toUTC() const { return toTimeSpec(Qt::UTC); }
- int daysTo(const QDateTime &) const;
+ qint64 daysTo(const QDateTime &) const;
int secsTo(const QDateTime &) const;
qint64 msecsTo(const QDateTime &) const;
diff --git a/src/corelib/tools/qdatetime_p.h b/src/corelib/tools/qdatetime_p.h
index 38aa748c6c..fa897121f6 100644
--- a/src/corelib/tools/qdatetime_p.h
+++ b/src/corelib/tools/qdatetime_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -274,13 +274,6 @@ Q_CORE_EXPORT bool operator==(const QDateTimeParser::SectionNode &s1, const QDat
Q_DECLARE_OPERATORS_FOR_FLAGS(QDateTimeParser::Sections)
Q_DECLARE_OPERATORS_FOR_FLAGS(QDateTimeParser::FieldInfo)
-#ifdef Q_OS_SYMBIAN
-QDateTime qt_symbian_TTime_To_QDateTime(const TTime& time);
-TTime qt_symbian_QDateTime_To_TTime(const QDateTime& datetime);
-time_t qt_symbian_TTime_To_time_t(const TTime& time);
-TTime qt_symbian_time_t_To_TTime(time_t time);
-#endif //Q_OS_SYMBIAN
-
#endif // QT_BOOTSTRAPPED
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index a3614f9b6c..76c06cb0d5 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h
index ef18ae20bc..4d53af591b 100644
--- a/src/corelib/tools/qeasingcurve.h
+++ b/src/corelib/tools/qeasingcurve.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QEasingCurvePrivate;
class QPointF;
diff --git a/src/corelib/tools/qelapsedtimer.cpp b/src/corelib/tools/qelapsedtimer.cpp
index 087252a926..e8f2ce174e 100644
--- a/src/corelib/tools/qelapsedtimer.cpp
+++ b/src/corelib/tools/qelapsedtimer.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -138,7 +138,7 @@ QT_BEGIN_NAMESPACE
\value SystemTime The human-readable system time. This clock is not monotonic.
\value MonotonicClock The system's monotonic clock, usually found in Unix systems. This clock is monotonic and does not overflow.
- \value TickCounter The system's tick counter, used on Windows and Symbian systems. This clock may overflow.
+ \value TickCounter The system's tick counter, used on Windows systems. This clock may overflow.
\value MachAbsoluteTime The Mach kernel's absolute time (Mac OS X). This clock is monotonic and does not overflow.
\value PerformanceCounter The high-resolution performance counter provided by Windows. This clock is monotonic and does not overflow.
@@ -164,7 +164,7 @@ QT_BEGIN_NAMESPACE
The tick counter clock type is based on the system's or the processor's
tick counter, multiplied by the duration of a tick. This clock type is
- used on Windows and Symbian platforms. If the high-precision performance
+ used on Windows platforms. If the high-precision performance
counter is available on Windows, the \tt{PerformanceCounter} clock type
is used instead.
@@ -178,12 +178,6 @@ QT_BEGIN_NAMESPACE
milliseconds. When comparing such values, it's recommended that the high
32 bits of the millisecond count be masked off.
- On Symbian systems, the overflow happens after 2^32 ticks, the duration
- of which can be obtained from the platform HAL using the constant
- HAL::ENanoTickPeriod. When comparing values between processes, it's
- necessary to divide the value by the tick duration and mask off the high
- 32 bits.
-
\section2 MachAbsoluteTime
This clock type is based on the absolute time presented by Mach kernels,
@@ -236,7 +230,7 @@ void QElapsedTimer::invalidate()
}
/*!
- Returns true if this object was invalidated by a call to invalidate() and
+ Returns false if this object was invalidated by a call to invalidate() and
has not been restarted since.
\sa invalidate(), start(), restart()
diff --git a/src/corelib/tools/qelapsedtimer.h b/src/corelib/tools/qelapsedtimer.h
index 73ec8d637e..7e0f3e27ae 100644
--- a/src/corelib/tools/qelapsedtimer.h
+++ b/src/corelib/tools/qelapsedtimer.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class Q_CORE_EXPORT QElapsedTimer
{
diff --git a/src/corelib/tools/qelapsedtimer_generic.cpp b/src/corelib/tools/qelapsedtimer_generic.cpp
index 3c7bb197d7..038a15bd37 100644
--- a/src/corelib/tools/qelapsedtimer_generic.cpp
+++ b/src/corelib/tools/qelapsedtimer_generic.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qelapsedtimer_mac.cpp b/src/corelib/tools/qelapsedtimer_mac.cpp
index f8f124f6a9..4150bc86ca 100644
--- a/src/corelib/tools/qelapsedtimer_mac.cpp
+++ b/src/corelib/tools/qelapsedtimer_mac.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qelapsedtimer_symbian.cpp b/src/corelib/tools/qelapsedtimer_symbian.cpp
deleted file mode 100644
index 4ae3f3d1ab..0000000000
--- a/src/corelib/tools/qelapsedtimer_symbian.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.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 the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qelapsedtimer.h"
-#include "qpair.h"
-#include <e32std.h>
-#include <sys/time.h>
-#include <hal.h>
-
-QT_BEGIN_NAMESPACE
-
-// return quint64 to avoid sign-extension
-static quint64 getMicrosecondFromTick()
-{
- static TInt nanokernel_tick_period;
- if (!nanokernel_tick_period)
- HAL::Get(HAL::ENanoTickPeriod, nanokernel_tick_period);
-
- static quint32 highdword = 0;
- static quint32 lastval = 0;
- quint32 val = User::NTickCount();
- if (val < lastval)
- ++highdword;
- lastval = val;
-
- return nanokernel_tick_period * (val | (quint64(highdword) << 32));
-}
-
-timeval qt_gettime()
-{
- timeval tv;
- quint64 now = getMicrosecondFromTick();
- tv.tv_sec = now / 1000000;
- tv.tv_usec = now % 1000000;
-
- return tv;
-}
-
-QElapsedTimer::ClockType QElapsedTimer::clockType()
-{
- return TickCounter;
-}
-
-bool QElapsedTimer::isMonotonic()
-{
- return true;
-}
-
-void QElapsedTimer::start()
-{
- t1 = getMicrosecondFromTick();
- t2 = 0;
-}
-
-qint64 QElapsedTimer::restart()
-{
- qint64 oldt1 = t1;
- t1 = getMicrosecondFromTick();
- t2 = 0;
- return (t1 - oldt1) / 1000;
-}
-
-qint64 QElapsedTimer::nsecsElapsed() const
-{
- return (getMicrosecondFromTick() - t1) * 1000;
-}
-
-qint64 QElapsedTimer::elapsed() const
-{
- return (getMicrosecondFromTick() - t1) / 1000;
-}
-
-qint64 QElapsedTimer::msecsSinceReference() const
-{
- return t1 / 1000;
-}
-
-qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const
-{
- return (other.t1 - t1) / 1000;
-}
-
-qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const
-{
- return msecsTo(other) / 1000000;
-}
-
-bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2)
-{
- return (v1.t1 - v2.t1) < 0;
-}
-
-QT_END_NAMESPACE
diff --git a/src/corelib/tools/qelapsedtimer_unix.cpp b/src/corelib/tools/qelapsedtimer_unix.cpp
index 7f3d4f635c..36acc81735 100644
--- a/src/corelib/tools/qelapsedtimer_unix.cpp
+++ b/src/corelib/tools/qelapsedtimer_unix.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qelapsedtimer_win.cpp b/src/corelib/tools/qelapsedtimer_win.cpp
index 183171e306..b1faf22c3f 100644
--- a/src/corelib/tools/qelapsedtimer_win.cpp
+++ b/src/corelib/tools/qelapsedtimer_win.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,21 +34,22 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qelapsedtimer.h"
-#include <windows.h>
-
-// Result of QueryPerformanceFrequency, 0 indicates that the high resolution timer is unavailable
-static quint64 counterFrequency = 0;
+#include <qt_windows.h>
typedef ULONGLONG (WINAPI *PtrGetTickCount64)(void);
static PtrGetTickCount64 ptrGetTickCount64 = 0;
QT_BEGIN_NAMESPACE
+// Result of QueryPerformanceFrequency, 0 indicates that the high resolution timer is unavailable
+static quint64 counterFrequency = 0;
+
static void resolveLibs()
{
static bool done = false;
diff --git a/src/corelib/tools/qfreelist.cpp b/src/corelib/tools/qfreelist.cpp
index 57530cf3c8..270f4840bb 100644
--- a/src/corelib/tools/qfreelist.cpp
+++ b/src/corelib/tools/qfreelist.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qfreelist_p.h b/src/corelib/tools/qfreelist_p.h
index 2105e5af56..599abcd48b 100644
--- a/src/corelib/tools/qfreelist_p.h
+++ b/src/corelib/tools/qfreelist_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -59,7 +59,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
/*! \internal
diff --git a/src/corelib/tools/qharfbuzz.cpp b/src/corelib/tools/qharfbuzz.cpp
index 4eb6565557..7d08547ab8 100644
--- a/src/corelib/tools/qharfbuzz.cpp
+++ b/src/corelib/tools/qharfbuzz.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qharfbuzz_p.h b/src/corelib/tools/qharfbuzz_p.h
index a8da47b71c..cc575ddffa 100644
--- a/src/corelib/tools/qharfbuzz_p.h
+++ b/src/corelib/tools/qharfbuzz_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index 82ac8a0591..18537023ad 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index ecd02008e2..91d015c394 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -52,7 +52,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QBitArray;
class QByteArray;
diff --git a/src/corelib/tools/qiterator.h b/src/corelib/tools/qiterator.h
index 0747940bf2..25a6f59383 100644
--- a/src/corelib/tools/qiterator.h
+++ b/src/corelib/tools/qiterator.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -53,7 +53,6 @@ namespace std {
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
#define Q_DECLARE_SEQUENTIAL_ITERATOR(C) \
\
diff --git a/src/corelib/tools/qiterator.qdoc b/src/corelib/tools/qiterator.qdoc
index 0e33aecbe4..e19a751755 100644
--- a/src/corelib/tools/qiterator.qdoc
+++ b/src/corelib/tools/qiterator.qdoc
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -21,6 +20,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp
index 161123cfff..1ca9a59bde 100644
--- a/src/corelib/tools/qline.cpp
+++ b/src/corelib/tools/qline.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qline.h b/src/corelib/tools/qline.h
index 956cbf9ce8..3c7977a207 100644
--- a/src/corelib/tools/qline.h
+++ b/src/corelib/tools/qline.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
/*******************************************************************************
* class QLine
diff --git a/src/corelib/tools/qlinkedlist.cpp b/src/corelib/tools/qlinkedlist.cpp
index acfbcd07eb..db5404e429 100644
--- a/src/corelib/tools/qlinkedlist.cpp
+++ b/src/corelib/tools/qlinkedlist.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
index e8696eb5f9..1fa4eaabd0 100644
--- a/src/corelib/tools/qlinkedlist.h
+++ b/src/corelib/tools/qlinkedlist.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,7 +54,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
struct Q_CORE_EXPORT QLinkedListData
{
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp
index 8eb4be090a..dbd026e65a 100644
--- a/src/corelib/tools/qlist.cpp
+++ b/src/corelib/tools/qlist.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -869,7 +869,7 @@ void **QListData::erase(void **xi)
\sa indexOf()
*/
-/*! \fn QBool QList::contains(const T &value) const
+/*! \fn bool QList::contains(const T &value) const
Returns true if the list contains an occurrence of \a value;
otherwise returns false.
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index c3db56d686..da3bae5f6c 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -63,7 +63,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
template <typename T> class QVector;
template <typename T> class QSet;
@@ -170,7 +169,7 @@ public:
void swap(int i, int j);
int indexOf(const T &t, int from = 0) const;
int lastIndexOf(const T &t, int from = -1) const;
- QBool contains(const T &t) const;
+ bool contains(const T &t) const;
int count(const T &t) const;
class const_iterator;
@@ -859,14 +858,14 @@ Q_OUTOFLINE_TEMPLATE int QList<T>::lastIndexOf(const T &t, int from) const
}
template <typename T>
-Q_OUTOFLINE_TEMPLATE QBool QList<T>::contains(const T &t) const
+Q_OUTOFLINE_TEMPLATE bool QList<T>::contains(const T &t) const
{
Node *b = reinterpret_cast<Node *>(p.begin());
Node *i = reinterpret_cast<Node *>(p.end());
while (i-- != b)
if (i->t() == t)
- return QBool(true);
- return QBool(false);
+ return true;
+ return false;
}
template <typename T>
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 1dc384985b..6c52eb3827 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -67,20 +67,15 @@ QT_END_NAMESPACE
#include "qstringlist.h"
#include "qvariant.h"
#include "qstringbuilder.h"
-#if defined(Q_OS_WIN)
-# include "qt_windows.h"
-# include <time.h>
-#endif
#include "private/qnumeric_p.h"
#include "private/qsystemlibrary_p.h"
+#ifdef Q_OS_WIN
+# include <qt_windows.h>
+# include <time.h>
+#endif
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_SYMBIAN)
-void qt_symbianUpdateSystemPrivate();
-void qt_symbianInitSystemLocale();
-#endif
-
#ifndef QT_NO_SYSTEMLOCALE
static QSystemLocale *_systemLocale = 0;
Q_GLOBAL_STATIC_WITH_ARGS(QSystemLocale, QSystemLocale_globalSystemLocale, (true))
@@ -474,9 +469,6 @@ static const QSystemLocale *systemLocale()
{
if (_systemLocale)
return _systemLocale;
-#if defined(Q_OS_SYMBIAN)
- qt_symbianInitSystemLocale();
-#endif
return QSystemLocale_globalSystemLocale();
}
@@ -491,10 +483,6 @@ void QLocalePrivate::updateSystemPrivate()
*system_lp = *sys_locale->fallbackLocale().d();
-#if defined(Q_OS_SYMBIAN)
- qt_symbianUpdateSystemPrivate();
-#endif
-
QVariant res = sys_locale->query(QSystemLocale::LanguageId, QVariant());
if (!res.isNull()) {
system_lp->m_language_id = res.toInt();
@@ -1033,11 +1021,7 @@ QString QLocale::scriptToString(QLocale::Script script)
}
/*!
- Returns the short int represented by the localized string \a s,
- using base \a base. If \a base is 0 the base is determined
- automatically using the following rules: If the string begins with
- "0x", it is assumed to be hexadecimal; if it begins with "0", it
- is assumed to be octal; otherwise it is assumed to be decimal.
+ Returns the short int represented by the localized string \a s.
If the conversion fails the function returns 0.
@@ -1049,9 +1033,9 @@ QString QLocale::scriptToString(QLocale::Script script)
\sa toUShort(), toString()
*/
-short QLocale::toShort(const QString &s, bool *ok, int base) const
+short QLocale::toShort(const QString &s, bool *ok) const
{
- qlonglong i = toLongLong(s, ok, base);
+ qlonglong i = toLongLong(s, ok);
if (i < SHRT_MIN || i > SHRT_MAX) {
if (ok != 0)
*ok = false;
@@ -1061,11 +1045,7 @@ short QLocale::toShort(const QString &s, bool *ok, int base) const
}
/*!
- Returns the unsigned short int represented by the localized string
- \a s, using base \a base. If \a base is 0 the base is determined
- automatically using the following rules: If the string begins with
- "0x", it is assumed to be hexadecimal; if it begins with "0", it
- is assumed to be octal; otherwise it is assumed to be decimal.
+ Returns the unsigned short int represented by the localized string \a s.
If the conversion fails the function returns 0.
@@ -1077,9 +1057,9 @@ short QLocale::toShort(const QString &s, bool *ok, int base) const
\sa toShort(), toString()
*/
-ushort QLocale::toUShort(const QString &s, bool *ok, int base) const
+ushort QLocale::toUShort(const QString &s, bool *ok) const
{
- qulonglong i = toULongLong(s, ok, base);
+ qulonglong i = toULongLong(s, ok);
if (i > USHRT_MAX) {
if (ok != 0)
*ok = false;
@@ -1089,11 +1069,7 @@ ushort QLocale::toUShort(const QString &s, bool *ok, int base) const
}
/*!
- Returns the int represented by the localized string \a s, using
- base \a base. If \a base is 0 the base is determined automatically
- using the following rules: If the string begins with "0x", it is
- assumed to be hexadecimal; if it begins with "0", it is assumed to
- be octal; otherwise it is assumed to be decimal.
+ Returns the int represented by the localized string \a s.
If the conversion fails the function returns 0.
@@ -1105,9 +1081,9 @@ ushort QLocale::toUShort(const QString &s, bool *ok, int base) const
\sa toUInt(), toString()
*/
-int QLocale::toInt(const QString &s, bool *ok, int base) const
+int QLocale::toInt(const QString &s, bool *ok) const
{
- qlonglong i = toLongLong(s, ok, base);
+ qlonglong i = toLongLong(s, ok);
if (i < INT_MIN || i > INT_MAX) {
if (ok != 0)
*ok = false;
@@ -1117,11 +1093,7 @@ int QLocale::toInt(const QString &s, bool *ok, int base) const
}
/*!
- Returns the unsigned int represented by the localized string \a s,
- using base \a base. If \a base is 0 the base is determined
- automatically using the following rules: If the string begins with
- "0x", it is assumed to be hexadecimal; if it begins with "0", it
- is assumed to be octal; otherwise it is assumed to be decimal.
+ Returns the unsigned int represented by the localized string \a s.
If the conversion fails the function returns 0.
@@ -1133,9 +1105,9 @@ int QLocale::toInt(const QString &s, bool *ok, int base) const
\sa toInt(), toString()
*/
-uint QLocale::toUInt(const QString &s, bool *ok, int base) const
+uint QLocale::toUInt(const QString &s, bool *ok) const
{
- qulonglong i = toULongLong(s, ok, base);
+ qulonglong i = toULongLong(s, ok);
if (i > UINT_MAX) {
if (ok != 0)
*ok = false;
@@ -1145,11 +1117,7 @@ uint QLocale::toUInt(const QString &s, bool *ok, int base) const
}
/*!
- Returns the long long int represented by the localized string \a
- s, using base \a base. If \a base is 0 the base is determined
- automatically using the following rules: If the string begins with
- "0x", it is assumed to be hexadecimal; if it begins with "0", it
- is assumed to be octal; otherwise it is assumed to be decimal.
+ Returns the long long int represented by the localized string \a s.
If the conversion fails the function returns 0.
@@ -1162,25 +1130,21 @@ uint QLocale::toUInt(const QString &s, bool *ok, int base) const
*/
-qlonglong QLocale::toLongLong(const QString &s, bool *ok, int base) const
+qlonglong QLocale::toLongLong(const QString &s, bool *ok) const
{
QLocalePrivate::GroupSeparatorMode mode
= p.numberOptions & RejectGroupSeparator
? QLocalePrivate::FailOnGroupSeparators
: QLocalePrivate::ParseGroupSeparators;
- return d()->stringToLongLong(s, base, ok, mode);
+ return d()->stringToLongLong(s, 10, ok, mode);
}
// ### Qt5: make the return type for toULongLong() qulonglong.
/*!
Returns the unsigned long long int represented by the localized
- string \a s, using base \a base. If \a base is 0 the base is
- determined automatically using the following rules: If the string
- begins with "0x", it is assumed to be hexadecimal; if it begins
- with "0", it is assumed to be octal; otherwise it is assumed to be
- decimal.
+ string \a s.
If the conversion fails the function returns 0.
@@ -1192,14 +1156,14 @@ qlonglong QLocale::toLongLong(const QString &s, bool *ok, int base) const
\sa toLongLong(), toInt(), toDouble(), toString()
*/
-qlonglong QLocale::toULongLong(const QString &s, bool *ok, int base) const
+qlonglong QLocale::toULongLong(const QString &s, bool *ok) const
{
QLocalePrivate::GroupSeparatorMode mode
= p.numberOptions & RejectGroupSeparator
? QLocalePrivate::FailOnGroupSeparators
: QLocalePrivate::ParseGroupSeparators;
- return d()->stringToUnsLongLong(s, base, ok, mode);
+ return d()->stringToUnsLongLong(s, 10, ok, mode);
}
/*!
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h
index 9bc4ea70b8..c029f627b2 100644
--- a/src/corelib/tools/qlocale.h
+++ b/src/corelib/tools/qlocale.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QDataStream;
class QDate;
@@ -62,71 +61,6 @@ class QTextStreamPrivate;
class QLocale;
-#ifndef QT_NO_SYSTEMLOCALE
-class Q_CORE_EXPORT QSystemLocale
-{
-public:
- QSystemLocale();
- virtual ~QSystemLocale();
-
- struct CurrencyToStringArgument
- {
- CurrencyToStringArgument() { }
- CurrencyToStringArgument(const QVariant &v, const QString &s)
- : value(v), symbol(s) { }
- QVariant value;
- QString symbol;
- };
-
- enum QueryType {
- LanguageId, // uint
- CountryId, // uint
- DecimalPoint, // QString
- GroupSeparator, // QString
- ZeroDigit, // QString
- NegativeSign, // QString
- DateFormatLong, // QString
- DateFormatShort, // QString
- TimeFormatLong, // QString
- TimeFormatShort, // QString
- DayNameLong, // QString, in: int
- DayNameShort, // QString, in: int
- MonthNameLong, // QString, in: int
- MonthNameShort, // QString, in: int
- DateToStringLong, // QString, in: QDate
- DateToStringShort, // QString in: QDate
- TimeToStringLong, // QString in: QTime
- TimeToStringShort, // QString in: QTime
- DateTimeFormatLong, // QString
- DateTimeFormatShort, // QString
- DateTimeToStringLong, // QString in: QDateTime
- DateTimeToStringShort, // QString in: QDateTime
- MeasurementSystem, // uint
- PositiveSign, // QString
- AMText, // QString
- PMText, // QString
- FirstDayOfWeek, // Qt::DayOfWeek
- Weekdays, // QList<Qt::DayOfWeek>
- CurrencySymbol, // QString in: CurrencyToStringArgument
- CurrencyToString, // QString in: qlonglong, qulonglong or double
- UILanguages, // QStringList
- StringToStandardQuotation, // QString in: QStringRef to quote
- StringToAlternateQuotation, // QString in: QStringRef to quote
- ScriptId, // uint
- ListToSeparatedString, // QString
- LocaleChanged, // system locale changed
- NativeLanguageName, // QString
- NativeCountryName // QString
- };
- virtual QVariant query(QueryType type, QVariant in) const;
- virtual QLocale fallbackLocale() const;
-
-private:
- QSystemLocale(bool);
- friend QSystemLocale *QSystemLocale_globalSystemLocale();
-};
-#endif
-
struct QLocalePrivate;
class Q_CORE_EXPORT QLocale
{
@@ -663,12 +597,12 @@ public:
QString nativeLanguageName() const;
QString nativeCountryName() const;
- short toShort(const QString &s, bool *ok = 0, int base = 0) const;
- ushort toUShort(const QString &s, bool *ok = 0, int base = 0) const;
- int toInt(const QString &s, bool *ok = 0, int base = 0) const;
- uint toUInt(const QString &s, bool *ok = 0, int base = 0) const;
- qlonglong toLongLong(const QString &s, bool *ok = 0, int base = 0) const;
- qlonglong toULongLong(const QString &s, bool *ok = 0, int base = 0) const;
+ short toShort(const QString &s, bool *ok = 0) const;
+ ushort toUShort(const QString &s, bool *ok = 0) const;
+ int toInt(const QString &s, bool *ok = 0) const;
+ uint toUInt(const QString &s, bool *ok = 0) const;
+ qlonglong toLongLong(const QString &s, bool *ok = 0) const;
+ qlonglong toULongLong(const QString &s, bool *ok = 0) const;
float toFloat(const QString &s, bool *ok = 0) const;
double toDouble(const QString &s, bool *ok = 0) const;
@@ -812,10 +746,6 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QLocale &);
QT_END_NAMESPACE
-#ifndef QT_NO_SYSTEMLOCALE
-Q_DECLARE_METATYPE(QSystemLocale::CurrencyToStringArgument)
-#endif
-
QT_END_HEADER
#endif // QLOCALE_H
diff --git a/src/corelib/tools/qlocale.qdoc b/src/corelib/tools/qlocale.qdoc
index 0337c708a9..cc335a4575 100644
--- a/src/corelib/tools/qlocale.qdoc
+++ b/src/corelib/tools/qlocale.qdoc
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -21,6 +20,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -711,6 +711,7 @@
*/
/*!
+ \internal
\class QSystemLocale
\brief The QSystemLocale class can be used to finetune the system locale
of the user.
diff --git a/src/corelib/tools/qlocale_data_p.h b/src/corelib/tools/qlocale_data_p.h
index a29e40079a..1508b982f1 100644
--- a/src/corelib/tools/qlocale_data_p.h
+++ b/src/corelib/tools/qlocale_data_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qlocale_icu.cpp b/src/corelib/tools/qlocale_icu.cpp
index 0e220ff000..ee2e5f436a 100644
--- a/src/corelib/tools/qlocale_icu.cpp
+++ b/src/corelib/tools/qlocale_icu.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm
index ffcbbbca4b..7153875146 100644
--- a/src/corelib/tools/qlocale_mac.mm
+++ b/src/corelib/tools/qlocale_mac.mm
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index 0b229e5e3f..7653f4d93d 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -59,12 +59,73 @@
#include "qlocale.h"
-#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
-class CEnvironmentChangeNotifier;
-#endif
-
QT_BEGIN_NAMESPACE
+#ifndef QT_NO_SYSTEMLOCALE
+class QSystemLocale
+{
+public:
+ QSystemLocale();
+ virtual ~QSystemLocale();
+
+ struct CurrencyToStringArgument
+ {
+ CurrencyToStringArgument() { }
+ CurrencyToStringArgument(const QVariant &v, const QString &s)
+ : value(v), symbol(s) { }
+ QVariant value;
+ QString symbol;
+ };
+
+ enum QueryType {
+ LanguageId, // uint
+ CountryId, // uint
+ DecimalPoint, // QString
+ GroupSeparator, // QString
+ ZeroDigit, // QString
+ NegativeSign, // QString
+ DateFormatLong, // QString
+ DateFormatShort, // QString
+ TimeFormatLong, // QString
+ TimeFormatShort, // QString
+ DayNameLong, // QString, in: int
+ DayNameShort, // QString, in: int
+ MonthNameLong, // QString, in: int
+ MonthNameShort, // QString, in: int
+ DateToStringLong, // QString, in: QDate
+ DateToStringShort, // QString in: QDate
+ TimeToStringLong, // QString in: QTime
+ TimeToStringShort, // QString in: QTime
+ DateTimeFormatLong, // QString
+ DateTimeFormatShort, // QString
+ DateTimeToStringLong, // QString in: QDateTime
+ DateTimeToStringShort, // QString in: QDateTime
+ MeasurementSystem, // uint
+ PositiveSign, // QString
+ AMText, // QString
+ PMText, // QString
+ FirstDayOfWeek, // Qt::DayOfWeek
+ Weekdays, // QList<Qt::DayOfWeek>
+ CurrencySymbol, // QString in: CurrencyToStringArgument
+ CurrencyToString, // QString in: qlonglong, qulonglong or double
+ UILanguages, // QStringList
+ StringToStandardQuotation, // QString in: QStringRef to quote
+ StringToAlternateQuotation, // QString in: QStringRef to quote
+ ScriptId, // uint
+ ListToSeparatedString, // QString
+ LocaleChanged, // system locale changed
+ NativeLanguageName, // QString
+ NativeCountryName // QString
+ };
+ virtual QVariant query(QueryType type, QVariant in) const;
+ virtual QLocale fallbackLocale() const;
+
+private:
+ QSystemLocale(bool);
+ friend QSystemLocale *QSystemLocale_globalSystemLocale();
+};
+#endif
+
struct Q_CORE_EXPORT QLocalePrivate
{
public:
@@ -257,20 +318,6 @@ inline char QLocalePrivate::digitToCLocale(const QChar &in) const
return 0;
}
-#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
-class QEnvironmentChangeNotifier
-{
-public:
- QEnvironmentChangeNotifier();
- ~QEnvironmentChangeNotifier();
-
- static TInt localeChanged(TAny *data);
-
-private:
- CEnvironmentChangeNotifier *iChangeNotifier;
-};
-#endif
-
QString qt_readEscapedFormatString(const QString &format, int *idx);
bool qt_splitLocaleName(const QString &name, QString &lang, QString &script, QString &cntry);
int qt_repeatCount(const QString &s, int i);
@@ -279,5 +326,8 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QStringRef)
Q_DECLARE_METATYPE(QList<Qt::DayOfWeek>)
+#ifndef QT_NO_SYSTEMLOCALE
+Q_DECLARE_METATYPE(QSystemLocale::CurrencyToStringArgument)
+#endif
#endif // QLOCALE_P_H
diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp
deleted file mode 100644
index abe437fc89..0000000000
--- a/src/corelib/tools/qlocale_symbian.cpp
+++ /dev/null
@@ -1,956 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.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 the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QDate>
-#include <QLocale>
-#include <QTime>
-#include <QVariant>
-#include <QThread>
-#include <QStringList>
-
-#include <e32std.h>
-#include <e32const.h>
-#include <e32base.h>
-#include <e32property.h>
-#include <bacntf.h>
-#include "private/qcore_symbian_p.h"
-#include "private/qcoreapplication_p.h"
-#include "private/qlocale_p.h"
-#include <qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-static TExtendedLocale _s60Locale;
-
-// Type definitions for runtime resolved function pointers
-typedef void (*FormatFunc)(TTime&, TDes&, const TDesC&, const TLocale&);
-typedef TPtrC (*FormatSpecFunc)(TExtendedLocale&);
-
-// Runtime resolved functions
-static FormatFunc ptrTimeFormatL = NULL;
-static FormatSpecFunc ptrGetTimeFormatSpec = NULL;
-static FormatSpecFunc ptrGetLongDateFormatSpec = NULL;
-static FormatSpecFunc ptrGetShortDateFormatSpec = NULL;
-
-// Default functions if functions cannot be resolved
-static void defaultTimeFormatL(TTime&, TDes& des, const TDesC&, const TLocale&)
-{
- des.Zero();
-}
-
-static TPtrC defaultFormatSpec(TExtendedLocale&)
-{
- return TPtrC(KNullDesC);
-}
-
-/*
- Definition of struct for mapping Symbian to ISO locale
-*/
-struct symbianToISO {
- int symbian_language;
- char iso_name[8];
- char uilanguage[8];
-};
-
-
-/*
- Mapping from Symbian to ISO locale.
- NOTE: This array should be sorted by the first column!
-*/
-static const symbianToISO symbian_to_iso_list[] = {
- { ELangEnglish, "en_GB", "en" }, // 1
- { ELangFrench, "fr_FR", "fr" }, // 2
- { ELangGerman, "de_DE", "de" }, // 3
- { ELangSpanish, "es_ES", "es" }, // 4
- { ELangItalian, "it_IT", "it" }, // 5
- { ELangSwedish, "sv_SE", "sv" }, // 6
- { ELangDanish, "da_DK", "da" }, // 7
- { ELangNorwegian, "nb_NO", "nb" }, // 8
- { ELangFinnish, "fi_FI", "fi" }, // 9
- { ELangAmerican, "en_US", "en-US" }, // 10
- { ELangPortuguese, "pt_PT", "pt" }, // 13
- { ELangTurkish, "tr_TR", "tr" }, // 14
- { ELangIcelandic, "is_IS", "is" }, // 15
- { ELangRussian, "ru_RU", "ru" }, // 16
- { ELangHungarian, "hu_HU", "hu" }, // 17
- { ELangDutch, "nl_NL", "nl" }, // 18
- { ELangCzech, "cs_CZ", "cs" }, // 25
- { ELangSlovak, "sk_SK", "sk" }, // 26
- { ELangPolish, "pl_PL", "pl" }, // 27
- { ELangSlovenian, "sl_SI", "sl" }, // 28
- { ELangTaiwanChinese, "zh_TW", "zh-TW" }, // 29
- { ELangHongKongChinese, "zh_HK", "zh-HK" }, // 30
- { ELangPrcChinese, "zh_CN", "zh" }, // 31
- { ELangJapanese, "ja_JP", "ja" }, // 32
- { ELangThai, "th_TH", "th" }, // 33
- { ELangArabic, "ar_AE", "ar" }, // 37
- { ELangTagalog, "tl_PH", "tl" }, // 39
- { ELangBulgarian, "bg_BG", "bg" }, // 42
- { ELangCatalan, "ca_ES", "ca" }, // 44
- { ELangCroatian, "hr_HR", "hr" }, // 45
- { ELangEstonian, "et_EE", "et" }, // 49
- { ELangFarsi, "fa_IR", "fa" }, // 50
- { ELangCanadianFrench, "fr_CA", "fr-CA" }, // 51
- { ELangGreek, "el_GR", "el" }, // 54
- { ELangHebrew, "he_IL", "he" }, // 57
- { ELangHindi, "hi_IN", "hi" }, // 58
- { ELangIndonesian, "id_ID", "id" }, // 59
- { 63/*ELangKazakh*/, "kk_KZ", "kk" }, // 63
- { ELangKorean, "ko_KO", "ko" }, // 65
- { ELangLatvian, "lv_LV", "lv" }, // 67
- { ELangLithuanian, "lt_LT", "lt" }, // 68
- { ELangMalay, "ms_MY", "ms" }, // 70
- { ELangNorwegianNynorsk, "nn_NO", "nn" }, // 75
- { ELangBrazilianPortuguese, "pt_BR", "pt-BR" }, // 76
- { ELangRomanian, "ro_RO", "ro" }, // 78
- { ELangSerbian, "sr_RS", "sr" }, // 79
- { ELangLatinAmericanSpanish,"es_419", "es-419" },// 83
- { ELangUkrainian, "uk_UA", "uk" }, // 93
- { ELangUrdu, "ur_PK", "ur" }, // 94 - India/Pakistan
- { ELangVietnamese, "vi_VN", "vi" }, // 96
-#ifdef __E32LANG_H__
-// 5.0
- { ELangBasque, "eu_ES", "eu" }, // 102
- { ELangGalician, "gl_ES", "gl" }, // 103
-#endif
-#if !defined(__SERIES60_31__)
- { ELangEnglish_Apac, "en_GB", "en" }, // 129
- { ELangEnglish_Taiwan, "en_TW", "en-TW" }, // 157 ### Not supported by CLDR
- { ELangEnglish_HongKong, "en_HK", "en-HK" }, // 158
- { ELangEnglish_Prc, "en_CN", "en-CN" }, // 159 ### Not supported by CLDR
- { ELangEnglish_Japan, "en_JP", "en" }, // 160 ### Not supported by CLDR
- { ELangEnglish_Thailand, "en_TH", "en" }, // 161 ### Not supported by CLDR
- { 230/*ELangEnglish_India*/,"en_IN", "en" }, // 230
- { ELangMalay_Apac, "ms_MY", "ms" }, // 326
-#endif
- { 327/*ELangIndonesian_Apac*/, "id_ID", "id" } // 327 - appeared in Symbian^3
-};
-
-enum LocaleNameType {
- ISO,
- UILanguage
-};
-
-QByteArray qt_resolveSymbianLocaleName(int code, LocaleNameType type)
-{
- //Number of Symbian to ISO locale mappings
- static const int symbian_to_iso_count
- = sizeof(symbian_to_iso_list)/sizeof(symbianToISO);
-
- int cmp = code - symbian_to_iso_list[0].symbian_language;
- if (cmp < 0)
- return 0;
-
- if (cmp == 0) {
- if (type == ISO)
- return symbian_to_iso_list[0].iso_name;
- return symbian_to_iso_list[0].uilanguage;
- }
-
- int begin = 0;
- int end = symbian_to_iso_count;
-
- while (end - begin > 1) {
- uint mid = (begin + end)/2;
-
- const symbianToISO *elt = symbian_to_iso_list + mid;
- int cmp = code - elt->symbian_language;
- if (cmp < 0) {
- end = mid;
- } else if (cmp > 0) {
- begin = mid;
- } else {
- if (type == ISO)
- return elt->iso_name;
- return elt->uilanguage;
- }
- }
-
- return 0;
-}
-
-/*!
- Returns ISO name corresponding to the Symbian locale code \a sys_fmt.
-*/
-QByteArray qt_symbianLocaleName(int code)
-{
- return qt_resolveSymbianLocaleName(code, ISO);
-}
-
-// order is: normal, abbr, nmode, nmode+abbr
-static const char *us_locale_dep[] = {
- "MM", "dd", "yyyy", "MM", "dd",
- "M", "d", "yy", "M", "d",
- "MMMM", "dd", "yyyy", "MMMM", "dd",
- "MMM", "d", "yy", "MMM", "d" };
-
-static const char *eu_locale_dep[] = {
- "dd", "MM", "yyyy", "dd", "MM",
- "d", "M", "yy", "d", "M",
- "dd", "MMMM", "yyyy", "dd", "MMMM",
- "d", "MMM", "yy", "d", "MMM" };
-
-static const char *jp_locale_dep[] = {
- "yyyy", "MM", "dd", "MM", "dd",
- "yy", "M", "d", "M", "d",
- "yyyy", "MMMM", "dd", "MMMM", "dd",
- "yy", "MMM", "d", "MMM", "d" };
-
-/*!
- Returns a Qt version of the given \a sys_fmt Symbian locale format string.
-*/
-static QString s60ToQtFormat(const QString &sys_fmt)
-{
- TLocale *locale = _s60Locale.GetLocale();
-
- QString result;
- QString other;
- QString qtformatchars = QString::fromLatin1("adhmsyzAHM");
-
- QChar c;
- int i = 0;
- bool open_escape = false;
- bool abbrev_next = false;
- bool locale_indep_ordering = false;
- bool minus_mode = false;
- bool plus_mode = false;
- bool n_mode = false;
- TTimeFormat tf = locale->TimeFormat();
-
- while (i < sys_fmt.size()) {
-
- c = sys_fmt.at(i);
-
- // let formatting thru
- if (c.unicode() == '%') {
- // if we have gathered string, concat it
- if (!other.isEmpty()) {
- result += other;
- other.clear();
- }
- // if we have open escape, end it
- if (open_escape) {
- result += QLatin1Char('\'');
- open_escape = false;
- }
-
- ++i;
- if (i >= sys_fmt.size())
- break;
-
- c = sys_fmt.at(i);
-
- // process specials
- abbrev_next = c.unicode() == '*';
- plus_mode = c.unicode() == '+';
- minus_mode = c.unicode() == '-';
-
- if (abbrev_next || plus_mode || minus_mode) {
- ++i;
- if (i >= sys_fmt.size())
- break;
-
- c = sys_fmt.at(i);
-
- if (plus_mode || minus_mode) {
- // break on undefined plus/minus mode
- if (c.unicode() != 'A' && c.unicode() != 'B')
- break;
- }
- }
-
- switch (c.unicode()) {
- case 'F':
- {
- // locale indep mode on
- locale_indep_ordering = true;
- break;
- }
-
- case '/':
- {
- // date sep 0-3
- ++i;
- if (i >= sys_fmt.size())
- break;
-
- c = sys_fmt.at(i);
- if (c.isDigit() && c.digitValue() <= 3) {
- TChar s = locale->DateSeparator(c.digitValue());
- TUint val = s;
- // some indexes return zero for empty
- if (val > 0)
- result += QChar(val);
- }
- break;
- }
-
- case 'D':
- {
- if (!locale_indep_ordering)
- break;
-
- if (!abbrev_next)
- result += QLatin1String("dd");
- else
- result += QLatin1Char('d');
-
- break;
- }
-
- case 'M':
- {
- if (!locale_indep_ordering)
- break;
-
- if (!n_mode) {
- if (!abbrev_next)
- result += QLatin1String("MM");
- else
- result += QLatin1String("M");
- } else {
- if (!abbrev_next)
- result += QLatin1String("MMMM");
- else
- result += QLatin1String("MMM");
- }
-
- break;
- }
-
- case 'N':
- {
- n_mode = true;
-
- if (!locale_indep_ordering)
- break;
-
- if (!abbrev_next)
- result += QLatin1String("MMMM");
- else
- result += QLatin1String("MMM");
-
- break;
- }
-
- case 'Y':
- {
- if (!locale_indep_ordering)
- break;
-
- if (!abbrev_next)
- result += QLatin1String("yyyy");
- else
- result += QLatin1String("yy");
-
- break;
- }
-
- case 'E':
- {
- if (!abbrev_next)
- result += QLatin1String("dddd");
- else
- result += QLatin1String("ddd");
-
- break;
- }
-
- case ':':
- {
- // timesep 0-3
- ++i;
- if (i >= sys_fmt.size())
- break;
-
- c = sys_fmt.at(i);
- if (c.isDigit() && c.digitValue() <= 3) {
- TChar s = locale->TimeSeparator(c.digitValue());
- TUint val = s;
- // some indexes return zero for empty
- if (val > 0)
- result += QChar(val);
- }
-
- break;
- }
-
- case 'J':
- {
- if (tf == ETime24 && !abbrev_next)
- result += QLatin1String("hh");
- else
- result += QLatin1Char('h');
-
- break;
- }
-
- case 'H':
- {
- if (!abbrev_next)
- result += QLatin1String("hh");
- else
- result += QLatin1Char('h');
-
- break;
- }
-
- case 'I':
- {
- result += QLatin1Char('h');
- break;
- }
-
- case 'T':
- {
- if (!abbrev_next)
- result += QLatin1String("mm");
- else
- result += QLatin1Char('m');
-
- break;
- }
-
- case 'S':
- {
- if (!abbrev_next)
- result += QLatin1String("ss");
- else
- result += QLatin1Char('s');
-
- break;
- }
-
- case 'B':
- {
- // only done for 12h clock
- if (tf == ETime24)
- break;
- }
-
- // fallthru to A
- case 'A': {
- // quickie to get capitalization, can't use s60 string as is because Qt 'hh' format's am/pm logic
- TAmPmName ampm = TAmPmName();
- TChar first(ampm[0]);
- QString qtampm = QString::fromLatin1(first.IsUpper() ? "AP" : "ap");
-
- int pos = locale->AmPmSymbolPosition();
-
- if ((minus_mode && pos != ELocaleBefore) ||
- (plus_mode && pos != ELocaleAfter))
- break;
-
- if (!abbrev_next && locale->AmPmSpaceBetween()) {
- if (pos == ELocaleBefore)
- qtampm.append(QLatin1Char(' '));
- else
- qtampm.prepend(QLatin1Char(' '));
- }
-
- result += qtampm;
- }
- break;
-
- case '.': {
- // decimal sep
- TChar s = locale->DecimalSeparator();
- TUint val = s;
- if (val > 0)
- result += QChar(val);
- }
- break;
-
- case 'C':
- {
- // six digits in s60, three digits in qt
- if (!abbrev_next) {
- result += QLatin1String("zzz");
- } else {
- // next char is number from 0-6, how many digits to display
- ++i;
- if (i >= sys_fmt.size())
- break;
-
- c = sys_fmt.at(i);
-
- if (c.isDigit()) {
- // try to match wanted digits
- QChar val(c.digitValue());
-
- if (val >= 3) {
- result += QLatin1String("zzz");
- } else if (val > 0) {
- result += QLatin1Char('z');
- }
- }
- }
- break;
- }
-
- // these cases fallthru
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- {
-
- // shouldn't parse these with %F
- if (locale_indep_ordering)
- break;
-
- TDateFormat df = locale->DateFormat();
-
- const char **locale_dep;
- switch (df) {
- default: // fallthru to american
- case EDateAmerican:
- locale_dep = us_locale_dep;
- break;
- case EDateEuropean:
- locale_dep = eu_locale_dep;
- break;
- case EDateJapanese:
- locale_dep = jp_locale_dep;
- break;
- }
- int offset = 0;
- if (abbrev_next)
- offset += 5;
- if (n_mode)
- offset += 10;
-
- result += QLatin1String(locale_dep[offset + (c.digitValue()-1)]);
- break;
- }
-
- case '%': // fallthru percent
- {
- // any junk gets copied as is
- }
- default:
- {
- result += c;
- break;
- }
-
- case 'Z': // Qt doesn't support these :(
- case 'X':
- case 'W':
- {
- break;
- }
- }
- } else {
- // double any single quotes, don't begin escape
- if (c.unicode() == '\'') {
- // end open escape
- if (open_escape) {
- result += other;
- other.clear();
- result += QLatin1Char('\'');
- open_escape = false;
- }
-
- other += c;
- }
-
- // gather chars and escape them in one go if any format chars are found
- if (!open_escape && qtformatchars.indexOf(c) != -1) {
- result += QLatin1Char('\'');
- open_escape = true;
- }
- other += c;
- }
-
- ++i;
- }
-
- if (!other.isEmpty())
- result += other;
- if (open_escape)
- result += QLatin1Char('\'');
-
- return result;
-}
-
-/*!
- Retrieves Symbian locale decimal separator.
-*/
-static QString symbianDecimalPoint()
-{
- TLocale *locale = _s60Locale.GetLocale();
-
- TChar decPoint = locale->DecimalSeparator();
- int val = decPoint;
- return QChar(val);
-}
-
-/*!
- Retrieves Symbian locale group separator.
-*/
-static QString symbianGroupSeparator()
-{
- TLocale *locale = _s60Locale.GetLocale();
-
- TChar grpSep = locale->ThousandsSeparator();
- int val = grpSep;
- return QChar(val);
-}
-
-/*!
- Retrieves Symbian locale zero digit.
-*/
-static QString symbianZeroDigit()
-{
- TLocale *locale = _s60Locale.GetLocale();
-
- // TDigitType enumeration value returned by TLocale
- // will always correspond to zero digit unicode value.
- TDigitType digit = locale->DigitType();
- return QChar(digit);
-}
-
-/*!
- Retrieves a day name from Symbian locale. The \a day is an integer
- from 1 to 7. When \a short_format is true the method returns
- the day in short format. Otherwise it returns the day in a long format.
-*/
-static QString symbianDayName(int day, bool short_format)
-{
- day -= 1;
-
- if (day < 0 || day > 6)
- return QString();
-
- if (short_format) {
- return qt_TDes2QString(TDayNameAbb(TDay(day)));
- } else {
- return qt_TDes2QString(TDayName(TDay(day)));
- }
-}
-
-/*!
- Retrieves a month name from Symbian locale. The \a month is an integer
- from 1 to 12. When \a short_format is true the method returns
- the month in short format. Otherwise it returns the month in a long format.
-*/
-static QString symbianMonthName(int month, bool short_format)
-{
- month -= 1;
- if (month < 0 || month > 11)
- return QString();
-
- if (short_format) {
- return qt_TDes2QString(TMonthNameAbb(TMonth(month)));
- } else {
- return qt_TDes2QString(TMonthName(TMonth(month)));
- }
-}
-
-/*!
- Retrieves date format from Symbian locale and
- transforms it to Qt format.
-
- When \a short_format is true the method returns
- short date format. Otherwise it returns the long format.
-*/
-static QString symbianDateFormat(bool short_format)
-{
- TPtrC dateFormat;
-
- if (short_format) {
- dateFormat.Set(ptrGetShortDateFormatSpec(_s60Locale));
- } else {
- dateFormat.Set(ptrGetLongDateFormatSpec(_s60Locale));
- }
-
- return s60ToQtFormat(qt_TDesC2QString(dateFormat));
-}
-
-/*!
- Retrieves time format from Symbian locale and
- transforms it to Qt format.
-*/
-static QString symbianTimeFormat()
-{
- return s60ToQtFormat(qt_TDesC2QString(ptrGetTimeFormatSpec(_s60Locale)));
-}
-
-/*!
- Returns localized string representation of given \a date
- formatted with Symbian locale date format.
-
- If \a short_format is true the format will be a short version.
- Otherwise it uses a longer version.
-*/
-static QString symbianDateToString(const QDate &date, bool short_format)
-{
- int month = date.month() - 1;
- int day = date.day() - 1;
- int year = date.year();
-
- TDateTime dateTime;
- dateTime.Set(year, TMonth(month), day, 0, 0, 0, 0);
-
- TTime timeStr(dateTime);
- TBuf<KMaxLongDateFormatSpec*2> buffer;
-
- TPtrC dateFormat;
- if (short_format) {
- dateFormat.Set(ptrGetShortDateFormatSpec(_s60Locale));
- } else {
- dateFormat.Set(ptrGetLongDateFormatSpec(_s60Locale));
- }
-
- TRAPD(err, ptrTimeFormatL(timeStr, buffer, dateFormat, *_s60Locale.GetLocale());)
-
- if (err == KErrNone)
- return qt_TDes2QString(buffer);
- else
- return QString();
-}
-
-/*!
- Returns localized string representation of given \a time
- formatted with Symbian locale time format.
-*/
-static QString symbianTimeToString(const QTime &time)
-{
- int hour = time.hour();
- int minute = time.minute();
- int second = time.second();
- int milliseconds = 0;
-
- TDateTime dateTime;
- dateTime.Set(0, TMonth(0), 0, hour, minute, second, milliseconds);
-
- TTime timeStr(dateTime);
- TBuf<KMaxTimeFormatSpec*2> buffer;
-
- TRAPD(err, ptrTimeFormatL(
- timeStr,
- buffer,
- ptrGetTimeFormatSpec(_s60Locale),
- *_s60Locale.GetLocale());
- )
-
- if (err == KErrNone)
- return qt_TDes2QString(buffer);
- else
- return QString();
-}
-
-/*!
- Returns the measurement system stored in Symbian locale
-
- \sa QLocale::MeasurementSystem
-*/
-static QLocale::MeasurementSystem symbianMeasurementSystem()
-{
- TLocale *locale = _s60Locale.GetLocale();
-
- TUnitsFormat unitFormat = locale->UnitsGeneral();
- if (unitFormat == EUnitsImperial)
- return QLocale::ImperialSystem;
- else
- return QLocale::MetricSystem;
-}
-
-void qt_symbianUpdateSystemPrivate()
-{
- // load system data before query calls
- _s60Locale.LoadSystemSettings();
-}
-
-void qt_symbianInitSystemLocale()
-{
- static QBasicAtomicInt initDone = Q_BASIC_ATOMIC_INITIALIZER(0);
- if (initDone == 2)
- return;
- if (initDone.testAndSetRelaxed(0, 1)) {
- // Initialize platform version dependent function pointers
- ptrTimeFormatL = reinterpret_cast<FormatFunc>
- (qt_resolveS60PluginFunc(S60Plugin_TimeFormatL));
- ptrGetTimeFormatSpec = reinterpret_cast<FormatSpecFunc>
- (qt_resolveS60PluginFunc(S60Plugin_GetTimeFormatSpec));
- ptrGetLongDateFormatSpec = reinterpret_cast<FormatSpecFunc>
- (qt_resolveS60PluginFunc(S60Plugin_GetLongDateFormatSpec));
- ptrGetShortDateFormatSpec = reinterpret_cast<FormatSpecFunc>
- (qt_resolveS60PluginFunc(S60Plugin_GetShortDateFormatSpec));
- if (!ptrTimeFormatL)
- ptrTimeFormatL = &defaultTimeFormatL;
- if (!ptrGetTimeFormatSpec)
- ptrGetTimeFormatSpec = &defaultFormatSpec;
- if (!ptrGetLongDateFormatSpec)
- ptrGetLongDateFormatSpec = &defaultFormatSpec;
- if (!ptrGetShortDateFormatSpec)
- ptrGetShortDateFormatSpec = &defaultFormatSpec;
- bool ret = initDone.testAndSetRelease(1, 2);
- Q_ASSERT(ret);
- Q_UNUSED(ret);
- }
- while(initDone != 2)
- QThread::yieldCurrentThread();
-}
-
-QLocale QSystemLocale::fallbackLocale() const
-{
- TLanguage lang = User::Language();
- QString locale = QLatin1String(qt_symbianLocaleName(lang));
- return QLocale(locale);
-}
-
-static QStringList symbianUILanguages()
-{
- TLanguage lang = User::Language();
- QString s = QLatin1String(qt_resolveSymbianLocaleName(lang, UILanguage));
- return QStringList(s);
-}
-
-QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
-{
- switch(type) {
- case DecimalPoint:
- return symbianDecimalPoint();
- case GroupSeparator:
- return symbianGroupSeparator();
-
- case ZeroDigit:
- return symbianZeroDigit();
-
- case DayNameLong:
- case DayNameShort:
- return symbianDayName(in.toInt(), (type == DayNameShort) );
-
- case MonthNameLong:
- case MonthNameShort:
- return symbianMonthName(in.toInt(), (type == MonthNameShort) );
-
- case DateFormatLong:
- case DateFormatShort:
- return symbianDateFormat( (type == DateFormatShort) );
- case TimeFormatLong:
- case TimeFormatShort:
- return symbianTimeFormat();
- case DateTimeFormatLong:
- case DateTimeFormatShort:
- return QString(symbianDateFormat( (type == DateTimeFormatShort) ) + QLatin1Char(' ') + symbianTimeFormat());
- case DateToStringShort:
- case DateToStringLong:
- return symbianDateToString(in.toDate(), (type == DateToStringShort) );
- case TimeToStringShort:
- case TimeToStringLong:
- return symbianTimeToString(in.toTime());
- case DateTimeToStringShort:
- case DateTimeToStringLong: {
- const QDateTime dt = in.toDateTime();
- return QString(symbianDateToString(dt.date(), (type == DateTimeToStringShort) )
- + QLatin1Char(' ') + symbianTimeToString(dt.time()));
- }
- case MeasurementSystem:
- return static_cast<int>(symbianMeasurementSystem());
- case LanguageId:
- case CountryId: {
- TLanguage language = User::Language();
- QString locale = QLatin1String(qt_symbianLocaleName(language));
- QLocale::Language lang;
- QLocale::Script script;
- QLocale::Country cntry;
- QLocalePrivate::getLangAndCountry(locale, lang, script, cntry);
- if (type == LanguageId)
- return lang;
- // few iso codes have no country and will use this
- if (cntry == QLocale::AnyCountry)
- return fallbackLocale().country();
-
- return cntry;
- }
- case ScriptId:
- return QVariant(QLocale::AnyScript);
- case NegativeSign:
- case PositiveSign:
- break;
- case AMText:
- return qt_TDes2QString(TAmPmName(TAmPm(EAm)));
- case PMText:
- return qt_TDes2QString(TAmPmName(TAmPm(EPm)));
- case UILanguages:
- return QVariant(symbianUILanguages());
- default:
- break;
- }
- return QVariant();
-}
-
-#if !defined(QT_NO_SYSTEMLOCALE)
-QEnvironmentChangeNotifier::QEnvironmentChangeNotifier()
-{
- // Create the change notifier and install the callback function
- const TCallBack callback(&QEnvironmentChangeNotifier::localeChanged, this);
- QT_TRAP_THROWING(iChangeNotifier = CEnvironmentChangeNotifier::NewL(CActive::EPriorityStandard, callback));
- iChangeNotifier->Start();
-}
-
-TInt QEnvironmentChangeNotifier::localeChanged(TAny *data)
-{
- QEnvironmentChangeNotifier *that = reinterpret_cast<QEnvironmentChangeNotifier *>(data);
-
- TInt flag = that->iChangeNotifier->Change();
- if (flag & EChangesLocale) {
- static bool first = true;
- if (!first) { // skip the first notification on app startup
- QT_TRYCATCH_LEAVING(QLocalePrivate::updateSystemPrivate());
- QT_TRYCATCH_LEAVING(QCoreApplication::postEvent(qApp, new QEvent(QEvent::LocaleChange)));
- }
- first = false;
- }
- return KErrNone;
-}
-
-QEnvironmentChangeNotifier::~QEnvironmentChangeNotifier()
-{
- delete iChangeNotifier;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/corelib/tools/qlocale_tools.cpp b/src/corelib/tools/qlocale_tools.cpp
index 8a57a418e4..31a29d7fe1 100644
--- a/src/corelib/tools/qlocale_tools.cpp
+++ b/src/corelib/tools/qlocale_tools.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -258,13 +258,6 @@ bool removeGroupSeparators(QLocalePrivate::CharBuff *num)
return true;
}
-#if defined(Q_CC_MWERKS) && defined(Q_OS_WIN32)
-inline bool isascii(int c)
-{
- return (c >= 0 && c <=127);
-}
-#endif
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
diff --git a/src/corelib/tools/qlocale_tools_p.h b/src/corelib/tools/qlocale_tools_p.h
index 85e6d3b0d0..2dc5c03a20 100644
--- a/src/corelib/tools/qlocale_tools_p.h
+++ b/src/corelib/tools/qlocale_tools_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qlocale_unix.cpp b/src/corelib/tools/qlocale_unix.cpp
index 5839a80e00..6ace96f771 100644
--- a/src/corelib/tools/qlocale_unix.cpp
+++ b/src/corelib/tools/qlocale_unix.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp
index c09802879c..cd9fffc7a5 100644
--- a/src/corelib/tools/qlocale_win.cpp
+++ b/src/corelib/tools/qlocale_win.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,8 +50,8 @@
#include "qdebug.h"
-#if defined(Q_OS_WIN)
-# include "qt_windows.h"
+#ifdef Q_OS_WIN
+# include <qt_windows.h>
# include <time.h>
#endif
diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp
index b1e8ecb0ad..474e9cb59d 100644
--- a/src/corelib/tools/qmap.cpp
+++ b/src/corelib/tools/qmap.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index 7e19760c5f..a8306194d4 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -56,7 +56,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
struct Q_CORE_EXPORT QMapData
{
diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp
index e14e2aa227..41f7dce9a5 100644
--- a/src/corelib/tools/qmargins.cpp
+++ b/src/corelib/tools/qmargins.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qmargins.h b/src/corelib/tools/qmargins.h
index 4e69907440..7d9d07ed46 100644
--- a/src/corelib/tools/qmargins.h
+++ b/src/corelib/tools/qmargins.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QMargins
{
diff --git a/src/corelib/tools/qpair.h b/src/corelib/tools/qpair.h
index 0acd617e26..501f2af3e6 100644
--- a/src/corelib/tools/qpair.h
+++ b/src/corelib/tools/qpair.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
template <class T1, class T2>
struct QPair
diff --git a/src/corelib/tools/qpair.qdoc b/src/corelib/tools/qpair.qdoc
index 26e7c78996..fdf1eafc23 100644
--- a/src/corelib/tools/qpair.qdoc
+++ b/src/corelib/tools/qpair.qdoc
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -21,6 +20,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qpodlist_p.h b/src/corelib/tools/qpodlist_p.h
index 9c03f0e64a..7fc04cfb39 100644
--- a/src/corelib/tools/qpodlist_p.h
+++ b/src/corelib/tools/qpodlist_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -59,7 +59,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
template <typename T, int Prealloc>
class QPodList : public QVarLengthArray<T, Prealloc>
diff --git a/src/corelib/tools/qpoint.cpp b/src/corelib/tools/qpoint.cpp
index 9139f4033c..55a2261cb9 100644
--- a/src/corelib/tools/qpoint.cpp
+++ b/src/corelib/tools/qpoint.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qpoint.h b/src/corelib/tools/qpoint.h
index a6381578d8..827de3936c 100644
--- a/src/corelib/tools/qpoint.h
+++ b/src/corelib/tools/qpoint.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class Q_CORE_EXPORT QPoint
{
diff --git a/src/corelib/tools/qqueue.cpp b/src/corelib/tools/qqueue.cpp
index 5753c7d695..06d996a542 100644
--- a/src/corelib/tools/qqueue.cpp
+++ b/src/corelib/tools/qqueue.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qqueue.h b/src/corelib/tools/qqueue.h
index 9aa7a7bdb0..9e891199a0 100644
--- a/src/corelib/tools/qqueue.h
+++ b/src/corelib/tools/qqueue.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
template <class T>
class QQueue : public QList<T>
diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp
index 2d63eb85e6..7ff883a99a 100644
--- a/src/corelib/tools/qrect.cpp
+++ b/src/corelib/tools/qrect.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qrect.h b/src/corelib/tools/qrect.h
index 34000750ee..bc9a4d68be 100644
--- a/src/corelib/tools/qrect.h
+++ b/src/corelib/tools/qrect.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -53,7 +53,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class Q_CORE_EXPORT QRect
{
diff --git a/src/corelib/tools/qrefcount.cpp b/src/corelib/tools/qrefcount.cpp
index 5341d27a91..24cfedb5db 100644
--- a/src/corelib/tools/qrefcount.cpp
+++ b/src/corelib/tools/qrefcount.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qrefcount.h b/src/corelib/tools/qrefcount.h
index 1d2474b6d8..16b1d339b3 100644
--- a/src/corelib/tools/qrefcount.h
+++ b/src/corelib/tools/qrefcount.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
namespace QtPrivate
{
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index d300ed967d..421d15c436 100644
--- a/src/corelib/tools/qregexp.cpp
+++ b/src/corelib/tools/qregexp.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -773,7 +773,7 @@ static QString wc2rx(const QString &wc_str, const bool enableEscaping)
if (isEscaping) {
rx += QLatin1String("\\\\");
} // we insert the \\ later if necessary
- if (i+1 == wclen) { // the end
+ if (i == wclen) { // the end
rx += QLatin1String("\\\\");
}
} else {
@@ -3809,7 +3809,7 @@ uint qHash(const QRegExpEngineKey &key)
typedef QCache<QRegExpEngineKey, QRegExpEngine> EngineCache;
Q_GLOBAL_STATIC(EngineCache, globalEngineCache)
-Q_GLOBAL_STATIC(QMutex, mutex)
+static QBasicMutex globalEngineCacheMutex;
#endif // QT_NO_REGEXP_OPTIM
static void derefEngine(QRegExpEngine *eng, const QRegExpEngineKey &key)
@@ -3817,7 +3817,7 @@ static void derefEngine(QRegExpEngine *eng, const QRegExpEngineKey &key)
if (!eng->ref.deref()) {
#if !defined(QT_NO_REGEXP_OPTIM)
if (globalEngineCache()) {
- QMutexLocker locker(mutex());
+ QMutexLocker locker(&globalEngineCacheMutex);
QT_TRY {
globalEngineCache()->insert(key, eng, 4 + key.pattern.length() / 4);
} QT_CATCH(const std::bad_alloc &) {
@@ -3839,7 +3839,7 @@ static void prepareEngine_helper(QRegExpPrivate *priv)
bool initMatchState = !priv->eng;
#if !defined(QT_NO_REGEXP_OPTIM)
if (!priv->eng && globalEngineCache()) {
- QMutexLocker locker(mutex());
+ QMutexLocker locker(&globalEngineCacheMutex);
priv->eng = globalEngineCache()->take(priv->engineKey);
if (priv->eng != 0)
priv->eng->ref.ref();
@@ -4316,18 +4316,13 @@ int QRegExp::matchedLength() const
#ifndef QT_NO_REGEXP_CAPTURE
-#ifndef QT_NO_DEPRECATED
/*!
+ \fn int QRegExp::numCaptures() const
\obsolete
Returns the number of captures contained in the regular expression.
\sa captureCount()
*/
-int QRegExp::numCaptures() const
-{
- return captureCount();
-}
-#endif
/*!
\since 4.6
diff --git a/src/corelib/tools/qregexp.h b/src/corelib/tools/qregexp.h
index 364745e24a..0455e1603e 100644
--- a/src/corelib/tools/qregexp.h
+++ b/src/corelib/tools/qregexp.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
struct QRegExpPrivate;
class QStringList;
@@ -100,9 +99,6 @@ public:
int lastIndexIn(const QString &str, int offset = -1, CaretMode caretMode = CaretAtZero) const;
int matchedLength() const;
#ifndef QT_NO_REGEXP_CAPTURE
-#ifdef QT_DEPRECATED
- QT_DEPRECATED int numCaptures() const;
-#endif
int captureCount() const;
QStringList capturedTexts() const;
QStringList capturedTexts();
diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h
index 6bbce03a44..46e505099a 100644
--- a/src/corelib/tools/qringbuffer_p.h
+++ b/src/corelib/tools/qringbuffer_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp
index a95468617b..b6bf525fb9 100644
--- a/src/corelib/tools/qscopedpointer.cpp
+++ b/src/corelib/tools/qscopedpointer.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h
index 41e6dff90c..4e1027e86a 100644
--- a/src/corelib/tools/qscopedpointer.h
+++ b/src/corelib/tools/qscopedpointer.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -46,7 +46,6 @@
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
template <typename T>
struct QScopedPointerDeleter
@@ -86,9 +85,7 @@ struct QScopedPointerPodDeleter
template <typename T, typename Cleanup = QScopedPointerDeleter<T> >
class QScopedPointer
{
-#ifndef Q_CC_NOKIAX86
typedef T *QScopedPointer:: *RestrictedBool;
-#endif
public:
explicit inline QScopedPointer(T *p = 0) : d(p)
{
@@ -118,7 +115,7 @@ public:
return !d;
}
-#if defined(Q_CC_NOKIAX86) || defined(Q_QDOC)
+#if defined(Q_QDOC)
inline operator bool() const
{
return isNull() ? 0 : &QScopedPointer::d;
diff --git a/src/corelib/tools/qscopedpointer_p.h b/src/corelib/tools/qscopedpointer_p.h
index eb7cc80e54..ff32954bad 100644
--- a/src/corelib/tools/qscopedpointer_p.h
+++ b/src/corelib/tools/qscopedpointer_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -57,7 +57,6 @@
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
/* Internal helper class - exposes the data through data_ptr (legacy from QShared).
diff --git a/src/corelib/tools/qscopedvaluerollback.cpp b/src/corelib/tools/qscopedvaluerollback.cpp
index e5b68ded1f..9cbdb4c6ec 100644
--- a/src/corelib/tools/qscopedvaluerollback.cpp
+++ b/src/corelib/tools/qscopedvaluerollback.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qscopedvaluerollback.h b/src/corelib/tools/qscopedvaluerollback.h
index 3b821956eb..23d2d9eda0 100644
--- a/src/corelib/tools/qscopedvaluerollback.h
+++ b/src/corelib/tools/qscopedvaluerollback.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -46,7 +46,6 @@
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
template <typename T>
class QScopedValueRollback
diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h
index 7ad16a7943..7750cd1147 100644
--- a/src/corelib/tools/qset.h
+++ b/src/corelib/tools/qset.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
template <class T>
class QSet
diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc
index 28b53e690d..b33064e1b8 100644
--- a/src/corelib/tools/qset.qdoc
+++ b/src/corelib/tools/qset.qdoc
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -21,6 +20,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qshareddata.cpp b/src/corelib/tools/qshareddata.cpp
index 2995d4a123..6250745400 100644
--- a/src/corelib/tools/qshareddata.cpp
+++ b/src/corelib/tools/qshareddata.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h
index add8025d5a..1003baaae3 100644
--- a/src/corelib/tools/qshareddata.h
+++ b/src/corelib/tools/qshareddata.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
template <class T> class QSharedDataPointer;
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp
index 0069eb6831..ee0aee2399 100644
--- a/src/corelib/tools/qsharedpointer.cpp
+++ b/src/corelib/tools/qsharedpointer.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qsharedpointer.h b/src/corelib/tools/qsharedpointer.h
index f4a0c02ebf..4033b5d422 100644
--- a/src/corelib/tools/qsharedpointer.h
+++ b/src/corelib/tools/qsharedpointer.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,7 +54,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
// These classes are here to fool qdoc into generating a better documentation
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index 3cad13856c..ebab027196 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -52,7 +52,6 @@
// classes found in qsharedpointer.h
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
QT_END_NAMESPACE
QT_END_HEADER
#pragma qt_sync_stop_processing
@@ -66,7 +65,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
// Macro QSHAREDPOINTER_VERIFY_AUTO_CAST
// generates a compiler error if the following construct isn't valid:
@@ -130,9 +128,7 @@ namespace QtSharedPointer {
template <class T>
class Basic
{
-#ifndef Q_CC_NOKIAX86
typedef T *Basic:: *RestrictedBool;
-#endif
public:
typedef T Type;
typedef T element_type;
@@ -145,11 +141,7 @@ namespace QtSharedPointer {
inline T *data() const { return value; }
inline bool isNull() const { return !data(); }
-#ifndef Q_CC_NOKIAX86
inline operator RestrictedBool() const { return isNull() ? 0 : &Basic::value; }
-#else
- inline operator bool() const { return isNull() ? 0 : &Basic::value; }
-#endif
inline bool operator !() const { return isNull(); }
inline T &operator*() const { return *data(); }
inline T *operator->() const { return data(); }
@@ -563,9 +555,7 @@ public:
template <class T>
class QWeakPointer
{
-#ifndef Q_CC_NOKIAX86
typedef T *QWeakPointer:: *RestrictedBool;
-#endif
typedef QtSharedPointer::ExternalRefCountData Data;
public:
@@ -578,11 +568,7 @@ public:
typedef qptrdiff difference_type;
inline bool isNull() const { return d == 0 || d->strongref.load() == 0 || value == 0; }
-#ifndef Q_CC_NOKIAX86
inline operator RestrictedBool() const { return isNull() ? 0 : &QWeakPointer::value; }
-#else
- inline operator bool() const { return isNull() ? 0 : &QWeakPointer::value; }
-#endif
inline bool operator !() const { return isNull(); }
inline T *data() const { return d == 0 || d->strongref.load() == 0 ? 0 : value; }
diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp
index 9001c4a399..d65dfa35a6 100644
--- a/src/corelib/tools/qsimd.cpp
+++ b/src/corelib/tools/qsimd.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -43,15 +43,14 @@
#include <QByteArray>
#include <stdio.h>
-#if defined(Q_OS_WINCE)
-#include <windows.h>
-#endif
-
-#if defined(Q_OS_WIN64) && !defined(Q_CC_GNU)
-#include <intrin.h>
-#endif
-
-#if defined(Q_OS_LINUX) && defined(__arm__)
+#if defined(Q_OS_WIN)
+# if defined(Q_OS_WINCE)
+# include <qt_windows.h>
+# endif
+# if defined(Q_OS_WIN64) && !defined(Q_CC_GNU)
+# include <intrin.h>
+# endif
+#elif defined(Q_OS_LINUX) && defined(__arm__)
#include "private/qcore_unix_p.h"
// the kernel header definitions for HWCAP_*
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index 2fc6d88fb6..47c4a9952b 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -71,9 +71,6 @@ QT_BEGIN_HEADER
# include <emmintrin.h>
# undef posix_memalign
#else
-# ifdef Q_CC_MINGW
-# include <windows.h>
-# endif
# include <emmintrin.h>
#endif
@@ -139,7 +136,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
enum CPUFeatures {
None = 0,
diff --git a/src/corelib/tools/qsize.cpp b/src/corelib/tools/qsize.cpp
index 41abb0be17..d5e6f18326 100644
--- a/src/corelib/tools/qsize.cpp
+++ b/src/corelib/tools/qsize.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qsize.h b/src/corelib/tools/qsize.h
index c9712b3976..5400f76a3a 100644
--- a/src/corelib/tools/qsize.h
+++ b/src/corelib/tools/qsize.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class Q_CORE_EXPORT QSize
{
diff --git a/src/corelib/tools/qstack.cpp b/src/corelib/tools/qstack.cpp
index de851d2f0d..888fbfa0b4 100644
--- a/src/corelib/tools/qstack.cpp
+++ b/src/corelib/tools/qstack.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qstack.h b/src/corelib/tools/qstack.h
index 35518cfe5e..920ad02881 100644
--- a/src/corelib/tools/qstack.h
+++ b/src/corelib/tools/qstack.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
template<class T>
class QStack : public QVector<T>
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 8e49106f1d..28e8b6be83 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -64,28 +64,26 @@
#include <private/qfunctions_p.h>
-#if defined(Q_OS_WINCE)
-#include <windows.h>
-#include <winnls.h>
-#endif
-
-#ifdef Q_OS_SYMBIAN
-#include <e32cmn.h>
-#endif
-
#include <limits.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
-#ifdef truncate
-#undef truncate
-#endif
-
#include "qchar.cpp"
#include "qstringmatcher.cpp"
+#ifdef Q_OS_WIN
+# include <qt_windows.h>
+# ifdef Q_OS_WINCE
+# include <winnls.h>
+# endif
+#endif
+
+#ifdef truncate
+# undef truncate
+#endif
+
#ifndef LLONG_MAX
#define LLONG_MAX qint64_C(9223372036854775807)
#endif
@@ -166,7 +164,7 @@ static int ucstricmp(const ushort *a, const ushort *ae, const ushort *b, const u
}
// Case-insensitive comparison between a Unicode string and a QLatin1String
-static int ucstricmp(const ushort *a, const ushort *ae, const uchar *b)
+static int ucstricmp(const ushort *a, const ushort *ae, const uchar *b, const uchar *be)
{
if (a == 0) {
if (b == 0)
@@ -176,7 +174,11 @@ static int ucstricmp(const ushort *a, const ushort *ae, const uchar *b)
if (b == 0)
return -1;
- while (a < ae && *b) {
+ const ushort *e = ae;
+ if (be - b < ae - a)
+ e = a + (be - b);
+
+ while (a < e) {
int diff = foldCase(*a) - foldCase(*b);
if ((diff))
return diff;
@@ -184,7 +186,7 @@ static int ucstricmp(const ushort *a, const ushort *ae, const uchar *b)
++b;
}
if (a == ae) {
- if (!*b)
+ if (b == be)
return 0;
return -1;
}
@@ -1459,7 +1461,7 @@ QString &QString::insert(int i, const QLatin1String &str)
if (i < 0 || !s || !(*s))
return *this;
- int len = qstrlen(str.latin1());
+ int len = str.size();
expand(qMax(d->size, i) + len - 1);
::memmove(d->data() + i + len, d->data() + i, (d->size - i - len) * sizeof(QChar));
@@ -1560,7 +1562,7 @@ QString &QString::append(const QLatin1String &str)
{
const uchar *s = (const uchar *)str.latin1();
if (s) {
- int len = qstrlen((char *)s);
+ int len = str.size();
if (d->ref.isShared() || d->size + len > int(d->alloc))
realloc(grow(d->size + len));
ushort *i = d->data() + d->size;
@@ -2057,11 +2059,11 @@ QString &QString::replace(const QLatin1String &before,
const QLatin1String &after,
Qt::CaseSensitivity cs)
{
- int alen = qstrlen(after.latin1());
+ int alen = after.size();
QVarLengthArray<ushort> a(alen);
for (int i = 0; i < alen; ++i)
a[i] = (uchar)after.latin1()[i];
- int blen = qstrlen(before.latin1());
+ int blen = before.size();
QVarLengthArray<ushort> b(blen);
for (int i = 0; i < blen; ++i)
b[i] = (uchar)before.latin1()[i];
@@ -2236,7 +2238,7 @@ bool QString::operator<(const QLatin1String &other) const
++uc;
++c;
}
- return (uc == (d->data() + d->size) ? *c : *uc < *c);
+ return (uc == e ? d->size < other.size() : *uc < *c);
}
/*! \fn bool QString::operator<(const QByteArray &other) const
@@ -2329,7 +2331,7 @@ bool QString::operator>(const QLatin1String &other) const
if (!c || *c == '\0')
return !isEmpty();
- const ushort *uc = d->data();;
+ const ushort *uc = d->data();
const ushort *e = uc + qMin(d->size, other.size());
while (uc < e) {
@@ -2338,7 +2340,7 @@ bool QString::operator>(const QLatin1String &other) const
++uc;
++c;
}
- return (uc == (d->data() + d->size) ? false : *uc > *c);
+ return (uc == e) ? d->size > other.size() : *uc > *c;
}
/*! \fn bool QString::operator>(const QByteArray &other) const
@@ -3389,7 +3391,7 @@ QString QString::right(int n) const
QString QString::mid(int position, int n) const
{
- if (d == &shared_null.str || position >= d->size)
+ if (d == &shared_null.str || position > d->size)
return QString();
if (n < 0)
n = d->size - position;
@@ -4610,22 +4612,31 @@ int QString::compare_helper(const QChar *data1, int length1, QLatin1String s2,
Qt::CaseSensitivity cs)
{
const ushort *uc = reinterpret_cast<const ushort *>(data1);
- const ushort *e = uc + length1;
+ const ushort *uce = uc + length1;
const uchar *c = (uchar *)s2.latin1();
if (!c)
return length1;
if (cs == Qt::CaseSensitive) {
- while (uc < e && *c && *uc == *c)
+ const ushort *e = uc + length1;
+ if (s2.size() < length1)
+ e = uc + s2.size();
+ while (uc < e) {
+ int diff = *uc - *c;
+ if (diff)
+ return diff;
uc++, c++;
+ }
- if (uc == e)
- return -*c;
-
- return *uc - *c;
+ if (uc == uce) {
+ if (c == (const uchar *)s2.latin1() + s2.size())
+ return 0;
+ return -1;
+ }
+ return 1;
} else {
- return ucstricmp(uc, e, c);
+ return ucstricmp(uc, uce, c, c + s2.size());
}
}
@@ -4701,12 +4712,6 @@ int QString::localeAwareCompare(const QString &other) const
return localeAwareCompare_helper(constData(), length(), other.constData(), other.length());
}
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
-QT_END_NAMESPACE
-#include "qt_windows.h"
-QT_BEGIN_NAMESPACE
-#endif
-
/*!
\internal
\since 4.5
@@ -4745,10 +4750,6 @@ 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)
# if defined(QT_USE_ICU)
int res;
@@ -5432,11 +5433,14 @@ QString &QString::vsprintf(const char* cformat, va_list ap)
begins with "0x", base 16 is used; if the string begins with "0",
base 8 is used; otherwise, base 10 is used.
+ The string conversion will always happen in the 'C' locale. For locale
+ dependent conversion use QLocale::toLongLong()
+
Example:
\snippet doc/src/snippets/qstring/main.cpp 74
- \sa number(), toULongLong(), toInt()
+ \sa number(), toULongLong(), toInt(), QLocale::toLongLong()
*/
qint64 QString::toLongLong(bool *ok, int base) const
@@ -5448,15 +5452,6 @@ qint64 QString::toLongLong(bool *ok, int base) const
}
#endif
- bool my_ok;
- QLocale def_locale;
- qint64 result = def_locale.d()->stringToLongLong(*this, base, &my_ok, QLocalePrivate::FailOnGroupSeparators);
- if (my_ok) {
- if (ok != 0)
- *ok = true;
- return result;
- }
-
QLocale c_locale(QLocale::C);
return c_locale.d()->stringToLongLong(*this, base, ok, QLocalePrivate::FailOnGroupSeparators);
}
@@ -5473,11 +5468,14 @@ qint64 QString::toLongLong(bool *ok, int base) const
begins with "0x", base 16 is used; if the string begins with "0",
base 8 is used; otherwise, base 10 is used.
+ The string conversion will always happen in the 'C' locale. For locale
+ dependent conversion use QLocale::toULongLong()
+
Example:
\snippet doc/src/snippets/qstring/main.cpp 79
- \sa number(), toLongLong()
+ \sa number(), toLongLong(), QLocale::toULongLong()
*/
quint64 QString::toULongLong(bool *ok, int base) const
@@ -5489,15 +5487,6 @@ quint64 QString::toULongLong(bool *ok, int base) const
}
#endif
- bool my_ok;
- QLocale def_locale;
- quint64 result = def_locale.d()->stringToUnsLongLong(*this, base, &my_ok, QLocalePrivate::FailOnGroupSeparators);
- if (my_ok) {
- if (ok != 0)
- *ok = true;
- return result;
- }
-
QLocale c_locale(QLocale::C);
return c_locale.d()->stringToUnsLongLong(*this, base, ok, QLocalePrivate::FailOnGroupSeparators);
}
@@ -5516,11 +5505,14 @@ quint64 QString::toULongLong(bool *ok, int base) const
begins with "0x", base 16 is used; if the string begins with "0",
base 8 is used; otherwise, base 10 is used.
+ The string conversion will always happen in the 'C' locale. For locale
+ dependent conversion use QLocale::toLong()
+
Example:
\snippet doc/src/snippets/qstring/main.cpp 73
- \sa number(), toULong(), toInt()
+ \sa number(), toULong(), toInt(), QLocale::toLong()
*/
long QString::toLong(bool *ok, int base) const
@@ -5548,11 +5540,14 @@ long QString::toLong(bool *ok, int base) const
begins with "0x", base 16 is used; if the string begins with "0",
base 8 is used; otherwise, base 10 is used.
+ The string conversion will always happen in the 'C' locale. For locale
+ dependent conversion use QLocale::toULong()
+
Example:
\snippet doc/src/snippets/qstring/main.cpp 78
- \sa number()
+ \sa number(), QLocale::toULong()
*/
ulong QString::toULong(bool *ok, int base) const
@@ -5579,11 +5574,14 @@ ulong QString::toULong(bool *ok, int base) const
begins with "0x", base 16 is used; if the string begins with "0",
base 8 is used; otherwise, base 10 is used.
+ The string conversion will always happen in the 'C' locale. For locale
+ dependent conversion use QLocale::toInt()
+
Example:
\snippet doc/src/snippets/qstring/main.cpp 72
- \sa number(), toUInt(), toDouble()
+ \sa number(), toUInt(), toDouble(), QLocale::toInt()
*/
int QString::toInt(bool *ok, int base) const
@@ -5609,11 +5607,14 @@ int QString::toInt(bool *ok, int base) const
begins with "0x", base 16 is used; if the string begins with "0",
base 8 is used; otherwise, base 10 is used.
+ The string conversion will always happen in the 'C' locale. For locale
+ dependent conversion use QLocale::toUInt()
+
Example:
\snippet doc/src/snippets/qstring/main.cpp 77
- \sa number(), toInt()
+ \sa number(), toInt(), QLocale::toUInt()
*/
uint QString::toUInt(bool *ok, int base) const
@@ -5639,11 +5640,14 @@ uint QString::toUInt(bool *ok, int base) const
begins with "0x", base 16 is used; if the string begins with "0",
base 8 is used; otherwise, base 10 is used.
+ The string conversion will always happen in the 'C' locale. For locale
+ dependent conversion use QLocale::toShort()
+
Example:
\snippet doc/src/snippets/qstring/main.cpp 76
- \sa number(), toUShort(), toInt()
+ \sa number(), toUShort(), toInt(), QLocale::toShort()
*/
short QString::toShort(bool *ok, int base) const
@@ -5669,11 +5673,14 @@ short QString::toShort(bool *ok, int base) const
begins with "0x", base 16 is used; if the string begins with "0",
base 8 is used; otherwise, base 10 is used.
+ The string conversion will always happen in the 'C' locale. For locale
+ dependent conversion use QLocale::toUShort()
+
Example:
\snippet doc/src/snippets/qstring/main.cpp 80
- \sa number(), toShort()
+ \sa number(), toShort(), QLocale::toUShort()
*/
ushort QString::toUShort(bool *ok, int base) const
@@ -5703,37 +5710,22 @@ ushort QString::toUShort(bool *ok, int base) const
\snippet doc/src/snippets/qstring/main.cpp 67
- This function tries to interpret the string according to the
- current locale. The current locale is determined from the
- system at application startup and can be changed by calling
- QLocale::setDefault(). If the string cannot be interpreted
- according to the current locale, this function falls back
- on the "C" locale.
+ The string conversion will always happen in the 'C' locale. For locale
+ dependent conversion use QLocale::toDouble()
- \snippet doc/src/snippets/qstring/main.cpp 69
- \snippet doc/src/snippets/qstring/main.cpp 70
+ \snippet doc/src/snippets/qstring/main.cpp 68
- Due to the ambiguity between the decimal point and thousands group
- separator in various locales, this function does not handle
+ For historic reasons, this function does not handle
thousands group separators. If you need to convert such numbers,
- see QLocale::toDouble().
+ use QLocale::toDouble().
- \snippet doc/src/snippets/qstring/main.cpp 68
+ \snippet doc/src/snippets/qstring/main.cpp 69
\sa number() QLocale::setDefault() QLocale::toDouble() trimmed()
*/
double QString::toDouble(bool *ok) const
{
- bool my_ok;
- QLocale def_locale;
- double result = def_locale.d()->stringToDouble(*this, &my_ok, QLocalePrivate::FailOnGroupSeparators);
- if (my_ok) {
- if (ok != 0)
- *ok = true;
- return result;
- }
-
QLocale c_locale(QLocale::C);
return c_locale.d()->stringToDouble(*this, ok, QLocalePrivate::FailOnGroupSeparators);
}
@@ -5744,11 +5736,14 @@ double QString::toDouble(bool *ok) const
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true. Returns 0.0 if the conversion fails.
+ The string conversion will always happen in the 'C' locale. For locale
+ dependent conversion use QLocale::toFloat()
+
Example:
\snippet doc/src/snippets/qstring/main.cpp 71
- \sa number(), toDouble(), toInt()
+ \sa number(), toDouble(), toInt(), QLocale::toFloat()
*/
#define QT_MAX_FLOAT 3.4028234663852886e+38
@@ -5850,8 +5845,9 @@ QString &QString::setNum(qulonglong n, int base)
The \a format can be 'f', 'F', 'e', 'E', 'g' or 'G' (see the
arg() function documentation for an explanation of the formats).
- Unlike QLocale::toString(), this function doesn't honor the
- user's locale settings.
+ The formatting always uses QLocale::C, i.e., English/UnitedStates.
+ To get a localized string representation of a number, use
+ QLocale::toString() with the appropriate locale.
*/
QString &QString::setNum(double n, char f, int prec)
@@ -5892,6 +5888,10 @@ QString &QString::setNum(double n, char f, int prec)
Sets the string to the printed value of \a n, formatted according
to the given \a format and \a precision, and returns a reference
to the string.
+
+ The formatting always uses QLocale::C, i.e., English/UnitedStates.
+ To get a localized string representation of a number, use
+ QLocale::toString() with the appropriate locale.
*/
@@ -5905,6 +5905,10 @@ QString &QString::setNum(double n, char f, int prec)
and 36. For bases other than 10, \a n is treated as an
unsigned integer.
+ The formatting always uses QLocale::C, i.e., English/UnitedStates.
+ To get a localized string representation of a number, use
+ QLocale::toString() with the appropriate locale.
+
\snippet doc/src/snippets/qstring/main.cpp 35
\sa setNum()
@@ -7164,11 +7168,29 @@ QString &QString::setRawData(const QChar *unicode, int size)
\sa latin1()
*/
+/*! \fn QLatin1String::QLatin1String(const char *str, int size)
+
+ Constructs a QLatin1String object that stores \a str with \a size.
+ Note that if \a str is 0, an empty string is created; this case
+ is handled by QString.
+
+ The string data is \e not copied. The caller must be able to
+ guarantee that \a str will not be deleted or modified as long as
+ the QLatin1String object exists.
+
+ \sa latin1()
+*/
+
/*! \fn const char *QLatin1String::latin1() const
Returns the Latin-1 string stored in this object.
*/
+/*! \fn int QLatin1String::size() const
+
+ Returns the size of the Latin-1 string stored in this object.
+*/
+
/*! \fn bool QLatin1String::operator==(const QString &other) const
Returns true if this string is equal to string \a other;
@@ -7324,37 +7346,37 @@ QString &QString::setRawData(const QChar *unicode, int size)
-/* \fn bool operator==(const QLatin1String &s1, const QLatin1String &s2)
+/*! \fn bool operator==(const QLatin1String &s1, const QLatin1String &s2)
\relates QLatin1String
Returns true if string \a s1 is lexically equal to string \a s2; otherwise
returns false.
*/
-/* \fn bool operator!=(const QLatin1String &s1, const QLatin1String &s2)
+/*! \fn bool operator!=(const QLatin1String &s1, const QLatin1String &s2)
\relates QLatin1String
Returns true if string \a s1 is lexically unequal to string \a s2; otherwise
returns false.
*/
-/* \fn bool operator<(const QLatin1String &s1, const QLatin1String &s2)
+/*! \fn bool operator<(const QLatin1String &s1, const QLatin1String &s2)
\relates QLatin1String
Returns true if string \a s1 is lexically smaller than string \a s2; otherwise
returns false.
*/
-/* \fn bool operator<=(const QLatin1String &s1, const QLatin1String &s2)
+/*! \fn bool operator<=(const QLatin1String &s1, const QLatin1String &s2)
\relates QLatin1String
Returns true if string \a s1 is lexically smaller than or equal to string \a s2; otherwise
returns false.
*/
-/* \fn bool operator>(const QLatin1String &s1, const QLatin1String &s2)
+/*! \fn bool operator>(const QLatin1String &s1, const QLatin1String &s2)
\relates QLatin1String
Returns true if string \a s1 is lexically greater than string \a s2; otherwise
returns false.
*/
-/* \fn bool operator>=(const QLatin1String &s1, const QLatin1String &s2)
+/*! \fn bool operator>=(const QLatin1String &s1, const QLatin1String &s2)
\relates QLatin1String
Returns true if string \a s1 is lexically greater than or equal to
@@ -7678,6 +7700,9 @@ bool operator==(const QString &s1,const QStringRef &s2)
*/
bool operator==(const QLatin1String &s1, const QStringRef &s2)
{
+ if (s1.size() != s2.size())
+ return false;
+
const ushort *uc = reinterpret_cast<const ushort *>(s2.unicode());
const ushort *e = uc + s2.size();
const uchar *c = reinterpret_cast<const uchar *>(s1.latin1());
@@ -8019,7 +8044,7 @@ QStringRef QString::rightRef(int n) const
Returns a substring reference to \a n characters of this string,
starting at the specified \a position.
- If the \a position exceeds the length of the string, an empty
+ If the \a position exceeds the length of the string, a null
reference is returned.
If there are less than \a n characters available in the string,
@@ -8036,7 +8061,7 @@ QStringRef QString::rightRef(int n) const
QStringRef QString::midRef(int position, int n) const
{
- if (d == &shared_null.str || position >= d->size)
+ if (d == &shared_null.str || position > d->size)
return QStringRef();
if (n < 0)
n = d->size - position;
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 42fe85e81f..a857d2d4e5 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -61,7 +61,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QCharRef;
class QRegExp;
@@ -266,9 +265,9 @@ public:
int lastIndexOf(const QLatin1String &s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int lastIndexOf(const QStringRef &s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
- inline QBool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
- inline QBool contains(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
- inline QBool contains(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
+ inline bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
+ inline bool contains(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
+ inline bool contains(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int count(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int count(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
@@ -276,12 +275,12 @@ public:
#ifndef QT_NO_REGEXP
int indexOf(const QRegExp &, int from = 0) const;
int lastIndexOf(const QRegExp &, int from = -1) const;
- inline QBool contains(const QRegExp &rx) const { return QBool(indexOf(rx) != -1); }
+ inline bool contains(const QRegExp &rx) const { return indexOf(rx) != -1; }
int count(const QRegExp &) const;
int indexOf(QRegExp &, int from = 0) const;
int lastIndexOf(QRegExp &, int from = -1) const;
- inline QBool contains(QRegExp &rx) const { return QBool(indexOf(rx) != -1); }
+ inline bool contains(QRegExp &rx) const { return indexOf(rx) != -1; }
#endif
enum SectionFlag {
@@ -646,6 +645,7 @@ class QLatin1String
{
public:
Q_DECL_CONSTEXPR inline explicit QLatin1String(const char *s) : m_size(s ? int(strlen(s)) : 0), m_data(s) {}
+ Q_DECL_CONSTEXPR inline explicit QLatin1String(const char *s, int sz) : m_size(sz), m_data(s) {}
inline const char *latin1() const { return m_data; }
inline int size() const { return m_size; }
@@ -685,7 +685,7 @@ private:
typedef QLatin1String QLatin1Literal;
-inline QString::QString(const QLatin1String &aLatin1) : d(fromLatin1_helper(aLatin1.latin1()))
+inline QString::QString(const QLatin1String &aLatin1) : d(fromLatin1_helper(aLatin1.latin1(), aLatin1.size()))
{ }
inline int QString::length() const
{ return d->size; }
@@ -711,7 +711,7 @@ inline bool QString::isDetached() const
{ return !d->ref.isShared(); }
inline QString &QString::operator=(const QLatin1String &s)
{
- *this = fromLatin1(s.latin1());
+ *this = fromLatin1(s.latin1(), s.size());
return *this;
}
inline void QString::clear()
@@ -910,12 +910,12 @@ inline QString::const_iterator QString::end() const
{ return reinterpret_cast<const QChar*>(d->data() + d->size); }
inline QString::const_iterator QString::constEnd() const
{ return reinterpret_cast<const QChar*>(d->data() + d->size); }
-inline QBool QString::contains(const QString &s, Qt::CaseSensitivity cs) const
-{ return QBool(indexOf(s, 0, cs) != -1); }
-inline QBool QString::contains(const QStringRef &s, Qt::CaseSensitivity cs) const
-{ return QBool(indexOf(s, 0, cs) != -1); }
-inline QBool QString::contains(QChar c, Qt::CaseSensitivity cs) const
-{ return QBool(indexOf(c, 0, cs) != -1); }
+inline bool QString::contains(const QString &s, Qt::CaseSensitivity cs) const
+{ return indexOf(s, 0, cs) != -1; }
+inline bool QString::contains(const QStringRef &s, Qt::CaseSensitivity cs) const
+{ return indexOf(s, 0, cs) != -1; }
+inline bool QString::contains(QChar c, Qt::CaseSensitivity cs) const
+{ return indexOf(c, 0, cs) != -1; }
inline bool operator==(QString::Null, QString::Null) { return true; }
@@ -973,17 +973,21 @@ inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QLatin1String &s
{ return (QString::fromAscii(s1, s1 ? int(strlen(s1)) : -1) >= s2); }
inline bool operator==(const QLatin1String &s1, const QLatin1String &s2)
-{ return (qstrcmp(s1.latin1(), s2.latin1()) == 0); }
+{ return (s1.size() == s2.size() && !memcmp(s1.latin1(), s2.latin1(), s1.size())); }
inline bool operator!=(const QLatin1String &s1, const QLatin1String &s2)
-{ return (qstrcmp(s1.latin1(), s2.latin1()) != 0); }
+{ return (s1.size() != s2.size() || memcmp(s1.latin1(), s2.latin1(), s1.size())); }
inline bool operator<(const QLatin1String &s1, const QLatin1String &s2)
-{ return (qstrcmp(s1.latin1(), s2.latin1()) < 0); }
+{ int r = memcmp(s1.latin1(), s2.latin1(), qMin(s1.size(), s2.size()));
+ return (r < 0) || (r == 0 && s1.size() < s2.size()); }
inline bool operator<=(const QLatin1String &s1, const QLatin1String &s2)
-{ return (qstrcmp(s1.latin1(), s2.latin1()) <= 0); }
+{ int r = memcmp(s1.latin1(), s2.latin1(), qMin(s1.size(), s2.size()));
+ return (r < 0) || (r == 0 && s1.size() <= s2.size()); }
inline bool operator>(const QLatin1String &s1, const QLatin1String &s2)
-{ return (qstrcmp(s1.latin1(), s2.latin1()) > 0); }
+{ int r = memcmp(s1.latin1(), s2.latin1(), qMin(s1.size(), s2.size()));
+ return (r > 0) || (r == 0 && s1.size() > s2.size()); }
inline bool operator>=(const QLatin1String &s1, const QLatin1String &s2)
-{ return (qstrcmp(s1.latin1(), s2.latin1()) >= 0); }
+{ int r = memcmp(s1.latin1(), s2.latin1(), qMin(s1.size(), s2.size()));
+ return (r > 0) || (r == 0 && s1.size() >= s2.size()); }
inline bool QString::operator==(const QByteArray &s) const
@@ -1115,10 +1119,10 @@ public:
int lastIndexOf(QLatin1String str, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int lastIndexOf(const QStringRef &str, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
- inline QBool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
- inline QBool contains(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
- inline QBool contains(QLatin1String str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
- inline QBool contains(const QStringRef &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
+ inline bool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
+ inline bool contains(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
+ inline bool contains(QLatin1String str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
+ inline bool contains(const QStringRef &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int count(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
@@ -1258,14 +1262,14 @@ inline int QStringRef::localeAwareCompare(const QStringRef &s1, const QString &s
inline int QStringRef::localeAwareCompare(const QStringRef &s1, const QStringRef &s2)
{ return QString::localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); }
-inline QBool QStringRef::contains(const QString &s, Qt::CaseSensitivity cs) const
-{ return QBool(indexOf(s, 0, cs) != -1); }
-inline QBool QStringRef::contains(QLatin1String s, Qt::CaseSensitivity cs) const
-{ return QBool(indexOf(s, 0, cs) != -1); }
-inline QBool QStringRef::contains(QChar c, Qt::CaseSensitivity cs) const
-{ return QBool(indexOf(c, 0, cs) != -1); }
-inline QBool QStringRef::contains(const QStringRef &s, Qt::CaseSensitivity cs) const
-{ return QBool(indexOf(s, 0, cs) != -1); }
+inline bool QStringRef::contains(const QString &s, Qt::CaseSensitivity cs) const
+{ return indexOf(s, 0, cs) != -1; }
+inline bool QStringRef::contains(QLatin1String s, Qt::CaseSensitivity cs) const
+{ return indexOf(s, 0, cs) != -1; }
+inline bool QStringRef::contains(QChar c, Qt::CaseSensitivity cs) const
+{ return indexOf(c, 0, cs) != -1; }
+inline bool QStringRef::contains(const QStringRef &s, Qt::CaseSensitivity cs) const
+{ return indexOf(s, 0, cs) != -1; }
namespace Qt {
#if QT_DEPRECATED_SINCE(5, 0)
diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp
index 018a312fa6..3d6b0eb709 100644
--- a/src/corelib/tools/qstringbuilder.cpp
+++ b/src/corelib/tools/qstringbuilder.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index 016e37fb38..1afdde852c 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -57,7 +57,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
struct Q_CORE_EXPORT QAbstractConcatenable
{
diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp
index 1fca78b03b..a352045a7d 100644
--- a/src/corelib/tools/qstringlist.cpp
+++ b/src/corelib/tools/qstringlist.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -266,7 +266,7 @@ QStringList QtPrivate::QStringList_filter(const QStringList *that, const QString
/*!
- \fn QBool QStringList::contains(const QString &str, Qt::CaseSensitivity cs) const
+ \fn bool QStringList::contains(const QString &str, Qt::CaseSensitivity cs) const
Returns true if the list contains the string \a str; otherwise
returns false. The search is case insensitive if \a cs is
@@ -274,15 +274,15 @@ QStringList QtPrivate::QStringList_filter(const QStringList *that, const QString
\sa indexOf(), lastIndexOf(), QString::contains()
*/
-QBool QtPrivate::QStringList_contains(const QStringList *that, const QString &str,
- Qt::CaseSensitivity cs)
+bool QtPrivate::QStringList_contains(const QStringList *that, const QString &str,
+ Qt::CaseSensitivity cs)
{
for (int i = 0; i < that->size(); ++i) {
const QString & string = that->at(i);
if (string.length() == str.length() && str.compare(string, cs) == 0)
- return QBool(true);
+ return true;
}
- return QBool(false);
+ return false;
}
#ifndef QT_NO_REGEXP
diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h
index 6c32f11096..260008f183 100644
--- a/src/corelib/tools/qstringlist.h
+++ b/src/corelib/tools/qstringlist.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -53,7 +53,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QRegExp;
@@ -77,7 +76,7 @@ public:
inline QString join(const QString &sep) const;
inline QStringList filter(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
- inline QBool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
+ inline bool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
inline QStringList &replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
@@ -107,6 +106,8 @@ public:
#endif
};
+Q_DECLARE_TYPEINFO(QStringList, Q_MOVABLE_TYPE);
+
namespace QtPrivate {
void Q_CORE_EXPORT QStringList_sort(QStringList *that);
int Q_CORE_EXPORT QStringList_removeDuplicates(QStringList *that);
@@ -114,7 +115,7 @@ namespace QtPrivate {
QStringList Q_CORE_EXPORT QStringList_filter(const QStringList *that, const QString &str,
Qt::CaseSensitivity cs);
- QBool Q_CORE_EXPORT QStringList_contains(const QStringList *that, const QString &str, Qt::CaseSensitivity cs);
+ bool Q_CORE_EXPORT QStringList_contains(const QStringList *that, const QString &str, Qt::CaseSensitivity cs);
void Q_CORE_EXPORT QStringList_replaceInStrings(QStringList *that, const QString &before, const QString &after,
Qt::CaseSensitivity cs);
@@ -148,7 +149,7 @@ inline QStringList QStringList::filter(const QString &str, Qt::CaseSensitivity c
return QtPrivate::QStringList_filter(this, str, cs);
}
-inline QBool QStringList::contains(const QString &str, Qt::CaseSensitivity cs) const
+inline bool QStringList::contains(const QString &str, Qt::CaseSensitivity cs) const
{
return QtPrivate::QStringList_contains(this, str, cs);
}
diff --git a/src/corelib/tools/qstringmatcher.cpp b/src/corelib/tools/qstringmatcher.cpp
index 36016a9401..faab7a903f 100644
--- a/src/corelib/tools/qstringmatcher.cpp
+++ b/src/corelib/tools/qstringmatcher.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qstringmatcher.h b/src/corelib/tools/qstringmatcher.h
index 9f5e10b942..a9b2a7c371 100644
--- a/src/corelib/tools/qstringmatcher.h
+++ b/src/corelib/tools/qstringmatcher.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QStringMatcherPrivate;
diff --git a/src/corelib/tools/qtextboundaryfinder.cpp b/src/corelib/tools/qtextboundaryfinder.cpp
index 4554ebb34f..20ee954efd 100644
--- a/src/corelib/tools/qtextboundaryfinder.cpp
+++ b/src/corelib/tools/qtextboundaryfinder.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qtextboundaryfinder.h b/src/corelib/tools/qtextboundaryfinder.h
index 3f4f309d31..dc26939664 100644
--- a/src/corelib/tools/qtextboundaryfinder.h
+++ b/src/corelib/tools/qtextboundaryfinder.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QTextBoundaryFinderPrivate;
diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp
index 2ff25a9a46..f0d8c248b4 100644
--- a/src/corelib/tools/qtimeline.cpp
+++ b/src/corelib/tools/qtimeline.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qtimeline.h b/src/corelib/tools/qtimeline.h
index 06a5d76a4b..48e2165b4f 100644
--- a/src/corelib/tools/qtimeline.h
+++ b/src/corelib/tools/qtimeline.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QTimeLinePrivate;
class Q_CORE_EXPORT QTimeLine : public QObject
diff --git a/src/corelib/tools/qtools_p.h b/src/corelib/tools/qtools_p.h
index 6a1b78b12b..d7ebba1f57 100644
--- a/src/corelib/tools/qtools_p.h
+++ b/src/corelib/tools/qtools_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qunicodetables.cpp b/src/corelib/tools/qunicodetables.cpp
index 7fc09e7d60..7f823d4380 100644
--- a/src/corelib/tools/qunicodetables.cpp
+++ b/src/corelib/tools/qunicodetables.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qunicodetables_p.h b/src/corelib/tools/qunicodetables_p.h
index 0a357c0da6..0b8115035c 100644
--- a/src/corelib/tools/qunicodetables_p.h
+++ b/src/corelib/tools/qunicodetables_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h
index d37389a8dc..a6613a3774 100644
--- a/src/corelib/tools/qvarlengtharray.h
+++ b/src/corelib/tools/qvarlengtharray.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -53,7 +53,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
template<class T, int Prealloc>
class QPodList;
diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc
index c4198aafa7..1a0579a077 100644
--- a/src/corelib/tools/qvarlengtharray.qdoc
+++ b/src/corelib/tools/qvarlengtharray.qdoc
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -21,6 +20,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp
index a7a6add15a..0a15c2208c 100644
--- a/src/corelib/tools/qvector.cpp
+++ b/src/corelib/tools/qvector.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 0116d1db6c..22ce2a3d8a 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -61,7 +61,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
struct Q_CORE_EXPORT QVectorData
{
diff --git a/src/corelib/tools/qvsnprintf.cpp b/src/corelib/tools/qvsnprintf.cpp
index 85f8270ffd..9185bff83a 100644
--- a/src/corelib/tools/qvsnprintf.cpp
+++ b/src/corelib/tools/qvsnprintf.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index 2ec32fd9e9..21407fa9cd 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -95,7 +95,6 @@ SOURCES += \
SOURCES += tools/qelapsedtimer_mac.cpp
OBJECTIVE_SOURCES += tools/qlocale_mac.mm
}
-else:symbian:SOURCES += tools/qelapsedtimer_symbian.cpp tools/qlocale_symbian.cpp
else:unix:SOURCES += tools/qelapsedtimer_unix.cpp tools/qlocale_unix.cpp
else:win32:SOURCES += tools/qelapsedtimer_win.cpp tools/qlocale_win.cpp
else:integrity:SOURCES += tools/qelapsedtimer_unix.cpp tools/qlocale_unix.cpp
@@ -131,5 +130,5 @@ INCLUDEPATH += ../3rdparty/md5 \
../3rdparty/md4
# Note: libm should be present by default becaue this is C++
-!macx-icc:!vxworks:!symbian:unix:LIBS_PRIVATE += -lm
+!macx-icc:!vxworks:unix:LIBS_PRIVATE += -lm