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 /sc/source/filter | |
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 'sc/source/filter')
-rw-r--r-- | sc/source/filter/excel/xepivot.cxx | 8 | ||||
-rw-r--r-- | sc/source/filter/excel/xepivotxml.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xlpivot.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/html/htmlpars.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/inc/eeparser.hxx | 8 | ||||
-rw-r--r-- | sc/source/filter/inc/lotfntbf.hxx | 4 | ||||
-rw-r--r-- | sc/source/filter/inc/xlpivot.hxx | 4 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLExportDataPilot.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLExportDataPilot.hxx | 4 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLStylesImportHelper.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLStylesImportHelper.hxx | 16 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLTableShapeImportHelper.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcelli.hxx | 14 |
14 files changed, 46 insertions, 46 deletions
diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx index 33d0a8aa2200..30c973abda8e 100644 --- a/sc/source/filter/excel/xepivot.cxx +++ b/sc/source/filter/excel/xepivot.cxx @@ -922,7 +922,7 @@ void XclExpPTItem::SetPropertiesFromMember( const ScDPSaveMember& rSaveMem ) ::set_flag( maItemInfo.mnFlags, EXC_SXVI_HIDEDETAIL, rSaveMem.HasShowDetails() && !rSaveMem.GetShowDetails() ); // visible name - const o3tl::optional<OUString> & pVisName = rSaveMem.GetLayoutName(); + const std::optional<OUString> & pVisName = rSaveMem.GetLayoutName(); if (pVisName && *pVisName != GetItemName()) maItemInfo.SetVisName(*pVisName); } @@ -1005,11 +1005,11 @@ void XclExpPTField::SetPropertiesFromDim( const ScDPSaveDimension& rSaveDim ) ::set_flag( maFieldExtInfo.mnFlags, EXC_SXVDEX_SHOWALL, rSaveDim.HasShowEmpty() && rSaveDim.GetShowEmpty() ); // visible name - const o3tl::optional<OUString> & pLayoutName = rSaveDim.GetLayoutName(); + const std::optional<OUString> & pLayoutName = rSaveDim.GetLayoutName(); if (pLayoutName && *pLayoutName != GetFieldName()) maFieldInfo.SetVisName(*pLayoutName); - const o3tl::optional<OUString> & pSubtotalName = rSaveDim.GetSubtotalName(); + const std::optional<OUString> & pSubtotalName = rSaveDim.GetSubtotalName(); if (pSubtotalName) { OUString aSubName = lcl_convertCalcSubtotalName(*pSubtotalName); @@ -1076,7 +1076,7 @@ void XclExpPTField::SetDataPropertiesFromDim( const ScDPSaveDimension& rSaveDim rDataInfo.SetApiAggFunc( eFunc ); // visible name - const o3tl::optional<OUString> & pVisName = rSaveDim.GetLayoutName(); + const std::optional<OUString> & pVisName = rSaveDim.GetLayoutName(); if (pVisName) rDataInfo.SetVisName(*pVisName); else diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index 8bb77f5eb1a0..91958bbf82a4 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -1121,7 +1121,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP long nDimIdx = rDataField.mnPos; assert(aCachedDims[nDimIdx]); // the loop above should have screened for NULL's. const ScDPSaveDimension& rDim = *rDataField.mpDim; - o3tl::optional<OUString> pName = rDim.GetLayoutName(); + std::optional<OUString> pName = rDim.GetLayoutName(); // tdf#124651: despite being optional in CT_DataField according to ECMA-376 Part 1, // Excel (at least 2016) seems to insist on the presence of "name" attribute in // dataField element. diff --git a/sc/source/filter/excel/xlpivot.cxx b/sc/source/filter/excel/xlpivot.cxx index c2d07ffa3dd7..d0f9df3d4fe1 100644 --- a/sc/source/filter/excel/xlpivot.cxx +++ b/sc/source/filter/excel/xlpivot.cxx @@ -994,7 +994,7 @@ void XclPTViewEx9Info::Init( const ScDPObject& rDPObj ) const ScDPSaveData* pData = rDPObj.GetSaveData(); if (pData) { - const o3tl::optional<OUString> & pGrandTotal = pData->GetGrandTotalName(); + const std::optional<OUString> & pGrandTotal = pData->GetGrandTotalName(); if (pGrandTotal) maGrandTotalName = *pGrandTotal; } diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index a1ccfb6e4ded..8e4a1dd6d63d 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -2058,7 +2058,7 @@ void ScHTMLTable::DataOn( const HtmlImportInfo& rInfo ) { // read needed options from the <td> tag ScHTMLSize aSpanSize( 1, 1 ); - o3tl::optional<OUString> pValStr, pNumStr; + std::optional<OUString> pValStr, pNumStr; const HTMLOptions& rOptions = static_cast<HTMLParser*>(rInfo.pParser)->GetOptions(); sal_uInt32 nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND; for (const auto& rOption : rOptions) diff --git a/sc/source/filter/inc/eeparser.hxx b/sc/source/filter/inc/eeparser.hxx index 90fe0960a810..dbd0cbd56137 100644 --- a/sc/source/filter/inc/eeparser.hxx +++ b/sc/source/filter/inc/eeparser.hxx @@ -24,7 +24,7 @@ #include <vcl/graph.hxx> #include <svl/itemset.hxx> #include <editeng/editdata.hxx> -#include <o3tl/optional.hxx> +#include <optional> #include <address.hxx> #include <memory> #include <vector> @@ -52,11 +52,11 @@ struct ScEEParseEntry { SfxItemSet aItemSet; ESelection aSel; // Selection in EditEngine - o3tl::optional<OUString> + std::optional<OUString> pValStr; // HTML possibly SDVAL string - o3tl::optional<OUString> + std::optional<OUString> pNumStr; // HTML possibly SDNUM string - o3tl::optional<OUString> + std::optional<OUString> pName; // HTML possibly anchor/RangeName OUString aAltText; // HTML IMG ALT Text std::vector< std::unique_ptr<ScHTMLImage> > maImageList; // graphics in this cell diff --git a/sc/source/filter/inc/lotfntbf.hxx b/sc/source/filter/inc/lotfntbf.hxx index 8fa9a5c56522..4483b645a643 100644 --- a/sc/source/filter/inc/lotfntbf.hxx +++ b/sc/source/filter/inc/lotfntbf.hxx @@ -22,7 +22,7 @@ #include <editeng/fontitem.hxx> #include <editeng/fhgtitem.hxx> -#include <o3tl/optional.hxx> +#include <optional> // Code in fontbuff.cxx (excel) @@ -31,7 +31,7 @@ class LotusFontBuffer private: struct ENTRY { - o3tl::optional<OUString> xTmpName; + std::optional<OUString> xTmpName; std::unique_ptr<SvxFontItem> pFont; std::unique_ptr<SvxFontHeightItem> pHeight; sal_Int32 nType = -1; // < 0 -> undefined diff --git a/sc/source/filter/inc/xlpivot.hxx b/sc/source/filter/inc/xlpivot.hxx index c0df275cab24..2e784cef8d42 100644 --- a/sc/source/filter/inc/xlpivot.hxx +++ b/sc/source/filter/inc/xlpivot.hxx @@ -26,7 +26,7 @@ #include "xladdress.hxx" #include <dpobject.hxx> -#include <o3tl/optional.hxx> +#include <optional> class XclImpStream; class XclExpStream; @@ -624,7 +624,7 @@ struct XclPTFieldExtInfo sal_uInt16 mnSortField; /// Index to data field sorting bases on. sal_uInt16 mnShowField; /// Index to data field AutoShow bases on. sal_uInt16 mnNumFmt; - o3tl::optional<OUString> mpFieldTotalName; + std::optional<OUString> mpFieldTotalName; explicit XclPTFieldExtInfo(); diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx index fdf042f7ad4b..67d365cb2126 100644 --- a/sc/source/filter/xml/XMLExportDataPilot.cxx +++ b/sc/source/filter/xml/XMLExportDataPilot.cxx @@ -431,7 +431,7 @@ void ScXMLExportDataPilot::WriteLayoutInfo(const ScDPSaveDimension* pDim) void ScXMLExportDataPilot::WriteSubTotals(const ScDPSaveDimension* pDim) { sal_Int32 nSubTotalCount = pDim->GetSubTotalsCount(); - o3tl::optional<OUString> pLayoutName; + std::optional<OUString> pLayoutName; if (rExport.getDefaultVersion() > SvtSaveOptions::ODFVER_012) // Export display names only for 1.2 extended or later. pLayoutName = pDim->GetSubtotalName(); @@ -467,7 +467,7 @@ void ScXMLExportDataPilot::WriteMembers(const ScDPSaveDimension* pDim) if (rExport.getDefaultVersion() > SvtSaveOptions::ODFVER_012) { // Export display names only for ODF 1.2 extended or later. - const o3tl::optional<OUString> & pLayoutName = rpMember->GetLayoutName(); + const std::optional<OUString> & pLayoutName = rpMember->GetLayoutName(); if (pLayoutName) rExport.AddAttribute(XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, *pLayoutName); } @@ -678,7 +678,7 @@ void ScXMLExportDataPilot::WriteDimension(const ScDPSaveDimension* pDim, const S if (rExport.getDefaultVersion() > SvtSaveOptions::ODFVER_012) { // Export display names only for ODF 1.2 extended or later. - const o3tl::optional<OUString> & pLayoutName = pDim->GetLayoutName(); + const std::optional<OUString> & pLayoutName = pDim->GetLayoutName(); if (pLayoutName) rExport.AddAttribute(XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, *pLayoutName); } @@ -724,7 +724,7 @@ void ScXMLExportDataPilot::WriteDimensions(const ScDPSaveData* pDPSave) } } -void ScXMLExportDataPilot::WriteGrandTotal(::xmloff::token::XMLTokenEnum eOrient, bool bVisible, const o3tl::optional<OUString> & pGrandTotal) +void ScXMLExportDataPilot::WriteGrandTotal(::xmloff::token::XMLTokenEnum eOrient, bool bVisible, const std::optional<OUString> & pGrandTotal) { rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY, bVisible ? XML_TRUE : XML_FALSE); rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ORIENTATION, eOrient); @@ -812,7 +812,7 @@ void ScXMLExportDataPilot::WriteDataPilots() // grand total elements. - const o3tl::optional<OUString> & pGrandTotalName = pDPSave->GetGrandTotalName(); + const std::optional<OUString> & pGrandTotalName = pDPSave->GetGrandTotalName(); if (pGrandTotalName && rExport.getDefaultVersion() > SvtSaveOptions::ODFVER_012) { // Use the new data-pilot-grand-total element. diff --git a/sc/source/filter/xml/XMLExportDataPilot.hxx b/sc/source/filter/xml/XMLExportDataPilot.hxx index 806e270028ec..8e0d0affcd76 100644 --- a/sc/source/filter/xml/XMLExportDataPilot.hxx +++ b/sc/source/filter/xml/XMLExportDataPilot.hxx @@ -22,7 +22,7 @@ #include <sal/config.h> -#include <o3tl/optional.hxx> +#include <optional> #include <rtl/ustring.hxx> #include <global.hxx> @@ -65,7 +65,7 @@ class ScXMLExportDataPilot void WriteDimension(const ScDPSaveDimension* pDim, const ScDPDimensionSaveData* pDimData); void WriteDimensions(const ScDPSaveData* pDPSave); - void WriteGrandTotal(::xmloff::token::XMLTokenEnum eOrient, bool bVisible, const o3tl::optional<OUString> & pGrandTotal); + void WriteGrandTotal(::xmloff::token::XMLTokenEnum eOrient, bool bVisible, const std::optional<OUString> & pGrandTotal); public: explicit ScXMLExportDataPilot(ScXMLExport& rExport); diff --git a/sc/source/filter/xml/XMLStylesImportHelper.cxx b/sc/source/filter/xml/XMLStylesImportHelper.cxx index 21fb889e8e43..e7dffa697e36 100644 --- a/sc/source/filter/xml/XMLStylesImportHelper.cxx +++ b/sc/source/filter/xml/XMLStylesImportHelper.cxx @@ -109,7 +109,7 @@ void ScMyStyleRanges::AddRange(const ScRange& rRange, const sal_Int16 nType) } } -void ScMyStyleRanges::AddCurrencyRange(const ScRange& rRange, const o3tl::optional<OUString> & pCurrency) +void ScMyStyleRanges::AddCurrencyRange(const ScRange& rRange, const std::optional<OUString> & pCurrency) { if (!pCurrencyList) pCurrencyList.reset( new ScMyCurrencyStylesSet ); @@ -327,8 +327,8 @@ void ScMyStylesImportHelper::SetRowStyle(const OUString& sStyleName) aRowDefaultStyle = GetIterator(sStyleName); } -void ScMyStylesImportHelper::SetAttributes(o3tl::optional<OUString> pStyleNameP, - o3tl::optional<OUString> pCurrencyP, const sal_Int16 nCellTypeP) +void ScMyStylesImportHelper::SetAttributes(std::optional<OUString> pStyleNameP, + std::optional<OUString> pCurrencyP, const sal_Int16 nCellTypeP) { pStyleName = std::move(pStyleNameP); pCurrency = std::move(pCurrencyP); diff --git a/sc/source/filter/xml/XMLStylesImportHelper.hxx b/sc/source/filter/xml/XMLStylesImportHelper.hxx index 4a8748ad12ff..45ac02b9a8fd 100644 --- a/sc/source/filter/xml/XMLStylesImportHelper.hxx +++ b/sc/source/filter/xml/XMLStylesImportHelper.hxx @@ -29,7 +29,7 @@ #include <set> #include <map> #include <vector> -#include <o3tl/optional.hxx> +#include <optional> class ScXMLImport; @@ -101,7 +101,7 @@ public: ScMyStyleRanges(); ~ScMyStyleRanges(); void AddRange(const ScRange& rRange, const sal_Int16 nType); - void AddCurrencyRange(const ScRange& rRange, const o3tl::optional<OUString> & pCurrency); + void AddCurrencyRange(const ScRange& rRange, const std::optional<OUString> & pCurrency); void InsertCol(const sal_Int32 nCol, const sal_Int32 nTab); void SetStylesToRanges(const OUString* pStyleName, ScXMLImport& rImport); }; @@ -115,13 +115,13 @@ class ScMyStylesImportHelper std::vector<ScMyStylesMap::iterator> aColDefaultStyles; ScMyStylesMap::iterator aRowDefaultStyle; ScXMLImport& rImport; - o3tl::optional<OUString> + std::optional<OUString> pStyleName; - o3tl::optional<OUString> + std::optional<OUString> pPrevStyleName; - o3tl::optional<OUString> + std::optional<OUString> pCurrency; - o3tl::optional<OUString> + std::optional<OUString> pPrevCurrency; ScRange aPrevRange; sal_Int16 nCellType; @@ -138,8 +138,8 @@ public: ~ScMyStylesImportHelper(); void AddColumnStyle(const OUString& rStyleName, const sal_Int32 nColumn, const sal_Int32 nRepeat); void SetRowStyle(const OUString& rStyleName); - void SetAttributes(o3tl::optional<OUString> pStyleName, - o3tl::optional<OUString> pCurrency, const sal_Int16 nCellType); + void SetAttributes(std::optional<OUString> pStyleName, + std::optional<OUString> pCurrency, const sal_Int16 nCellType); void AddRange(const ScRange& rRange); void AddCell(const ScAddress& rAddress); void InsertCol(const sal_Int32 nCol, const sal_Int32 nTab); // a col is inserted before nCol diff --git a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx index 64260d2c3e58..7c5d1d8c2c0b 100644 --- a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx +++ b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx @@ -94,7 +94,7 @@ void XMLTableShapeImportHelper::finishShape( sal_Int32 nEndX(-1); sal_Int32 nEndY(-1); sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - o3tl::optional<OUString> xRangeList; + std::optional<OUString> xRangeList; SdrLayerID nLayerID = SDRLAYER_NOTFOUND; for( sal_Int16 i=0; i < nAttrCount; ++i ) { diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 7baff729c77b..353bdb429f18 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -144,8 +144,8 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport, rXMLImport.GetTables().AddColumn(bTempIsCovered); - o3tl::optional<OUString> xStyleName; - o3tl::optional<OUString> xCurrencySymbol; + std::optional<OUString> xStyleName; + std::optional<OUString> xCurrencySymbol; if ( rAttrList.is() ) { for (auto &it : *rAttrList) @@ -1028,7 +1028,7 @@ void ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const } void ScXMLTableRowCellContext::PutTextCell( const ScAddress& rCurrentPos, - const SCCOL nCurrentCol, const ::o3tl::optional< OUString >& pOUText ) + const SCCOL nCurrentCol, const ::std::optional< OUString >& pOUText ) { ScDocument* pDoc = rXMLImport.GetDocument(); bool bDoIncrement = true; @@ -1167,7 +1167,7 @@ bool isEmptyOrNote( const ScDocument* pDoc, const ScAddress& rCurrentPos ) } void ScXMLTableRowCellContext::AddTextAndValueCell( const ScAddress& rCellPos, - const ::o3tl::optional< OUString >& pOUText, ScAddress& rCurrentPos ) + const ::std::optional< OUString >& pOUText, ScAddress& rCurrentPos ) { ScDocument* pDoc = rXMLImport.GetDocument(); ScMyTables& rTables = rXMLImport.GetTables(); @@ -1303,7 +1303,7 @@ OUString getOutputString( ScDocument* pDoc, const ScAddress& aCellPos ) void ScXMLTableRowCellContext::AddNonFormulaCell( const ScAddress& rCellPos ) { - ::o3tl::optional< OUString > pOUText; + ::std::optional< OUString > pOUText; ScDocument* pDoc = rXMLImport.GetDocument(); if( nCellType == util::NumberFormat::TEXT ) diff --git a/sc/source/filter/xml/xmlcelli.hxx b/sc/source/filter/xml/xmlcelli.hxx index eefeb8ead221..f1ce2e1b6bd6 100644 --- a/sc/source/filter/xml/xmlcelli.hxx +++ b/sc/source/filter/xml/xmlcelli.hxx @@ -25,7 +25,7 @@ #include <svl/itemset.hxx> #include <editeng/editdata.hxx> -#include <o3tl/optional.hxx> +#include <optional> #include <memory> #include <vector> @@ -62,10 +62,10 @@ class ScXMLTableRowCellContext : public ScXMLImportContext typedef std::vector<std::unique_ptr<Field> > FieldsType; typedef std::pair<OUString, OUString> FormulaWithNamespace; - o3tl::optional<FormulaWithNamespace> maFormula; /// table:formula attribute - o3tl::optional<OUString> maStringValue; /// office:string-value attribute - o3tl::optional<OUString> maContentValidationName; - o3tl::optional<OUString> maFirstParagraph; /// unformatted first paragraph, for better performance. + std::optional<FormulaWithNamespace> maFormula; /// table:formula attribute + std::optional<OUString> maStringValue; /// office:string-value attribute + std::optional<OUString> maContentValidationName; + std::optional<OUString> maFirstParagraph; /// unformatted first paragraph, for better performance. ScEditEngineDefaulter* mpEditEngine; OUStringBuffer maParagraph{32}; @@ -109,10 +109,10 @@ class ScXMLTableRowCellContext : public ScXMLImportContext void SetFormulaCell ( ScFormulaCell* pFCell ) const; void PutTextCell ( const ScAddress& rScCurrentPos, const SCCOL nCurrentCol, - const ::o3tl::optional< OUString >& pOUText ); + const ::std::optional< OUString >& pOUText ); void PutValueCell ( const ScAddress& rScCurrentPos ); void AddTextAndValueCell ( const ScAddress& rScCellPos, - const ::o3tl::optional< OUString >& pOUText, ScAddress& rScCurrentPos ); + const ::std::optional< OUString >& pOUText, ScAddress& rScCurrentPos ); void AddNonFormulaCell ( const ScAddress& rScCellPos ); void PutFormulaCell ( const ScAddress& rScCurrentPos ); void AddFormulaCell ( const ScAddress& rScCellPos ); |