diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2018-07-11 18:23:37 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2018-08-13 14:15:44 +0000 |
commit | d283d81c1c65b945662f90403f58124cb7fb8f47 (patch) | |
tree | 682f843aefff1e16723903b5995f073fee42e269 /src/corelib/tools/qcollator_p.h | |
parent | c39d2ab482c1f11e30d7a80f92d65c4982a12703 (diff) |
Supply locale to QCollatorPrivate via its constructor
Both places that new'd it were then setting its locale themselves;
they might as well do it tidily by passing it to the constructor.
There's also no need to cleanup() in the constructor; every back-end
is a no-op when collator has its initial value.
Tidied up the class declaration in the process:
* moved {con,de}structor to be first methods
* comment on the two methods back-ends provide
Change-Id: I041669637935e68141e002156552af8b475ba36e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qcollator_p.h')
-rw-r--r-- | src/corelib/tools/qcollator_p.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/corelib/tools/qcollator_p.h b/src/corelib/tools/qcollator_p.h index 71095f845d..18a43f0de6 100644 --- a/src/corelib/tools/qcollator_p.h +++ b/src/corelib/tools/qcollator_p.h @@ -104,19 +104,18 @@ public: CollatorType collator = 0; + QCollatorPrivate(const QLocale &locale) : locale(locale) {} + ~QCollatorPrivate() { cleanup(); } + void clear() { cleanup(); collator = 0; } + // Implemented by each back-end, in its own way: void init(); void cleanup(); - QCollatorPrivate() - { cleanup(); } - - ~QCollatorPrivate() { cleanup(); } - private: Q_DISABLE_COPY(QCollatorPrivate) }; |