clang-tidy modernize-use-emplace in test..vbahelper

Change-Id: Ifbe1dd7c9d5dde33f7419548670434591b1a1d82
Reviewed-on: https://gerrit.libreoffice.org/42258
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2017-09-13 16:43:57 +02:00
parent b0b0aef18f
commit 2d2259c848
21 changed files with 73 additions and 91 deletions

View File

@ -33,33 +33,33 @@ OUString collectPushFlags(PushFlags nFlags)
std::vector<OUString> aStrings;
if (nFlags & PushFlags::LINECOLOR)
aStrings.push_back("PushLineColor");
aStrings.emplace_back("PushLineColor");
if (nFlags & PushFlags::FILLCOLOR)
aStrings.push_back("PushFillColor");
aStrings.emplace_back("PushFillColor");
if (nFlags & PushFlags::FONT)
aStrings.push_back("PushFont");
aStrings.emplace_back("PushFont");
if (nFlags & PushFlags::TEXTCOLOR)
aStrings.push_back("PushTextColor");
aStrings.emplace_back("PushTextColor");
if (nFlags & PushFlags::MAPMODE)
aStrings.push_back("PushMapMode");
aStrings.emplace_back("PushMapMode");
if (nFlags & PushFlags::CLIPREGION)
aStrings.push_back("PushClipRegion");
aStrings.emplace_back("PushClipRegion");
if (nFlags & PushFlags::RASTEROP)
aStrings.push_back("PushRasterOp");
aStrings.emplace_back("PushRasterOp");
if (nFlags & PushFlags::TEXTFILLCOLOR)
aStrings.push_back("PushTextFillColor");
aStrings.emplace_back("PushTextFillColor");
if (nFlags & PushFlags::TEXTALIGN)
aStrings.push_back("PushTextAlign");
aStrings.emplace_back("PushTextAlign");
if (nFlags & PushFlags::REFPOINT)
aStrings.push_back("PushRefPoint");
aStrings.emplace_back("PushRefPoint");
if (nFlags & PushFlags::TEXTLINECOLOR)
aStrings.push_back("PushTextLineColor");
aStrings.emplace_back("PushTextLineColor");
if (nFlags & PushFlags::TEXTLAYOUTMODE)
aStrings.push_back("PushTextLayoutMode");
aStrings.emplace_back("PushTextLayoutMode");
if (nFlags & PushFlags::TEXTLANGUAGE)
aStrings.push_back("PushTextLanguage");
aStrings.emplace_back("PushTextLanguage");
if (nFlags & PushFlags::OVERLINECOLOR)
aStrings.push_back("PushOverlineColor");
aStrings.emplace_back("PushOverlineColor");
OUString aString;
@ -78,41 +78,41 @@ OUString convertDrawTextFlagsToString(DrawTextFlags eDrawTextFlags)
{
std::vector<OUString> aStrings;
if (eDrawTextFlags & DrawTextFlags::Disable)
aStrings.push_back("Disable");
aStrings.emplace_back("Disable");
if (eDrawTextFlags & DrawTextFlags::Mnemonic)
aStrings.push_back("Mnemonic");
aStrings.emplace_back("Mnemonic");
if (eDrawTextFlags & DrawTextFlags::Mono)
aStrings.push_back("Mono");
aStrings.emplace_back("Mono");
if (eDrawTextFlags & DrawTextFlags::Clip)
aStrings.push_back("Clip");
aStrings.emplace_back("Clip");
if (eDrawTextFlags & DrawTextFlags::Left)
aStrings.push_back("Left");
aStrings.emplace_back("Left");
if (eDrawTextFlags & DrawTextFlags::Center)
aStrings.push_back("Center");
aStrings.emplace_back("Center");
if (eDrawTextFlags & DrawTextFlags::Right)
aStrings.push_back("Right");
aStrings.emplace_back("Right");
if (eDrawTextFlags & DrawTextFlags::Top)
aStrings.push_back("Top");
aStrings.emplace_back("Top");
if (eDrawTextFlags & DrawTextFlags::VCenter)
aStrings.push_back("VCenter");
aStrings.emplace_back("VCenter");
if (eDrawTextFlags & DrawTextFlags::Bottom)
aStrings.push_back("Bottom");
aStrings.emplace_back("Bottom");
if (eDrawTextFlags & DrawTextFlags::EndEllipsis)
aStrings.push_back("EndEllipsis");
aStrings.emplace_back("EndEllipsis");
if (eDrawTextFlags & DrawTextFlags::PathEllipsis)
aStrings.push_back("PathEllipsis");
aStrings.emplace_back("PathEllipsis");
if (eDrawTextFlags & DrawTextFlags::MultiLine)
aStrings.push_back("MultiLine");
aStrings.emplace_back("MultiLine");
if (eDrawTextFlags & DrawTextFlags::WordBreak)
aStrings.push_back("WordBreak");
aStrings.emplace_back("WordBreak");
if (eDrawTextFlags & DrawTextFlags::NewsEllipsis)
aStrings.push_back("NewsEllipsis");
aStrings.emplace_back("NewsEllipsis");
if (eDrawTextFlags & DrawTextFlags::WordBreakHyphenation)
aStrings.push_back("WordBreakHyphenation");
aStrings.emplace_back("WordBreakHyphenation");
if (eDrawTextFlags & DrawTextFlags::CenterEllipsis)
aStrings.push_back("CenterEllipsis");
aStrings.emplace_back("CenterEllipsis");
if (eDrawTextFlags & DrawTextFlags::HideMnemonic)
aStrings.push_back("HideMnemonic");
aStrings.emplace_back("HideMnemonic");
OUString aString;

View File

@ -171,7 +171,7 @@ namespace toolkit
o_images.reserve( count );
for ( size_t i = 0; i < count; ++i )
{
o_images.push_back( CachedImage( i_imageURLs[i] ) );
o_images.emplace_back( i_imageURLs[i] );
}
}

