emplace_back: use perfect forwarding if possible
When using that new-ish method, try giving the compiler a chance to construct in-place. Left out harder cases using initializer lists, and might have missed slightly less obvious places. Change-Id: Ifcc3a6d4599474457e37dd17a35c41fc73e7a17e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111980 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
This commit is contained in:
@@ -170,7 +170,7 @@ namespace dbaui
|
||||
OUString sDecodedURL = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
|
||||
|
||||
m_xControl->append_text(sTitle);
|
||||
m_aURLs.emplace_back(StringPair(sDecodedURL, sFilter));
|
||||
m_aURLs.emplace_back(sDecodedURL, sFilter);
|
||||
}
|
||||
}
|
||||
catch( Exception& ) {}
|
||||
|
||||
@@ -800,15 +800,15 @@ std::unique_ptr<SfxStyleFamilies> SdModule::CreateStyleFamilies()
|
||||
{
|
||||
std::unique_ptr<SfxStyleFamilies> pStyleFamilies(new SfxStyleFamilies);
|
||||
|
||||
pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Para,
|
||||
SdResId(STR_GRAPHICS_STYLE_FAMILY),
|
||||
BMP_STYLES_FAMILY_GRAPHICS,
|
||||
RID_GRAPHICSTYLEFAMILY, SD_MOD()->GetResLocale()));
|
||||
pStyleFamilies->emplace_back(SfxStyleFamily::Para,
|
||||
SdResId(STR_GRAPHICS_STYLE_FAMILY),
|
||||
BMP_STYLES_FAMILY_GRAPHICS,
|
||||
RID_GRAPHICSTYLEFAMILY, SD_MOD()->GetResLocale());
|
||||
|
||||
pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Pseudo,
|
||||
SdResId(STR_PRESENTATIONS_STYLE_FAMILY),
|
||||
BMP_STYLES_FAMILY_PRESENTATIONS,
|
||||
RID_PRESENTATIONSTYLEFAMILY, SD_MOD()->GetResLocale()));
|
||||
pStyleFamilies->emplace_back(SfxStyleFamily::Pseudo,
|
||||
SdResId(STR_PRESENTATIONS_STYLE_FAMILY),
|
||||
BMP_STYLES_FAMILY_PRESENTATIONS,
|
||||
RID_PRESENTATIONSTYLEFAMILY, SD_MOD()->GetResLocale());
|
||||
|
||||
return pStyleFamilies;
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ void SAL_CALL SfxClassificationParser::startElement(const OUString& rName, const
|
||||
OUString aIdentifier = xAttribs->getValueByName("Identifier");
|
||||
|
||||
// Create a new category and initialize it with the data that's true for all categories.
|
||||
m_aCategories.emplace_back(SfxClassificationCategory());
|
||||
m_aCategories.emplace_back();
|
||||
SfxClassificationCategory& rCategory = m_aCategories.back();
|
||||
|
||||
rCategory.m_aName = aName;
|
||||
|
||||
@@ -268,7 +268,7 @@ sw::WriterMultiListener::~WriterMultiListener()
|
||||
void sw::WriterMultiListener::StartListening(SwModify* pDepend)
|
||||
{
|
||||
EndListening(nullptr);
|
||||
m_vDepends.emplace_back(ListenerEntry(&m_rToTell, pDepend));
|
||||
m_vDepends.emplace_back(&m_rToTell, pDepend);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ OString RtfStringBuffer::makeStringAndClear()
|
||||
OStringBuffer& RtfStringBuffer::getLastBuffer()
|
||||
{
|
||||
if (m_aValues.empty() || m_aValues.back().isGraphic())
|
||||
m_aValues.emplace_back(RtfStringBufferValue());
|
||||
m_aValues.emplace_back();
|
||||
return m_aValues.back().getBuffer();
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ void RtfStringBuffer::clear() { m_aValues.clear(); }
|
||||
|
||||
void RtfStringBuffer::append(const SwFlyFrameFormat* pFlyFrameFormat, const SwGrfNode* pGrfNode)
|
||||
{
|
||||
m_aValues.emplace_back(RtfStringBufferValue(pFlyFrameFormat, pGrfNode));
|
||||
m_aValues.emplace_back(pFlyFrameFormat, pGrfNode);
|
||||
}
|
||||
|
||||
void RtfStringBuffer::appendAndClear(RtfStringBuffer& rBuf)
|
||||
|
||||
@@ -345,35 +345,35 @@ std::unique_ptr<SfxStyleFamilies> SwModule::CreateStyleFamilies()
|
||||
{
|
||||
std::unique_ptr<SfxStyleFamilies> pStyleFamilies(new SfxStyleFamilies);
|
||||
|
||||
pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Para,
|
||||
SwResId(STR_PARAGRAPHSTYLEFAMILY),
|
||||
BMP_STYLES_FAMILY_PARA,
|
||||
RID_PARAGRAPHSTYLEFAMILY, GetResLocale()));
|
||||
pStyleFamilies->emplace_back(SfxStyleFamily::Para,
|
||||
SwResId(STR_PARAGRAPHSTYLEFAMILY),
|
||||
BMP_STYLES_FAMILY_PARA,
|
||||
RID_PARAGRAPHSTYLEFAMILY, GetResLocale());
|
||||
|
||||
pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Char,
|
||||
SwResId(STR_CHARACTERSTYLEFAMILY),
|
||||
BMP_STYLES_FAMILY_CHAR,
|
||||
RID_CHARACTERSTYLEFAMILY, GetResLocale()));
|
||||
pStyleFamilies->emplace_back(SfxStyleFamily::Char,
|
||||
SwResId(STR_CHARACTERSTYLEFAMILY),
|
||||
BMP_STYLES_FAMILY_CHAR,
|
||||
RID_CHARACTERSTYLEFAMILY, GetResLocale());
|
||||
|
||||
pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Frame,
|
||||
SwResId(STR_FRAMESTYLEFAMILY),
|
||||
BMP_STYLES_FAMILY_FRAME,
|
||||
RID_FRAMESTYLEFAMILY, GetResLocale()));
|
||||
pStyleFamilies->emplace_back(SfxStyleFamily::Frame,
|
||||
SwResId(STR_FRAMESTYLEFAMILY),
|
||||
BMP_STYLES_FAMILY_FRAME,
|
||||
RID_FRAMESTYLEFAMILY, GetResLocale());
|
||||
|
||||
pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Page,
|
||||
SwResId(STR_PAGESTYLEFAMILY),
|
||||
BMP_STYLES_FAMILY_PAGE,
|
||||
RID_PAGESTYLEFAMILY, GetResLocale()));
|
||||
pStyleFamilies->emplace_back(SfxStyleFamily::Page,
|
||||
SwResId(STR_PAGESTYLEFAMILY),
|
||||
BMP_STYLES_FAMILY_PAGE,
|
||||
RID_PAGESTYLEFAMILY, GetResLocale());
|
||||
|
||||
pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Pseudo,
|
||||
SwResId(STR_LISTSTYLEFAMILY),
|
||||
BMP_STYLES_FAMILY_LIST,
|
||||
RID_LISTSTYLEFAMILY, GetResLocale()));
|
||||
pStyleFamilies->emplace_back(SfxStyleFamily::Pseudo,
|
||||
SwResId(STR_LISTSTYLEFAMILY),
|
||||
BMP_STYLES_FAMILY_LIST,
|
||||
RID_LISTSTYLEFAMILY, GetResLocale());
|
||||
|
||||
pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Table,
|
||||
SwResId(STR_TABLESTYLEFAMILY),
|
||||
BMP_STYLES_FAMILY_TABLE,
|
||||
RID_TABLESTYLEFAMILY, GetResLocale()));
|
||||
pStyleFamilies->emplace_back(SfxStyleFamily::Table,
|
||||
SwResId(STR_TABLESTYLEFAMILY),
|
||||
BMP_STYLES_FAMILY_TABLE,
|
||||
RID_TABLESTYLEFAMILY, GetResLocale());
|
||||
|
||||
return pStyleFamilies;
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ void SwView_Impl::AddTransferable(SwTransferable& rTransferable)
|
||||
return !xTunnel.is();
|
||||
}), mxTransferables.end());
|
||||
|
||||
mxTransferables.emplace_back(uno::Reference<lang::XUnoTunnel>(&rTransferable));
|
||||
mxTransferables.emplace_back(&rTransferable);
|
||||
}
|
||||
osl_atomic_decrement(&rTransferable.m_refCount);
|
||||
}
|
||||
|
||||
@@ -39,10 +39,10 @@ static void ImplInitMsgBoxImageList()
|
||||
std::vector<Image> &rImages = pSVData->mpWinData->maMsgBoxImgList;
|
||||
if (rImages.empty())
|
||||
{
|
||||
rImages.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_ERRORBOX));
|
||||
rImages.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_QUERYBOX));
|
||||
rImages.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_WARNINGBOX));
|
||||
rImages.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_INFOBOX));
|
||||
rImages.emplace_back(StockImage::Yes, SV_RESID_BITMAP_ERRORBOX);
|
||||
rImages.emplace_back(StockImage::Yes, SV_RESID_BITMAP_QUERYBOX);
|
||||
rImages.emplace_back(StockImage::Yes, SV_RESID_BITMAP_WARNINGBOX);
|
||||
rImages.emplace_back(StockImage::Yes, SV_RESID_BITMAP_INFOBOX);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,12 +118,12 @@ void ImplWheelWindow::ImplSetRegion( const Bitmap& rRegionBmp )
|
||||
|
||||
void ImplWheelWindow::ImplCreateImageList()
|
||||
{
|
||||
maImgList.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_SCROLLVH));
|
||||
maImgList.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_SCROLLV));
|
||||
maImgList.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_SCROLLH));
|
||||
maImgList.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_WHEELVH));
|
||||
maImgList.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_WHEELV));
|
||||
maImgList.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_WHEELH));
|
||||
maImgList.emplace_back(StockImage::Yes, SV_RESID_BITMAP_SCROLLVH);
|
||||
maImgList.emplace_back(StockImage::Yes, SV_RESID_BITMAP_SCROLLV);
|
||||
maImgList.emplace_back(StockImage::Yes, SV_RESID_BITMAP_SCROLLH);
|
||||
maImgList.emplace_back(StockImage::Yes, SV_RESID_BITMAP_WHEELVH);
|
||||
maImgList.emplace_back(StockImage::Yes, SV_RESID_BITMAP_WHEELV);
|
||||
maImgList.emplace_back(StockImage::Yes, SV_RESID_BITMAP_WHEELH);
|
||||
}
|
||||
|
||||
void ImplWheelWindow::ImplSetWheelMode( WheelMode nWheelMode )
|
||||
|
||||
@@ -273,7 +273,7 @@ bool RTFDocumentImpl::dispatchParagraphSprmValue(RTFKeyword nKeyword, int nParam
|
||||
{
|
||||
while (m_aTableBufferStack.size() < sal::static_int_cast<std::size_t>(nParam))
|
||||
{
|
||||
m_aTableBufferStack.emplace_back(RTFBuffer_t());
|
||||
m_aTableBufferStack.emplace_back();
|
||||
}
|
||||
// Invalid tables may omit INTBL after ITAP
|
||||
dispatchFlag(RTF_INTBL); // sets newly pushed buffer as current
|
||||
@@ -1637,8 +1637,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
|
||||
if (rDrawingObject.getPolyLinePoints().empty())
|
||||
dispatchValue(RTF_DPPOLYCOUNT, 2);
|
||||
|
||||
rDrawingObject.getPolyLinePoints().emplace_back(
|
||||
awt::Point(convertTwipToMm100(nParam), 0));
|
||||
rDrawingObject.getPolyLinePoints().emplace_back(convertTwipToMm100(nParam), 0);
|
||||
}
|
||||
break;
|
||||
case RTF_DPPTY:
|
||||
|
||||
@@ -1483,8 +1483,7 @@ void RTFDocumentImpl::text(OUString& rString)
|
||||
if (m_aStates.top().getTableCellSprms().find(NS_ooxml::LN_CT_TcPrBase_vAlign)
|
||||
&& m_nTopLevelCells == 0)
|
||||
{
|
||||
m_aTableBufferStack.back().emplace_back(
|
||||
Buf_t(BUFFER_UTEXT, new RTFValue(rString), nullptr));
|
||||
m_aTableBufferStack.back().emplace_back(BUFFER_UTEXT, new RTFValue(rString), nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3673,9 +3672,9 @@ void RTFDocumentImpl::resetFrame() { m_aStates.top().getFrame() = RTFFrame(&m_aS
|
||||
void RTFDocumentImpl::bufferProperties(RTFBuffer_t& rBuffer, const RTFValue::Pointer_t& pValue,
|
||||
const tools::SvRef<TableRowBuffer>& pTableProperties)
|
||||
{
|
||||
rBuffer.emplace_back(
|
||||
Buf_t(BUFFER_SETSTYLE, new RTFValue(m_aStates.top().getCurrentStyleIndex()), nullptr));
|
||||
rBuffer.emplace_back(Buf_t(BUFFER_PROPS, pValue, pTableProperties));
|
||||
rBuffer.emplace_back(BUFFER_SETSTYLE, new RTFValue(m_aStates.top().getCurrentStyleIndex()),
|
||||
nullptr);
|
||||
rBuffer.emplace_back(BUFFER_PROPS, pValue, pTableProperties);
|
||||
}
|
||||
|
||||
RTFShape::RTFShape() = default;
|
||||
|
||||
Reference in New Issue
Block a user