diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-02-21 07:26:06 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-02-21 14:50:28 +0100 |
commit | 9ad252b2e79576119c2d733a1a45fdd9e9f83140 (patch) | |
tree | 87fee16145d457b6799a05c389d85270476f7f35 /include/comphelper | |
parent | 3aca35f1505fa552eaa316a2d47a60ef52646525 (diff) |
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>\|\"o3tl/optional\.hxx\":<optional>:' \
> -e 's/\<o3tl::optional\>/std::optional/g' \
> -e 's/\<o3tl::make_optional\>/std::make_optional/g' "$i"
> done
> for i in $(git grep -Flw o3tl::nullopt); do
> sed -i -e 's/\<o3tl::nullopt\>/std::nullopt/g' "$i"
> done
(though that causes some of the resulting
#include <optional>
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 <sbergman@redhat.com>
Diffstat (limited to 'include/comphelper')
-rw-r--r-- | include/comphelper/configuration.hxx | 18 | ||||
-rw-r--r-- | include/comphelper/logging.hxx | 4 | ||||
-rw-r--r-- | include/comphelper/unwrapargs.hxx | 6 |
3 files changed, 14 insertions, 14 deletions
diff --git a/include/comphelper/configuration.hxx b/include/comphelper/configuration.hxx index 7c2a0a7fb4ec..de65a7ad3f1e 100644 --- a/include/comphelper/configuration.hxx +++ b/include/comphelper/configuration.hxx @@ -12,7 +12,7 @@ #include <sal/config.h> -#include <o3tl/optional.hxx> +#include <optional> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Reference.h> #include <comphelper/comphelperdllapi.h> @@ -158,18 +158,18 @@ private: }; /// @internal -template< typename T > struct Convert< o3tl::optional< T > > +template< typename T > struct Convert< std::optional< T > > { - static css::uno::Any toAny(o3tl::optional< T > const & value) { + static css::uno::Any toAny(std::optional< T > const & value) { return value ? css::uno::makeAny(*value) : css::uno::Any(); } - static o3tl::optional< T > fromAny(css::uno::Any const & value) + static std::optional< T > fromAny(css::uno::Any const & value) { return value.hasValue() - ? o3tl::optional< T >(value.get< T >()) : o3tl::optional< T >(); + ? std::optional< T >(value.get< T >()) : std::optional< T >(); } private: @@ -200,7 +200,7 @@ template< typename T, typename U > struct ConfigurationProperty /// Get the value of the given (non-localized) configuration property. /// - /// For nillable properties, U is of type o3tl::optional<U'>. + /// For nillable properties, U is of type std::optional<U'>. static U get( css::uno::Reference< css::uno::XComponentContext > const & context = comphelper::getProcessComponentContext()) @@ -216,7 +216,7 @@ template< typename T, typename U > struct ConfigurationProperty /// Set the value of the given (non-localized) configuration property, via a /// given changes batch. /// - /// For nillable properties, U is of type o3tl::optional<U'>. + /// For nillable properties, U is of type std::optional<U'>. static void set( U const & value, std::shared_ptr< ConfigurationChanges > const & batch) @@ -244,7 +244,7 @@ template< typename T, typename U > struct ConfigurationLocalizedProperty /// locale currently set at the /// com.sun.star.configuration.theDefaultProvider. /// - /// For nillable properties, U is of type o3tl::optional<U'>. + /// For nillable properties, U is of type std::optional<U'>. static U get(css::uno::Reference< css::uno::XComponentContext > const & context) { // Folding this into one statement causes a bogus error at least with @@ -260,7 +260,7 @@ template< typename T, typename U > struct ConfigurationLocalizedProperty /// com.sun.star.configuration.theDefaultProvider, via a given changes /// batch. /// - /// For nillable properties, U is of type o3tl::optional<U'>. + /// For nillable properties, U is of type std::optional<U'>. static void set( U const & value, std::shared_ptr< ConfigurationChanges > const & batch) diff --git a/include/comphelper/logging.hxx b/include/comphelper/logging.hxx index 7719e86da201..d7bd806c8f84 100644 --- a/include/comphelper/logging.hxx +++ b/include/comphelper/logging.hxx @@ -23,7 +23,7 @@ #include <comphelper/comphelperdllapi.h> #include <rtl/ustring.hxx> -#include <o3tl/optional.hxx> +#include <optional> #include <memory> namespace com::sun::star::uno { template <class interface_type> class Reference; } @@ -65,7 +65,7 @@ namespace comphelper //= EventLogger class EventLogger_Impl; - typedef ::o3tl::optional< OUString > OptionalString; + typedef ::std::optional< OUString > OptionalString; /** encapsulates a css::logging::XLogger diff --git a/include/comphelper/unwrapargs.hxx b/include/comphelper/unwrapargs.hxx index 3ba4e213c266..041c69da1818 100644 --- a/include/comphelper/unwrapargs.hxx +++ b/include/comphelper/unwrapargs.hxx @@ -22,7 +22,7 @@ #include <sal/config.h> -#include <o3tl/optional.hxx> +#include <optional> #include <rtl/ustrbuf.hxx> #include <com/sun/star/uno/Sequence.hxx> @@ -67,7 +67,7 @@ namespace detail { template< typename T, typename... Args > inline void unwrapArgs( const css::uno::Sequence< css::uno::Any >& seq, - sal_Int32 nArg, ::o3tl::optional< T >& v, Args&... args ); + sal_Int32 nArg, ::std::optional< T >& v, Args&... args ); template< typename T, typename... Args > inline void unwrapArgs( @@ -95,7 +95,7 @@ namespace detail { template< typename T, typename... Args > inline void unwrapArgs( const css::uno::Sequence< css::uno::Any >& seq, - sal_Int32 nArg, ::o3tl::optional< T >& v, Args&... args ) + sal_Int32 nArg, ::std::optional< T >& v, Args&... args ) { if( nArg < seq.getLength() ) { |