From 9ad252b2e79576119c2d733a1a45fdd9e9f83140 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 21 Feb 2020 07:26:06 +0100 Subject: Drop o3tl::optional wrapper ...now that macOS builds are guaranteed to have std::optional since 358146bbbd1b9775c12770fb5e497b6ec5adfc51 "Bump macOS build baseline to Xcode 11.3 and macOS 10.14.4". The change is done mostly mechanically with > for i in $(git grep -Fl optional); do > sed -i -e 's:\|\"o3tl/optional\.hxx\"::' \ > -e 's/\/std::optional/g' \ > -e 's/\/std::make_optional/g' "$i" > done > for i in $(git grep -Flw o3tl::nullopt); do > sed -i -e 's/\/std::nullopt/g' "$i" > done (though that causes some of the resulting #include to appear at different places relative to other includes than if they had been added manually), plus a few manual modifications: * adapt bin/find-unneeded-includes * adapt desktop/IwyuFilter_desktop.yaml * remove include/o3tl/optional.hxx * quote resulting "<"/">" as "<"/">" in officecfg/registry/cppheader.xsl * and then solenv/clang-format/reformat-formatted-files Change-Id: I68833d9f7945e57aa2bc703349cbc5a56b342273 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89165 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- connectivity/inc/pch/precompiled_file.hxx | 2 +- connectivity/source/commontools/dbmetadata.cxx | 8 +++--- connectivity/source/commontools/sqlerror.cxx | 36 +++++++++++++------------- connectivity/source/inc/java/io/Reader.hxx | 4 +-- 4 files changed, 25 insertions(+), 25 deletions(-) (limited to 'connectivity') diff --git a/connectivity/inc/pch/precompiled_file.hxx b/connectivity/inc/pch/precompiled_file.hxx index 72acb30e6c62..d7919bf68fd6 100644 --- a/connectivity/inc/pch/precompiled_file.hxx +++ b/connectivity/inc/pch/precompiled_file.hxx @@ -181,7 +181,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx index cec1ec418f5c..f8afdcda692c 100644 --- a/connectivity/source/commontools/dbmetadata.cxx +++ b/connectivity/source/commontools/dbmetadata.cxx @@ -38,7 +38,7 @@ #include #include -#include +#include namespace dbtools @@ -71,8 +71,8 @@ namespace dbtools Reference< XDatabaseMetaData > xConnectionMetaData; ::connectivity::DriversConfig aDriverConfig; - ::o3tl::optional< OUString > sCachedIdentifierQuoteString; - ::o3tl::optional< OUString > sCachedCatalogSeparator; + ::std::optional< OUString > sCachedIdentifierQuoteString; + ::std::optional< OUString > sCachedCatalogSeparator; DatabaseMetaData_Impl() :xConnection() @@ -154,7 +154,7 @@ namespace dbtools const OUString& lcl_getConnectionStringSetting( - const DatabaseMetaData_Impl& _metaData, ::o3tl::optional< OUString >& _cachedSetting, + const DatabaseMetaData_Impl& _metaData, ::std::optional< OUString >& _cachedSetting, OUString (SAL_CALL XDatabaseMetaData::*_getter)() ) { if ( !_cachedSetting ) diff --git a/connectivity/source/commontools/sqlerror.cxx b/connectivity/source/commontools/sqlerror.cxx index db4c59f2f480..dee6f36f0b61 100644 --- a/connectivity/source/commontools/sqlerror.cxx +++ b/connectivity/source/commontools/sqlerror.cxx @@ -50,12 +50,12 @@ namespace connectivity // versions of the public SQLError methods which are just delegated to this impl-class static const OUString& getMessagePrefix(); - OUString getErrorMessage( const ErrorCondition _eCondition, const o3tl::optional& _rParamValue1, const o3tl::optional& _rParamValue2, const o3tl::optional& _rParamValue3 ); + OUString getErrorMessage( const ErrorCondition _eCondition, const std::optional& _rParamValue1, const std::optional& _rParamValue2, const std::optional& _rParamValue3 ); static ErrorCode getErrorCode( const ErrorCondition _eCondition ); - void raiseException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, const o3tl::optional& _rParamValue1, const o3tl::optional& _rParamValue2, const o3tl::optional& _rParamValue3 ); - void raiseException( const ErrorCondition _eCondition, const o3tl::optional& _rParamValue1, const o3tl::optional& _rParamValue2, const o3tl::optional& _rParamValue3 ); - void raiseTypedException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, const Type& _rExceptionType, const o3tl::optional& _rParamValue1, const o3tl::optional& _rParamValue2, const o3tl::optional& _rParamValue3 ); - SQLException getSQLException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, const o3tl::optional& _rParamValue1, const o3tl::optional& _rParamValue2, const o3tl::optional& _rParamValue3 ); + void raiseException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, const std::optional& _rParamValue1, const std::optional& _rParamValue2, const std::optional& _rParamValue3 ); + void raiseException( const ErrorCondition _eCondition, const std::optional& _rParamValue1, const std::optional& _rParamValue2, const std::optional& _rParamValue3 ); + void raiseTypedException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, const Type& _rExceptionType, const std::optional& _rParamValue1, const std::optional& _rParamValue2, const std::optional& _rParamValue3 ); + SQLException getSQLException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, const std::optional& _rParamValue1, const std::optional& _rParamValue2, const std::optional& _rParamValue3 ); private: /// returns the basic error message associated with the given error condition, without any parameter replacements @@ -69,7 +69,7 @@ namespace connectivity /// returns an SQLException describing the given error condition SQLException impl_buildSQLException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, - const o3tl::optional& _rParamValue1, const o3tl::optional& _rParamValue2, const o3tl::optional& _rParamValue3 ); + const std::optional& _rParamValue1, const std::optional& _rParamValue2, const std::optional& _rParamValue3 ); private: std::locale m_aResources; }; @@ -90,7 +90,7 @@ namespace connectivity /** substitutes a given placeholder in the given message with the given value */ - void lcl_substitutePlaceholder(OUString& _rMessage, const char* _pPlaceholder, const o3tl::optional& rParamValue) + void lcl_substitutePlaceholder(OUString& _rMessage, const char* _pPlaceholder, const std::optional& rParamValue) { size_t nPlaceholderLen( strlen( _pPlaceholder ) ); sal_Int32 nIndex = _rMessage.indexOfAsciiL( _pPlaceholder, nPlaceholderLen ); @@ -142,7 +142,7 @@ namespace connectivity } } - OUString SQLError_Impl::getErrorMessage( const ErrorCondition _eCondition, const o3tl::optional& _rParamValue1, const o3tl::optional& _rParamValue2, const o3tl::optional& _rParamValue3 ) + OUString SQLError_Impl::getErrorMessage( const ErrorCondition _eCondition, const std::optional& _rParamValue1, const std::optional& _rParamValue2, const std::optional& _rParamValue3 ) { OUString sErrorMessage( impl_getErrorMessage( _eCondition ) ); @@ -160,7 +160,7 @@ namespace connectivity } - void SQLError_Impl::raiseException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, const o3tl::optional& _rParamValue1, const o3tl::optional& _rParamValue2, const o3tl::optional& _rParamValue3 ) + void SQLError_Impl::raiseException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, const std::optional& _rParamValue1, const std::optional& _rParamValue2, const std::optional& _rParamValue3 ) { raiseTypedException( _eCondition, @@ -173,7 +173,7 @@ namespace connectivity } - void SQLError_Impl::raiseException( const ErrorCondition _eCondition, const o3tl::optional& _rParamValue1, const o3tl::optional& _rParamValue2, const o3tl::optional& _rParamValue3 ) + void SQLError_Impl::raiseException( const ErrorCondition _eCondition, const std::optional& _rParamValue1, const std::optional& _rParamValue2, const std::optional& _rParamValue3 ) { raiseTypedException( _eCondition, @@ -186,7 +186,7 @@ namespace connectivity } void SQLError_Impl::raiseTypedException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, - const Type& _rExceptionType, const o3tl::optional& _rParamValue1, const o3tl::optional& _rParamValue2, const o3tl::optional& _rParamValue3 ) + const Type& _rExceptionType, const std::optional& _rParamValue1, const std::optional& _rParamValue2, const std::optional& _rParamValue3 ) { if ( !::cppu::UnoType< SQLException >::get().isAssignableFrom( _rExceptionType ) ) throw std::bad_cast(); @@ -203,13 +203,13 @@ namespace connectivity } SQLException SQLError_Impl::getSQLException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, - const o3tl::optional& _rParamValue1, const o3tl::optional& _rParamValue2, const o3tl::optional& _rParamValue3 ) + const std::optional& _rParamValue1, const std::optional& _rParamValue2, const std::optional& _rParamValue3 ) { return impl_buildSQLException( _eCondition, _rxContext, _rParamValue1, _rParamValue2, _rParamValue3 ); } SQLException SQLError_Impl::impl_buildSQLException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, - const o3tl::optional& _rParamValue1, const o3tl::optional& _rParamValue2, const o3tl::optional& _rParamValue3 ) + const std::optional& _rParamValue1, const std::optional& _rParamValue2, const std::optional& _rParamValue3 ) { return SQLException( getErrorMessage( _eCondition, _rParamValue1, _rParamValue2, _rParamValue3 ), @@ -258,7 +258,7 @@ namespace connectivity OUString SQLError::getErrorMessage( const ErrorCondition _eCondition ) const { - return m_pImpl->getErrorMessage( _eCondition, o3tl::optional(), o3tl::optional(), o3tl::optional() ); + return m_pImpl->getErrorMessage( _eCondition, std::optional(), std::optional(), std::optional() ); } @@ -268,7 +268,7 @@ namespace connectivity } - void SQLError::raiseException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, const o3tl::optional& _rParamValue1, const o3tl::optional& _rParamValue2, const o3tl::optional& _rParamValue3 ) const + void SQLError::raiseException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, const std::optional& _rParamValue1, const std::optional& _rParamValue2, const std::optional& _rParamValue3 ) const { m_pImpl->raiseException( _eCondition, _rxContext, _rParamValue1, _rParamValue2, _rParamValue3 ); } @@ -276,19 +276,19 @@ namespace connectivity void SQLError::raiseException( const ErrorCondition _eCondition ) const { - m_pImpl->raiseException( _eCondition, o3tl::optional(), o3tl::optional(), o3tl::optional() ); + m_pImpl->raiseException( _eCondition, std::optional(), std::optional(), std::optional() ); } void SQLError::raiseTypedException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, const Type& _rExceptionType ) const { - m_pImpl->raiseTypedException( _eCondition, _rxContext, _rExceptionType, o3tl::optional(), o3tl::optional(), o3tl::optional() ); + m_pImpl->raiseTypedException( _eCondition, _rxContext, _rExceptionType, std::optional(), std::optional(), std::optional() ); } SQLException SQLError::getSQLException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, - const o3tl::optional& _rParamValue1, const o3tl::optional& _rParamValue2, const o3tl::optional& _rParamValue3 ) const + const std::optional& _rParamValue1, const std::optional& _rParamValue2, const std::optional& _rParamValue3 ) const { return m_pImpl->getSQLException( _eCondition, _rxContext, _rParamValue1, _rParamValue2, _rParamValue3 ); } diff --git a/connectivity/source/inc/java/io/Reader.hxx b/connectivity/source/inc/java/io/Reader.hxx index 45d67bbd9b11..7a2cf0524483 100644 --- a/connectivity/source/inc/java/io/Reader.hxx +++ b/connectivity/source/inc/java/io/Reader.hxx @@ -23,7 +23,7 @@ #include #include #include -#include +#include namespace connectivity { @@ -36,7 +36,7 @@ namespace connectivity // static Data for the Class static jclass theClass; virtual ~java_io_Reader() override; - o3tl::optional m_buf; + std::optional m_buf; public: virtual jclass getMyClass() const override; // a Constructor, that is needed for when Returning the Object is needed: -- cgit