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 /include/editeng | |
parent | boost::optional: replace uses of get_value_or with value_or (diff) | |
download | core-7e403195e574be5174815a51cf5c42f06f76a87a.tar.gz core-7e403195e574be5174815a51cf5c42f06f76a87a.zip |
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 'include/editeng')
-rw-r--r-- | include/editeng/editeng.hxx | 4 | ||||
-rw-r--r-- | include/editeng/outliner.hxx | 16 | ||||
-rw-r--r-- | include/editeng/svxacorr.hxx | 4 | ||||
-rw-r--r-- | include/editeng/unoedprx.hxx | 2 | ||||
-rw-r--r-- | include/editeng/unoedsrc.hxx | 2 | ||||
-rw-r--r-- | include/editeng/unofored.hxx | 2 | ||||
-rw-r--r-- | include/editeng/unoforou.hxx | 2 | ||||
-rw-r--r-- | include/editeng/unotext.hxx | 2 |
8 files changed, 17 insertions, 17 deletions
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index 12b4b0b28398..01dcffe10022 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -23,7 +23,7 @@ #include <memory> #include <vector> -#include <boost/optional.hpp> +#include <o3tl/optional.hxx> #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, boost::optional<Color>& rTxtColor, boost::optional<Color>& rFldColor ); + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rTxtColor, o3tl::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 70c08e5e45ee..2f6cc2d9abf3 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 <boost/optional.hpp> +#include <o3tl/optional.hxx> #include <functional> #include <memory> #include <vector> @@ -484,8 +484,8 @@ private: Outliner* pOutliner; const SvxFieldItem& rFldItem; - boost::optional<Color> mxTxtColor; - boost::optional<Color> mxFldColor; + o3tl::optional<Color> mxTxtColor; + o3tl::optional<Color> mxFldColor; OUString aRepresentation; @@ -509,11 +509,11 @@ public: const SvxFieldItem& GetField() const { return rFldItem; } - boost::optional<Color> const & GetTextColor() const { return mxTxtColor; } - void SetTextColor( boost::optional<Color> xCol ) { mxTxtColor = xCol; } + o3tl::optional<Color> const & GetTextColor() const { return mxTxtColor; } + void SetTextColor( o3tl::optional<Color> xCol ) { mxTxtColor = xCol; } - boost::optional<Color> const & GetFieldColor() const { return mxFldColor; } - void SetFieldColor( boost::optional<Color> xCol ) { mxFldColor = xCol; } + o3tl::optional<Color> const & GetFieldColor() const { return mxFldColor; } + void SetFieldColor( o3tl::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, boost::optional<Color>& rTxtColor, boost::optional<Color>& rFldColor ); + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rTxtColor, o3tl::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 46c3df27f18f..cde80d6aca83 100644 --- a/include/editeng/svxacorr.hxx +++ b/include/editeng/svxacorr.hxx @@ -28,7 +28,7 @@ #include <editeng/swafopt.hxx> #include <editeng/editengdllapi.h> -#include <boost/optional.hpp> +#include <o3tl/optional.hxx> #include <map> #include <memory> @@ -155,7 +155,7 @@ public: ~SvxAutocorrWordList(); void DeleteAndDestroyAll(); const SvxAutocorrWord* Insert(SvxAutocorrWord aWord) const; - boost::optional<SvxAutocorrWord> FindAndRemove(const SvxAutocorrWord *pWord); + o3tl::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 132cbbf96c66..a3aa0b915cc3 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, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor ) override; + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rpTxtColor, o3tl::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 e9f3ee0dd093..ab8a567d78d2 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, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor ) = 0; + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rpTxtColor, o3tl::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 8222a3043bdb..a0cf70caf5f8 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, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor ) override; + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rpTxtColor, o3tl::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 f2d28a53e405..17029f9ca85c 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, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor ) override; + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rpTxtColor, o3tl::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 203bf309809d..4fae9a92dfe3 100644 --- a/include/editeng/unotext.hxx +++ b/include/editeng/unotext.hxx @@ -189,7 +189,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, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor ) override; + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rpTxtColor, o3tl::optional<Color>& rpFldColor ) override; virtual void FieldClicked( const SvxFieldItem& rField ) override; virtual bool IsValid() const override; |