optimise find/insert pattern
if we're doing a find/insert on a set or a map, it is better to just do a conditional insert/emplace operation than triggering two lookups. Change-Id: I80da5097f5a89fe30fa348ce5b6e747c34287a8d Reviewed-on: https://gerrit.libreoffice.org/70937 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -124,11 +124,10 @@ namespace basctl { namespace docs {
|
||||
// those
|
||||
continue;
|
||||
|
||||
if ( aEncounteredModels.find( xModel ) != aEncounteredModels.end() )
|
||||
if ( !aEncounteredModels.insert( xModel ).second )
|
||||
// there might be multiple frames for the same model
|
||||
// handle it only once
|
||||
continue;
|
||||
aEncounteredModels.insert( xModel );
|
||||
|
||||
// create a DocumentDescriptor
|
||||
DocumentDescriptor aDescriptor;
|
||||
|
||||
@@ -155,11 +155,12 @@ sal_Int32 VtableFactory::BaseOffset::calculate(
|
||||
typelib_InterfaceTypeDescription * type, sal_Int32 offset)
|
||||
{
|
||||
OUString name(type->aBase.pTypeName);
|
||||
if (m_map.find(name) == m_map.end()) {
|
||||
auto it = m_map.find(name);
|
||||
if (it == m_map.end()) {
|
||||
for (sal_Int32 i = 0; i < type->nBaseTypes; ++i) {
|
||||
offset = calculate(type->ppBaseTypes[i], offset);
|
||||
}
|
||||
m_map.insert({name, offset});
|
||||
m_map.insert(it, {name, offset});
|
||||
typelib_typedescription_complete(
|
||||
reinterpret_cast< typelib_TypeDescription ** >(&type));
|
||||
offset += bridges::cpp_uno::shared::getLocalFunctions(type);
|
||||
|
||||
@@ -603,8 +603,7 @@ bool CStyleCast::rewriteArithmeticCast(CStyleCastExpr const * expr, char const *
|
||||
secondBegin = l;
|
||||
++secondLen;
|
||||
}
|
||||
if (rewritten_.find(firstBegin) == rewritten_.end()) {
|
||||
rewritten_.insert(firstBegin);
|
||||
if (rewritten_.insert(firstBegin).second) {
|
||||
if (!replaceText(firstBegin, firstLen, functional ? "" : "static_cast<")) {
|
||||
if (isDebugMode()) {
|
||||
report(
|
||||
@@ -630,8 +629,7 @@ bool CStyleCast::rewriteArithmeticCast(CStyleCastExpr const * expr, char const *
|
||||
}
|
||||
}
|
||||
if (third.isValid()) {
|
||||
if (rewritten_.find(third) == rewritten_.end()) {
|
||||
rewritten_.insert(third);
|
||||
if (rewritten_.insert(third).second) {
|
||||
if (!insertTextBefore(third, "(")) {
|
||||
//TODO: roll back
|
||||
if (isDebugMode()) {
|
||||
|
||||
@@ -130,8 +130,7 @@ bool MemoryVar::VisitCXXDeleteExpr(const CXXDeleteExpr *deleteExpr)
|
||||
|
||||
SourceLocation loc = varDecl->getLocation();
|
||||
|
||||
if (maVarUsesSet.find(loc) == maVarUsesSet.end()) {
|
||||
maVarUsesSet.insert(loc);
|
||||
if (maVarUsesSet.insert(loc).second) {
|
||||
maVarDeclSourceRangeMap[loc] = varDecl->getSourceRange();
|
||||
maVarDeleteSourceRangeMap[loc] = declRefExpr->getSourceRange();
|
||||
}
|
||||
|
||||
@@ -267,24 +267,18 @@ void XcsParser::endElement(xmlreader::XmlReader const & reader) {
|
||||
switch (state_) {
|
||||
case STATE_TEMPLATES:
|
||||
{
|
||||
NodeMap::iterator i(data_.templates.find(top.name));
|
||||
if (i == data_.templates.end()) {
|
||||
data_.templates.insert(
|
||||
NodeMap::value_type(top.name, top.node));
|
||||
} else {
|
||||
merge(i->second, top.node);
|
||||
auto itPair = data_.templates.insert({top.name, top.node});
|
||||
if (!itPair.second) {
|
||||
merge(itPair.first->second, top.node);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case STATE_COMPONENT:
|
||||
{
|
||||
NodeMap & components = data_.getComponents();
|
||||
NodeMap::iterator i(components.find(top.name));
|
||||
if (i == components.end()) {
|
||||
components.insert(
|
||||
NodeMap::value_type(top.name, top.node));
|
||||
} else {
|
||||
merge(i->second, top.node);
|
||||
auto itPair = components.insert({top.name, top.node});
|
||||
if (!itPair.second) {
|
||||
merge(itPair.first->second, top.node);
|
||||
}
|
||||
state_ = STATE_COMPONENT_DONE;
|
||||
}
|
||||
|
||||
@@ -71,9 +71,8 @@ void FontFeaturesDialog::initialize()
|
||||
for (vcl::font::Feature const& rFontFeature : rFontFeatures)
|
||||
{
|
||||
sal_uInt32 nFontFeatureCode = rFontFeature.m_aID.m_aFeatureCode;
|
||||
if (aDoneFeatures.find(nFontFeatureCode) != aDoneFeatures.end())
|
||||
if (!aDoneFeatures.insert(nFontFeatureCode).second)
|
||||
continue;
|
||||
aDoneFeatures.insert(nFontFeatureCode);
|
||||
rFilteredFontFeatures.push_back(rFontFeature);
|
||||
}
|
||||
|
||||
|
||||
@@ -1042,16 +1042,14 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
|
||||
// Fill command map. It stores all our commands and from what
|
||||
// image manager we got our image. So we can decide if we have to use an
|
||||
// image from a notification message.
|
||||
CommandToInfoMap::iterator pIter = m_aCommandMap.find( aCommandURL );
|
||||
if ( pIter == m_aCommandMap.end())
|
||||
auto pIter = m_aCommandMap.emplace( aCommandURL, aCmdInfo );
|
||||
if ( pIter.second )
|
||||
{
|
||||
aCmdInfo.nId = nId;
|
||||
const CommandToInfoMap::value_type aValue( aCommandURL, aCmdInfo );
|
||||
m_aCommandMap.insert( aValue );
|
||||
}
|
||||
else
|
||||
{
|
||||
pIter->second.aIds.push_back( nId );
|
||||
pIter.first->second.aIds.push_back( nId );
|
||||
}
|
||||
|
||||
if ( !bIsVisible )
|
||||
@@ -1197,16 +1195,15 @@ void ToolBarManager::FillOverflowToolbar( ToolBox const * pParent )
|
||||
// Fill command map. It stores all our commands and from what
|
||||
// image manager we got our image. So we can decide if we have to use an
|
||||
// image from a notification message.
|
||||
CommandToInfoMap::iterator pIter = m_aCommandMap.find( aCommandURL );
|
||||
if ( pIter == m_aCommandMap.end())
|
||||
auto pIter = m_aCommandMap.emplace( aCommandURL, aCmdInfo );
|
||||
if ( pIter.second )
|
||||
{
|
||||
aCmdInfo.nId = nId;
|
||||
const CommandToInfoMap::value_type aValue( aCommandURL, aCmdInfo );
|
||||
m_aCommandMap.insert( aValue );
|
||||
}
|
||||
else
|
||||
{
|
||||
pIter->second.aIds.push_back( nId );
|
||||
pIter.first->second.aIds.push_back( nId );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1065,8 +1065,7 @@ void ZipFile::recover()
|
||||
aEntry.nSize = 0;
|
||||
}
|
||||
|
||||
if ( aEntries.find( aEntry.sPath ) == aEntries.end() )
|
||||
aEntries[aEntry.sPath] = aEntry;
|
||||
aEntries.emplace( aEntry.sPath, aEntry );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1109,11 +1109,8 @@ static sal_uInt32 checkTypeReaders(RegistryTypeReader const & reader1,
|
||||
}
|
||||
for (sal_uInt32 i=0 ; i < reader2.getFieldCount(); i++)
|
||||
{
|
||||
if (nameSet.find(reader2.getFieldName(i)) == nameSet.end())
|
||||
{
|
||||
nameSet.insert(reader2.getFieldName(i));
|
||||
if (nameSet.insert(reader2.getFieldName(i)).second)
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -120,13 +120,7 @@ private:
|
||||
|
||||
rtl_uString* internString( ScDPCache::StringSetType& rPool, const OUString& rStr )
|
||||
{
|
||||
ScDPCache::StringSetType::iterator it = rPool.find(rStr);
|
||||
if (it != rPool.end())
|
||||
// In the pool.
|
||||
return (*it).pData;
|
||||
|
||||
std::pair<ScDPCache::StringSetType::iterator, bool> r = rPool.insert(rStr);
|
||||
return r.second ? (*r.first).pData : nullptr;
|
||||
return rPool.insert(rStr).first->pData;
|
||||
}
|
||||
|
||||
OUString createLabelString( const ScDocument* pDoc, SCCOL nCol, const ScRefCellValue& rCell )
|
||||
|
||||
@@ -3896,9 +3896,7 @@ void ScDPResultVisibilityData::addVisibleMember(const OUString& rDimName, const
|
||||
itr = r.first;
|
||||
}
|
||||
VisibleMemberType& rMem = itr->second;
|
||||
VisibleMemberType::iterator itrMem = rMem.find(rMemberItem);
|
||||
if (itrMem == rMem.end())
|
||||
rMem.insert(rMemberItem);
|
||||
rMem.insert(rMemberItem);
|
||||
}
|
||||
|
||||
void ScDPResultVisibilityData::fillFieldFilters(vector<ScDPFilteredCache::Criterion>& rFilters) const
|
||||
@@ -3962,8 +3960,7 @@ ScDPResultMember* ScDPResultDimension::AddMember(const ScDPParentDimData &aData
|
||||
SCROW nDataIndex = pMember->GetDataId();
|
||||
maMemberArray.emplace_back( pMember );
|
||||
|
||||
if ( maMemberHash.end() == maMemberHash.find( nDataIndex ) )
|
||||
maMemberHash.insert( std::pair< SCROW, ScDPResultMember *>( nDataIndex, pMember ) );
|
||||
maMemberHash.emplace( nDataIndex, pMember );
|
||||
return pMember;
|
||||
}
|
||||
|
||||
@@ -3976,8 +3973,7 @@ ScDPResultMember* ScDPResultDimension::InsertMember(const ScDPParentDimData *pMe
|
||||
maMemberArray.emplace( maMemberArray.begin()+nInsert, pNew );
|
||||
|
||||
SCROW nDataIndex = pMemberData->mpMemberDesc->GetItemDataId();
|
||||
if ( maMemberHash.end() == maMemberHash.find( nDataIndex ) )
|
||||
maMemberHash.insert( std::pair< SCROW, ScDPResultMember *>( nDataIndex, pNew ) );
|
||||
maMemberHash.emplace( nDataIndex, pNew );
|
||||
return pNew;
|
||||
}
|
||||
return maMemberArray[ nInsert ].get();
|
||||
|
||||
@@ -3020,10 +3020,8 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
|
||||
aStyleName = pEntry->GetStyleName();
|
||||
}
|
||||
|
||||
if (maStyleNameToDxfId.find(aStyleName) == maStyleNameToDxfId.end())
|
||||
if (maStyleNameToDxfId.emplace(aStyleName, nIndex).second)
|
||||
{
|
||||
maStyleNameToDxfId.insert(std::pair<OUString, sal_Int32>(aStyleName, nIndex));
|
||||
|
||||
SfxStyleSheetBase* pStyle = rRoot.GetDoc().GetStyleSheetPool()->Find(aStyleName);
|
||||
if(!pStyle)
|
||||
continue;
|
||||
|
||||
@@ -116,18 +116,8 @@ void ScMyStyleRanges::AddCurrencyRange(const ScRange& rRange, const boost::optio
|
||||
ScMyCurrencyStyle aStyle;
|
||||
if (pCurrency)
|
||||
aStyle.sCurrency = *pCurrency;
|
||||
ScMyCurrencyStylesSet::iterator aItr(pCurrencyList->find(aStyle));
|
||||
if (aItr == pCurrencyList->end())
|
||||
{
|
||||
std::pair<ScMyCurrencyStylesSet::iterator, bool> aPair(pCurrencyList->insert(aStyle));
|
||||
if (aPair.second)
|
||||
{
|
||||
aItr = aPair.first;
|
||||
aItr->mpRanges->addRange(rRange);
|
||||
}
|
||||
}
|
||||
else
|
||||
aItr->mpRanges->addRange(rRange);
|
||||
auto itPair = pCurrencyList->insert(aStyle);
|
||||
itPair.first->mpRanges->addRange(rRange);
|
||||
}
|
||||
|
||||
void ScMyStyleRanges::InsertCol(const sal_Int32 nCol, const sal_Int32 nTab)
|
||||
@@ -257,19 +247,8 @@ ScMyStylesSet::iterator ScMyStylesImportHelper::GetIterator(const boost::optiona
|
||||
{
|
||||
OSL_FAIL("here is no stylename given");
|
||||
}
|
||||
ScMyStylesSet::iterator aItr(aCellStyles.find(aStyle));
|
||||
if (aItr == aCellStyles.end())
|
||||
{
|
||||
std::pair<ScMyStylesSet::iterator, bool> aPair(aCellStyles.insert(aStyle));
|
||||
if (aPair.second)
|
||||
aItr = aPair.first;
|
||||
else
|
||||
{
|
||||
OSL_FAIL("not possible to insert style");
|
||||
return aCellStyles.end();
|
||||
}
|
||||
}
|
||||
return aItr;
|
||||
auto itPair = aCellStyles.insert(aStyle);
|
||||
return itPair.first;
|
||||
}
|
||||
|
||||
void ScMyStylesImportHelper::AddDefaultRange(const ScRange& rRange)
|
||||
|
||||
@@ -1793,9 +1793,8 @@ bool ScDBFunc::DataPilotMove( const ScRange& rSource, const ScAddress& rDest )
|
||||
pDPObj->GetHeaderPositionData( ScAddress( nCol, nRow, rSource.aStart.Tab() ), aSourceData );
|
||||
if ( aSourceData.Dimension == aDestData.Dimension && !aSourceData.MemberName.isEmpty() )
|
||||
{
|
||||
if ( aMembersSet.find( aSourceData.MemberName ) == aMembersSet.end() )
|
||||
if ( aMembersSet.insert( aSourceData.MemberName ).second )
|
||||
{
|
||||
aMembersSet.insert( aSourceData.MemberName );
|
||||
aMembersVector.push_back( aSourceData.MemberName );
|
||||
}
|
||||
// duplicates are ignored
|
||||
|
||||
@@ -100,11 +100,10 @@ void SAL_CALL Configuration::addResource (const Reference<XResourceId>& rxResour
|
||||
if ( ! rxResourceId.is() || rxResourceId->getResourceURL().isEmpty())
|
||||
throw css::lang::IllegalArgumentException();
|
||||
|
||||
if (mpResourceContainer->find(rxResourceId) == mpResourceContainer->end())
|
||||
if (mpResourceContainer->insert(rxResourceId).second)
|
||||
{
|
||||
SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": Configuration::addResource() " <<
|
||||
FrameworkHelper::ResourceIdToString(rxResourceId));
|
||||
mpResourceContainer->insert(rxResourceId);
|
||||
PostEvent(rxResourceId, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,9 +127,8 @@ void CurrentMasterPagesSelector::Fill (ItemList& rItemList)
|
||||
|
||||
// Use the name of the master page to avoid duplicate entries.
|
||||
OUString sName (pMasterPage->GetName());
|
||||
if (aMasterPageNames.find(sName)!=aMasterPageNames.end())
|
||||
if (!aMasterPageNames.insert(sName).second)
|
||||
continue;
|
||||
aMasterPageNames.insert (sName);
|
||||
|
||||
// Look up the master page in the container and, when it is not yet
|
||||
// in it, insert it.
|
||||
|
||||
@@ -990,9 +990,8 @@ bool FindAttrImpl(SwPaM & rSearchPam,
|
||||
if( !pNode->HasSwAttrSet() )
|
||||
{
|
||||
SwFormat* pTmpFormat = pNode->GetFormatColl();
|
||||
if( aFormatArr.find( pTmpFormat ) != aFormatArr.end() )
|
||||
if( !aFormatArr.insert( pTmpFormat ).second )
|
||||
continue; // collection was requested earlier
|
||||
aFormatArr.insert( pTmpFormat );
|
||||
}
|
||||
|
||||
if( SfxItemState::SET == pNode->GetSwAttrSet().GetItemState( nWhich,
|
||||
@@ -1165,9 +1164,8 @@ static bool FindAttrsImpl(SwPaM & rSearchPam,
|
||||
if (!rPropsNode.HasSwAttrSet())
|
||||
{
|
||||
SwFormat* pTmpFormat = rPropsNode.GetFormatColl();
|
||||
if( aFormatArr.find( pTmpFormat ) != aFormatArr.end() )
|
||||
if( !aFormatArr.insert( pTmpFormat ).second )
|
||||
continue; // collection was requested earlier
|
||||
aFormatArr.insert( pTmpFormat );
|
||||
}
|
||||
|
||||
if (lcl_Search(rPropsNode, aOtherSet, bNoColls))
|
||||
|
||||
@@ -45,13 +45,9 @@ void DocumentListItemsManager::addListItem( const SwNodeNum& rNodeNum )
|
||||
}
|
||||
|
||||
const bool bAlreadyInserted(
|
||||
mpListItemsList->find( &rNodeNum ) != mpListItemsList->end() );
|
||||
mpListItemsList->insert( &rNodeNum ).second );
|
||||
OSL_ENSURE( !bAlreadyInserted,
|
||||
"<DocumentListItemsManager::addListItem(..)> - <SwNodeNum> instance already registered as numbered item!" );
|
||||
if ( !bAlreadyInserted )
|
||||
{
|
||||
mpListItemsList->insert( &rNodeNum );
|
||||
}
|
||||
}
|
||||
|
||||
void DocumentListItemsManager::removeListItem( const SwNodeNum& rNodeNum )
|
||||
|
||||
@@ -35,12 +35,7 @@ SwMovedFwdFramesByObjPos::~SwMovedFwdFramesByObjPos()
|
||||
void SwMovedFwdFramesByObjPos::Insert( const SwTextFrame& _rMovedFwdFrameByObjPos,
|
||||
const sal_uInt32 _nToPageNum )
|
||||
{
|
||||
if ( maMovedFwdFrames.end() ==
|
||||
maMovedFwdFrames.find(_rMovedFwdFrameByObjPos.GetTextNodeFirst()) )
|
||||
{
|
||||
const NodeMapEntry aEntry(_rMovedFwdFrameByObjPos.GetTextNodeFirst(), _nToPageNum);
|
||||
maMovedFwdFrames.insert( aEntry );
|
||||
}
|
||||
maMovedFwdFrames.emplace(_rMovedFwdFrameByObjPos.GetTextNodeFirst(), _nToPageNum);
|
||||
}
|
||||
|
||||
void SwMovedFwdFramesByObjPos::Remove( const SwTextFrame& _rTextFrame )
|
||||
|
||||
@@ -2676,12 +2676,10 @@ const SwCellFrame * SwTableCellInfo::Impl::getNextTableBoxsCellFrame(const SwFra
|
||||
{
|
||||
const SwCellFrame * pCellFrame = static_cast<const SwCellFrame *>(pFrame);
|
||||
const SwTableBox * pTabBox = pCellFrame->GetTabBox();
|
||||
TableBoxes_t::const_iterator aIt = m_HandledTableBoxes.find(pTabBox);
|
||||
|
||||
if (aIt == m_HandledTableBoxes.end())
|
||||
auto aIt = m_HandledTableBoxes.insert(pTabBox);
|
||||
if (aIt.second)
|
||||
{
|
||||
pResult = pCellFrame;
|
||||
m_HandledTableBoxes.insert(pTabBox);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1373,11 +1373,7 @@ void makeTableCellRedline( SwTableBox& rTableBox,
|
||||
void SwAnyMapHelper::SetValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any& rAny )
|
||||
{
|
||||
sal_uInt32 nKey = (nWhichId << 16) + nMemberId;
|
||||
auto aIt = m_Map.find( nKey );
|
||||
if (aIt != m_Map.end())
|
||||
aIt->second = rAny;
|
||||
else
|
||||
m_Map.insert(std::make_pair(nKey, rAny));
|
||||
m_Map[nKey] = rAny;
|
||||
}
|
||||
|
||||
bool SwAnyMapHelper::FillValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any*& pAny )
|
||||
|
||||
@@ -3747,9 +3747,8 @@ SwAutoStylesEnumImpl::SwAutoStylesEnumImpl( SwDoc* pInitDoc, IStyleAccess::SwAut
|
||||
if ( pItem && pItem->GetTextRuby() )
|
||||
{
|
||||
std::pair< sal_uInt16, text::RubyAdjust > aPair( pItem->GetPosition(), pItem->GetAdjustment() );
|
||||
if ( aRubyMap.find( aPair ) == aRubyMap.end() )
|
||||
if ( aRubyMap.insert( aPair ).second )
|
||||
{
|
||||
aRubyMap.insert( aPair );
|
||||
std::shared_ptr<SfxItemSet> pItemSet( new SfxItemSet( rAttrPool, svl::Items<RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY>{} ) );
|
||||
pItemSet->Put( *pItem );
|
||||
mAutoStyles.push_back( pItemSet );
|
||||
|
||||
@@ -1309,13 +1309,11 @@ static void AddControl( HTMLControls& rControls,
|
||||
{
|
||||
uno::Reference< container::XIndexContainer > xFormComps( xForm, uno::UNO_QUERY );
|
||||
std::unique_ptr<HTMLControl> pHCntrl(new HTMLControl( xFormComps, nNodeIdx ));
|
||||
HTMLControls::const_iterator it = rControls.find( pHCntrl.get() );
|
||||
if( it == rControls.end() )
|
||||
rControls.insert( std::move(pHCntrl) );
|
||||
else
|
||||
auto itPair = rControls.insert( std::move(pHCntrl) );
|
||||
if (!itPair.second )
|
||||
{
|
||||
if( (*it)->xFormComps==xFormComps )
|
||||
(*it)->nCount++;
|
||||
if( (*itPair.first)->xFormComps==xFormComps )
|
||||
(*itPair.first)->nCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,18 +353,16 @@ void MSWordStyles::BuildStyleIds()
|
||||
OString aLower(aStyleId.toAsciiLowerCase());
|
||||
|
||||
// check for uniqueness & construct something unique if we have to
|
||||
if (aUsed.find(aLower) == aUsed.end())
|
||||
if (aUsed.insert(aLower).second)
|
||||
{
|
||||
aUsed.insert(aLower);
|
||||
m_aStyleIds.push_back(aStyleId);
|
||||
}
|
||||
else
|
||||
{
|
||||
int nFree = 1;
|
||||
while (aUsed.find(aLower + OString::number(nFree)) != aUsed.end())
|
||||
while (!aUsed.insert(aLower + OString::number(nFree)).second)
|
||||
++nFree;
|
||||
|
||||
aUsed.insert(aLower + OString::number(nFree));
|
||||
m_aStyleIds.emplace_back(aStyleId + OString::number(nFree));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,9 +259,8 @@ bool SwWW8ImplReader::ReadGrafFile(OUString& rFileName, std::unique_ptr<Graphic>
|
||||
//skip duplicate graphics when fuzzing
|
||||
if (utl::ConfigManager::IsFuzzing())
|
||||
{
|
||||
if (m_aGrafPosSet.find(nPosFc) != m_aGrafPosSet.end())
|
||||
if (!m_aGrafPosSet.insert(nPosFc).second)
|
||||
return false;
|
||||
m_aGrafPosSet.insert(nPosFc);
|
||||
}
|
||||
|
||||
if (m_xWwFib->m_envr != 1) // !MAC as creator
|
||||
|
||||
@@ -418,12 +418,8 @@ void XMLRedlineImportHelper::Add(
|
||||
pInfo->bMergeLastParagraph = bMergeLastPara;
|
||||
|
||||
// ad 3)
|
||||
if (aRedlineMap.end() == aRedlineMap.find(rId))
|
||||
{
|
||||
// 3a) insert into map
|
||||
aRedlineMap[rId] = pInfo;
|
||||
}
|
||||
else
|
||||
auto itPair = aRedlineMap.emplace(rId, pInfo);
|
||||
if (!itPair.second)
|
||||
{
|
||||
// 3b) we already have a redline with this name: hierarchical redlines
|
||||
// insert pInfo as last element in the chain.
|
||||
@@ -431,7 +427,7 @@ void XMLRedlineImportHelper::Add(
|
||||
|
||||
// find last element
|
||||
RedlineInfo* pInfoChain;
|
||||
for( pInfoChain = aRedlineMap[rId];
|
||||
for( pInfoChain = itPair.first->second;
|
||||
nullptr != pInfoChain->pNextRedline;
|
||||
pInfoChain = pInfoChain->pNextRedline) ; // empty loop
|
||||
|
||||
|
||||
@@ -2224,8 +2224,7 @@ TaskManager::load( const ContentMap::iterator& it, bool create )
|
||||
xS->getPropertyValue( seq[i].Name ),
|
||||
beans::PropertyState_DIRECT_VALUE,
|
||||
seq[i].Attributes );
|
||||
if( properties.find( readProp ) == properties.end() )
|
||||
properties.insert( readProp );
|
||||
properties.insert( readProp );
|
||||
}
|
||||
}
|
||||
else if( create )
|
||||
|
||||
@@ -491,17 +491,11 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
// Add cached properties, if present and still missing.
|
||||
if (xCachedProps)
|
||||
{
|
||||
const std::set< OUString >::const_iterator set_end
|
||||
= aPropSet.end();
|
||||
|
||||
const std::unique_ptr< PropertyValueMap > & xProps
|
||||
= xCachedProps->getProperties();
|
||||
|
||||
for ( const auto& rEntry : *xProps )
|
||||
{
|
||||
if ( aPropSet.find( rEntry.first ) == set_end )
|
||||
aPropSet.insert( rEntry.first );
|
||||
}
|
||||
aPropSet.insert( rEntry.first );
|
||||
}
|
||||
|
||||
// std::set -> uno::Sequence
|
||||
|
||||
@@ -440,17 +440,11 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
// Add cached properties, if present and still missing.
|
||||
if ( xCachedProps.get() )
|
||||
{
|
||||
const std::set< OUString >::const_iterator set_end
|
||||
= aPropSet.end();
|
||||
|
||||
const std::unique_ptr< PropertyValueMap > & xProps
|
||||
= xCachedProps->getProperties();
|
||||
|
||||
for ( const auto& rEntry : *xProps )
|
||||
{
|
||||
if ( aPropSet.find( rEntry.first ) == set_end )
|
||||
aPropSet.insert( rEntry.first );
|
||||
}
|
||||
aPropSet.insert( rEntry.first );
|
||||
}
|
||||
|
||||
// std::set -> uno::Sequence
|
||||
|
||||
@@ -1101,9 +1101,7 @@ void generateCalcAddin(ProgramOptions const & options,
|
||||
// special case for the optional XLocalization interface. It should be
|
||||
// implemented always. But it is parent of the XAddIn and we need it only
|
||||
// if backwardcompatible is false.
|
||||
if (interfaces.find("com.sun.star.lang.XLocalizable") == interfaces.end()) {
|
||||
interfaces.insert("com.sun.star.lang.XLocalizable");
|
||||
}
|
||||
interfaces.insert("com.sun.star.lang.XLocalizable");
|
||||
}
|
||||
|
||||
OUString propertyhelper = checkPropertyHelper(
|
||||
|
||||
@@ -845,9 +845,7 @@ void generateSkeleton(ProgramOptions const & options,
|
||||
// special case for the optional XLocalization interface. It should be
|
||||
// implemented always. But it is parent of the XAddIn and we need it only
|
||||
// if backwardcompatible is false.
|
||||
if (interfaces.find("com.sun.star.lang.XLocalizable") == interfaces.end()) {
|
||||
interfaces.insert("com.sun.star.lang.XLocalizable");
|
||||
}
|
||||
interfaces.insert("com.sun.star.lang.XLocalizable");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -183,19 +183,15 @@ void checkType(rtl::Reference< TypeManager > const & manager,
|
||||
if ( name == "com.sun.star.lang.XTypeProvider" ||
|
||||
name == "com.sun.star.uno.XWeak" )
|
||||
return;
|
||||
if (interfaceTypes.find(name) == interfaceTypes.end()) {
|
||||
interfaceTypes.insert(name);
|
||||
}
|
||||
interfaceTypes.insert(name);
|
||||
break;
|
||||
case codemaker::UnoType::Sort::SingleInterfaceBasedService:
|
||||
if (serviceTypes.find(name) == serviceTypes.end()) {
|
||||
serviceTypes.insert(name);
|
||||
if (serviceTypes.insert(name).second) {
|
||||
rtl::Reference< unoidl::SingleInterfaceBasedServiceEntity > ent2(
|
||||
dynamic_cast< unoidl::SingleInterfaceBasedServiceEntity * >(
|
||||
ent.get()));
|
||||
assert(ent2.is());
|
||||
if (interfaceTypes.find(ent2->getBase()) == interfaceTypes.end()) {
|
||||
interfaceTypes.insert(ent2->getBase());
|
||||
if (interfaceTypes.insert(ent2->getBase()).second) {
|
||||
// check if constructors are specified, if yes automatically
|
||||
// support of XInitialization. We will take care of the default
|
||||
// constructor because in this case XInitialization is not
|
||||
@@ -204,16 +200,13 @@ void checkType(rtl::Reference< TypeManager > const & manager,
|
||||
(ent2->getConstructors().size() == 1 &&
|
||||
!ent2->getConstructors()[0].defaultConstructor))
|
||||
{
|
||||
OUString s("com.sun.star.lang.XInitialization");
|
||||
if (interfaceTypes.find(s) == interfaceTypes.end())
|
||||
interfaceTypes.insert(s);
|
||||
interfaceTypes.insert(OUString("com.sun.star.lang.XInitialization"));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case codemaker::UnoType::Sort::AccumulationBasedService:
|
||||
if ( serviceTypes.find(name) == serviceTypes.end() ) {
|
||||
serviceTypes.insert(name);
|
||||
if ( serviceTypes.insert(name).second ) {
|
||||
rtl::Reference< unoidl::AccumulationBasedServiceEntity > ent2(
|
||||
dynamic_cast< unoidl::AccumulationBasedServiceEntity * >(
|
||||
ent.get()));
|
||||
@@ -249,8 +242,7 @@ void checkDefaultInterfaces(
|
||||
if ( services.empty() ) {
|
||||
interfaces.erase("com.sun.star.lang.XServiceInfo");
|
||||
} else {
|
||||
if (interfaces.find("com.sun.star.lang.XServiceInfo") == interfaces.end())
|
||||
interfaces.insert("com.sun.star.lang.XServiceInfo");
|
||||
interfaces.insert("com.sun.star.lang.XServiceInfo");
|
||||
}
|
||||
|
||||
if ( propertyhelper == "_" ) {
|
||||
|
||||
@@ -863,11 +863,9 @@ void FontSubstConfiguration::fillSubstVector( const css::uno::Reference< XNameAc
|
||||
OUString aSubst( pLine->getToken( 0, ';', nIndex ) );
|
||||
if( !aSubst.isEmpty() )
|
||||
{
|
||||
UniqueSubstHash::iterator aEntry = maSubstHash.find( aSubst );
|
||||
if (aEntry != maSubstHash.end())
|
||||
aSubst = *aEntry;
|
||||
else
|
||||
maSubstHash.insert( aSubst );
|
||||
auto itPair = maSubstHash.insert( aSubst );
|
||||
if (!itPair.second)
|
||||
aSubst = *itPair.first;
|
||||
rSubstVector.push_back( aSubst );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,10 +149,7 @@ namespace XPath
|
||||
const xmlChar* pPre = curDef->prefix;
|
||||
OUString aPrefix(reinterpret_cast<char const *>(pPre), strlen(reinterpret_cast<char const *>(pPre)), RTL_TEXTENCODING_UTF8);
|
||||
// we could already have this prefix from a child node
|
||||
if (rNamespaces.find(aPrefix) == rNamespaces.end())
|
||||
{
|
||||
rNamespaces.insert(::std::make_pair(aPrefix, aURI));
|
||||
}
|
||||
rNamespaces.emplace(aPrefix, aURI);
|
||||
curDef = curDef->next;
|
||||
}
|
||||
pNode = pNode->parent;
|
||||
|
||||
@@ -248,11 +248,8 @@ void AquaA11yFocusTracker::window_got_focus(vcl::Window *pWindow)
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_aDocumentWindowList.find(pWindow) == m_aDocumentWindowList.end() )
|
||||
{
|
||||
m_aDocumentWindowList.insert(pWindow);
|
||||
if( m_aDocumentWindowList.insert(pWindow).second )
|
||||
m_xDocumentFocusListener->attachRecursive(xAccessible, xContext, xStateSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1041,9 +1041,8 @@ void PrintFontManager::Substitute(FontSelectPattern &rPattern, OUString& rMissin
|
||||
{
|
||||
LanguageTag aOurTag(getExemplarLangTagForCodePoint(pRemainingCodes[i]));
|
||||
OString sTag = OUStringToOString(aOurTag.getBcp47(), RTL_TEXTENCODING_UTF8);
|
||||
if (m_aPreviousLangSupportRequests.find(sTag) != m_aPreviousLangSupportRequests.end())
|
||||
if (!m_aPreviousLangSupportRequests.insert(sTag).second)
|
||||
continue;
|
||||
m_aPreviousLangSupportRequests.insert(sTag);
|
||||
sTag = mapToFontConfigLangTag(aOurTag);
|
||||
if (!sTag.isEmpty() && m_aPreviousLangSupportRequests.find(sTag) == m_aPreviousLangSupportRequests.end())
|
||||
{
|
||||
|
||||
@@ -193,14 +193,7 @@ std::vector<std::pair<std::string, gchar*>> const & CPDManager::getTempBackends(
|
||||
}
|
||||
|
||||
void CPDManager::addNewPrinter(const OUString& aPrinterName, const OUString& aUniqueName, CPDPrinter *pDest) {
|
||||
std::pair<OUString, CPDPrinter *> newPrinter (aUniqueName, pDest);
|
||||
std::unordered_map<OUString, CPDPrinter *>::iterator it = m_aCPDDestMap.find( aUniqueName );
|
||||
if (it == m_aCPDDestMap.end()) {
|
||||
m_aCPDDestMap.insert(newPrinter);
|
||||
} else {
|
||||
m_aCPDDestMap.erase(it);
|
||||
m_aCPDDestMap.insert(newPrinter);
|
||||
}
|
||||
m_aCPDDestMap[aUniqueName] = pDest;
|
||||
bool bSetToGlobalDefaults = m_aPrinters.find( aUniqueName ) == m_aPrinters.end();
|
||||
Printer aPrinter = m_aPrinters[ aUniqueName ];
|
||||
if( bSetToGlobalDefaults )
|
||||
|
||||
@@ -818,12 +818,11 @@ static void standardSysQueueTokenHandler(
|
||||
// get the queue name between fore and aft tokens
|
||||
OUString aSysQueue( OStringToOUString( line.copy( nPos, nAftPos - nPos ), aEncoding ) );
|
||||
// do not insert duplicates (e.g. lpstat tends to produce such lines)
|
||||
if( aUniqueSet.find( aSysQueue ) == aUniqueSet.end() )
|
||||
if( aUniqueSet.insert( aSysQueue ).second )
|
||||
{
|
||||
o_rQueues.emplace_back( );
|
||||
o_rQueues.back().m_aQueue = aSysQueue;
|
||||
o_rQueues.back().m_aLocation = aSysQueue;
|
||||
aUniqueSet.insert( aSysQueue );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -576,9 +576,8 @@ static void handle_get_focus(::VclWindowEvent const * pEvent)
|
||||
}
|
||||
else
|
||||
{
|
||||
if( g_aWindowList.list.find(pWindow) == g_aWindowList.list.end() )
|
||||
if( g_aWindowList.list.insert(pWindow).second )
|
||||
{
|
||||
g_aWindowList.list.insert(pWindow);
|
||||
try
|
||||
{
|
||||
rDocumentFocusListener.attachRecursive(xAccessible, xContext, xStateSet);
|
||||
|
||||
@@ -511,16 +511,9 @@ bool SvXMLAutoStylePoolP_Impl::Add(
|
||||
XMLAutoStyleFamily &rFamily = **iter;
|
||||
|
||||
std::unique_ptr<XMLAutoStylePoolParent> pTmp(new XMLAutoStylePoolParent(rParentName));
|
||||
auto it2 = rFamily.m_ParentSet.find(pTmp);
|
||||
if (it2 == rFamily.m_ParentSet.end())
|
||||
{
|
||||
std::pair<XMLAutoStyleFamily::ParentSetType::iterator,bool> r =
|
||||
rFamily.m_ParentSet.insert(std::make_unique<XMLAutoStylePoolParent>(
|
||||
auto itPair = rFamily.m_ParentSet.insert(std::make_unique<XMLAutoStylePoolParent>(
|
||||
rParentName));
|
||||
it2 = r.first;
|
||||
}
|
||||
|
||||
XMLAutoStylePoolParent& rParent = **it2;
|
||||
XMLAutoStylePoolParent& rParent = **itPair.first;
|
||||
|
||||
bool bRet = false;
|
||||
if (rParent.Add(rFamily, rProperties, rName, bDontSeek))
|
||||
@@ -544,17 +537,9 @@ bool SvXMLAutoStylePoolP_Impl::AddNamed(
|
||||
|
||||
XMLAutoStyleFamily &rFamily = **iter;
|
||||
|
||||
std::unique_ptr<XMLAutoStylePoolParent> pTmp(new XMLAutoStylePoolParent(rParentName));
|
||||
auto it2 = rFamily.m_ParentSet.find(pTmp);
|
||||
if (it2 == rFamily.m_ParentSet.end())
|
||||
{
|
||||
std::pair<XMLAutoStyleFamily::ParentSetType::iterator,bool> r =
|
||||
rFamily.m_ParentSet.insert(std::make_unique<XMLAutoStylePoolParent>(
|
||||
auto itPair = rFamily.m_ParentSet.insert(std::make_unique<XMLAutoStylePoolParent>(
|
||||
rParentName));
|
||||
it2 = r.first;
|
||||
}
|
||||
|
||||
XMLAutoStylePoolParent& rParent = **it2;
|
||||
XMLAutoStylePoolParent& rParent = **itPair.first;
|
||||
|
||||
bool bRet = false;
|
||||
if (rParent.AddNamed(rFamily, rProperties, rName))
|
||||
|
||||
@@ -1083,16 +1083,10 @@ void SvXMLNumFmtElementContext::AddEmbeddedElement( sal_Int32 nFormatPos, const
|
||||
if (rContent.isEmpty())
|
||||
return;
|
||||
|
||||
auto const iter(aNumInfo.m_EmbeddedElements.find(nFormatPos));
|
||||
if (iter == aNumInfo.m_EmbeddedElements.end())
|
||||
{
|
||||
aNumInfo.m_EmbeddedElements.insert(std::make_pair(nFormatPos, rContent));
|
||||
}
|
||||
else
|
||||
{
|
||||
auto iterPair = aNumInfo.m_EmbeddedElements.emplace(nFormatPos, rContent);
|
||||
if (!iterPair.second)
|
||||
// there's already an element at this position - append text to existing element
|
||||
iter->second += rContent;
|
||||
}
|
||||
iterPair.first->second += rContent;
|
||||
}
|
||||
|
||||
void SvXMLNumFmtElementContext::EndElement()
|
||||
|
||||
Reference in New Issue
Block a user