clang-tidy modernize-use-emplace in svgio..svtools

Change-Id: I4f3b0762e197d5397e723aba1dc43e3c857be145
Reviewed-on: https://gerrit.libreoffice.org/42193
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2017-09-12 12:00:35 +02:00
parent 65b756f605
commit 48b200a0a2
19 changed files with 45 additions and 46 deletions

View File

@@ -350,7 +350,7 @@ namespace svgio
{ {
// if it is a Css style, allow reading text between the start and end tag (see // if it is a Css style, allow reading text between the start and end tag (see
// SvgDocHdl::characters for details) // SvgDocHdl::characters for details)
maCssContents.push_back(OUString()); maCssContents.emplace_back();
} }
break; break;
} }

View File

@@ -289,11 +289,10 @@ namespace svgio
fOffset = 1.0; fOffset = 1.0;
} }
aVector.push_back( aVector.emplace_back(
drawinglayer::primitive2d::SvgGradientEntry(
fOffset, fOffset,
pStyle->getStopColor(), pStyle->getStopColor(),
pStyle->getStopOpacity().solve(*this))); pStyle->getStopOpacity().solve(*this));
} }
else else
{ {

View File

@@ -56,7 +56,7 @@ namespace svt
_rHistory.end()); _rHistory.end());
// then push_back the picker // then push_back the picker
_rHistory.push_back( css::uno::WeakReference< XInterface >( _rxPicker ) ); _rHistory.emplace_back( _rxPicker );
} }
} }

View File

@@ -49,7 +49,7 @@ namespace svl {
IndexedStyleSheets::IndexedStyleSheets() IndexedStyleSheets::IndexedStyleSheets()
{ {
for (size_t i = 0; i < NUMBER_OF_FAMILIES; i++) { for (size_t i = 0; i < NUMBER_OF_FAMILIES; i++) {
mStyleSheetPositionsByFamily.push_back(std::vector<unsigned>()); mStyleSheetPositionsByFamily.emplace_back();
} }
;} ;}
@@ -69,7 +69,7 @@ IndexedStyleSheets::Reindex()
mPositionsByName.clear(); mPositionsByName.clear();
mStyleSheetPositionsByFamily.clear(); mStyleSheetPositionsByFamily.clear();
for (size_t i = 0; i < NUMBER_OF_FAMILIES; i++) { for (size_t i = 0; i < NUMBER_OF_FAMILIES; i++) {
mStyleSheetPositionsByFamily.push_back(std::vector<unsigned>()); mStyleSheetPositionsByFamily.emplace_back();
} }
unsigned i = 0; unsigned i = 0;

View File

@@ -157,7 +157,7 @@ PropertyEntryVector_t SfxItemPropertyMap::getPropertyEntries() const
while( aIt != m_pImpl->end() ) while( aIt != m_pImpl->end() )
{ {
const SfxItemPropertySimpleEntry* pEntry = &(*aIt).second; const SfxItemPropertySimpleEntry* pEntry = &(*aIt).second;
aRet.push_back( SfxItemPropertyNamedEntry( (*aIt).first, * pEntry ) ); aRet.emplace_back( (*aIt).first, * pEntry );
++aIt; ++aIt;
} }
return aRet; return aRet;

View File

@@ -34,7 +34,7 @@ void SvCommandList::Append
const OUString & rArg /* The command's argument */ const OUString & rArg /* The command's argument */
) )
{ {
aCommandList.push_back( SvCommand( rCommand, rArg ) ); aCommandList.emplace_back( rCommand, rArg );
} }
void SvCommandList::FillFromSequence( const css::uno::Sequence < css::beans::PropertyValue >& aCommandSequence ) void SvCommandList::FillFromSequence( const css::uno::Sequence < css::beans::PropertyValue >& aCommandSequence )

View File

