[Libreoffice-commits] core.git: svgio/source svl/source svtools/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Sep 12 11:16:03 UTC 2017


 svgio/source/svgreader/svgdocumenthandler.cxx      |    2 -
 svgio/source/svgreader/svggradientnode.cxx         |    5 +---
 svl/source/filepicker/pickerhistory.cxx            |    2 -
 svl/source/items/IndexedStyleSheets.cxx            |    4 +--
 svl/source/items/itemprop.cxx                      |    2 -
 svl/source/misc/ownlist.cxx                        |    2 -
 svl/source/passwordcontainer/passwordcontainer.cxx |    2 -
 svl/source/undo/undo.cxx                           |    4 +--
 svtools/source/contnr/fileview.cxx                 |    4 +--
 svtools/source/control/collatorres.cxx             |   24 ++++++++++-----------
 svtools/source/control/indexentryres.cxx           |   20 ++++++++---------
 svtools/source/dialogs/addresstemplate.cxx         |    2 -
 svtools/source/dialogs/insdlg.cxx                  |    2 -
 svtools/source/misc/dialogcontrolling.cxx          |    2 -
 svtools/source/misc/langtab.cxx                    |    4 +--
 svtools/source/svhtml/parhtml.cxx                  |    2 -
 svtools/source/table/tablecontrol_impl.cxx         |    4 +--
 svtools/source/uno/treecontrolpeer.cxx             |    2 -
 svtools/source/uno/unoimap.cxx                     |    2 -
 19 files changed, 45 insertions(+), 46 deletions(-)

New commits:
commit 48b200a0a2aa70a7dfc0aad8a4964690ae11d42e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Sep 12 12:00:35 2017 +0200

    clang-tidy modernize-use-emplace in svgio..svtools
    
    Change-Id: I4f3b0762e197d5397e723aba1dc43e3c857be145
    Reviewed-on: https://gerrit.libreoffice.org/42193
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx b/svgio/source/svgreader/svgdocumenthandler.cxx
index 208eb90c1634..1ce1e3b55ffd 100644
--- a/svgio/source/svgreader/svgdocumenthandler.cxx
+++ b/svgio/source/svgreader/svgdocumenthandler.cxx
@@ -350,7 +350,7 @@ namespace svgio
                         {
                             // if it is a Css style, allow reading text between the start and end tag (see
                             // SvgDocHdl::characters for details)
-                            maCssContents.push_back(OUString());
+                            maCssContents.emplace_back();
                         }
                         break;
                     }
diff --git a/svgio/source/svgreader/svggradientnode.cxx b/svgio/source/svgreader/svggradientnode.cxx
index 675a648393d0..81617c8814dc 100644
--- a/svgio/source/svgreader/svggradientnode.cxx
+++ b/svgio/source/svgreader/svggradientnode.cxx
@@ -289,11 +289,10 @@ namespace svgio
                                 fOffset = 1.0;
                             }
 
-                            aVector.push_back(
-                                drawinglayer::primitive2d::SvgGradientEntry(
+                            aVector.emplace_back(
                                     fOffset,
                                     pStyle->getStopColor(),
-                                    pStyle->getStopOpacity().solve(*this)));
+                                    pStyle->getStopOpacity().solve(*this));
                         }
                         else
                         {
diff --git a/svl/source/filepicker/pickerhistory.cxx b/svl/source/filepicker/pickerhistory.cxx
index c4c4b03008e9..525ac66940a8 100644
--- a/svl/source/filepicker/pickerhistory.cxx
+++ b/svl/source/filepicker/pickerhistory.cxx
@@ -56,7 +56,7 @@ namespace svt
                             _rHistory.end());
 
             // then push_back the picker
-            _rHistory.push_back( css::uno::WeakReference< XInterface >( _rxPicker ) );
+            _rHistory.emplace_back( _rxPicker );
         }
     }
 
