diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-08-01 13:50:45 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-08-02 10:36:07 +0200 |
commit | 13fac4894f752e922727c6f22c6303712e06ba12 (patch) | |
tree | 5689829e917927bb13461d91988ec99e461f1831 /connectivity | |
parent | 13cadf3fe38daa0b4cfddcfa68ec8631bc85f44a (diff) |
normalize resource locale ctor construction mechanisms
make them all the same and share std::locales more
various OModuleClient, etc, classes go away
Change-Id: I7e3ff01a69332eeacd22e3078f66a60318de62d5
Reviewed-on: https://gerrit.libreoffice.org/40634
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/commontools/sqlerror.cxx | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/connectivity/source/commontools/sqlerror.cxx b/connectivity/source/commontools/sqlerror.cxx index a2fcf1103683..066719eb9963 100644 --- a/connectivity/source/commontools/sqlerror.cxx +++ b/connectivity/source/commontools/sqlerror.cxx @@ -78,28 +78,22 @@ namespace connectivity SQLException impl_buildSQLException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, const ParamValue& _rParamValue1, const ParamValue& _rParamValue2, const ParamValue& _rParamValue3 ); - - /// initializes our resource bundle - bool impl_initResources(); - private: ::osl::Mutex m_aMutex; - std::unique_ptr<std::locale> m_xResources; - bool m_bAttemptedInit; + std::locale m_aResources; }; - SQLError_Impl::SQLError_Impl() : m_bAttemptedInit( false ) + SQLError_Impl::SQLError_Impl() + : m_aResources(Translate::Create("cnr")) { } - const OUString& SQLError_Impl::getMessagePrefix() { static const OUString s_sMessagePrefix( "[OOoBase]" ); return s_sMessagePrefix; } - namespace { @@ -239,12 +233,9 @@ namespace connectivity { OUStringBuffer aMessage; - if ( impl_initResources() ) - { - OUString sResMessage(Translate::get(lcl_getResourceErrorID(_eCondition), *m_xResources)); - OSL_ENSURE( !sResMessage.isEmpty(), "SQLError_Impl::impl_getErrorMessage: illegal error condition, or invalid resource!" ); - aMessage.append( getMessagePrefix() ).append( " " ).append( sResMessage ); - } + OUString sResMessage(Translate::get(lcl_getResourceErrorID(_eCondition), m_aResources)); + OSL_ENSURE( !sResMessage.isEmpty(), "SQLError_Impl::impl_getErrorMessage: illegal error condition, or invalid resource!" ); + aMessage.append( getMessagePrefix() ).append( " " ).append( sResMessage ); return aMessage.makeStringAndClear(); } @@ -257,20 +248,6 @@ namespace connectivity return sState; } - bool SQLError_Impl::impl_initResources() - { - if (m_xResources.get()) - return true; - if (m_bAttemptedInit) - return false; - - ::osl::MutexGuard aGuard( m_aMutex ); - m_bAttemptedInit = true; - - m_xResources.reset(new std::locale(Translate::Create("cnr"))); - return m_xResources.get() != nullptr; - } - SQLError::SQLError() :m_pImpl( new SQLError_Impl ) { |