@@ -214,7 +214,7 @@ PassMap StorageItem::getInfo()
PassMap::iterator aIter = aResult.find( aUrl ); PassMap::iterator aIter = aResult.find( aUrl );
if( aIter != aResult.end() ) if( aIter != aResult.end() )
aIter->second.push_back( NamePassRecord( aName, aEPasswd ) ); aIter->second.emplace_back( aName, aEPasswd );
else else
{ {
NamePassRecord aNewRecord( aName, aEPasswd ); NamePassRecord aNewRecord( aName, aEPasswd );

View File

@@ -356,12 +356,12 @@ namespace svl { namespace undo { namespace impl
*/ */
void scheduleNotification( UndoListenerVoidMethod i_notificationMethod ) void scheduleNotification( UndoListenerVoidMethod i_notificationMethod )
{ {
m_notifiers.push_back( NotifyUndoListener( i_notificationMethod ) ); m_notifiers.emplace_back( i_notificationMethod );
} }
void scheduleNotification( UndoListenerStringMethod i_notificationMethod, const OUString& i_actionComment ) void scheduleNotification( UndoListenerStringMethod i_notificationMethod, const OUString& i_actionComment )
{ {
m_notifiers.push_back( NotifyUndoListener( i_notificationMethod, i_actionComment ) ); m_notifiers.emplace_back( i_notificationMethod, i_actionComment );
} }
private: private:

View File

@@ -146,7 +146,7 @@ void FilterMatch::createWildCardFilterList(const OUString& _rFilterList,::std::v
sToken = _rFilterList.getToken( 0, ';', nIndex ); sToken = _rFilterList.getToken( 0, ';', nIndex );
if ( !sToken.isEmpty() ) if ( !sToken.isEmpty() )
{ {
_rFilters.push_back( WildCard( sToken.toAsciiUpperCase() ) ); _rFilters.emplace_back( sToken.toAsciiUpperCase() );
} }
} }
while ( nIndex >= 0 ); while ( nIndex >= 0 );
@@ -154,7 +154,7 @@ void FilterMatch::createWildCardFilterList(const OUString& _rFilterList,::std::v
else else
{ {
// no filter is given -> match all // no filter is given -> match all
_rFilters.push_back( WildCard("*") ); _rFilters.emplace_back("*" );
} }
} }

View File

@@ -24,18 +24,18 @@
// implementation of the collator-algorithm-name translation // implementation of the collator-algorithm-name translation
CollatorResource::CollatorResource() CollatorResource::CollatorResource()
{ {
m_aData.push_back(CollatorResourceData("alphanumeric", SvtResId(STR_SVT_COLLATE_ALPHANUMERIC))); m_aData.emplace_back("alphanumeric", SvtResId(STR_SVT_COLLATE_ALPHANUMERIC));
m_aData.push_back(CollatorResourceData("charset", SvtResId(STR_SVT_COLLATE_CHARSET))); m_aData.emplace_back("charset", SvtResId(STR_SVT_COLLATE_CHARSET));
m_aData.push_back(CollatorResourceData("dict", SvtResId(STR_SVT_COLLATE_DICTIONARY))); m_aData.emplace_back("dict", SvtResId(STR_SVT_COLLATE_DICTIONARY));
m_aData.push_back(CollatorResourceData("normal", SvtResId(STR_SVT_COLLATE_NORMAL))); m_aData.emplace_back("normal", SvtResId(STR_SVT_COLLATE_NORMAL));
m_aData.push_back(CollatorResourceData("pinyin", SvtResId(STR_SVT_COLLATE_PINYIN))); m_aData.emplace_back("pinyin", SvtResId(STR_SVT_COLLATE_PINYIN));
m_aData.push_back(CollatorResourceData("radical", SvtResId(STR_SVT_COLLATE_RADICAL))); m_aData.emplace_back("radical", SvtResId(STR_SVT_COLLATE_RADICAL));
m_aData.push_back(CollatorResourceData("stroke", SvtResId(STR_SVT_COLLATE_STROKE))); m_aData.emplace_back("stroke", SvtResId(STR_SVT_COLLATE_STROKE));
m_aData.push_back(CollatorResourceData("unicode", SvtResId(STR_SVT_COLLATE_UNICODE))); m_aData.emplace_back("unicode", SvtResId(STR_SVT_COLLATE_UNICODE));
m_aData.push_back(CollatorResourceData("zhuyin", SvtResId(STR_SVT_COLLATE_ZHUYIN))); m_aData.emplace_back("zhuyin", SvtResId(STR_SVT_COLLATE_ZHUYIN));
m_aData.push_back(CollatorResourceData("phonebook", SvtResId(STR_SVT_COLLATE_PHONEBOOK))); m_aData.emplace_back("phonebook", SvtResId(STR_SVT_COLLATE_PHONEBOOK));
m_aData.push_back(CollatorResourceData("phonetic (alphanumeric first)", SvtResId(STR_SVT_COLLATE_PHONETIC_F))); m_aData.emplace_back("phonetic (alphanumeric first)", SvtResId(STR_SVT_COLLATE_PHONETIC_F));
m_aData.push_back(CollatorResourceData("phonetic (alphanumeric last)", SvtResId(STR_SVT_COLLATE_PHONETIC_L))); m_aData.emplace_back("phonetic (alphanumeric last)", SvtResId(STR_SVT_COLLATE_PHONETIC_L));
} }
const OUString& const OUString&

View File

@@ -25,16 +25,16 @@
// implementation of the indexentry-algorithm-name translation // implementation of the indexentry-algorithm-name translation
IndexEntryResource::IndexEntryResource() IndexEntryResource::IndexEntryResource()
{ {
m_aData.push_back(IndexEntryResourceData("alphanumeric", SvtResId(STR_SVT_INDEXENTRY_ALPHANUMERIC))); m_aData.emplace_back("alphanumeric", SvtResId(STR_SVT_INDEXENTRY_ALPHANUMERIC));
m_aData.push_back(IndexEntryResourceData("dict", SvtResId(STR_SVT_INDEXENTRY_DICTIONARY))); m_aData.emplace_back("dict", SvtResId(STR_SVT_INDEXENTRY_DICTIONARY));
m_aData.push_back(IndexEntryResourceData("pinyin", SvtResId(STR_SVT_INDEXENTRY_PINYIN))); m_aData.emplace_back("pinyin", SvtResId(STR_SVT_INDEXENTRY_PINYIN));
m_aData.push_back(IndexEntryResourceData("radical", SvtResId(STR_SVT_INDEXENTRY_RADICAL))); m_aData.emplace_back("radical", SvtResId(STR_SVT_INDEXENTRY_RADICAL));
m_aData.push_back(IndexEntryResourceData("stroke", SvtResId(STR_SVT_INDEXENTRY_STROKE))); m_aData.emplace_back("stroke", SvtResId(STR_SVT_INDEXENTRY_STROKE));
m_aData.push_back(IndexEntryResourceData("zhuyin", SvtResId(STR_SVT_INDEXENTRY_ZHUYIN))); m_aData.emplace_back("zhuyin", SvtResId(STR_SVT_INDEXENTRY_ZHUYIN));
m_aData.push_back(IndexEntryResourceData("phonetic (alphanumeric first) (grouped by syllable)", SvtResId(STR_SVT_INDEXENTRY_PHONETIC_FS))); m_aData.emplace_back("phonetic (alphanumeric first) (grouped by syllable)", SvtResId(STR_SVT_INDEXENTRY_PHONETIC_FS));
m_aData.push_back(IndexEntryResourceData("phonetic (alphanumeric first) (grouped by consonant)", SvtResId(STR_SVT_INDEXENTRY_PHONETIC_FC))); m_aData.emplace_back("phonetic (alphanumeric first) (grouped by consonant)", SvtResId(STR_SVT_INDEXENTRY_PHONETIC_FC));
m_aData.push_back(IndexEntryResourceData("phonetic (alphanumeric last) (grouped by syllable)", SvtResId(STR_SVT_INDEXENTRY_PHONETIC_LS))); m_aData.emplace_back("phonetic (alphanumeric last) (grouped by syllable)", SvtResId(STR_SVT_INDEXENTRY_PHONETIC_LS));
m_aData.push_back(IndexEntryResourceData("phonetic (alphanumeric last) (grouped by consonant)", SvtResId(STR_SVT_INDEXENTRY_PHONETIC_LC))); m_aData.emplace_back("phonetic (alphanumeric last) (grouped by consonant)", SvtResId(STR_SVT_INDEXENTRY_PHONETIC_LC));
} }
const OUString& IndexEntryResource::GetTranslation(const OUString &r_Algorithm) const OUString& IndexEntryResource::GetTranslation(const OUString &r_Algorithm)

View File

@@ -583,7 +583,7 @@ void AssignmentPersistentData::ImplCommit()
// force a even number of known fields // force a even number of known fields
m_pImpl->bOddFieldNumber = (m_pImpl->aFieldLabels.size() % 2) != 0; m_pImpl->bOddFieldNumber = (m_pImpl->aFieldLabels.size() % 2) != 0;
if (m_pImpl->bOddFieldNumber) if (m_pImpl->bOddFieldNumber)
m_pImpl->aFieldLabels.push_back( OUString() ); m_pImpl->aFieldLabels.emplace_back( );
// limit the scrollbar range accordingly // limit the scrollbar range accordingly
sal_Int32 nOverallFieldPairs = m_pImpl->aFieldLabels.size() / 2; sal_Int32 nOverallFieldPairs = m_pImpl->aFieldLabels.size() / 2;

View File

@@ -163,7 +163,7 @@ void SvObjectServerList::FillInsertObjects()
{ {
if( !Get( aClassName ) ) if( !Get( aClassName ) )
// not entered yet // not entered yet
aObjectServerList.push_back( SvObjectServer( aClassName, aUIName ) ); aObjectServerList.emplace_back( aClassName, aUIName );
} }
} }
} }