diff --git a/svl/source/items/IndexedStyleSheets.cxx b/svl/source/items/IndexedStyleSheets.cxx
index b327315b8a2c..b74cffb2a2c9 100644
--- a/svl/source/items/IndexedStyleSheets.cxx
+++ b/svl/source/items/IndexedStyleSheets.cxx
@@ -49,7 +49,7 @@ namespace svl {
 IndexedStyleSheets::IndexedStyleSheets()
 {
     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();
     mStyleSheetPositionsByFamily.clear();
     for (size_t i = 0; i < NUMBER_OF_FAMILIES; i++) {
-        mStyleSheetPositionsByFamily.push_back(std::vector<unsigned>());
+        mStyleSheetPositionsByFamily.emplace_back();
     }
 
     unsigned i = 0;
diff --git a/svl/source/items/itemprop.cxx b/svl/source/items/itemprop.cxx
index 46dd51b8084d..276ccc797497 100644
--- a/svl/source/items/itemprop.cxx
+++ b/svl/source/items/itemprop.cxx
@@ -157,7 +157,7 @@ PropertyEntryVector_t SfxItemPropertyMap::getPropertyEntries() const
     while( aIt != m_pImpl->end() )
     {
         const SfxItemPropertySimpleEntry* pEntry = &(*aIt).second;
-        aRet.push_back( SfxItemPropertyNamedEntry( (*aIt).first, * pEntry ) );
+        aRet.emplace_back( (*aIt).first, * pEntry );
         ++aIt;
     }
     return aRet;
diff --git a/svl/source/misc/ownlist.cxx b/svl/source/misc/ownlist.cxx
index 18f52af7e99f..7d2b926ebe12 100644
--- a/svl/source/misc/ownlist.cxx
+++ b/svl/source/misc/ownlist.cxx
@@ -34,7 +34,7 @@ void SvCommandList::Append
  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 )
diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx
index 355594e71c2f..f310b6d8b00a 100644
--- a/svl/source/passwordcontainer/passwordcontainer.cxx
+++ b/svl/source/passwordcontainer/passwordcontainer.cxx
@@ -214,7 +214,7 @@ PassMap StorageItem::getInfo()
 
             PassMap::iterator aIter = aResult.find( aUrl );
             if( aIter != aResult.end() )
-                aIter->second.push_back( NamePassRecord( aName, aEPasswd ) );
+                aIter->second.emplace_back( aName, aEPasswd );
             else
             {
                 NamePassRecord aNewRecord( aName, aEPasswd );
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index ce8434180279..087f65986568 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -356,12 +356,12 @@ namespace svl { namespace undo { namespace impl
         */
         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 )
         {
-            m_notifiers.push_back( NotifyUndoListener( i_notificationMethod, i_actionComment ) );
+            m_notifiers.emplace_back( i_notificationMethod, i_actionComment );
         }
 
     private:
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 5b429bc5a406..55f2488444e6 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -146,7 +146,7 @@ void FilterMatch::createWildCardFilterList(const OUString& _rFilterList,::std::v
             sToken = _rFilterList.getToken( 0, ';', nIndex );
             if ( !sToken.isEmpty() )
             {
-                _rFilters.push_back( WildCard( sToken.toAsciiUpperCase() ) );
+                _rFilters.emplace_back( sToken.toAsciiUpperCase() );
             }
         }
         while ( nIndex >= 0 );
@@ -154,7 +154,7 @@ void FilterMatch::createWildCardFilterList(const OUString& _rFilterList,::std::v
     else
     {
         // no filter is given -> match all
-        _rFilters.push_back( WildCard("*") );
+        _rFilters.emplace_back("*" );
     }
 }
 
diff --git a/svtools/source/control/collatorres.cxx b/svtools/source/control/collatorres.cxx
index 2b707859a62e..c2db6b4e9570 100644
--- a/svtools/source/control/collatorres.cxx
+++ b/svtools/source/control/collatorres.cxx
@@ -24,18 +24,18 @@
 //  implementation of the collator-algorithm-name translation
 CollatorResource::CollatorResource()
 {
-    m_aData.push_back(CollatorResourceData("alphanumeric", SvtResId(STR_SVT_COLLATE_ALPHANUMERIC)));
-    m_aData.push_back(CollatorResourceData("charset", SvtResId(STR_SVT_COLLATE_CHARSET)));
-    m_aData.push_back(CollatorResourceData("dict", SvtResId(STR_SVT_COLLATE_DICTIONARY)));
-    m_aData.push_back(CollatorResourceData("normal", SvtResId(STR_SVT_COLLATE_NORMAL)));
-    m_aData.push_back(CollatorResourceData("pinyin", SvtResId(STR_SVT_COLLATE_PINYIN)));
-    m_aData.push_back(CollatorResourceData("radical", SvtResId(STR_SVT_COLLATE_RADICAL)));
-    m_aData.push_back(CollatorResourceData("stroke", SvtResId(STR_SVT_COLLATE_STROKE)));
-    m_aData.push_back(CollatorResourceData("unicode", SvtResId(STR_SVT_COLLATE_UNICODE)));
-    m_aData.push_back(CollatorResourceData("zhuyin", SvtResId(STR_SVT_COLLATE_ZHUYIN)));
-    m_aData.push_back(CollatorResourceData("phonebook", SvtResId(STR_SVT_COLLATE_PHONEBOOK)));
-    m_aData.push_back(CollatorResourceData("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("alphanumeric", SvtResId(STR_SVT_COLLATE_ALPHANUMERIC));
+    m_aData.emplace_back("charset", SvtResId(STR_SVT_COLLATE_CHARSET));
+    m_aData.emplace_back("dict", SvtResId(STR_SVT_COLLATE_DICTIONARY));
+    m_aData.emplace_back("normal", SvtResId(STR_SVT_COLLATE_NORMAL));
+    m_aData.emplace_back("pinyin", SvtResId(STR_SVT_COLLATE_PINYIN));
+    m_aData.emplace_back("radical", SvtResId(STR_SVT_COLLATE_RADICAL));
+    m_aData.emplace_back("stroke", SvtResId(STR_SVT_COLLATE_STROKE));
+    m_aData.emplace_back("unicode", SvtResId(STR_SVT_COLLATE_UNICODE));
+    m_aData.emplace_back("zhuyin", SvtResId(STR_SVT_COLLATE_ZHUYIN));
+    m_aData.emplace_back("phonebook", SvtResId(STR_SVT_COLLATE_PHONEBOOK));
+    m_aData.emplace_back("phonetic (alphanumeric first)", SvtResId(STR_SVT_COLLATE_PHONETIC_F));
+    m_aData.emplace_back("phonetic (alphanumeric last)", SvtResId(STR_SVT_COLLATE_PHONETIC_L));
 }
 
 const OUString&
diff --git a/svtools/source/control/indexentryres.cxx b/svtools/source/control/indexentryres.cxx
index cb8391f0aeeb..9420a37b278f 100644
--- a/svtools/source/control/indexentryres.cxx
+++ b/svtools/source/control/indexentryres.cxx
@@ -25,16 +25,16 @@
 //  implementation of the indexentry-algorithm-name translation
 IndexEntryResource::IndexEntryResource()
 {
-    m_aData.push_back(IndexEntryResourceData("alphanumeric", SvtResId(STR_SVT_INDEXENTRY_ALPHANUMERIC)));
-    m_aData.push_back(IndexEntryResourceData("dict", SvtResId(STR_SVT_INDEXENTRY_DICTIONARY)));
-    m_aData.push_back(IndexEntryResourceData("pinyin", SvtResId(STR_SVT_INDEXENTRY_PINYIN)));
-    m_aData.push_back(IndexEntryResourceData("radical", SvtResId(STR_SVT_INDEXENTRY_RADICAL)));
-    m_aData.push_back(IndexEntryResourceData("stroke", SvtResId(STR_SVT_INDEXENTRY_STROKE)));
-    m_aData.push_back(IndexEntryResourceData("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.push_back(IndexEntryResourceData("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.push_back(IndexEntryResourceData("phonetic (alphanumeric last) (grouped by consonant)", SvtResId(STR_SVT_INDEXENTRY_PHONETIC_LC)));
+    m_aData.emplace_back("alphanumeric", SvtResId(STR_SVT_INDEXENTRY_ALPHANUMERIC));
+    m_aData.emplace_back("dict", SvtResId(STR_SVT_INDEXENTRY_DICTIONARY));
+    m_aData.emplace_back("pinyin", SvtResId(STR_SVT_INDEXENTRY_PINYIN));
+    m_aData.emplace_back("radical", SvtResId(STR_SVT_INDEXENTRY_RADICAL));
+    m_aData.emplace_back("stroke", SvtResId(STR_SVT_INDEXENTRY_STROKE));
+    m_aData.emplace_back("zhuyin", SvtResId(STR_SVT_INDEXENTRY_ZHUYIN));
+    m_aData.emplace_back("phonetic (alphanumeric first) (grouped by syllable)", SvtResId(STR_SVT_INDEXENTRY_PHONETIC_FS));
+    m_aData.emplace_back("phonetic (alphanumeric first) (grouped by consonant)", SvtResId(STR_SVT_INDEXENTRY_PHONETIC_FC));
+    m_aData.emplace_back("phonetic (alphanumeric last) (grouped by syllable)", SvtResId(STR_SVT_INDEXENTRY_PHONETIC_LS));
+    m_aData.emplace_back("phonetic (alphanumeric last) (grouped by consonant)", SvtResId(STR_SVT_INDEXENTRY_PHONETIC_LC));
 }
 
 const OUString& IndexEntryResource::GetTranslation(const OUString &r_Algorithm)
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index 6a815779425d..99389a084066 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -583,7 +583,7 @@ void AssignmentPersistentData::ImplCommit()
         // force a even number of known fields
         m_pImpl->bOddFieldNumber = (m_pImpl->aFieldLabels.size() % 2) != 0;
         if (m_pImpl->bOddFieldNumber)
-            m_pImpl->aFieldLabels.push_back( OUString() );
+            m_pImpl->aFieldLabels.emplace_back( );
 
         // limit the scrollbar range accordingly
         sal_Int32 nOverallFieldPairs = m_pImpl->aFieldLabels.size() / 2;
diff --git a/svtools/source/dialogs/insdlg.cxx b/svtools/source/dialogs/insdlg.cxx
index 323075200693..a16bdc4c0bf9 100644
--- a/svtools/source/dialogs/insdlg.cxx
+++ b/svtools/source/dialogs/insdlg.cxx
@@ -163,7 +163,7 @@ void SvObjectServerList::FillInsertObjects()
                     {
                         if( !Get( aClassName ) )
                             // not entered yet
-                            aObjectServerList.push_back( SvObjectServer( aClassName, aUIName ) );
+                            aObjectServerList.emplace_back( aClassName, aUIName );
                     }
                 }
             }
diff --git a/svtools/source/misc/dialogcontrolling.cxx b/svtools/source/misc/dialogcontrolling.cxx
index 4766e3540feb..a6ae0b394583 100644
--- a/svtools/source/misc/dialogcontrolling.cxx
+++ b/svtools/source/misc/dialogcontrolling.cxx
@@ -94,7 +94,7 @@ namespace svt
 
     void DialogController::addDependentWindow( vcl::Window& _rWindow )
     {
-        m_pImpl->aConcernedWindows.push_back( &_rWindow );
+        m_pImpl->aConcernedWindows.emplace_back(&_rWindow );
 
         VclWindowEvent aEvent( &_rWindow, VclEventId::NONE, nullptr );
         impl_update( aEvent, _rWindow );
diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx
index d714a29599a1..db835cc3a1b6 100644
--- a/svtools/source/misc/langtab.cxx
+++ b/svtools/source/misc/langtab.cxx
@@ -51,7 +51,7 @@ public:
     LanguageType    GetTypeAtIndex( sal_uInt32 nIndex ) const;
     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();
     }
     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)
     {
-        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();
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index 0458e5225c9d..1ec0aa655c5f 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -1523,7 +1523,7 @@ const HTMLOptions& HTMLParser::GetOptions( HtmlOptionId const *pNoConvertToken )
             }
 
             // Token is known and can be saved
-            maOptions.push_back(HTMLOption(nToken, sName, aValue));
+            maOptions.emplace_back(nToken, sName, aValue);
 
         }
         else
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index 5bdb7678b6ea..78825ccb1400 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -772,7 +772,7 @@ namespace svt { namespace table
             if ( flexibility > 0 )
                 ++flexibleColumnCount;
 
-            effectiveColumnLimits.push_back( ::std::pair< long, long >( effectiveMin, effectiveMax ) );
+            effectiveColumnLimits.emplace_back( effectiveMin, effectiveMax );
             accumulatedMinWidth += effectiveMin;
             accumulatedMaxWidth += effectiveMax;
         }
@@ -1028,7 +1028,7 @@ namespace svt { namespace table
         {
             const long columnStart = accumulatedWidthPixel;
             const long columnEnd = columnStart + newWidthsPixel[col];
-            m_aColumnWidths.push_back( MutableColumnMetrics( columnStart, columnEnd ) );
+            m_aColumnWidths.emplace_back( columnStart, columnEnd );
             accumulatedWidthPixel = columnEnd;
 
             // and don't forget to forward this to the column models
diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx
index b4ebeb666c70..247e0dc07618 100644
--- a/svtools/source/uno/treecontrolpeer.cxx
+++ b/svtools/source/uno/treecontrolpeer.cxx
@@ -613,7 +613,7 @@ Reference< XEnumeration > SAL_CALL TreeControlPeer::createSelectionEnumeration()
     UnoTreeListEntry* pEntry = dynamic_cast< UnoTreeListEntry* >( rTree.FirstSelected() );
     while( pEntry && nSelectionCount )
     {
-        aSelection.push_back( Any( pEntry->mxNode ) );
+        aSelection.emplace_back( pEntry->mxNode );
         pEntry = dynamic_cast< UnoTreeListEntry* >( rTree.NextSelected( pEntry ) );
         --nSelectionCount;
     }
diff --git a/svtools/source/uno/unoimap.cxx b/svtools/source/uno/unoimap.cxx
index 096a141cc658..58f95496182f 100644
--- a/svtools/source/uno/unoimap.cxx
+++ b/svtools/source/uno/unoimap.cxx
@@ -579,7 +579,7 @@ void SAL_CALL SvUnoImageMap::insertByIndex( sal_Int32 nIndex, const Any& Element
         throw IndexOutOfBoundsException();
 
     if( nIndex == nCount )
-        maObjectList.push_back( pObject );
+        maObjectList.emplace_back(pObject );
     else
     {
         auto aIter = maObjectList.begin();


More information about the Libreoffice-commits mailing list