summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlocale.h
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2012-03-26 17:23:21 +0100
committerQt by Nokia <qt-info@nokia.com>2012-04-24 16:37:11 +0200
commit0060b44d7045434583f14b5787211bafd045dd54 (patch)
tree7a515509cb1c904ada365e2e1aef4c6038f96e56 /src/corelib/tools/qlocale.h
parentfeb736ef27deb5afc4b8739b3f831b1a94004163 (diff)
QLocale: Clean up QLocalePrivate implementation
In Qt4 QLocalePrivate is a struct returned by a d() method. This will be unsuitable for the planned change to use ICU and may cause BIC issues. This change makes QLocalePrivate a class and creates a new struct QLocaleData to hold the data index. Further clean-ups are possible but are left for later. Change-Id: Ie316a07790f74674a3b520b735dff72695cc4060 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qlocale.h')
-rw-r--r--src/corelib/tools/qlocale.h21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h
index bdb5ae026c..a014b6b7b5 100644
--- a/src/corelib/tools/qlocale.h
+++ b/src/corelib/tools/qlocale.h
@@ -45,6 +45,7 @@
#include <QtCore/qvariant.h>
#include <QtCore/qstring.h>
#include <QtCore/qobjectdefs.h>
+#include <QtCore/qshareddata.h>
QT_BEGIN_HEADER
@@ -59,9 +60,8 @@ class QVariant;
class QTextStream;
class QTextStreamPrivate;
-class QLocale;
+class QLocalePrivate;
-struct QLocalePrivate;
class Q_CORE_EXPORT QLocale
{
Q_GADGET
@@ -590,6 +590,7 @@ public:
QLocale(Language language, Country country = AnyCountry);
QLocale(Language language, Script script, Country country);
QLocale(const QLocale &other);
+ ~QLocale();
QLocale &operator=(const QLocale &other);
@@ -700,20 +701,10 @@ public:
QString quoteString(const QStringRef &str, QuotationStyle style = StandardQuotation) const;
QString createSeparatedList(const QStringList &strl) const;
-//private: // this should be private, but can't be
- struct Data {
- quint16 index;
- quint16 numberOptions;
- };
+
private:
- friend struct QLocalePrivate;
- // ### We now use this field to pack an index into locale_data and NumberOptions.
- // ### Qt 5: change to a QLocaleData *d; uint numberOptions.
- union {
- void *v;
- Data p;
- };
- const QLocalePrivate *d() const;
+ friend class QLocalePrivate;
+ QSharedDataPointer<QLocalePrivate> d;
};
Q_DECLARE_TYPEINFO(QLocale, Q_MOVABLE_TYPE);
Q_DECLARE_OPERATORS_FOR_FLAGS(QLocale::NumberOptions)