View File

@@ -94,7 +94,7 @@ namespace svt
void DialogController::addDependentWindow( vcl::Window& _rWindow ) void DialogController::addDependentWindow( vcl::Window& _rWindow )
{ {
m_pImpl->aConcernedWindows.push_back( &_rWindow ); m_pImpl->aConcernedWindows.emplace_back(&_rWindow );
VclWindowEvent aEvent( &_rWindow, VclEventId::NONE, nullptr ); VclWindowEvent aEvent( &_rWindow, VclEventId::NONE, nullptr );
impl_update( aEvent, _rWindow ); impl_update( aEvent, _rWindow );

View File

@@ -51,7 +51,7 @@ public:
LanguageType GetTypeAtIndex( sal_uInt32 nIndex ) const; LanguageType GetTypeAtIndex( sal_uInt32 nIndex ) const;
sal_uInt32 AddItem(const OUString& rLanguage, const LanguageType eType) sal_uInt32 AddItem(const OUString& rLanguage, const LanguageType eType)
{ {
m_aStrings.push_back(std::make_pair(rLanguage, eType)); m_aStrings.emplace_back(rLanguage, eType);
return m_aStrings.size(); return m_aStrings.size();
} }
LanguageType GetValue(sal_uInt32 nIndex) const LanguageType GetValue(sal_uInt32 nIndex) const
@@ -154,7 +154,7 @@ SvtLanguageTableImpl::SvtLanguageTableImpl()
{ {
for (size_t i = 0; i < SAL_N_ELEMENTS(STR_ARR_SVT_LANGUAGE_TABLE); ++i) for (size_t i = 0; i < SAL_N_ELEMENTS(STR_ARR_SVT_LANGUAGE_TABLE); ++i)
{ {
m_aStrings.push_back(std::make_pair(SvtResId(STR_ARR_SVT_LANGUAGE_TABLE[i].first), STR_ARR_SVT_LANGUAGE_TABLE[i].second)); m_aStrings.emplace_back(SvtResId(STR_ARR_SVT_LANGUAGE_TABLE[i].first), STR_ARR_SVT_LANGUAGE_TABLE[i].second);
} }
auto xNA = officecfg::VCL::ExtraLanguages::get(); auto xNA = officecfg::VCL::ExtraLanguages::get();

View File

@@ -1523,7 +1523,7 @@ const HTMLOptions& HTMLParser::GetOptions( HtmlOptionId const *pNoConvertToken )
} }
// Token is known and can be saved // Token is known and can be saved
maOptions.push_back(HTMLOption(nToken, sName, aValue)); maOptions.emplace_back(nToken, sName, aValue);
} }
else else