View File

@ -147,7 +147,7 @@ public:
Reference< XCloneable > xCloneSource( _rSource.first, UNO_QUERY );
Reference< XControlModel > xClone( xCloneSource->createClone(), UNO_QUERY );
// add to target list
m_rTargetList.push_back( ControlModelContainerBase::UnoControlModelHolder( xClone, _rSource.second ) );
m_rTargetList.emplace_back( xClone, _rSource.second );
}
};
@ -594,7 +594,7 @@ void ControlModelContainerBase::insertByName( const OUString& aName, const Any&
if ( xAllChildren.is() )
updateUserFormChildren( xAllChildren, aName, Insert, xM );
maModels.push_back( UnoControlModelHolder( xM, aName ) );
maModels.emplace_back( xM, aName );
mbGroupsUpToDate = false;
startControlListening( xM );

View File

@ -483,7 +483,7 @@
PropSeqArray &rAggProperties = AggregateProperties::get();
m_nPropertyMapId = rAggProperties.size();
rAggProperties.push_back( xPI->getProperties() );
AmbiguousPropertyIds::get().push_back( IntArrayArray::value_type() );
AmbiguousPropertyIds::get().emplace_back( );
rMap[ m_sServiceSpecifier ] = m_nPropertyMapId;
}

View File

@ -530,7 +530,7 @@ void UnoControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent
// Add properties with dependencies on other properties last
// since they're dependent on properties added later (such as
// VALUE dependency on VALUEMIN/MAX)
aPeerPropertiesToSet.push_back(PropertyValue(pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE));
aPeerPropertiesToSet.emplace_back(pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE);
}
else
{
@ -600,8 +600,7 @@ void UnoControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent
OUString aPropName( OUString::createFromAscii( pLangDepProp->pPropName ));
if ( xPSI.is() && xPSI->hasPropertyByName( aPropName ) )
{
aPeerPropertiesToSet.push_back(
PropertyValue( aPropName, 0, xPS->getPropertyValue( aPropName ), PropertyState_DIRECT_VALUE ) );
aPeerPropertiesToSet.emplace_back( aPropName, 0, xPS->getPropertyValue( aPropName ), PropertyState_DIRECT_VALUE );
}
}

View File

@ -83,7 +83,7 @@ namespace
aRetProp = aPropsNames.getPropertiesNames();
CPPUNIT_ASSERT_EQUAL( true, ( aProps == aRetProp ) );
aProps[0].properties.push_back( "DAV:getlastmodified" );
aProps[0].properties.emplace_back("DAV:getlastmodified" );
aRetProp = aPropsNames.getPropertiesNames();
CPPUNIT_ASSERT_EQUAL( false, ( aProps == aRetProp ) );
}

View File

