Kaydet (Commit) 84cbd6a5 authored tarafından Noel Grandin's avatar Noel Grandin

clang-tidy modernize-use-emplace in b*

Change-Id: I51e0369ba2e1fe0b7c934531f71d3bda95ba09ec
Reviewed-on: https://gerrit.libreoffice.org/42109Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 44786fad
......@@ -314,7 +314,7 @@ void Shell::onDocumentClosed( const ScriptDocument& _rDocument )
pWin->BasicStopped();
}
else
aDeleteVec.push_back( pWin );
aDeleteVec.emplace_back(pWin );
}
}
// delete windows outside main loop so we don't invalidate the original iterator
......@@ -557,7 +557,7 @@ void Shell::CheckWindows()
{
BaseWindow* pWin = it->second;
if ( pWin->GetStatus() & BASWIN_TOBEKILLED )
aDeleteVec.push_back( pWin );
aDeleteVec.emplace_back(pWin );
}
for ( VclPtr<BaseWindow> const & pWin : aDeleteVec )
{
......@@ -579,7 +579,7 @@ void Shell::RemoveWindows( const ScriptDocument& rDocument, const OUString& rLib
{
BaseWindow* pWin = it->second;
if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName )
aDeleteVec.push_back( pWin );
aDeleteVec.emplace_back(pWin );
}
for ( VclPtr<BaseWindow> const & pWin : aDeleteVec )
{
......@@ -612,7 +612,7 @@ void Shell::UpdateWindows()
// Window is frozen at first, later the windows should be changed
// anyway to be marked as hidden instead of being deleted.
if ( !(pWin->GetStatus() & ( BASWIN_TOBEKILLED | BASWIN_RUNNINGBASIC | BASWIN_SUSPENDED ) ) )
aDeleteVec.push_back( pWin );
aDeleteVec.emplace_back(pWin );
}
}
for ( auto it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it )
......
......@@ -189,7 +189,7 @@ namespace basegfx
const temporaryPoint& rTempPoint = rPointVector[a];
const double fCutPosInPolygon((double)rTempPoint.getIndex() + rTempPoint.getCut());
const double fRelativeCutPos(fCutPosInPolygon / (double)nEdgeCount);
rTempPoints.push_back(temporaryPoint(rTempPoint.getPoint(), nInd, fRelativeCutPos));
rTempPoints.emplace_back(rTempPoint.getPoint(), nInd, fRelativeCutPos);
}
}
}
......@@ -251,8 +251,8 @@ namespace basegfx
// add a cut point to each list. The lists may be the same for
// self intersections.
const B2DPoint aCutPoint(interpolate(rCurrA, rNextA, fCut));
rTempPointsA.push_back(temporaryPoint(aCutPoint, nIndA, fCut));
rTempPointsB.push_back(temporaryPoint(aCutPoint, nIndB, fCut2));
rTempPointsA.emplace_back(aCutPoint, nIndA, fCut);
rTempPointsB.emplace_back(aCutPoint, nIndB, fCut2);
}
}
}
......@@ -340,13 +340,13 @@ namespace basegfx
// by outer methods and would just produce a double point
if(a)
{
rTempPointsA.push_back(temporaryPoint(aCurrA, a, 0.0));
rTempPointsA.emplace_back(aCurrA, a, 0.0);
}
}
else
{
const B2DPoint aCutPoint(interpolate(aCurrA, aNextA, fCutA));
rTempPointsA.push_back(temporaryPoint(aCutPoint, a, fCutA));
rTempPointsA.emplace_back(aCutPoint, a, fCutA);
}
// #i111715# use fTools::equal instead of fTools::equalZero for better accuracy
......@@ -356,13 +356,13 @@ namespace basegfx
// by outer methods and would just produce a double point
if(b)
{
rTempPointsB.push_back(temporaryPoint(aCurrB, b, 0.0));
rTempPointsB.emplace_back(aCurrB, b, 0.0);
}
}
else
{
const B2DPoint aCutPoint(interpolate(aCurrB, aNextB, fCutB));
rTempPointsB.push_back(temporaryPoint(aCutPoint, b, fCutB));
rTempPointsB.emplace_back(aCutPoint, b, fCutB);
}
}
}
......@@ -414,7 +414,7 @@ namespace basegfx
// append remapped tempVector entries for edge to tempPoints for edge
for(temporaryPoint & rTempPoint : aTempPointVectorEdge)
{
rTempPointsB.push_back(temporaryPoint(rTempPoint.getPoint(), nIndB, rTempPoint.getCut()));
rTempPointsB.emplace_back(rTempPoint.getPoint(), nIndB, rTempPoint.getCut());
}
}
......@@ -641,7 +641,7 @@ namespace basegfx
if(fTools::more(fCut, fZero) && fTools::less(fCut, fOne))
{
rTempPoints.push_back(temporaryPoint(aTestPoint, nInd, fCut));
rTempPoints.emplace_back(aTestPoint, nInd, fCut);
}
}
}
......
......@@ -3419,10 +3419,9 @@ namespace basegfx
{
// add current point (always) and remember StartPointIndex for evtl. later corrections
const sal_uInt32 nStartPointIndex(aCollectPoints.size());
aCollectPoints.push_back(
css::awt::Point(
aCollectPoints.emplace_back(
fround(aBezierSegment.getStartPoint().getX()),
fround(aBezierSegment.getStartPoint().getY())));
fround(aBezierSegment.getStartPoint().getY()));
aCollectFlags.push_back(css::drawing::PolygonFlags_NORMAL);
// prepare next segment
......@@ -3434,16 +3433,14 @@ namespace basegfx
if(aBezierSegment.isBezier())
{
// if bezier is used, add always two control points due to the old schema
aCollectPoints.push_back(
css::awt::Point(
aCollectPoints.emplace_back(
fround(aBezierSegment.getControlPointA().getX()),
fround(aBezierSegment.getControlPointA().getY())));
fround(aBezierSegment.getControlPointA().getY()));
aCollectFlags.push_back(css::drawing::PolygonFlags_CONTROL);
aCollectPoints.push_back(
css::awt::Point(
aCollectPoints.emplace_back(
fround(aBezierSegment.getControlPointB().getX()),
fround(aBezierSegment.getControlPointB().getY())));
fround(aBezierSegment.getControlPointB().getY()));
aCollectFlags.push_back(css::drawing::PolygonFlags_CONTROL);
}
......@@ -3476,10 +3473,9 @@ namespace basegfx
{
// add last point as closing point
const B2DPoint aClosingPoint(rPolygon.getB2DPoint(nPointCount - 1));
aCollectPoints.push_back(
css::awt::Point(
aCollectPoints.emplace_back(
fround(aClosingPoint.getX()),
fround(aClosingPoint.getY())));
fround(aClosingPoint.getY()));
aCollectFlags.push_back(css::drawing::PolygonFlags_NORMAL);
}
......
......@@ -233,7 +233,7 @@ namespace basegfx
if( !aPrevPnt.equal(aNextPnt) )
{
maStartEntries.push_back(EdgeEntry(aPrevPnt, aNextPnt));
maStartEntries.emplace_back(aPrevPnt, aNextPnt);
}
aPrevPnt = aNextPnt;
......
......@@ -449,13 +449,13 @@ namespace basegfx
if(pLast->getX() != aMiddle.getX() || pLast->getY() != aMiddle.getY())
{
maCorrectionTable.push_back(CorrectionPair(*pLast, aMiddle));
maCorrectionTable.emplace_back(*pLast, aMiddle);
*pLast = aMiddle;
}
if(pCurrent->getX() != aMiddle.getX() || pCurrent->getY() != aMiddle.getY())
{
maCorrectionTable.push_back(CorrectionPair(*pCurrent, aMiddle));
maCorrectionTable.emplace_back(*pCurrent, aMiddle);
*pCurrent = aMiddle;
}
}
......
......@@ -556,7 +556,7 @@ namespace basegfx
if(!fTools::equal(pPrev->getX(), pCurr->getX()))
{
// X-order not needed, just add
aTrDeSimpleEdges.push_back(TrDeSimpleEdge(pPrev, pCurr));
aTrDeSimpleEdges.emplace_back(pPrev, pCurr);
const double fMiddle((pPrev->getY() + pCurr->getY()) * 0.5);
pPrev->setY(fMiddle);
......@@ -567,7 +567,7 @@ namespace basegfx
{
// vertical edge. Positive Y-direction is guaranteed by the
// TrDeEdgeEntry constructor
maTrDeEdgeEntries.push_back(TrDeEdgeEntry(pPrev, pCurr, 0));
maTrDeEdgeEntries.emplace_back(pPrev, pCurr, 0);
mnInitialEdgeEntryCount++;
}
......@@ -874,14 +874,13 @@ namespace basegfx
// the two edges start at the same Y, they use the same DeltaY, they
// do not cut themselves and not any other edge in range. Create a
// B2DTrapezoid and consume both edges
ro_Result.push_back(
B2DTrapezoid(
ro_Result.emplace_back(
aLeft.getStart().getX(),
aRight.getStart().getX(),
aLeft.getStart().getY(),
aLeftEnd.getX(),
aRightEnd.getX(),
aLeftEnd.getY()));
aLeftEnd.getY());
maTrDeEdgeEntries.pop_front();
maTrDeEdgeEntries.pop_front();
......@@ -980,14 +979,13 @@ namespace basegfx
const double fLeftX(rPointA.getX() - fHalfLineWidth);
const double fRightX(rPointA.getX() + fHalfLineWidth);
ro_Result.push_back(
B2DTrapezoid(
ro_Result.emplace_back(
fLeftX,
fRightX,
std::min(rPointA.getY(), rPointB.getY()),
fLeftX,
fRightX,
std::max(rPointA.getY(), rPointB.getY())));
std::max(rPointA.getY(), rPointB.getY()));
}
else if(fTools::equal(rPointA.getY(), rPointB.getY()))
{
......@@ -995,14 +993,13 @@ namespace basegfx
const double fLeftX(std::min(rPointA.getX(), rPointB.getX()));
const double fRightX(std::max(rPointA.getX(), rPointB.getX()));
ro_Result.push_back(
B2DTrapezoid(
ro_Result.emplace_back(
fLeftX,
fRightX,
rPointA.getY() - fHalfLineWidth,
fLeftX,
fRightX,
rPointA.getY() + fHalfLineWidth));
rPointA.getY() + fHalfLineWidth);
}
else
{
......@@ -1021,10 +1018,10 @@ namespace basegfx
// create EdgeEntries
basegfx::trapezoidhelper::TrDeEdgeEntries aTrDeEdgeEntries;
aTrDeEdgeEntries.push_back(basegfx::trapezoidhelper::TrDeEdgeEntry(&aStartLow, &aStartHigh, 0));
aTrDeEdgeEntries.push_back(basegfx::trapezoidhelper::TrDeEdgeEntry(&aStartHigh, &aEndHigh, 0));
aTrDeEdgeEntries.push_back(basegfx::trapezoidhelper::TrDeEdgeEntry(&aEndHigh, &aEndLow, 0));
aTrDeEdgeEntries.push_back(basegfx::trapezoidhelper::TrDeEdgeEntry(&aEndLow, &aStartLow, 0));
aTrDeEdgeEntries.emplace_back(&aStartLow, &aStartHigh, 0);
aTrDeEdgeEntries.emplace_back(&aStartHigh, &aEndHigh, 0);
aTrDeEdgeEntries.emplace_back(&aEndHigh, &aEndLow, 0);
aTrDeEdgeEntries.emplace_back(&aEndLow, &aStartLow, 0);
aTrDeEdgeEntries.sort();
// here we know we have exactly four edges, and they do not cut, touch or
......@@ -1038,26 +1035,24 @@ namespace basegfx
if(bEndOnSameLine)
{
// create two triangle trapezoids
ro_Result.push_back(
B2DTrapezoid(
ro_Result.emplace_back(
aLeft.getStart().getX(),
aRight.getStart().getX(),
aLeft.getStart().getY(),
aLeft.getEnd().getX(),
aRight.getEnd().getX(),
aLeft.getEnd().getY()));
aLeft.getEnd().getY());
basegfx::trapezoidhelper::TrDeEdgeEntries::reference aLeft2(*aCurrent++);
basegfx::trapezoidhelper::TrDeEdgeEntries::reference aRight2(*aCurrent++);
ro_Result.push_back(
B2DTrapezoid(
ro_Result.emplace_back(
aLeft2.getStart().getX(),
aRight2.getStart().getX(),
aLeft2.getStart().getY(),
aLeft2.getEnd().getX(),
aRight2.getEnd().getX(),
aLeft2.getEnd().getY()));
aLeft2.getEnd().getY());
}
else
{
......@@ -1072,32 +1067,29 @@ namespace basegfx
const B2DPoint aSplitLeft(aLeft.getCutPointForGivenY(aRight.getEnd().getY()));
const B2DPoint aSplitRight(aRight2.getCutPointForGivenY(aLeft.getEnd().getY()));
ro_Result.push_back(
B2DTrapezoid(
ro_Result.emplace_back(
aLeft.getStart().getX(),
aRight.getStart().getX(),
aLeft.getStart().getY(),
aSplitLeft.getX(),
aRight.getEnd().getX(),
aRight.getEnd().getY()));
aRight.getEnd().getY());
ro_Result.push_back(
B2DTrapezoid(
ro_Result.emplace_back(
aSplitLeft.getX(),
aRight.getEnd().getX(),
aRight.getEnd().getY(),
aLeft2.getStart().getX(),
aSplitRight.getX(),
aLeft2.getStart().getY()));
aLeft2.getStart().getY());
ro_Result.push_back(
B2DTrapezoid(
ro_Result.emplace_back(
aLeft2.getStart().getX(),
aSplitRight.getX(),
aLeft2.getStart().getY(),
aLeft2.getEnd().getX(),
aRight2.getEnd().getX(),
aLeft2.getEnd().getY()));
aLeft2.getEnd().getY());
}
else
{
......@@ -1106,32 +1098,29 @@ namespace basegfx
const B2DPoint aSplitRight(aRight.getCutPointForGivenY(aLeft.getEnd().getY()));
const B2DPoint aSplitLeft(aLeft2.getCutPointForGivenY(aRight.getEnd().getY()));
ro_Result.push_back(
B2DTrapezoid(
ro_Result.emplace_back(
aLeft.getStart().getX(),
aRight.getStart().getX(),
aLeft.getStart().getY(),
aLeft.getEnd().getX(),
aSplitRight.getX(),
aLeft.getEnd().getY()));
aLeft.getEnd().getY());
ro_Result.push_back(
B2DTrapezoid(
ro_Result.emplace_back(
aLeft.getEnd().getX(),
aSplitRight.getX(),
aLeft.getEnd().getY(),
aSplitLeft.getX(),
aRight.getEnd().getX(),
aRight2.getStart().getY()));
aRight2.getStart().getY());
ro_Result.push_back(
B2DTrapezoid(
ro_Result.emplace_back(
aSplitLeft.getX(),
aRight.getEnd().getX(),
aRight2.getStart().getY(),
aLeft2.getEnd().getX(),
aRight2.getEnd().getX(),
aLeft2.getEnd().getY()));
aLeft2.getEnd().getY());
}
}
}
......
......@@ -542,12 +542,11 @@ namespace basegfx
{
const B2DRectangle& rCurrRect( *aCurrRect++ );
o_rEventVector.push_back(
SweepLineEvent( rCurrRect.getMinX(),
o_rEventVector.emplace_back( rCurrRect.getMinX(),
rCurrRect,
SweepLineEvent::STARTING_EDGE,
(*aCurrOrientation++) == B2VectorOrientation::Positive ?
SweepLineEvent::PROCEED_UP : SweepLineEvent::PROCEED_DOWN) );
SweepLineEvent::PROCEED_UP : SweepLineEvent::PROCEED_DOWN );
}
// second pass: add all right edges in reversed order
......@@ -558,12 +557,11 @@ namespace basegfx
{
const B2DRectangle& rCurrRect( *aCurrRectR++ );
o_rEventVector.push_back(
SweepLineEvent( rCurrRect.getMaxX(),
o_rEventVector.emplace_back( rCurrRect.getMaxX(),
rCurrRect,
SweepLineEvent::FINISHING_EDGE,
(*aCurrOrientationR++) == B2VectorOrientation::Positive ?
SweepLineEvent::PROCEED_DOWN : SweepLineEvent::PROCEED_UP ) );
SweepLineEvent::PROCEED_DOWN : SweepLineEvent::PROCEED_UP );
}
// sort events
......@@ -618,19 +616,17 @@ namespace basegfx
io_rPolygonPool.get(nIdxPolygon).setPolygonPoolIndex(nIdxPolygon);
// upper edge
aNewEdges.push_back(
ActiveEdge(
aNewEdges.emplace_back(
rRect,
rRect.getMinY(),
bGoesDown ? nIdxPolygon : -1,
bGoesDown ? ActiveEdge::PROCEED_LEFT : ActiveEdge::PROCEED_RIGHT) );
bGoesDown ? ActiveEdge::PROCEED_LEFT : ActiveEdge::PROCEED_RIGHT );
// lower edge
aNewEdges.push_back(
ActiveEdge(
aNewEdges.emplace_back(
rRect,
rRect.getMaxY(),
bGoesDown ? -1 : nIdxPolygon,
bGoesDown ? ActiveEdge::PROCEED_RIGHT : ActiveEdge::PROCEED_LEFT ) );
bGoesDown ? ActiveEdge::PROCEED_RIGHT : ActiveEdge::PROCEED_LEFT );
// furthermore, have to respect a special tie-breaking
// rule here, for edges which share the same y value:
......
......@@ -168,10 +168,10 @@ namespace basegfx
const sal_uInt32 nYDelta(nYEnd - nYStart);
const double fInvYDelta(1.0 / nYDelta);
maLineEntries.push_back(RasterConversionLineEntry3D(
maLineEntries.emplace_back(
aStart.getX(), (aEnd.getX() - aStart.getX()) * fInvYDelta,
aStart.getZ(), (aEnd.getZ() - aStart.getZ()) * fInvYDelta,
nYStart, nYDelta));
nYStart, nYDelta);
// if extra interpolation data is used, add it to the last created entry
RasterConversionLineEntry3D& rEntry = maLineEntries[maLineEntries.size() - 1];
......@@ -261,14 +261,14 @@ namespace basegfx
// horizontal line, create vertical entries. These will be sorted by
// X anyways, so no need to distinguish the case here
maLineEntries.push_back(RasterConversionLineEntry3D(
maLineEntries.emplace_back(
aStart.getX(), 0.0,
aStart.getZ() + fZBufferLineAdd, 0.0,
nYStart, 1));
maLineEntries.push_back(RasterConversionLineEntry3D(
nYStart, 1);
maLineEntries.emplace_back(
aEnd.getX(), 0.0,
aEnd.getZ() + fZBufferLineAdd, 0.0,
nYStart, 1));
nYStart, 1);
}
}
else
......@@ -287,10 +287,10 @@ namespace basegfx
// non-horizontal line, create two parallel entries. These will be sorted by
// X anyways, so no need to distinguish the case here
maLineEntries.push_back(RasterConversionLineEntry3D(
maLineEntries.emplace_back(
aStart.getX(), (aEnd.getX() - aStart.getX()) * fInvYDelta,
aStart.getZ() + fZBufferLineAdd, (aEnd.getZ() - aStart.getZ()) * fInvYDelta,
nYStart, nYDelta));
nYStart, nYDelta);
RasterConversionLineEntry3D& rEntry = maLineEntries[maLineEntries.size() - 1];
......@@ -300,10 +300,10 @@ namespace basegfx
// guarantee one pixel per line, add a minimum of one for X.
const double fDistanceX(fabs(rEntry.getX().getInc()) >= 1.0 ? rEntry.getX().getInc() : 1.0);
maLineEntries.push_back(RasterConversionLineEntry3D(
maLineEntries.emplace_back(
rEntry.getX().getVal() + fDistanceX, rEntry.getX().getInc(),
rEntry.getZ().getVal() + rEntry.getZ().getInc(), rEntry.getZ().getInc(),
nYStart, nYDelta));
nYStart, nYDelta);
}
}
......
......@@ -200,12 +200,12 @@ namespace unotools
if(aBezier.isBezier())
{
// if one is used, add always two control points due to the old schema
aPoints.push_back( awt::Point(fround(aBezier.getControlPointA().getX()),
fround(aBezier.getControlPointA().getY())) );
aPoints.emplace_back(fround(aBezier.getControlPointA().getX()),
fround(aBezier.getControlPointA().getY()) );
aFlags.push_back(drawing::PolygonFlags_CONTROL);
aPoints.push_back( awt::Point(fround(aBezier.getControlPointB().getX()),
fround(aBezier.getControlPointB().getY())) );
aPoints.emplace_back(fround(aBezier.getControlPointB().getX()),
fround(aBezier.getControlPointB().getY()) );
aFlags.push_back(drawing::PolygonFlags_CONTROL);
}
......
......@@ -629,7 +629,7 @@ void BasicManager::ImpMgrNotLoaded( const OUString& rStorageName )
// pErrInf is only destroyed if the error os processed by an
// ErrorHandler
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_MGROPEN, rStorageName, DialogMask::ButtonsOk );
aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::OPENMGRSTREAM));
aErrors.emplace_back(*pErrInf, BasicErrorReason::OPENMGRSTREAM);
// Create a stdlib otherwise we crash!
BasicLibInfo* pStdLibInfo = CreateLibInfo();
......@@ -769,7 +769,7 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
if (!ImplLoadBasic( *xManagerStream, mpImpl->aLibs.front()->GetLibRef() ))
{
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_MGROPEN, aStorName, DialogMask::ButtonsOk );
aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::OPENMGRSTREAM));
aErrors.emplace_back(*pErrInf, BasicErrorReason::OPENMGRSTREAM);
// and it proceeds ...
}
xManagerStream->Seek( nBasicEndOff+1 ); // +1: 0x00 as separator
......@@ -817,7 +817,7 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
else
{
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, aStorName, DialogMask::ButtonsOk );
aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::STORAGENOTFOUND));
aErrors.emplace_back(*pErrInf, BasicErrorReason::STORAGENOTFOUND);
}
}
}
......@@ -900,7 +900,7 @@ bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStora
if ( !xBasicStorage.is() || xBasicStorage->GetError() )
{
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_MGROPEN, xStorage->GetName(), DialogMask::ButtonsOk );
aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::OPENLIBSTORAGE));
aErrors.emplace_back(*pErrInf, BasicErrorReason::OPENLIBSTORAGE);
}
else
{
......@@ -909,7 +909,7 @@ bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStora
if ( !xBasicStream.is() || xBasicStream->GetError() )
{
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD , pLibInfo->GetLibName(), DialogMask::ButtonsOk );
aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::OPENLIBSTREAM));
aErrors.emplace_back(*pErrInf, BasicErrorReason::OPENLIBSTREAM);
}
else
{
......@@ -932,7 +932,7 @@ bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStora
if ( !bLoaded )
{
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, pLibInfo->GetLibName(), DialogMask::ButtonsOk );
aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::BASICLOADERROR));
aErrors.emplace_back(*pErrInf, BasicErrorReason::BASICLOADERROR);
}
else
{
......@@ -1116,7 +1116,7 @@ bool BasicManager::RemoveLib( sal_uInt16 nLib, bool bDelBasicFromStorage )
if( !nLib || nLib < mpImpl->aLibs.size() )
{
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_REMOVELIB, OUString(), DialogMask::ButtonsOk );
aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::STDLIB));
aErrors.emplace_back(*pErrInf, BasicErrorReason::STDLIB);
return false;
}
......@@ -1152,7 +1152,7 @@ bool BasicManager::RemoveLib( sal_uInt16 nLib, bool bDelBasicFromStorage )
if ( !xBasicStorage.is() || xBasicStorage->GetError() )
{
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_REMOVELIB, OUString(), DialogMask::ButtonsOk );
aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::OPENLIBSTORAGE));
aErrors.emplace_back(*pErrInf, BasicErrorReason::OPENLIBSTORAGE);
}
else if (xBasicStorage->IsStream((*itLibInfo)->GetLibName()))
{
......@@ -1287,7 +1287,7 @@ bool BasicManager::LoadLib( sal_uInt16 nLib )
else
{
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, OUString(), DialogMask::ButtonsOk );
aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::LIBNOTFOUND));
aErrors.emplace_back(*pErrInf, BasicErrorReason::LIBNOTFOUND);
}
return bDone;
}
......
......@@ -1064,7 +1064,7 @@ SbModule* StarBASIC::MakeModule( const OUString& rName, const ModuleInfo& mInfo,
}
p->SetSource32( rSrc );
p->SetParent( this );
pModules.push_back(p);
pModules.emplace_back(p);
SetModified( true );
return p;
}
......@@ -1073,7 +1073,7 @@ void StarBASIC::Insert( SbxVariable* pVar )
{
if( dynamic_cast<const SbModule*>(pVar) != nullptr)
{
pModules.push_back(static_cast<SbModule*>(pVar));
pModules.emplace_back(static_cast<SbModule*>(pVar));
pVar->SetParent( this );
StartListening( pVar->GetBroadcaster(), true );
}
......@@ -1862,7 +1862,7 @@ bool StarBASIC::LoadData( SvStream& r, sal_uInt16 nVer )
else
{
pMod->SetParent( this );
pModules.push_back( pMod );
pModules.emplace_back(pMod );
}
}
// HACK for SFX-Bullshit!
......
......@@ -458,7 +458,7 @@ static sal_uInt32 lcl_registerNativeObjectWrapper( SbxObject* pNativeObj )
{
NativeObjectWrapperVector &rNativeObjectWrapperVector = GaNativeObjectWrapperVector::get();
sal_uInt32 nIndex = rNativeObjectWrapperVector.size();
rNativeObjectWrapperVector.push_back( ObjectItem( pNativeObj ) );
rNativeObjectWrapperVector.emplace_back( pNativeObj );
return nIndex;
}
......@@ -4452,7 +4452,7 @@ void registerComponentToBeDisposedForBasic
( const Reference< XComponent >& xComponent, StarBASIC* pBasic )
{
StarBasicDisposeItem* pItem = lcl_getOrCreateItemForBasic( pBasic );
pItem->m_vComImplementsObjects.push_back( xComponent );
pItem->m_vComImplementsObjects.emplace_back(xComponent );
}
void registerComListenerVariableForBasic( SbxVariable* pVar, StarBASIC* pBasic )
......
......@@ -3977,7 +3977,7 @@ void SbiRuntime::StepELEM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
// #74254 now per list
if( pObj )
{
aRefSaved.push_back( pObj );
aRefSaved.emplace_back(pObj );
}
PushVar( FindElement( pObj, nOp1, nOp2, ERRCODE_BASIC_NO_METHOD, false ) );
}
......@@ -4057,7 +4057,7 @@ void SbiRuntime::StepPARAM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
else if( t != SbxVARIANT && (SbxDataType)(p->GetType() & 0x0FFF ) != t )
{
SbxVariable* q = new SbxVariable( t );
aRefSaved.push_back( q );
aRefSaved.emplace_back(q );
*q = *p;
p = q;
if ( i )
......
......@@ -622,10 +622,9 @@ void Bridge::sendRequestChangeRequest() {
assert(mode_ == MODE_REQUESTED);
random_ = random();
std::vector< BinaryAny > a;
a.push_back(
BinaryAny(
a.emplace_back(
css::uno::TypeDescription(cppu::UnoType< sal_Int32 >::get()),
&random_));
&random_);
sendProtPropRequest(OutgoingRequest::KIND_REQUEST_CHANGE, a);
}
......@@ -865,10 +864,9 @@ css::uno::Reference< css::uno::XInterface > Bridge::getInstance(
css::uno::TypeDescription ifc(cppu::UnoType<css::uno::XInterface>::get());
typelib_TypeDescription * p = ifc.get();
std::vector< BinaryAny > inArgs;
inArgs.push_back(
BinaryAny(
inArgs.emplace_back(
css::uno::TypeDescription(cppu::UnoType< css::uno::Type >::get()),
&p));
&p);
BinaryAny ret;
std::vector< BinaryAny> outArgs;
bool bExc = makeCall(
......
......@@ -126,8 +126,7 @@ css::uno::Reference< css::bridge::XBridge > BridgeFactory::createBridge(
}
b.set(new Bridge(this, sName, aConnection, anInstanceProvider));
if (sName.isEmpty()) {
unnamed_.push_back(
css::uno::Reference< css::bridge::XBridge >(b.get()));
unnamed_.emplace_back(b.get());
} else {
named_[sName] = b.get();
}
......
......@@ -212,11 +212,10 @@ bool IncomingRequest::execute_throw(
css::uno::TypeDescription(
mtd->pParams[j].pTypeRef));
} else {
outBufs.push_back(
std::vector< char >(size_t_round(