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 | |
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')
34 files changed, 125 insertions, 171 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() ) { diff --git a/include/connectivity/sqlerror.hxx b/include/connectivity/sqlerror.hxx index b10d8ae570b6..252fe479e566 100644 --- a/include/connectivity/sqlerror.hxx +++ b/include/connectivity/sqlerror.hxx @@ -22,7 +22,7 @@ #include <com/sun/star/sdbc/SQLException.hpp> #include <connectivity/dbtoolsdllapi.hxx> -#include <o3tl/optional.hxx> +#include <optional> #include <memory> namespace connectivity @@ -138,9 +138,9 @@ namespace connectivity void raiseException( const ErrorCondition _eCondition, const css::uno::Reference< css::uno::XInterface >& _rxContext, - const o3tl::optional<OUString>& _rParamValue1 = o3tl::nullopt, - const o3tl::optional<OUString>& _rParamValue2 = o3tl::nullopt, - const o3tl::optional<OUString>& _rParamValue3 = o3tl::nullopt + const std::optional<OUString>& _rParamValue1 = std::nullopt, + const std::optional<OUString>& _rParamValue2 = std::nullopt, + const std::optional<OUString>& _rParamValue3 = std::nullopt ) const; /** throws an SQLException describing the given error condition @@ -221,9 +221,9 @@ namespace connectivity getSQLException( const ErrorCondition _eCondition, const css::uno::Reference< css::uno::XInterface >& _rxContext, - const o3tl::optional<OUString>& _rParamValue1 = o3tl::nullopt, - const o3tl::optional<OUString>& _rParamValue2 = o3tl::nullopt, - const o3tl::optional<OUString>& _rParamValue3 = o3tl::nullopt + const std::optional<OUString>& _rParamValue1 = std::nullopt, + const std::optional<OUString>& _rParamValue2 = std::nullopt, + const std::optional<OUString>& _rParamValue3 = std::nullopt ) const; private: diff --git a/include/cppcanvas/renderer.hxx b/include/cppcanvas/renderer.hxx index ed1dc04a11f7..d71be2f09e89 100644 --- a/include/cppcanvas/renderer.hxx +++ b/include/cppcanvas/renderer.hxx @@ -22,7 +22,7 @@ #include <sal/types.h> #include <rtl/ustring.hxx> -#include <o3tl/optional.hxx> +#include <optional> #include <basegfx/matrix/b2dhommatrix.hxx> #include <cppcanvas/canvasgraphic.hxx> #include <cppcanvas/color.hxx> @@ -100,16 +100,16 @@ namespace cppcanvas struct Parameters { /// Optionally forces the fill color attribute for all actions - ::o3tl::optional< IntSRGBA > maFillColor; + ::std::optional< IntSRGBA > maFillColor; /// Optionally forces the line color attribute for all actions - ::o3tl::optional< IntSRGBA > maLineColor; + ::std::optional< IntSRGBA > maLineColor; /// Optionally forces the text color attribute for all actions - ::o3tl::optional< IntSRGBA > maTextColor; + ::std::optional< IntSRGBA > maTextColor; /// Optionally forces the given fontname for all text actions - ::o3tl::optional< OUString > maFontName; + ::std::optional< OUString > maFontName; /** Optionally transforms all text output actions with the given matrix (in addition to the overall canvas @@ -119,16 +119,16 @@ namespace cppcanvas rect coordinate system, i.e. the metafile is assumed to be contained in the unit rect. */ - ::o3tl::optional< ::basegfx::B2DHomMatrix > maTextTransformation; + ::std::optional< ::basegfx::B2DHomMatrix > maTextTransformation; /// Optionally forces the given font weight for all text actions - ::o3tl::optional< sal_Int8 > maFontWeight; + ::std::optional< sal_Int8 > maFontWeight; /// Optionally forces the given font letter form (italics etc.) for all text actions - ::o3tl::optional< sal_Int8 > maFontLetterForm; + ::std::optional< sal_Int8 > maFontLetterForm; /// Optionally forces underlining for all text actions - ::o3tl::optional< bool > maFontUnderline; + ::std::optional< bool > maFontUnderline; }; }; diff --git a/include/dbaccess/genericcontroller.hxx b/include/dbaccess/genericcontroller.hxx index 60c75236475f..805131548f28 100644 --- a/include/dbaccess/genericcontroller.hxx +++ b/include/dbaccess/genericcontroller.hxx @@ -27,7 +27,7 @@ #include <memory> #include <vector> -#include <o3tl/optional.hxx> +#include <optional> #include <com/sun/star/awt/XUserInputInterception.hpp> #include <com/sun/star/frame/CommandGroup.hpp> @@ -94,7 +94,7 @@ namespace dbaui class ODataView; template< typename T > - inline bool SAL_CALL operator >>= (const css::uno::Any& _any, o3tl::optional< T >& _value) + inline bool SAL_CALL operator >>= (const css::uno::Any& _any, std::optional< T >& _value) { _value.reset(); // de-init the optional value @@ -118,10 +118,10 @@ namespace dbaui { bool bEnabled; - o3tl::optional<bool> bChecked; - o3tl::optional<bool> bInvisible; + std::optional<bool> bChecked; + std::optional<bool> bInvisible; css::uno::Any aValue; - o3tl::optional<OUString> sTitle; + std::optional<OUString> sTitle; FeatureState() : bEnabled(false) { } }; diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index 01dcffe10022..5f45dd1fbf29 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -23,7 +23,7 @@ #include <memory> #include <vector> -#include <o3tl/optional.hxx> +#include <optional> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/i18n/WordType.hpp> @@ -506,7 +506,7 @@ public: virtual OUString GetUndoComment( sal_uInt16 nUndoId ) const; virtual bool SpellNextDocument(); virtual void FieldClicked( const SvxFieldItem& rField ); - virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rTxtColor, o3tl::optional<Color>& rFldColor ); + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor ); // override this if access to bullet information needs to be provided virtual const SvxNumberFormat * GetNumberFormat( sal_Int32 nPara ) const; diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 2f6cc2d9abf3..991a5e3ba58f 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -40,7 +40,7 @@ #include <editeng/paragraphdata.hxx> #include <o3tl/typed_flags_set.hxx> -#include <o3tl/optional.hxx> +#include <optional> #include <functional> #include <memory> #include <vector> @@ -484,8 +484,8 @@ private: Outliner* pOutliner; const SvxFieldItem& rFldItem; - o3tl::optional<Color> mxTxtColor; - o3tl::optional<Color> mxFldColor; + std::optional<Color> mxTxtColor; + std::optional<Color> mxFldColor; OUString aRepresentation; @@ -509,11 +509,11 @@ public: const SvxFieldItem& GetField() const { return rFldItem; } - o3tl::optional<Color> const & GetTextColor() const { return mxTxtColor; } - void SetTextColor( o3tl::optional<Color> xCol ) { mxTxtColor = xCol; } + std::optional<Color> const & GetTextColor() const { return mxTxtColor; } + void SetTextColor( std::optional<Color> xCol ) { mxTxtColor = xCol; } - o3tl::optional<Color> const & GetFieldColor() const { return mxFldColor; } - void SetFieldColor( o3tl::optional<Color> xCol ) { mxFldColor = xCol; } + std::optional<Color> const & GetFieldColor() const { return mxFldColor; } + void SetFieldColor( std::optional<Color> xCol ) { mxFldColor = xCol; } sal_Int32 GetPara() const { return nPara; } sal_Int32 GetPos() const { return nPos; } @@ -880,7 +880,7 @@ public: bool UpdateFields(); void RemoveFields( const std::function<bool ( const SvxFieldData* )>& isFieldData = [] (const SvxFieldData* ){return true;} ); - virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rTxtColor, o3tl::optional<Color>& rFldColor ); + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor ); void SetSpeller( css::uno::Reference< css::linguistic2::XSpellChecker1 > const &xSpeller ); css::uno::Reference< css::linguistic2::XSpellChecker1 > const & diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx index e0624aaaf8f0..df6a3214792b 100644 --- a/include/editeng/svxacorr.hxx +++ b/include/editeng/svxacorr.hxx @@ -28,7 +28,7 @@ #include <editeng/swafopt.hxx> #include <editeng/editengdllapi.h> -#include <o3tl/optional.hxx> +#include <optional> #include <map> #include <memory> @@ -155,7 +155,7 @@ public: ~SvxAutocorrWordList(); void DeleteAndDestroyAll(); const SvxAutocorrWord* Insert(SvxAutocorrWord aWord) const; - o3tl::optional<SvxAutocorrWord> FindAndRemove(const SvxAutocorrWord *pWord); + std::optional<SvxAutocorrWord> FindAndRemove(const SvxAutocorrWord *pWord); void LoadEntry(const OUString& sWrong, const OUString& sRight, bool bOnlyTxt); bool empty() const; diff --git a/include/editeng/unoedprx.hxx b/include/editeng/unoedprx.hxx index a3aa0b915cc3..59d83c38c8bd 100644 --- a/include/editeng/unoedprx.hxx +++ b/include/editeng/unoedprx.hxx @@ -54,7 +54,7 @@ public: virtual SfxItemPool* GetPool() const override; - virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rpTxtColor, o3tl::optional<Color>& rpFldColor ) override; + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) override; virtual void FieldClicked( const SvxFieldItem& rField ) override; virtual bool IsValid() const override; diff --git a/include/editeng/unoedsrc.hxx b/include/editeng/unoedsrc.hxx index ab8a567d78d2..44d8944bc442 100644 --- a/include/editeng/unoedsrc.hxx +++ b/include/editeng/unoedsrc.hxx @@ -159,7 +159,7 @@ public: virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) = 0; virtual void QuickInsertLineBreak( const ESelection& rSel ) = 0; - virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rpTxtColor, o3tl::optional<Color>& rpFldColor ) = 0; + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) = 0; virtual void FieldClicked( const SvxFieldItem& rField ) = 0; virtual SfxItemPool* GetPool() const = 0; diff --git a/include/editeng/unofored.hxx b/include/editeng/unofored.hxx index a0cf70caf5f8..989b5c36511d 100644 --- a/include/editeng/unofored.hxx +++ b/include/editeng/unofored.hxx @@ -54,7 +54,7 @@ public: virtual SfxItemPool* GetPool() const override; - virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rpTxtColor, o3tl::optional<Color>& rpFldColor ) override; + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) override; virtual void FieldClicked( const SvxFieldItem& rField ) override; virtual bool IsValid() const override; diff --git a/include/editeng/unoforou.hxx b/include/editeng/unoforou.hxx index 17029f9ca85c..4695077fa7c7 100644 --- a/include/editeng/unoforou.hxx +++ b/include/editeng/unoforou.hxx @@ -72,7 +72,7 @@ public: virtual SfxItemPool* GetPool() const override; - virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rpTxtColor, o3tl::optional<Color>& rpFldColor ) override; + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) override; virtual void FieldClicked( const SvxFieldItem& rField ) override; virtual bool IsValid() const override; diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx index 6dbcea427e8e..f85c6c657efb 100644 --- a/include/editeng/unotext.hxx +++ b/include/editeng/unotext.hxx @@ -190,7 +190,7 @@ public: virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) override; virtual void QuickInsertLineBreak( const ESelection& rSel ) override; - virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rpTxtColor, o3tl::optional<Color>& rpFldColor ) override; + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) override; virtual void FieldClicked( const SvxFieldItem& rField ) override; virtual bool IsValid() const override; diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx index 48feab870805..2af6fdfa4682 100644 --- a/include/filter/msfilter/msdffimp.hxx +++ b/include/filter/msfilter/msdffimp.hxx @@ -28,7 +28,7 @@ #include <vector> #include <unordered_map> -#include <o3tl/optional.hxx> +#include <optional> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Reference.hxx> #include <comphelper/stl_types.hxx> @@ -226,9 +226,9 @@ struct MSFILTER_DLLPUBLIC SvxMSDffImportRec pClientDataBuffer; sal_uInt32 nClientDataLen; sal_uInt32 nXAlign; - o3tl::optional<sal_uInt32> nXRelTo; + std::optional<sal_uInt32> nXRelTo; sal_uInt32 nYAlign; - o3tl::optional<sal_uInt32> nYRelTo; + std::optional<sal_uInt32> nYRelTo; sal_uInt32 nLayoutInTableCell; ShapeFlag nFlags; sal_Int32 nDxTextLeft; ///< distance of text box from surrounding shape diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx index ec50015bb191..9ee6944f1138 100644 --- a/include/filter/msfilter/svdfppt.hxx +++ b/include/filter/msfilter/svdfppt.hxx @@ -25,7 +25,7 @@ #include <memory> #include <vector> -#include <o3tl/optional.hxx> +#include <optional> #include <com/sun/star/uno/Reference.hxx> #include <editeng/eeitem.hxx> @@ -491,7 +491,7 @@ struct MSFILTER_DLLPUBLIC PPTFieldEntry sal_uInt16 nTextRangeEnd; std::unique_ptr<SvxFieldItem> xField1; std::unique_ptr<SvxFieldItem> xField2; - o3tl::optional<OUString> xString; + std::optional<OUString> xString; PPTFieldEntry() : nPos(0) @@ -813,7 +813,7 @@ class PPTNumberFormatCreator sal_uInt32 nLevel, TSS_Type nInstance, TSS_Type nInstanceInSheet, - o3tl::optional< sal_Int16 >& rStartNumbering, + std::optional< sal_Int16 >& rStartNumbering, sal_uInt32 nFontHeight, PPTParagraphObj const * pPara ); @@ -841,7 +841,7 @@ public: SvxNumberFormat& rNumberFormat, PPTParagraphObj* pPara, TSS_Type nInstanceInSheet, - o3tl::optional< sal_Int16 >& rStartNumbering + std::optional< sal_Int16 >& rStartNumbering ); }; @@ -1177,7 +1177,7 @@ public: void AppendPortion( PPTPortionObj& rPortion ); void ApplyTo( SfxItemSet& rSet, - o3tl::optional< sal_Int16 >& rStartNumbering, + std::optional< sal_Int16 >& rStartNumbering, SdrPowerPointImport const & rManager, TSS_Type nInstanceInSheet ); diff --git a/include/o3tl/any.hxx b/include/o3tl/any.hxx index b4d9e5272fc5..0acccff6439f 100644 --- a/include/o3tl/any.hxx +++ b/include/o3tl/any.hxx @@ -16,7 +16,7 @@ #include <type_traits> #include <utility> -#include <o3tl/optional.hxx> +#include <optional> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/RuntimeException.hpp> @@ -36,37 +36,37 @@ namespace detail { struct Void {}; template<typename T> struct Optional { using type = T const *; }; -template<> struct Optional<void> { using type = o3tl::optional<Void const>; }; -template<> struct Optional<bool> { using type = o3tl::optional<bool const>; }; +template<> struct Optional<void> { using type = std::optional<Void const>; }; +template<> struct Optional<bool> { using type = std::optional<bool const>; }; template<> struct Optional<sal_Int8> { - using type = o3tl::optional<sal_Int8 const>; + using type = std::optional<sal_Int8 const>; }; template<> struct Optional<sal_Int16> { - using type = o3tl::optional<sal_Int16 const>; + using type = std::optional<sal_Int16 const>; }; template<> struct Optional<sal_uInt16> { - using type = o3tl::optional<sal_uInt16 const>; + using type = std::optional<sal_uInt16 const>; }; template<> struct Optional<sal_Int32> { - using type = o3tl::optional<sal_Int32 const>; + using type = std::optional<sal_Int32 const>; }; template<> struct Optional<sal_uInt32> { - using type = o3tl::optional<sal_uInt32 const>; + using type = std::optional<sal_uInt32 const>; }; template<> struct Optional<sal_Int64> { - using type = o3tl::optional<sal_Int64 const>; + using type = std::optional<sal_Int64 const>; }; template<> struct Optional<sal_uInt64> { - using type = o3tl::optional<sal_uInt64 const>; + using type = std::optional<sal_uInt64 const>; }; template<> struct Optional<float> { - using type = o3tl::optional<float const>; + using type = std::optional<float const>; }; template<> struct Optional<double> { - using type = o3tl::optional<double const>; + using type = std::optional<double const>; }; template<typename T> struct Optional<css::uno::Reference<T>> { - using type = o3tl::optional<css::uno::Reference<T> const>; + using type = std::optional<css::uno::Reference<T> const>; }; template<> struct Optional<css::uno::Reference<css::uno::XInterface>> { using type = css::uno::Reference<css::uno::XInterface> const *; @@ -85,12 +85,12 @@ template<typename T> struct IsUnoSequenceType<cppu::UnoSequenceType<T>>: std::true_type {}; -template<typename T> inline o3tl::optional<T const> tryGetConverted( +template<typename T> inline std::optional<T const> tryGetConverted( css::uno::Any const & any) { T v; return (any >>= v) - ? o3tl::optional<T const>(std::move(v)) : o3tl::optional<T const>(); + ? std::optional<T const>(std::move(v)) : std::optional<T const>(); } } @@ -105,7 +105,7 @@ template<typename T> inline o3tl::optional<T const> tryGetConverted( proxy is positive. For a positive proxy P representing a value of requested type T, for any T other than void, the expression *P yields that value of type T. (Technically, the proxy is either a plain pointer or a - o3tl::optional, depending on whether a plain pointer into the given Any can + std::optional, depending on whether a plain pointer into the given Any can be returned for the specified type.) @attention A proxy returned from this function must not outlive the @@ -124,7 +124,7 @@ template<typename T> inline o3tl::optional<T const> tryGetConverted( @note Ideally this would be a public member function of css::uno::Any (at least conditional on LIBO_INTERNAL_ONLY, as it requires C++11). However, as std::optional (which would be needed to implement the proxies) is only - available since C++14, we need to use o3tl::optional for now. But To not + available since C++14, we need to use std::optional for now. But To not make every entity that includes <com/sun/star/uno/Any.hxx> depend on boost_headers, keep this here for now. @@ -156,8 +156,8 @@ template<> inline detail::Optional<void>::type tryAccess<void>( css::uno::Any const & any) { return any.hasValue() - ? o3tl::optional<detail::Void const>() - : o3tl::optional<detail::Void const>(detail::Void()); + ? std::optional<detail::Void const>() + : std::optional<detail::Void const>(detail::Void()); } template<> inline detail::Optional<bool>::type tryAccess<bool>( diff --git a/include/o3tl/optional.hxx b/include/o3tl/optional.hxx deleted file mode 100644 index 524818230e3e..000000000000 --- a/include/o3tl/optional.hxx +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -// A wrapper selecting either std::optional or boost::optional as a fallback for Xcode < 10. To be -// removed once std::optional is available everywhere. - -#ifndef INCLUDED_O3TL_OPTIONAL_HXX -#define INCLUDED_O3TL_OPTIONAL_HXX - -#include <sal/config.h> - -#if defined __APPLE__ && !__has_include(<optional>) - -#include <boost/none.hpp> -#include <boost/optional.hpp> - -namespace o3tl -{ -using boost::make_optional; -using boost::optional; - -inline auto const nullopt = boost::none; -} - -#else - -#include <optional> - -namespace o3tl -{ -using std::make_optional; -using std::nullopt; -using std::optional; -} - -#endif - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx index 168116b9db84..412b2d049c34 100644 --- a/include/oox/helper/helper.hxx +++ b/include/oox/helper/helper.hxx @@ -169,7 +169,7 @@ inline void setFlag( Type& ornBitField, Type nMask, bool bSet = true ) } -/** Optional value, similar to ::o3tl::optional<>, with convenience accessors. +/** Optional value, similar to ::std::optional<>, with convenience accessors. */ template< typename Type > class OptValue diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx index 42b769706da0..bb1e66e25ec0 100644 --- a/include/sax/tools/converter.hxx +++ b/include/sax/tools/converter.hxx @@ -22,7 +22,7 @@ #include <sal/config.h> -#include <o3tl/optional.hxx> +#include <optional> #include <sax/saxdllapi.h> @@ -196,7 +196,7 @@ public: css::util::Date * pDate, css::util::DateTime & rDateTime, bool & rbDateTime, - o3tl::optional<sal_Int16> * pTimeZoneOffset, + std::optional<sal_Int16> * pTimeZoneOffset, const OUString & rString ); /** gets the position of the first comma after npos in the string diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx index 6cc71e319cda..2501e44903bd 100644 --- a/include/sfx2/dinfdlg.hxx +++ b/include/sfx2/dinfdlg.hxx @@ -34,7 +34,7 @@ #include <sfx2/tabdlg.hxx> -#include <o3tl/optional.hxx> +#include <optional> #include <memory> namespace com::sun::star::beans { struct PropertyValue; } @@ -238,7 +238,7 @@ class CustomPropertiesDateField private: std::unique_ptr<SvtCalendarBox> m_xDateField; public: - ::o3tl::optional<sal_Int16> m_TZ; + ::std::optional<sal_Int16> m_TZ; CustomPropertiesDateField(SvtCalendarBox* pDateField); void set_visible(bool bVisible); diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index 3689b0086b58..c05920f548ac 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -17,7 +17,7 @@ #include <sfx2/viewsh.hxx> #include <cstddef> #include <rtl/string.hxx> -#include <o3tl/optional.hxx> +#include <optional> struct SFX2_DLLPUBLIC LokMouseEventData { @@ -27,7 +27,7 @@ struct SFX2_DLLPUBLIC LokMouseEventData MouseEventModifiers meModifiers; int mnButtons; int mnModifier; - o3tl::optional<Point> maLogicPosition; + std::optional<Point> maLogicPosition; LokMouseEventData(int nType, Point aPosition, int nCount, MouseEventModifiers eModifiers, int nButtons, int nModifier) : mnType(nType) diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx index 66959b8a0d50..b9fa004f7db2 100644 --- a/include/sfx2/sidebar/SidebarController.hxx +++ b/include/sfx2/sidebar/SidebarController.hxx @@ -36,7 +36,7 @@ #include <com/sun/star/ui/XContextChangeEventListener.hpp> #include <com/sun/star/ui/XSidebar.hpp> -#include <o3tl/optional.hxx> +#include <optional> #include <cppuhelper/compbase.hxx> #include <cppuhelper/basemutex.hxx> @@ -197,8 +197,8 @@ private: mbIsDeckRequestedOpen. Normally both flags have the same value. A document being read-only can prevent the deck from opening. */ - ::o3tl::optional<bool> mbIsDeckRequestedOpen; - ::o3tl::optional<bool> mbIsDeckOpen; + ::std::optional<bool> mbIsDeckRequestedOpen; + ::std::optional<bool> mbIsDeckOpen; bool mbFloatingDeckClosed; diff --git a/include/svx/svdomeas.hxx b/include/svx/svdomeas.hxx index 84a31fb3bb6e..18a0fb47596e 100644 --- a/include/svx/svdomeas.hxx +++ b/include/svx/svdomeas.hxx @@ -140,7 +140,7 @@ public: virtual OutlinerParaObject* GetOutlinerParaObject() const override; virtual bool CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos, - bool bEdit, o3tl::optional<Color>& rpTxtColor, o3tl::optional<Color>& rpFldColor, OUString& rRet) const override; + bool bEdit, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, OUString& rRet) const override; // #i97878# virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const override; diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx index 6e60f20c9b1c..3e4782416e47 100644 --- a/include/svx/svdotext.hxx +++ b/include/svx/svdotext.hxx @@ -498,7 +498,7 @@ public: virtual void NbcReformatText() override; virtual bool CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos, - bool bEdit, o3tl::optional<Color>& rpTxtColor, o3tl::optional<Color>& rpFldColor, OUString& rRet) const; + bool bEdit, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, OUString& rRet) const; virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override; diff --git a/include/svx/svdoutl.hxx b/include/svx/svdoutl.hxx index 0e1ee7f3dd4f..767d8231862b 100644 --- a/include/svx/svdoutl.hxx +++ b/include/svx/svdoutl.hxx @@ -43,7 +43,7 @@ public: void setVisualizedPage(const SdrPage* pPage) { if(pPage != mpVisualizedPage) mpVisualizedPage = pPage; } const SdrPage* getVisualizedPage() const { return mpVisualizedPage; } - virtual OUString CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rpTxtColor, o3tl::optional<Color>& rpFldColor) override; + virtual OUString CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor) override; bool hasEditViewCallbacks() const; }; diff --git a/include/toolkit/controls/unocontrols.hxx b/include/toolkit/controls/unocontrols.hxx index 683c6f1901e3..4c8f696d2c3c 100644 --- a/include/toolkit/controls/unocontrols.hxx +++ b/include/toolkit/controls/unocontrols.hxx @@ -54,7 +54,7 @@ #include <memory> #include <vector> -#include <o3tl/optional.hxx> +#include <optional> namespace com { namespace sun { namespace star { namespace graphic { class XGraphic; } } } } namespace com { namespace sun { namespace star { namespace graphic { class XGraphicObject; } } } } @@ -784,15 +784,15 @@ protected: private: void impl_notifyItemListEvent_nolck( const sal_Int32 i_nItemPosition, - const ::o3tl::optional< OUString >& i_rItemText, - const ::o3tl::optional< OUString >& i_rItemImageURL, + const ::std::optional< OUString >& i_rItemText, + const ::std::optional< OUString >& i_rItemImageURL, void ( SAL_CALL css::awt::XItemListListener::*NotificationMethod )( const css::awt::ItemListEvent& ) ); void impl_handleInsert( const sal_Int32 i_nItemPosition, - const ::o3tl::optional< OUString >& i_rItemText, - const ::o3tl::optional< OUString >& i_rItemImageURL, + const ::std::optional< OUString >& i_rItemText, + const ::std::optional< OUString >& i_rItemImageURL, ::osl::ClearableMutexGuard& i_rClearBeforeNotify ); @@ -803,8 +803,8 @@ private: void impl_handleModify( const sal_Int32 i_nItemPosition, - const ::o3tl::optional< OUString >& i_rItemText, - const ::o3tl::optional< OUString >& i_rItemImageURL, + const ::std::optional< OUString >& i_rItemText, + const ::std::optional< OUString >& i_rItemImageURL, ::osl::ClearableMutexGuard& i_rClearBeforeNotify ); diff --git a/include/unotools/historyoptions.hxx b/include/unotools/historyoptions.hxx index b723dc9326b7..fd852dde0d24 100644 --- a/include/unotools/historyoptions.hxx +++ b/include/unotools/historyoptions.hxx @@ -27,7 +27,7 @@ #include <unotools/options.hxx> #include <memory> -#include <o3tl/optional.hxx> +#include <optional> namespace com { namespace sun { namespace star { namespace beans { struct PropertyValue; } } } } @@ -86,7 +86,7 @@ public: */ void AppendItem(EHistoryType eHistory, const OUString& sURL, const OUString& sFilter, const OUString& sTitle, - const o3tl::optional<OUString>& sThumbnail); + const std::optional<OUString>& sThumbnail); /** Delete item from the specified list. */ diff --git a/include/vcl/event.hxx b/include/vcl/event.hxx index 900838d11b5c..177442cb474b 100644 --- a/include/vcl/event.hxx +++ b/include/vcl/event.hxx @@ -27,7 +27,7 @@ #include <vcl/vclptr.hxx> #include <vcl/outdev.hxx> #include <vcl/window.hxx> -#include <o3tl/optional.hxx> +#include <optional> class CommandEvent; @@ -109,7 +109,7 @@ private: sal_uInt16 mnCode; // Set, if the document relative logic position are available - o3tl::optional<Point> maLogicPosition; + std::optional<Point> maLogicPosition; public: explicit MouseEvent(); @@ -127,7 +127,7 @@ public: maLogicPosition = aLogicPosition; } - o3tl::optional<Point> getLogicPosition() const + std::optional<Point> getLogicPosition() const { return maLogicPosition; } diff --git a/include/vcl/fontcapabilities.hxx b/include/vcl/fontcapabilities.hxx index 539dd2710d0c..9698be7a535e 100644 --- a/include/vcl/fontcapabilities.hxx +++ b/include/vcl/fontcapabilities.hxx @@ -10,7 +10,7 @@ #ifndef INCLUDED_VCL_FONTCAPABILITIES_HXX #define INCLUDED_VCL_FONTCAPABILITIES_HXX -#include <o3tl/optional.hxx> +#include <optional> #include <bitset> //See OS/2 table, i.e. http://www.microsoft.com/typography/otspec/os2.htm#ur @@ -193,8 +193,8 @@ namespace vcl struct FontCapabilities { - o3tl::optional<std::bitset<UnicodeCoverage::MAX_UC_ENUM>> oUnicodeRange; - o3tl::optional<std::bitset<CodePageCoverage::MAX_CP_ENUM>> oCodePageRange; + std::optional<std::bitset<UnicodeCoverage::MAX_UC_ENUM>> oUnicodeRange; + std::optional<std::bitset<CodePageCoverage::MAX_CP_ENUM>> oCodePageRange; }; } diff --git a/include/vcl/outdevstate.hxx b/include/vcl/outdevstate.hxx index 5f0b12d41d86..62a4af7fbd94 100644 --- a/include/vcl/outdevstate.hxx +++ b/include/vcl/outdevstate.hxx @@ -28,7 +28,7 @@ #include <tools/fontenum.hxx> #include <o3tl/typed_flags_set.hxx> #include <memory> -#include <o3tl/optional.hxx> +#include <optional> #include <i18nlangtag/lang.h> namespace vcl { class Font; } @@ -81,17 +81,17 @@ struct OutDevState OutDevState(OutDevState&&); ~OutDevState(); - o3tl::optional<MapMode> mpMapMode; + std::optional<MapMode> mpMapMode; bool mbMapActive; std::unique_ptr<vcl::Region> mpClipRegion; - o3tl::optional<Color> mpLineColor; - o3tl::optional<Color> mpFillColor; + std::optional<Color> mpLineColor; + std::optional<Color> mpFillColor; std::unique_ptr<vcl::Font> mpFont; - o3tl::optional<Color> mpTextColor; - o3tl::optional<Color> mpTextFillColor; - o3tl::optional<Color> mpTextLineColor; - o3tl::optional<Color> mpOverlineColor; - o3tl::optional<Point> mpRefPoint; + std::optional<Color> mpTextColor; + std::optional<Color> mpTextFillColor; + std::optional<Color> mpTextLineColor; + std::optional<Color> mpOverlineColor; + std::optional<Point> mpRefPoint; TextAlign meTextAlign; RasterOp meRasterOp; ComplexTextLayoutFlags mnTextLayoutMode; diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx index dafae8735682..347c861bc5aa 100644 --- a/include/vcl/settings.hxx +++ b/include/vcl/settings.hxx @@ -29,7 +29,7 @@ #include <memory> #include <vector> -#include <o3tl/optional.hxx> +#include <optional> class BitmapEx; class LanguageTag; @@ -549,7 +549,7 @@ public: BitmapEx const & GetPersonaFooter() const; - const o3tl::optional<Color>& GetPersonaMenuBarTextColor() const; + const std::optional<Color>& GetPersonaMenuBarTextColor() const; // global switch to allow EdgeBlenging; currently possible for ValueSet and ListBox // when activated there using Get/SetEdgeBlending; default is true diff --git a/include/vcl/threadex.hxx b/include/vcl/threadex.hxx index 39c1633d2054..af2978ce3bdb 100644 --- a/include/vcl/threadex.hxx +++ b/include/vcl/threadex.hxx @@ -24,7 +24,7 @@ #include <tools/link.hxx> #include <vcl/dllapi.h> -#include <o3tl/optional.hxx> +#include <optional> #include <memory> namespace vcl @@ -84,9 +84,9 @@ private: #else FuncT const m_func; #endif - // using o3tl::optional here omits the need that ResultT is default + // using std::optional here omits the need that ResultT is default // constructable: - ::o3tl::optional<ResultT> m_result; + ::std::optional<ResultT> m_result; }; template <typename FuncT> diff --git a/include/vcl/treelistentry.hxx b/include/vcl/treelistentry.hxx index deb733b7bf9a..456a99c3fd67 100644 --- a/include/vcl/treelistentry.hxx +++ b/include/vcl/treelistentry.hxx @@ -27,7 +27,7 @@ #include <vcl/treelistentries.hxx> #include <o3tl/typed_flags_set.hxx> -#include <o3tl/optional.hxx> +#include <optional> #include <vector> #include <memory> @@ -64,7 +64,7 @@ class VCL_DLLPUBLIC SvTreeListEntry void* pUserData; SvTLEntryFlags nEntryFlags; Color maBackColor; - o3tl::optional<Color> mxTextColor; + std::optional<Color> mxTextColor; private: void ClearChildren(); @@ -112,8 +112,8 @@ public: void SetBackColor( const Color& rColor ) { maBackColor = rColor; } const Color& GetBackColor() const { return maBackColor; } - void SetTextColor( o3tl::optional<Color> xColor ) { mxTextColor = xColor; } - o3tl::optional<Color> const & GetTextColor() const { return mxTextColor; } + void SetTextColor( std::optional<Color> xColor ) { mxTextColor = xColor; } + std::optional<Color> const & GetTextColor() const { return mxTextColor; } SvTreeListEntry* GetParent() const { return pParent; } |