summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-11-30 17:48:32 +0100
committerStephan Bergmann <sbergman@redhat.com>2019-12-01 14:57:16 +0100
commit7e403195e574be5174815a51cf5c42f06f76a87a (patch)
treec6147bcac095cd387f06dee63a25e15db6ca84c6 /vcl
parent7b3190eda387bcd897095205732f6752dedf01ef (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 'vcl')
-rw-r--r--vcl/inc/bitmapwriteaccess.hxx6
-rw-r--r--vcl/inc/fontinstance.hxx4
-rw-r--r--vcl/inc/pch/precompiled_vcl.hxx2
-rw-r--r--vcl/inc/sft.hxx4
-rw-r--r--vcl/inc/svdata.hxx8
-rw-r--r--vcl/inc/unx/screensaverinhibitor.hxx14
-rw-r--r--vcl/inc/wall2.hxx4
-rw-r--r--vcl/inc/window.h14
-rw-r--r--vcl/qt5/Qt5Frame.cxx4
-rw-r--r--vcl/source/app/settings.cxx6
-rw-r--r--vcl/source/control/quickselectionengine.cxx4
-rw-r--r--vcl/source/fontsubset/sft.cxx4
-rw-r--r--vcl/unx/generic/window/salframe.cxx2
-rw-r--r--vcl/unx/generic/window/screensaverinhibitor.cxx4
-rw-r--r--vcl/unx/gtk3/gtk3gtkframe.cxx4
-rw-r--r--vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx2
-rw-r--r--vcl/unx/kf5/KF5SalFrame.cxx2
-rw-r--r--vcl/win/gdi/salnativewidgets-luna.cxx2
-rw-r--r--vcl/win/window/salframe.cxx2
19 files changed, 46 insertions, 46 deletions
diff --git a/vcl/inc/bitmapwriteaccess.hxx b/vcl/inc/bitmapwriteaccess.hxx
index 02ca3f983300..0cb7fbf3a653 100644
--- a/vcl/inc/bitmapwriteaccess.hxx
+++ b/vcl/inc/bitmapwriteaccess.hxx
@@ -14,7 +14,7 @@
#include <vcl/alpha.hxx>
#include <vcl/bitmap.hxx>
#include <vcl/bitmapaccess.hxx>
-#include <boost/optional.hpp>
+#include <o3tl/optional.hxx>
typedef vcl::ScopedBitmapAccess<BitmapWriteAccess, Bitmap, &Bitmap::AcquireWriteAccess>
BitmapScopedWriteAccess;
@@ -83,8 +83,8 @@ public:
void DrawRect(const tools::Rectangle& rRect);
private:
- boost::optional<BitmapColor> mpLineColor;
- boost::optional<BitmapColor> mpFillColor;
+ o3tl::optional<BitmapColor> mpLineColor;
+ o3tl::optional<BitmapColor> mpFillColor;
BitmapWriteAccess() = delete;
BitmapWriteAccess(const BitmapWriteAccess&) = delete;
diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx
index b4d7da663090..03663e025b6d 100644
--- a/vcl/inc/fontinstance.hxx
+++ b/vcl/inc/fontinstance.hxx
@@ -30,7 +30,7 @@
#include <tools/fontenum.hxx>
#include <vcl/glyphitem.hxx>
-#include <boost/optional.hpp>
+#include <o3tl/optional.hxx>
#include <unordered_map>
#include <memory>
@@ -103,7 +103,7 @@ private:
hb_font_t* m_pHbFont;
double m_nAveWidthFactor;
rtl::Reference<PhysicalFontFace> m_pFontFace;
- boost::optional<bool> m_xbIsGraphiteFont;
+ o3tl::optional<bool> m_xbIsGraphiteFont;
};
inline hb_font_t* LogicalFontInstance::GetHbFont()
diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx
index aad967c13739..d1b9eaf54270 100644
--- a/vcl/inc/pch/precompiled_vcl.hxx
+++ b/vcl/inc/pch/precompiled_vcl.hxx
@@ -50,7 +50,7 @@
#include <boost/functional/hash.hpp>
#include <boost/math/special_functions/sinc.hpp>
#include <boost/multi_array.hpp>
-#include <boost/optional.hpp>
+#include <o3tl/optional.hxx>
#endif // PCH_LEVEL >= 1
#if PCH_LEVEL >= 2
#include <osl/conditn.hxx>
diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx
index 8c7e4aaa8711..985ad5623e50 100644
--- a/vcl/inc/sft.hxx
+++ b/vcl/inc/sft.hxx
@@ -489,8 +489,8 @@ constexpr sal_uInt32 T_CFF = 0x43464620;
#endif
bool VCL_DLLPUBLIC getTTCoverage(
- boost::optional<std::bitset<UnicodeCoverage::MAX_UC_ENUM>> & rUnicodeCoverage,
- boost::optional<std::bitset<CodePageCoverage::MAX_CP_ENUM>> & rCodePageCoverage,
+ o3tl::optional<std::bitset<UnicodeCoverage::MAX_UC_ENUM>> & rUnicodeCoverage,
+ o3tl::optional<std::bitset<CodePageCoverage::MAX_CP_ENUM>> & rCodePageCoverage,
const unsigned char* pTable, size_t nLength);
/**
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 181082782e06..f95b6136e6d8 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -135,10 +135,10 @@ struct ImplSVAppData
SVAppKeyListeners maKeyListeners; // listeners for key events only (eg, extended toolkit)
std::vector<ImplPostEventPair> maPostedEventList;
ImplAccelManager* mpAccelMgr; // Accelerator Manager
- boost::optional<OUString> mxAppName; // Application name
- boost::optional<OUString> mxAppFileName; // Abs. Application FileName
- boost::optional<OUString> mxDisplayName; // Application Display Name
- boost::optional<OUString> mxToolkitName; // Toolkit Name
+ o3tl::optional<OUString> mxAppName; // Application name
+ o3tl::optional<OUString> mxAppFileName; // Abs. Application FileName
+ o3tl::optional<OUString> mxDisplayName; // Application Display Name
+ o3tl::optional<OUString> mxToolkitName; // Toolkit Name
Help* mpHelp = nullptr; // Application help
VclPtr<PopupMenu> mpActivePopupMenu; // Actives Popup-Menu (in Execute)
VclPtr<ImplWheelWindow> mpWheelWindow; // WheelWindow
diff --git a/vcl/inc/unx/screensaverinhibitor.hxx b/vcl/inc/unx/screensaverinhibitor.hxx
index 7100a8877399..fcc6f4917fa1 100644
--- a/vcl/inc/unx/screensaverinhibitor.hxx
+++ b/vcl/inc/unx/screensaverinhibitor.hxx
@@ -16,24 +16,24 @@
#include <rtl/ustring.hxx>
#include <vcl/dllapi.h>
-#include <boost/optional.hpp>
+#include <o3tl/optional.hxx>
class VCL_PLUGIN_PUBLIC ScreenSaverInhibitor
{
public:
void inhibit( bool bInhibit, const OUString& sReason,
- bool bIsX11, const boost::optional<unsigned int>& xid, boost::optional<Display*> pDisplay );
+ bool bIsX11, const o3tl::optional<unsigned int>& xid, o3tl::optional<Display*> pDisplay );
private:
// These are all used as guint, however this header may be included
// in kde/tde/etc backends, where we would ideally avoid having
// any glib dependencies, hence the direct use of unsigned int.
- boost::optional<unsigned int> mnFDOCookie; // FDO ScreenSaver Inhibit
- boost::optional<unsigned int> mnFDOPMCookie; // FDO PowerManagement Inhibit
- boost::optional<unsigned int> mnGSMCookie;
- boost::optional<unsigned int> mnMSMCookie;
+ o3tl::optional<unsigned int> mnFDOCookie; // FDO ScreenSaver Inhibit
+ o3tl::optional<unsigned int> mnFDOPMCookie; // FDO PowerManagement Inhibit
+ o3tl::optional<unsigned int> mnGSMCookie;
+ o3tl::optional<unsigned int> mnMSMCookie;
- boost::optional<int> mnXScreenSaverTimeout;
+ o3tl::optional<int> mnXScreenSaverTimeout;
#if !defined(__sun) && !defined(AIX)
BOOL mbDPMSWasEnabled;
diff --git a/vcl/inc/wall2.hxx b/vcl/inc/wall2.hxx
index 37cd4fa66812..ec96d905cc7c 100644
--- a/vcl/inc/wall2.hxx
+++ b/vcl/inc/wall2.hxx
@@ -20,14 +20,14 @@
#ifndef INCLUDED_VCL_INC_WALL2_HXX
#define INCLUDED_VCL_INC_WALL2_HXX
-#include <boost/optional.hpp>
+#include <o3tl/optional.hxx>
class ImplWallpaper
{
friend class Wallpaper;
private:
- boost::optional<tools::Rectangle> mpRect;
+ o3tl::optional<tools::Rectangle> mpRect;
std::unique_ptr<BitmapEx> mpBitmap;
std::unique_ptr<Gradient> mpGradient;
std::unique_ptr<BitmapEx> mpCache;
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index ab2e1497b301..970e7c58b0c3 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -31,7 +31,7 @@
#include <o3tl/typed_flags_set.hxx>
#include <cppuhelper/weakref.hxx>
-#include <boost/optional.hpp>
+#include <o3tl/optional.hxx>
#include <list>
#include <memory>
#include <vector>
@@ -97,20 +97,20 @@ bool ImplWindowFrameProc( vcl::Window* pInst, SalEvent nEvent, const void* pEven
struct ImplWinData
{
- boost::optional<OUString>
+ o3tl::optional<OUString>
mpExtOldText;
std::unique_ptr<ExtTextInputAttr[]>
mpExtOldAttrAry;
- boost::optional<tools::Rectangle>
+ o3tl::optional<tools::Rectangle>
mpCursorRect;
long mnCursorExtWidth;
bool mbVertical;
std::unique_ptr<tools::Rectangle[]>
mpCompositionCharRects;
long mnCompositionCharRects;
- boost::optional<tools::Rectangle>
+ o3tl::optional<tools::Rectangle>
mpFocusRect;
- boost::optional<tools::Rectangle>
+ o3tl::optional<tools::Rectangle>
mpTrackRect;
ShowTrackFlags mnTrackFlags;
sal_uInt16 mnIsTopWindow;
@@ -183,9 +183,9 @@ struct ImplFrameData
struct ImplAccessibleInfos
{
sal_uInt16 nAccessibleRole;
- boost::optional<OUString>
+ o3tl::optional<OUString>
pAccessibleName;
- boost::optional<OUString>
+ o3tl::optional<OUString>
pAccessibleDescription;
VclPtr<vcl::Window> pLabeledByWindow;
VclPtr<vcl::Window> pLabelForWindow;
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 21916ee56f13..070e17a742a9 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -651,8 +651,8 @@ void Qt5Frame::StartPresentation(bool bStart)
// meh - so there's no Qt platform independent solution
// https://forum.qt.io/topic/38504/solved-qdialog-in-fullscreen-disable-os-screensaver
#if QT5_USING_X11
- boost::optional<unsigned int> aRootWindow;
- boost::optional<Display*> aDisplay;
+ o3tl::optional<unsigned int> aRootWindow;
+ o3tl::optional<Display*> aDisplay;
if (QX11Info::isPlatformX11())
{
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 18c6f0f536ee..bf50a8150d47 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -199,7 +199,7 @@ struct ImplStyleData
BitmapEx maPersonaHeaderBitmap; ///< Cache the header bitmap.
BitmapEx maPersonaFooterBitmap; ///< Cache the footer bitmap.
- boost::optional<Color> maPersonaMenuBarTextColor; ///< Cache the menubar color.
+ o3tl::optional<Color> maPersonaMenuBarTextColor; ///< Cache the menubar color.
};
struct ImplMiscData
@@ -2098,7 +2098,7 @@ enum WhichPersona { PERSONA_HEADER, PERSONA_FOOTER };
}
/** Update the setting of the Persona header / footer in ImplStyleData */
-static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFooter, BitmapEx& rHeaderFooterBitmap, boost::optional<Color>& rMenuBarTextColor )
+static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFooter, BitmapEx& rHeaderFooterBitmap, o3tl::optional<Color>& rMenuBarTextColor )
{
uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
if ( !xContext.is() )
@@ -2191,7 +2191,7 @@ BitmapEx const & StyleSettings::GetPersonaFooter() const
return mxData->maPersonaFooterBitmap;
}
-const boost::optional<Color>& StyleSettings::GetPersonaMenuBarTextColor() const
+const o3tl::optional<Color>& StyleSettings::GetPersonaMenuBarTextColor() const
{
GetPersonaHeader();
return mxData->maPersonaMenuBarTextColor;
diff --git a/vcl/source/control/quickselectionengine.cxx b/vcl/source/control/quickselectionengine.cxx
index aff324a4eb65..5b76b0352872 100644
--- a/vcl/source/control/quickselectionengine.cxx
+++ b/vcl/source/control/quickselectionengine.cxx
@@ -25,7 +25,7 @@
#include <vcl/settings.hxx>
#include <sal/log.hxx>
-#include <boost/optional.hpp>
+#include <o3tl/optional.hxx>
namespace vcl
{
@@ -34,7 +34,7 @@ namespace vcl
{
ISearchableStringList& rEntryList;
OUString sCurrentSearchString;
- ::boost::optional< sal_Unicode > aSingleSearchChar;
+ ::o3tl::optional< sal_Unicode > aSingleSearchChar;
Timer aSearchTimeout;
explicit QuickSelectionEngine_Data( ISearchableStringList& _entryList )
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index c0c0c709e8a2..8c428653c1e9 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -2601,8 +2601,8 @@ append(std::bitset<N> & rSet, size_t const nOffset, sal_uInt32 const nValue)
}
bool getTTCoverage(
- boost::optional<std::bitset<UnicodeCoverage::MAX_UC_ENUM>> &rUnicodeRange,
- boost::optional<std::bitset<CodePageCoverage::MAX_CP_ENUM>> &rCodePageRange,
+ o3tl::optional<std::bitset<UnicodeCoverage::MAX_UC_ENUM>> &rUnicodeRange,
+ o3tl::optional<std::bitset<CodePageCoverage::MAX_CP_ENUM>> &rCodePageRange,
const unsigned char* pTable, size_t nLength)
{
bool bRet = false;
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 2ffb60b4999b..65da95ac09bf 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -57,7 +57,7 @@
#include <svdata.hxx>
#include <bitmaps.hlst>
-#include <boost/optional.hpp>
+#include <o3tl/optional.hxx>
#include <algorithm>
diff --git a/vcl/unx/generic/window/screensaverinhibitor.cxx b/vcl/unx/generic/window/screensaverinhibitor.cxx
index 87dd4ab3df7f..8c84a3ae5345 100644
--- a/vcl/unx/generic/window/screensaverinhibitor.cxx
+++ b/vcl/unx/generic/window/screensaverinhibitor.cxx
@@ -47,7 +47,7 @@
#include <sal/log.hxx>
void ScreenSaverInhibitor::inhibit( bool bInhibit, const OUString& sReason,
- bool bIsX11, const boost::optional<unsigned int>& xid, boost::optional<Display*> pDisplay )
+ bool bIsX11, const o3tl::optional<unsigned int>& xid, o3tl::optional<Display*> pDisplay )
{
const char* appname = SalGenericSystem::getFrameClassName();
const OString aReason = OUStringToOString( sReason, RTL_TEXTENCODING_UTF8 );
@@ -77,7 +77,7 @@ static void dbusInhibit( bool bInhibit,
const gchar* service, const gchar* path, const gchar* interface,
const std::function<GVariant*( GDBusProxy*, GError*& )>& fInhibit,
const std::function<GVariant*( GDBusProxy*, const guint, GError*& )>& fUnInhibit,
- boost::optional<guint>& rCookie )
+ o3tl::optional<guint>& rCookie )
{
if ( ( !bInhibit && !rCookie ) ||
( bInhibit && rCookie ) )
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 0d1348b8e551..91df150c26cf 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1888,8 +1888,8 @@ void GtkSalFrame::ShowFullScreen( bool bFullScreen, sal_Int32 nScreen )
void GtkSalFrame::StartPresentation( bool bStart )
{
- boost::optional<guint> aWindow;
- boost::optional<Display*> aDisplay;
+ o3tl::optional<guint> aWindow;
+ o3tl::optional<Display*> aDisplay;
if( getDisplay()->IsX11Display() )
{
aWindow = widget_get_xid(m_pWindow);
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 8a2e998f4e74..3e2b92568c5b 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -23,7 +23,7 @@
#include <unx/fontmanager.hxx>
#include "cairo_gtk3_cairo.hxx"
-#include <boost/optional.hpp>
+#include <o3tl/optional.hxx>
GtkStyleContext* GtkSalGraphics::mpWindowStyle = nullptr;
GtkStyleContext* GtkSalGraphics::mpButtonStyle = nullptr;
diff --git a/vcl/unx/kf5/KF5SalFrame.cxx b/vcl/unx/kf5/KF5SalFrame.cxx
index a212759aeb91..ba34839a1291 100644
--- a/vcl/unx/kf5/KF5SalFrame.cxx
+++ b/vcl/unx/kf5/KF5SalFrame.cxx
@@ -40,7 +40,7 @@
#include <svdata.hxx>
-#include <boost/optional.hpp>
+#include <o3tl/optional.hxx>
KF5SalFrame::KF5SalFrame(KF5SalFrame* pParent, SalFrameStyleFlags nState, bool bUseCairo)
: Qt5Frame(pParent, nState, bUseCairo)
diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx
index 41189555e55a..d0d0a07b8105 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -51,7 +51,7 @@
#include <map>
#include <string>
-#include <boost/optional.hpp>
+#include <o3tl/optional.hxx>
#include <ControlCacheKey.hxx>
using namespace std;
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 944acf6cd52d..b9e3b7026a81 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2648,7 +2648,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
aStyleSettings.SetUseFlatBorders( false );
aStyleSettings.SetUseFlatMenus( false );
aStyleSettings.SetMenuTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) );
- if ( boost::optional<Color> aColor = aStyleSettings.GetPersonaMenuBarTextColor() )
+ if ( o3tl::optional<Color> aColor = aStyleSettings.GetPersonaMenuBarTextColor() )
{
aStyleSettings.SetMenuBarTextColor( *aColor );
aStyleSettings.SetMenuBarRolloverTextColor( *aColor );