diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-11-30 17:48:32 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-12-01 14:57:16 +0100 |
commit | 7e403195e574be5174815a51cf5c42f06f76a87a (patch) | |
tree | c6147bcac095cd387f06dee63a25e15db6ca84c6 /slideshow | |
parent | 7b3190eda387bcd897095205732f6752dedf01ef (diff) |
Introduce o3tl::optional as an alias for std::optional
...with a boost::optional fallback for Xcode < 10 (as std::optional is only
available starting with Xcode 10 according to
<https://en.cppreference.com/w/cpp/compiler_support>, and our baseline for iOS
and macOS is still Xcode 9.3 according to README.md). And mechanically rewrite
all code to use o3tl::optional instead of boost::optional.
One immediate benefit is that disabling -Wmaybe-uninitialized for GCC as per
fed7c3deb3f4ec81f78967c2d7f3c4554398cb9d "Slience bogus
-Werror=maybe-uninitialized" should no longer be necessary (and whose check
happened to no longer trigger for GCC 10 trunk, even though that compiler would
still emit bogus -Wmaybe-uninitialized for uses of boost::optional under
--enable-optimized, which made me ponder whether this switch from
boost::optional to std::optional would be a useful thing to do; I keep that
configure.ac check for now, though, and will only remove it in a follow up
commit).
Another longer-term benefit is that the code is now already in good shape for an
eventual switch to std::optional (a switch we would have done anyway once we no
longer need to support Xcode < 10).
Only desktop/qa/desktop_lib/test_desktop_lib.cxx heavily uses
boost::property_tree::ptree::get_child_optional returning boost::optional, so
let it keep using boost::optional for now.
After a number of preceding commits have paved the way for this change, this
commit is completely mechanical, done with
> git ls-files -z | grep -vz -e '^bin/find-unneeded-includes$' -e '^configure.ac$' -e '^desktop/qa/desktop_lib/test_desktop_lib.cxx$' -e '^dictionaries$' -e '^external/' -e '^helpcontent2$' -e '^include/IwyuFilter_include.yaml$' -e '^sc/IwyuFilter_sc.yaml$' -e '^solenv/gdb/boost/optional.py$' -e '^solenv/vs/LibreOffice.natvis$' -e '^translations$' -e '\.svg$' | xargs -0 sed -i -E -e 's|\<boost(/optional)?/optional\.hpp\>|o3tl/optional.hxx|g' -e 's/\<boost(\s*)::(\s*)(make_)?optional\>/o3tl\1::\2\3optional/g' -e 's/\<boost(\s*)::(\s*)none\>/o3tl\1::\2nullopt/g'
(before committing include/o3tl/optional.hxx, and relying on some GNU features).
It excludes some files where mention of boost::optional et al should apparently
not be changed (and the sub-repo directory stubs). It turned out that all uses
of boost::none across the code base were in combination with boost::optional, so
had all to be rewritten as o3tl::nullopt.
Change-Id: Ibfd9f4b3d5a8aee6e6eed310b988c4e5ffd8b11b
Reviewed-on: https://gerrit.libreoffice.org/84128
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'slideshow')
15 files changed, 49 insertions, 49 deletions
diff --git a/slideshow/inc/pch/precompiled_slideshow.hxx b/slideshow/inc/pch/precompiled_slideshow.hxx index 7bd2a3b60344..c7708cbe1362 100644 --- a/slideshow/inc/pch/precompiled_slideshow.hxx +++ b/slideshow/inc/pch/precompiled_slideshow.hxx @@ -49,7 +49,7 @@ #include <unordered_set> #include <utility> #include <vector> -#include <boost/optional.hpp> +#include <o3tl/optional.hxx> #include <boost/property_tree/ptree.hpp> #endif // PCH_LEVEL >= 1 #if PCH_LEVEL >= 2 diff --git a/slideshow/source/engine/activities/activitiesfactory.cxx b/slideshow/source/engine/activities/activitiesfactory.cxx index e2cc9987e998..9f24302d995b 100644 --- a/slideshow/source/engine/activities/activitiesfactory.cxx +++ b/slideshow/source/engine/activities/activitiesfactory.cxx @@ -34,7 +34,7 @@ #include "continuousactivitybase.hxx" #include "continuouskeytimeactivitybase.hxx" -#include <boost/optional.hpp> +#include <o3tl/optional.hxx> #include <memory> #include <cmath> @@ -102,7 +102,7 @@ class FromToByActivity : public BaseType { public: typedef typename AnimationType::ValueType ValueType; - typedef boost::optional<ValueType> OptionalValueType; + typedef o3tl::optional<ValueType> OptionalValueType; private: // some compilers don't inline whose definition they haven't @@ -390,7 +390,7 @@ AnimationActivitySharedPtr createFromToByActivity( const ::basegfx::B2DVector& rSlideBounds ) { typedef typename AnimationType::ValueType ValueType; - typedef boost::optional<ValueType> OptionalValueType; + typedef o3tl::optional<ValueType> OptionalValueType; OptionalValueType aFrom; OptionalValueType aTo; diff --git a/slideshow/source/engine/activities/activitybase.hxx b/slideshow/source/engine/activities/activitybase.hxx index 990e65c0ed26..8fdc6be71601 100644 --- a/slideshow/source/engine/activities/activitybase.hxx +++ b/slideshow/source/engine/activities/activitybase.hxx @@ -126,7 +126,7 @@ private: AnimatableShapeSharedPtr mpShape; // only to pass on to animation ShapeAttributeLayerSharedPtr mpAttributeLayer; // only to pass on to anim - ::boost::optional<double> const maRepeats; + ::o3tl::optional<double> const maRepeats; const double mnAccelerationFraction; const double mnDecelerationFraction; diff --git a/slideshow/source/engine/activities/activityparameters.hxx b/slideshow/source/engine/activities/activityparameters.hxx index 0644ccf85913..d915230fe792 100644 --- a/slideshow/source/engine/activities/activityparameters.hxx +++ b/slideshow/source/engine/activities/activityparameters.hxx @@ -25,7 +25,7 @@ #include <expressionnode.hxx> #include <wakeupevent.hxx> -#include <boost/optional.hpp> +#include <o3tl/optional.hxx> #include <vector> namespace slideshow { @@ -80,7 +80,7 @@ struct ActivityParameters EventQueue& rEventQueue, ActivitiesQueue& rActivitiesQueue, double nMinDuration, - ::boost::optional<double> const& rRepeats, + ::o3tl::optional<double> const& rRepeats, double nAccelerationFraction, double nDecelerationFraction, sal_uInt32 nMinNumberOfFrames, @@ -117,7 +117,7 @@ struct ActivityParameters /// Total duration of activity (including all repeats) const double mnMinDuration; - ::boost::optional<double> const& mrRepeats; + ::o3tl::optional<double> const& mrRepeats; const double mnAccelerationFraction; const double mnDecelerationFraction; diff --git a/slideshow/source/engine/animationnodes/animationbasenode.cxx b/slideshow/source/engine/animationnodes/animationbasenode.cxx index a302b171c36c..1aa7bbc50055 100644 --- a/slideshow/source/engine/animationnodes/animationbasenode.cxx +++ b/slideshow/source/engine/animationnodes/animationbasenode.cxx @@ -33,7 +33,7 @@ #include <delayevent.hxx> #include <framerate.hxx> -#include <boost/optional.hpp> +#include <o3tl/optional.hxx> #include <algorithm> using namespace com::sun::star; @@ -401,7 +401,7 @@ AnimationBaseNode::fillCommonParameters() const const bool bAutoReverse( mxAnimateNode->getAutoReverse() ); - boost::optional<double> aRepeats; + o3tl::optional<double> aRepeats; double nRepeats = 0; if( mxAnimateNode->getRepeatCount() >>= nRepeats ) { aRepeats = nRepeats; diff --git a/slideshow/source/engine/shapes/drawshape.hxx b/slideshow/source/engine/shapes/drawshape.hxx index e014f0cb1979..e76fe9c115a0 100644 --- a/slideshow/source/engine/shapes/drawshape.hxx +++ b/slideshow/source/engine/shapes/drawshape.hxx @@ -29,7 +29,7 @@ #include "viewshape.hxx" #include <hyperlinkarea.hxx> -#include <boost/optional.hpp> +#include <o3tl/optional.hxx> #include <set> #include <vector> @@ -292,7 +292,7 @@ namespace slideshow mutable int mnCurrMtfLoadFlags; /// Contains the current shape bounds, in unit rect space - mutable ::boost::optional<basegfx::B2DRectangle> maCurrentShapeUnitBounds; + mutable ::o3tl::optional<basegfx::B2DRectangle> maCurrentShapeUnitBounds; // The attributes of this Shape const double mnPriority; diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx index b89804000ebd..c3b676d6ec41 100644 --- a/slideshow/source/engine/shapes/viewshape.cxx +++ b/slideshow/source/engine/shapes/viewshape.cxx @@ -551,7 +551,7 @@ namespace slideshow // shape needs repaint - setup all that's needed - boost::optional<basegfx::B2DPolyPolygon> aClip; + o3tl::optional<basegfx::B2DPolyPolygon> aClip; if( pAttr ) { diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index f81e9e9fb278..3786571d0a6e 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -424,13 +424,13 @@ private: //map of vector of Polygons, containing polygons drawn on each slide. PolygonMap maPolygons; - boost::optional<RGBColor> maUserPaintColor; + o3tl::optional<RGBColor> maUserPaintColor; double maUserPaintStrokeWidth; //changed for the eraser project - boost::optional<bool> maEraseAllInk; - boost::optional<sal_Int32> maEraseInk; + o3tl::optional<bool> maEraseAllInk; + o3tl::optional<sal_Int32> maEraseInk; //end changed std::shared_ptr<canvas::tools::ElapsedTime> mpPresTimer; @@ -864,7 +864,7 @@ ActivitySharedPtr SlideShowImpl::createSlideTransition( nTransitionDuration, nMinFrames, false, - boost::optional<double>(1.0), + o3tl::optional<double>(1.0), 0.0, 0.0, ShapeSharedPtr(), diff --git a/slideshow/source/engine/transitions/combtransition.cxx b/slideshow/source/engine/transitions/combtransition.cxx index 65c32b66e46f..d6c17e5129da 100644 --- a/slideshow/source/engine/transitions/combtransition.cxx +++ b/slideshow/source/engine/transitions/combtransition.cxx @@ -68,7 +68,7 @@ basegfx::B2DPolyPolygon createClipPolygon( } CombTransition::CombTransition( - boost::optional<SlideSharedPtr> const & leavingSlide, + o3tl::optional<SlideSharedPtr> const & leavingSlide, const SlideSharedPtr& pEnteringSlide, const SoundPlayerSharedPtr& pSoundPlayer, const UnoViewContainer& rViewContainer, diff --git a/slideshow/source/engine/transitions/combtransition.hxx b/slideshow/source/engine/transitions/combtransition.hxx index 1f1509a1c936..c0d2f46f24e6 100644 --- a/slideshow/source/engine/transitions/combtransition.hxx +++ b/slideshow/source/engine/transitions/combtransition.hxx @@ -39,7 +39,7 @@ public: @param nNumStripes Number of comb-like stripes to show in this effect */ - CombTransition( ::boost::optional<SlideSharedPtr> const & leavingSlide, + CombTransition( ::o3tl::optional<SlideSharedPtr> const & leavingSlide, const SlideSharedPtr& pEnteringSlide, const SoundPlayerSharedPtr& pSoundPlayer, const UnoViewContainer& rViewContainer, diff --git a/slideshow/source/engine/transitions/slidechangebase.cxx b/slideshow/source/engine/transitions/slidechangebase.cxx index d97210963c6a..3fbad5bec67d 100644 --- a/slideshow/source/engine/transitions/slidechangebase.cxx +++ b/slideshow/source/engine/transitions/slidechangebase.cxx @@ -37,7 +37,7 @@ using namespace com::sun::star; namespace slideshow { namespace internal { -SlideChangeBase::SlideChangeBase( boost::optional<SlideSharedPtr> const & leavingSlide, +SlideChangeBase::SlideChangeBase( o3tl::optional<SlideSharedPtr> const & leavingSlide, const SlideSharedPtr& pEnteringSlide, const SoundPlayerSharedPtr& pSoundPlayer, const UnoViewContainer& rViewContainer, @@ -76,13 +76,13 @@ SlideBitmapSharedPtr SlideChangeBase::getEnteringBitmap( const ViewEntry& rViewE { if( !rViewEntry.mpEnteringBitmap ) rViewEntry.mpEnteringBitmap = createBitmap( rViewEntry.mpView, - boost::optional<SlideSharedPtr>(mpEnteringSlide) ); + o3tl::optional<SlideSharedPtr>(mpEnteringSlide) ); return rViewEntry.mpEnteringBitmap; } SlideBitmapSharedPtr SlideChangeBase::createBitmap( const UnoViewSharedPtr& rView, - const boost::optional<SlideSharedPtr>& rSlide ) const + const o3tl::optional<SlideSharedPtr>& rSlide ) const { SlideBitmapSharedPtr pRet; if( !rSlide ) diff --git a/slideshow/source/engine/transitions/slidechangebase.hxx b/slideshow/source/engine/transitions/slidechangebase.hxx index 0cb20b1a66b4..443c8ed81ebe 100644 --- a/slideshow/source/engine/transitions/slidechangebase.hxx +++ b/slideshow/source/engine/transitions/slidechangebase.hxx @@ -28,7 +28,7 @@ #include <soundplayer.hxx> #include <memory> -#include <boost/optional.hpp> +#include <o3tl/optional.hxx> namespace cppcanvas { @@ -73,7 +73,7 @@ protected: entering slides. */ SlideChangeBase( - ::boost::optional<SlideSharedPtr> const & leavingSlide, + ::o3tl::optional<SlideSharedPtr> const & leavingSlide, const SlideSharedPtr& pEnteringSlide, const SoundPlayerSharedPtr& pSoundPlayer, const UnoViewContainer& rViewContainer, @@ -114,7 +114,7 @@ protected: SlideBitmapSharedPtr getEnteringBitmap( const ViewEntry& rViewEntry ) const; SlideBitmapSharedPtr createBitmap( const UnoViewSharedPtr& pView, - const boost::optional<SlideSharedPtr>& rSlide_ ) const; + const o3tl::optional<SlideSharedPtr>& rSlide_ ) const; ::basegfx::B2ISize getEnteringSlideSizePixel( const UnoViewSharedPtr& pView ) const; @@ -184,7 +184,7 @@ private: EventMultiplexer& mrEventMultiplexer; ScreenUpdater& mrScreenUpdater; - ::boost::optional<SlideSharedPtr> maLeavingSlide; + ::o3tl::optional<SlideSharedPtr> maLeavingSlide; SlideSharedPtr mpEnteringSlide; ViewsVecT maViewData; diff --git a/slideshow/source/engine/transitions/slidetransitionfactory.cxx b/slideshow/source/engine/transitions/slidetransitionfactory.cxx index 49d440aa2ed7..34ee72eb11c9 100644 --- a/slideshow/source/engine/transitions/slidetransitionfactory.cxx +++ b/slideshow/source/engine/transitions/slidetransitionfactory.cxx @@ -118,7 +118,7 @@ public: */ PluginSlideChange( sal_Int16 nTransitionType, sal_Int16 nTransitionSubType, - boost::optional<SlideSharedPtr> const& leavingSlide_, + o3tl::optional<SlideSharedPtr> const& leavingSlide_, const SlideSharedPtr& pEnteringSlide, const UnoViewContainer& rViewContainer, ScreenUpdater& rScreenUpdater, @@ -280,7 +280,7 @@ public: SlideChangeBase( // leaving bitmap is empty, we're leveraging the fact that the // old slide is still displayed in the background: - boost::optional<SlideSharedPtr>(), + o3tl::optional<SlideSharedPtr>(), pEnteringSlide, pSoundPlayer, rViewContainer, @@ -341,9 +341,9 @@ public: entering slides, which applies a fade effect. */ FadingSlideChange( - boost::optional<SlideSharedPtr> const & leavingSlide, + o3tl::optional<SlideSharedPtr> const & leavingSlide, const SlideSharedPtr& pEnteringSlide, - boost::optional<RGBColor> const& rFadeColor, + o3tl::optional<RGBColor> const& rFadeColor, const SoundPlayerSharedPtr& pSoundPlayer, const UnoViewContainer& rViewContainer, ScreenUpdater& rScreenUpdater, @@ -374,7 +374,7 @@ public: double t ) override; private: - const boost::optional< RGBColor > maFadeColor; + const o3tl::optional< RGBColor > maFadeColor; }; void FadingSlideChange::prepareForRun( @@ -439,7 +439,7 @@ public: entering slides, which applies a cut effect. */ CutSlideChange( - boost::optional<SlideSharedPtr> const & leavingSlide, + o3tl::optional<SlideSharedPtr> const & leavingSlide, const SlideSharedPtr& pEnteringSlide, const RGBColor& rFadeColor, const SoundPlayerSharedPtr& pSoundPlayer, @@ -543,7 +543,7 @@ public: final slide position. The vector must have unit length. */ MovingSlideChange( - const boost::optional<SlideSharedPtr>& leavingSlide, + const o3tl::optional<SlideSharedPtr>& leavingSlide, const SlideSharedPtr& pEnteringSlide, const SoundPlayerSharedPtr& pSoundPlayer, const UnoViewContainer& rViewContainer, @@ -661,7 +661,7 @@ void MovingSlideChange::performOut( NumberAnimationSharedPtr createPushWipeTransition( - boost::optional<SlideSharedPtr> const & leavingSlide_, + o3tl::optional<SlideSharedPtr> const & leavingSlide_, const SlideSharedPtr& pEnteringSlide, const UnoViewContainer& rViewContainer, ScreenUpdater& rScreenUpdater, @@ -671,7 +671,7 @@ NumberAnimationSharedPtr createPushWipeTransition( bool /*bTransitionDirection*/, const SoundPlayerSharedPtr& pSoundPlayer ) { - boost::optional<SlideSharedPtr> leavingSlide; // no bitmap + o3tl::optional<SlideSharedPtr> leavingSlide; // no bitmap if (leavingSlide_ && *leavingSlide_ != nullptr) { // opt: only page, if we've an @@ -764,7 +764,7 @@ NumberAnimationSharedPtr createPushWipeTransition( } NumberAnimationSharedPtr createSlideWipeTransition( - boost::optional<SlideSharedPtr> const & leavingSlide, + o3tl::optional<SlideSharedPtr> const & leavingSlide, const SlideSharedPtr& pEnteringSlide, const UnoViewContainer& rViewContainer, ScreenUpdater& rScreenUpdater, @@ -827,7 +827,7 @@ NumberAnimationSharedPtr createSlideWipeTransition( return NumberAnimationSharedPtr( new MovingSlideChange( - boost::optional<SlideSharedPtr>() /* no slide */, + o3tl::optional<SlideSharedPtr>() /* no slide */, pEnteringSlide, pSoundPlayer, rViewContainer, @@ -858,7 +858,7 @@ NumberAnimationSharedPtr createSlideWipeTransition( NumberAnimationSharedPtr createPluginTransition( sal_Int16 nTransitionType, sal_Int16 nTransitionSubType, - boost::optional<SlideSharedPtr> const& pLeavingSlide, + o3tl::optional<SlideSharedPtr> const& pLeavingSlide, const SlideSharedPtr& pEnteringSlide, const UnoViewContainer& rViewContainer, ScreenUpdater& rScreenUpdater, @@ -926,7 +926,7 @@ NumberAnimationSharedPtr TransitionFactory::createSlideTransition( createPluginTransition( nTransitionType, nTransitionSubType, - boost::make_optional(pLeavingSlide), + o3tl::make_optional(pLeavingSlide), pEnteringSlide, rViewContainer, rScreenUpdater, @@ -1021,7 +1021,7 @@ NumberAnimationSharedPtr TransitionFactory::createSlideTransition( case animations::TransitionType::PUSHWIPE: { return createPushWipeTransition( - boost::make_optional(pLeavingSlide), + o3tl::make_optional(pLeavingSlide), pEnteringSlide, rViewContainer, rScreenUpdater, @@ -1035,7 +1035,7 @@ NumberAnimationSharedPtr TransitionFactory::createSlideTransition( case animations::TransitionType::SLIDEWIPE: { return createSlideWipeTransition( - boost::make_optional(pLeavingSlide), + o3tl::make_optional(pLeavingSlide), pEnteringSlide, rViewContainer, rScreenUpdater, @@ -1050,8 +1050,8 @@ NumberAnimationSharedPtr TransitionFactory::createSlideTransition( case animations::TransitionType::FADE: { // black page: - boost::optional<SlideSharedPtr> leavingSlide; - boost::optional<RGBColor> aFadeColor; + o3tl::optional<SlideSharedPtr> leavingSlide; + o3tl::optional<RGBColor> aFadeColor; switch( nTransitionSubType ) { diff --git a/slideshow/source/inc/activitiesfactory.hxx b/slideshow/source/inc/activitiesfactory.hxx index ccf641dd7f82..1734fc1ea8b0 100644 --- a/slideshow/source/inc/activitiesfactory.hxx +++ b/slideshow/source/inc/activitiesfactory.hxx @@ -36,7 +36,7 @@ #include "boolanimation.hxx" #include "pairanimation.hxx" -#include <boost/optional.hpp> +#include <o3tl/optional.hxx> /* Definition of ActivitiesFactory class */ @@ -55,7 +55,7 @@ namespace ActivitiesFactory double nMinDuration, sal_uInt32 nMinNumberOfFrames, bool bAutoReverse, - ::boost::optional<double> const& aRepeats, + ::o3tl::optional<double> const& aRepeats, double nAcceleration, double nDeceleration, const ShapeSharedPtr& rShape, @@ -110,7 +110,7 @@ namespace ActivitiesFactory unspecified, the activity will repeat indefinitely. */ - ::boost::optional<double> const maRepeats; + ::o3tl::optional<double> const maRepeats; /// Fraction of simple time to accelerate animation double const mnAcceleration; diff --git a/slideshow/source/inc/animatedsprite.hxx b/slideshow/source/inc/animatedsprite.hxx index 3c215edc0d27..db38190a6d32 100644 --- a/slideshow/source/inc/animatedsprite.hxx +++ b/slideshow/source/inc/animatedsprite.hxx @@ -29,7 +29,7 @@ #include "viewlayer.hxx" -#include <boost/optional.hpp> +#include <o3tl/optional.hxx> #include <memory> @@ -148,8 +148,8 @@ namespace slideshow double const mnSpritePrio; double mnAlpha; - ::boost::optional< ::basegfx::B2DPoint > maPosPixel; - ::boost::optional< ::basegfx::B2DPolyPolygon > maClip; + ::o3tl::optional< ::basegfx::B2DPoint > maPosPixel; + ::o3tl::optional< ::basegfx::B2DPolyPolygon > maClip; bool mbSpriteVisible; }; |