@ -239,8 +239,7 @@ XResultSet_impl::OneMore()
{
osl::MutexGuard aGuard( m_aMutex );
m_aItems.push_back( aRow );
m_aIdents.push_back(
uno::Reference< ucb::XContentIdentifier >() );
m_aIdents.emplace_back( );
m_aUnqPath.push_back( aUnqPath );
rowCountChanged();
return true;
@ -254,8 +253,7 @@ XResultSet_impl::OneMore()
{
osl::MutexGuard aGuard( m_aMutex );
m_aItems.push_back( aRow );
m_aIdents.push_back(
uno::Reference< ucb::XContentIdentifier >() );
m_aIdents.emplace_back( );
m_aUnqPath.push_back( aUnqPath );
rowCountChanged();
return true;
@ -268,8 +266,7 @@ XResultSet_impl::OneMore()
{
osl::MutexGuard aGuard( m_aMutex );
m_aItems.push_back( aRow );
m_aIdents.push_back(
uno::Reference< ucb::XContentIdentifier >() );
m_aIdents.emplace_back( );
m_aUnqPath.push_back( aUnqPath );
rowCountChanged();
return true;

View File

@ -586,7 +586,7 @@ void Content::queryChildren( ContentRefList& rChildren )
if ( ( nPos == -1 ) || ( nPos == ( aChildURL.getLength() - 1 ) ) )
{
// No further slashes / only a final slash. It's a child!
rChildren.push_back( ::gio::Content::ContentRef (static_cast< ::gio::Content * >(xChild.get() ) ) );
rChildren.emplace_back(static_cast< ::gio::Content * >(xChild.get() ) );
}
}
++it;

View File

@ -760,9 +760,8 @@ void HierarchyContent::queryChildren( HierarchyContentRefList& rChildren )
( nPos == ( aChildURL.getLength() - 1 ) ) )
{
// No further slashes/ only a final slash. It's a child!
rChildren.push_back(
HierarchyContentRef(
static_cast< HierarchyContent * >( xChild.get() ) ) );
rChildren.emplace_back(
static_cast< HierarchyContent * >( xChild.get() ) );
}
}
++it;

View File

@ -2070,9 +2070,8 @@ void Content::queryChildren( ContentRefList& rChildren )
if ( aChildURL.indexOf( '/', nLen ) == -1 )
{
// No further slashes. It's a child!
rChildren.push_back(
ContentRef(
static_cast< Content * >( xChild.get() ) ) );
rChildren.emplace_back(
static_cast< Content * >( xChild.get() ) );
}
}
++it;

View File

@ -743,9 +743,8 @@ void Content::queryChildren( ContentRefList& rChildren )
( nPos == ( aChildURL.getLength() - 1 ) ) )
{
// No further slashes / only a final slash. It's a child!
rChildren.push_back(
ContentRef(
static_cast< Content * >( xChild.get() ) ) );
rChildren.emplace_back(
static_cast< Content * >( xChild.get() ) );
}
}
++it;

View File

@ -315,18 +315,15 @@ void ContentProperties::UCBNamesToHTTPNames(
if ( rProp.Name == "DateModified" )
{
propertyNames.push_back(
OUString("Last-Modified") );
propertyNames.emplace_back("Last-Modified" );
}
else if ( rProp.Name == "MediaType" )
{
propertyNames.push_back(
OUString("Content-Type") );
propertyNames.emplace_back("Content-Type" );
}
else if ( rProp.Name == "Size" )
{
propertyNames.push_back(
OUString("Content-Length") );
propertyNames.emplace_back("Content-Length" );
}
else
{

View File

@ -1089,10 +1089,9 @@ void DAVResourceAccess::getUserRequestHeaders(
for ( sal_Int32 n = 0; n < aRequestHeaders.getLength(); ++n )
{
rRequestHeaders.push_back(
DAVRequestHeader(
rRequestHeaders.emplace_back(
aRequestHeaders[ n ].First,
aRequestHeaders[ n ].Second ) );
aRequestHeaders[ n ].Second );
}
}
}
@ -1109,8 +1108,7 @@ void DAVResourceAccess::getUserRequestHeaders(
return;
}
}
rRequestHeaders.push_back(
DAVRequestHeader( "User-Agent", "LibreOffice" ) );
rRequestHeaders.emplace_back( "User-Agent", "LibreOffice" );
}
// This function member implements the control on cyclical redirections

View File

