summaryrefslogtreecommitdiff
path: root/sw/source/filter/xml/xmltble.cxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-09-14 13:28:26 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-09-14 16:52:29 +0200
commit76342be56ee1ec52a27cf867760c2485ac4fd291 (patch)
tree9fe60bece721a0966bb0c3a6fb7105f96a92ba38 /sw/source/filter/xml/xmltble.cxx
parentb8914154f5f24c429633d6ec1c5762e50ebe80d2 (diff)
try_emplace is a bit more efficient
It doesn't create the value_type when key exists. Change-Id: I9b45bf6b1db9a53dedf02f403f20d3eefbd0f714 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139922 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/source/filter/xml/xmltble.cxx')
-rw-r--r--sw/source/filter/xml/xmltble.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx
index 2bb7a564a48a..e6cbbcaea693 100644
--- a/sw/source/filter/xml/xmltble.cxx
+++ b/sw/source/filter/xml/xmltble.cxx
@@ -210,7 +210,7 @@ public:
// empty styles have not to be exported
if( !pFrameSize && !pBrush && !pRowSplit && !pHasTextChangesOnly )
{
- m_rFormatMap.emplace(&rFrameFormat, ::std::optional<OUString>()); // empty just to enable assert
+ m_rFormatMap.try_emplace(&rFrameFormat); // empty just to enable assert
return {};
}
@@ -293,13 +293,13 @@ public:
// found!
auto const oName(m_rFormatMap.find(pTestFormat)->second);
assert(oName);
- m_rFormatMap.emplace(&rFrameFormat, oName);
+ m_rFormatMap.try_emplace(&rFrameFormat, oName);
return {};
}
{
OUString const name(OUString::Concat(rNamePrefix) + "." + OUString::number(nLine+1));
- m_rFormatMap.emplace(&rFrameFormat, ::std::optional<OUString>(name));
+ m_rFormatMap.try_emplace(&rFrameFormat, name);
if ( i != m_aFormatList.end() ) ++i;
m_aFormatList.insert( i, &rFrameFormat );
return ::std::optional<OUString>(name);
@@ -338,7 +338,7 @@ static OUString lcl_xmltble_appendBoxPrefix(std::u16string_view rNamePrefix,
// empty styles have not to be exported
if( !pVertOrient && !pBrush && !pBox && !pNumFormat && !pFrameDir && !pAttCnt )
{
- m_rFormatMap.emplace(&rFrameFormat, ::std::optional<OUString>()); // empty just to enable assert
+ m_rFormatMap.try_emplace(&rFrameFormat); // empty just to enable assert
return {};
}
@@ -465,13 +465,13 @@ static OUString lcl_xmltble_appendBoxPrefix(std::u16string_view rNamePrefix,
// found!
auto const oName(m_rFormatMap.find(pTestFormat)->second);
assert(oName);
- m_rFormatMap.emplace(&rFrameFormat, oName);
+ m_rFormatMap.try_emplace(&rFrameFormat, oName);
return {};
}
{
OUString const name(lcl_xmltble_appendBoxPrefix(rNamePrefix, nCol, nRow, bTop));
- m_rFormatMap.emplace(&rFrameFormat, ::std::optional<OUString>(name));
+ m_rFormatMap.try_emplace(&rFrameFormat, name);
if ( i != m_aFormatList.end() ) ++i;
m_aFormatList.insert( i, &rFrameFormat );
return ::std::optional<OUString>(name);
@@ -1230,7 +1230,7 @@ void SwXMLTextParagraphExport::exportTable(
&& (bExportStyles || !pFormat->GetDoc()->IsInHeaderFooter(*pTableNd)))
{
maTableNodes.push_back(pTableNd);
- m_TableFormats.emplace(pTableNd, ::std::make_pair(SwXMLTextParagraphExport::FormatMap(), SwXMLTextParagraphExport::FormatMap()));
+ m_TableFormats.try_emplace(pTableNd);
// Collect all tables inside cells of this table, too
CollectTableLinesAutoStyles(pTable->GetTabLines(), *pFormat, _bProgress);
}