diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2023-02-26 20:37:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-02-27 05:43:11 +0000 |
commit | 09680fadbcd85da3405cefeed66712bc0ba2be9c (patch) | |
tree | 56e32ecc03bf9f4e3a484af5150bc58abeae3fb6 /include/unotools | |
parent | 44a3085f9aaf0dfc62b1a8f34d3b8889d69c4e62 (diff) |
no need to hold CollatorWrapper by std::unique_ptr
allocate it inline, it is only one pointer in size
Change-Id: Idb6217e6c9c37da92427aa6c497223a84015c553
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147742
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/unotools')
-rw-r--r-- | include/unotools/intlwrapper.hxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/include/unotools/intlwrapper.hxx b/include/unotools/intlwrapper.hxx index e86346a9552e..0c473cc4293f 100644 --- a/include/unotools/intlwrapper.hxx +++ b/include/unotools/intlwrapper.hxx @@ -21,14 +21,15 @@ #define INCLUDED_UNOTOOLS_INTLWRAPPER_HXX #include <unotools/unotoolsdllapi.h> +#include <unotools/collatorwrapper.hxx> #include <com/sun/star/uno/Reference.h> #include <i18nlangtag/languagetag.hxx> #include <memory> +#include <optional> namespace com::sun::star::uno { class XComponentContext; } -class CollatorWrapper; class LocaleDataWrapper; /** @@ -54,8 +55,8 @@ private: css::uno::Reference< css::uno::XComponentContext > m_xContext; std::unique_ptr<LocaleDataWrapper> pLocaleData; - std::unique_ptr<CollatorWrapper> pCollator; - std::unique_ptr<CollatorWrapper> pCaseCollator; + std::optional<CollatorWrapper> moCollator; + std::optional<CollatorWrapper> moCaseCollator; void ImplNewLocaleData() const; void ImplNewCollator( bool bCaseSensitive ) const; @@ -73,16 +74,16 @@ public: /// case insensitive collator, simple IGNORE_CASE const CollatorWrapper* getCollator() const { - if ( !pCollator ) + if ( !moCollator ) ImplNewCollator( false ); - return pCollator.get(); + return &*moCollator; } /// case sensitive collator const CollatorWrapper* getCaseCollator() const { - if ( !pCaseCollator ) + if ( !moCaseCollator ) ImplNewCollator( true ); - return pCaseCollator.get(); + return &*moCaseCollator; } }; |