@ -110,8 +110,8 @@ namespace
bool bIsRequestSize = false;
DAVResource aResource;
DAVRequestHeaders aPartialGet;
aPartialGet.push_back( DAVRequestHeader( OUString( "Range" ), // see <https://tools.ietf.org/html/rfc7233#section-3.1>
OUString( "bytes=0-0" ) ) );
aPartialGet.emplace_back( OUString( "Range" ), // see <https://tools.ietf.org/html/rfc7233#section-3.1>
OUString( "bytes=0-0" ) );
for ( std::vector< rtl::OUString >::const_iterator it = aHeaderNames.begin();
it != aHeaderNames.end(); ++it )
@ -127,8 +127,8 @@ namespace
{
// we need to know if the server accepts range requests for a resource
// and the range unit it uses
aHeaderNames.push_back( OUString( "Accept-Ranges" ) ); // see <https://tools.ietf.org/html/rfc7233#section-2.3>
aHeaderNames.push_back( OUString( "Content-Range" ) ); // see <https://tools.ietf.org/html/rfc7233#section-4.2>
aHeaderNames.emplace_back( "Accept-Ranges" ); // see <https://tools.ietf.org/html/rfc7233#section-2.3>
aHeaderNames.emplace_back( "Content-Range" ); // see <https://tools.ietf.org/html/rfc7233#section-4.2>
}
try
{
@ -1522,7 +1522,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
// in case of not DAV PROFIND (previously in program flow) failed
// so we need to add the only prop that's common
// to DAV and NON_DAV: MediaType, that maps to Content-Type
aHeaderNames.push_back( "Content-Type" );
aHeaderNames.emplace_back("Content-Type" );
}
if (!aHeaderNames.empty()) try
@ -2479,10 +2479,9 @@ void Content::queryChildren( ContentRefList& rChildren )
( nPos == ( aChildURL.getLength() - 1 ) ) )
{
// No further slashes / only a final slash. It's a child!
rChildren.push_back(
::webdav_ucp::Content::ContentRef(
rChildren.emplace_back(
static_cast< ::webdav_ucp::Content * >(
xChild.get() ) ) );
xChild.get() ) );
}
}
++it;
@ -4277,10 +4276,9 @@ bool Content::isResourceAvailable( const css::uno::Reference< css::ucb::XCommand
// do a GET with a payload of 0, the server does not
// support HEAD (or has HEAD disabled)
DAVRequestHeaders aPartialGet;
aPartialGet.push_back(
DAVRequestHeader(
aPartialGet.emplace_back(
OUString( "Range" ),
OUString( "bytes=0-0" )));
OUString( "bytes=0-0" ));
rResAccess->GET0( aPartialGet,
aHeaderNames,

View File

@ -734,11 +734,8 @@ void InternetProxyDecider_Impl::setNoProxyList(
}
}
m_aNoProxyList.push_back(
NoProxyListEntry( WildCard( aToken ),
WildCard(
aFullyQualifiedHost
.makeStringAndClear() ) ) );
m_aNoProxyList.emplace_back( WildCard( aToken ),
WildCard( aFullyQualifiedHost.makeStringAndClear() ) );
}
if ( nEnd != nLen )

View File

@ -205,9 +205,8 @@ void ContentProviderImplHelper::queryExistingContents(
uno::Reference< ucb::XContent > xContent( (*it).second );
if ( xContent.is() )
{
rContents.push_back(
rtl::Reference< ContentImplHelper >(
static_cast< ContentImplHelper * >( xContent.get() ) ) );
rContents.emplace_back(
static_cast< ContentImplHelper * >( xContent.get() ) );
}
++it;
}

View File

@ -1084,7 +1084,7 @@ const FontNameAttr* FontSubstConfiguration::getSubstInfo( const OUString& rFontN
::std::vector< OUString > aFallbacks( aLanguageTag.getFallbackStrings( true));
if (aLanguageTag.getLanguage() != "en")
aFallbacks.push_back("en");
aFallbacks.emplace_back("en");
for (::std::vector< OUString >::const_iterator fb( aFallbacks.begin()); fb != aFallbacks.end(); ++fb)
{

View File

@ -146,7 +146,7 @@ namespace utl
}
OEventListenerImpl* pListenerImpl = new OEventListenerImpl(this, _rxComp);
m_pImpl->aListeners.push_back(pListenerImpl);
m_pImpl->aListeners.emplace_back(pListenerImpl);
}
} // namespace utl

View File

@ -190,7 +190,7 @@ namespace DOM { namespace events {
{
Reference< XEventTarget > const xRef(
rDocument.GetCNode(cur).get());
captureVector.push_back(::std::make_pair(xRef, cur));
captureVector.emplace_back(xRef, cur);
cur = cur->parent;
}
captureListeners = m_CaptureListeners;

View File

@ -61,7 +61,7 @@ sal_Bool SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, cons
processing the original event. All unprocessed events are collected in
a queue. First element in the queue is the next event to be processed. */
EventQueue aEventQueue;
aEventQueue.push_back( EventQueueEntry( nEventId, rArgs ) );
aEventQueue.emplace_back( nEventId, rArgs );
/* bCancel will contain the current Cancel value. It is possible that
multiple events will try to modify the Cancel value. Every event

View File

@ -80,7 +80,7 @@ void ScVbaShapes::initBaseCollection()
sal_Int32 nLen = m_xIndexAccess->getCount();
aShapes.reserve( nLen );
for ( sal_Int32 index=0; index<nLen; ++index )
aShapes.push_back( uno::Reference< drawing::XShape >( m_xIndexAccess->getByIndex( index ) , uno::UNO_QUERY ) );
aShapes.emplace_back( m_xIndexAccess->getByIndex( index ) , uno::UNO_QUERY );
uno::Reference< container::XIndexAccess > xShapes( new XNamedObjectCollectionHelper< drawing::XShape >( aShapes ) );
m_xIndexAccess.set( xShapes, uno::UNO_QUERY );
m_xNameAccess.set( xShapes, uno::UNO_QUERY );