View File

@@ -772,7 +772,7 @@ namespace svt { namespace table
if ( flexibility > 0 ) if ( flexibility > 0 )
++flexibleColumnCount; ++flexibleColumnCount;
effectiveColumnLimits.push_back( ::std::pair< long, long >( effectiveMin, effectiveMax ) ); effectiveColumnLimits.emplace_back( effectiveMin, effectiveMax );
accumulatedMinWidth += effectiveMin; accumulatedMinWidth += effectiveMin;
accumulatedMaxWidth += effectiveMax; accumulatedMaxWidth += effectiveMax;
} }
@@ -1028,7 +1028,7 @@ namespace svt { namespace table
{ {
const long columnStart = accumulatedWidthPixel; const long columnStart = accumulatedWidthPixel;
const long columnEnd = columnStart + newWidthsPixel[col]; const long columnEnd = columnStart + newWidthsPixel[col];
m_aColumnWidths.push_back( MutableColumnMetrics( columnStart, columnEnd ) ); m_aColumnWidths.emplace_back( columnStart, columnEnd );
accumulatedWidthPixel = columnEnd; accumulatedWidthPixel = columnEnd;
// and don't forget to forward this to the column models // and don't forget to forward this to the column models

View File

@@ -613,7 +613,7 @@ Reference< XEnumeration > SAL_CALL TreeControlPeer::createSelectionEnumeration()
UnoTreeListEntry* pEntry = dynamic_cast< UnoTreeListEntry* >( rTree.FirstSelected() ); UnoTreeListEntry* pEntry = dynamic_cast< UnoTreeListEntry* >( rTree.FirstSelected() );
while( pEntry && nSelectionCount ) while( pEntry && nSelectionCount )
{ {
aSelection.push_back( Any( pEntry->mxNode ) ); aSelection.emplace_back( pEntry->mxNode );
pEntry = dynamic_cast< UnoTreeListEntry* >( rTree.NextSelected( pEntry ) ); pEntry = dynamic_cast< UnoTreeListEntry* >( rTree.NextSelected( pEntry ) );
--nSelectionCount; --nSelectionCount;
} }

View File

@@ -579,7 +579,7 @@ void SAL_CALL SvUnoImageMap::insertByIndex( sal_Int32 nIndex, const Any& Element
throw IndexOutOfBoundsException(); throw IndexOutOfBoundsException();
if( nIndex == nCount ) if( nIndex == nCount )
maObjectList.push_back( pObject ); maObjectList.emplace_back(pObject );
else else
{ {
auto aIter = maObjectList.begin(); auto aIter = maObjectList.begin();