[PATCH] Convert SfxViewFactoryArr_Impl from SfxPtrArray to std::vect...
Noel Grandin (via Code Review)
gerrit at gerrit.libreoffice.org
Fri Apr 12 07:36:08 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3360
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/60/3360/1
Convert SfxViewFactoryArr_Impl from SfxPtrArray to std::vector
Change-Id: I25c8edc51f97af9de2563a8dba7387a2be9f4fd5
---
M sfx2/source/doc/docfac.cxx
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx
index 25254aa..574bc54 100644
--- a/sfx2/source/doc/docfac.cxx
+++ b/sfx2/source/doc/docfac.cxx
@@ -57,7 +57,7 @@
//========================================================================
-DECL_PTRARRAY( SfxViewFactoryArr_Impl, SfxViewFactory*, 2, 2 )
+typedef std::vector<SfxViewFactory*> SfxViewFactoryArr_Impl;
//========================================================================
@@ -147,9 +147,9 @@
#if OSL_DEBUG_LEVEL > 0
{
const String sViewName( rFactory.GetAPIViewName() );
- for ( sal_uInt16 i = 0; i < pImpl->aViewFactoryArr.Count(); ++i )
+ for ( SfxViewFactoryArr_Impl::const_iterator it = pImpl->aViewFactoryArr.begin(); it != pImpl->aViewFactoryArr.end(); ++it )
{
- if ( !pImpl->aViewFactoryArr[i]->GetAPIViewName().Equals( sViewName ) )
+ if ( !(*it)->GetAPIViewName().Equals( sViewName ) )
continue;
OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM(
"SfxObjectFactory::RegisterViewFactory: duplicate view name '"));
@@ -160,20 +160,19 @@
}
}
#endif
- sal_uInt16 nPos;
- for ( nPos = 0;
- nPos < pImpl->aViewFactoryArr.Count() &&
- pImpl->aViewFactoryArr[nPos]->GetOrdinal() <= rFactory.GetOrdinal();
- ++nPos )
+ SfxViewFactoryArr_Impl::iterator it = pImpl->aViewFactoryArr.begin();
+ for ( ; it != pImpl->aViewFactoryArr.end() &&
+ (*it)->GetOrdinal() <= rFactory.GetOrdinal();
+ ++it )
/* empty loop */;
- pImpl->aViewFactoryArr.Insert(nPos, &rFactory);
+ pImpl->aViewFactoryArr.insert(it, &rFactory);
}
//--------------------------------------------------------------------
sal_uInt16 SfxObjectFactory::GetViewFactoryCount() const
{
- return pImpl->aViewFactoryArr.Count();
+ return pImpl->aViewFactoryArr.size();
}
//--------------------------------------------------------------------
--
To view, visit https://gerrit.libreoffice.org/3360
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I25c8edc51f97af9de2563a8dba7387a2be9f4fd5
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Noel Grandin <noelgrandin at gmail.com>
More information about the LibreOffice
mailing list