diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-07-23 21:58:31 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-07-24 10:58:53 +0200 |
commit | cef74993a96feae0dd7489a11dfdf062687c0868 (patch) | |
tree | 74f773e0e8316104db3ac8d5f4615e3c3ea74b8f | |
parent | 7c927b64fa42ea1b0ddf97ce6b6aa400f2e30d5b (diff) |
svtools: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: Ib0b10305768d368585d80ad6163e9081a4d8cd28
-rw-r--r-- | include/svtools/ctrltool.hxx | 10 | ||||
-rw-r--r-- | svtools/source/control/ctrltool.cxx | 25 |
2 files changed, 18 insertions, 17 deletions
diff --git a/include/svtools/ctrltool.hxx b/include/svtools/ctrltool.hxx index edda87f8c4f7..e66e2c2c6d2d 100644 --- a/include/svtools/ctrltool.hxx +++ b/include/svtools/ctrltool.hxx @@ -20,14 +20,16 @@ #ifndef INCLUDED_SVTOOLS_CTRLTOOL_HXX #define INCLUDED_SVTOOLS_CTRLTOOL_HXX -#include <boost/ptr_container/ptr_vector.hpp> - #include <svtools/svtdllapi.h> #include <rtl/ustring.hxx> #include <sal/types.h> #include <vcl/metric.hxx> #include <tools/solar.h> +#include <vector> +#include <memory> + + class ImplFontListNameInfo; class OutputDevice; @@ -149,7 +151,7 @@ private: sal_IntPtr* mpSizeAry; VclPtr<OutputDevice> mpDev; VclPtr<OutputDevice> mpDev2; - boost::ptr_vector<ImplFontListNameInfo> maEntries; + std::vector<std::unique_ptr<ImplFontListNameInfo>> m_Entries; SVT_DLLPRIVATE ImplFontListNameInfo* ImplFind( const OUString& rSearchName, sal_uLong* pIndex ) const; SVT_DLLPRIVATE ImplFontListNameInfo* ImplFindByName( const OUString& rStr ) const; @@ -182,7 +184,7 @@ public: bool IsAvailable( const OUString& rName ) const; sal_uInt16 GetFontNameCount() const { - return (sal_uInt16)maEntries.size(); + return (sal_uInt16)m_Entries.size(); } const vcl::FontInfo& GetFontName( sal_uInt16 nFont ) const; sal_Handle GetFirstFontInfo( const OUString& rName ) const; diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index 4e46ddabd5c9..50a304c266c5 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -168,8 +168,7 @@ ImplFontListNameInfo* FontList::ImplFind(const OUString& rSearchName, sal_uLong* // then the last one. We only compare to the last entry as the list of VCL // is returned sorted, which increases the probability that appending // is more likely - sal_uLong nCnt = maEntries.size(); - if ( !nCnt ) + if (m_Entries.empty()) { if ( pIndex ) *pIndex = ULONG_MAX; @@ -177,7 +176,7 @@ ImplFontListNameInfo* FontList::ImplFind(const OUString& rSearchName, sal_uLong* } else { - const ImplFontListNameInfo* pCmpData = &maEntries[nCnt-1]; + const ImplFontListNameInfo* pCmpData = m_Entries.back().get(); sal_Int32 nComp = rSearchName.compareTo( pCmpData->maSearchName ); if (nComp > 0) { @@ -192,14 +191,14 @@ ImplFontListNameInfo* FontList::ImplFind(const OUString& rSearchName, sal_uLong* // search fonts in the list const ImplFontListNameInfo* pCompareData; const ImplFontListNameInfo* pFoundData = NULL; - sal_uLong nLow = 0; - sal_uLong nHigh = nCnt-1; - sal_uLong nMid; + size_t nLow = 0; + size_t nHigh = m_Entries.size() - 1; + size_t nMid; do { nMid = (nLow + nHigh) / 2; - pCompareData = &maEntries[nMid]; + pCompareData = m_Entries[nMid].get(); sal_Int32 nComp = rSearchName.compareTo(pCompareData->maSearchName); if (nComp < 0) { @@ -275,10 +274,11 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, bool bAll, pData->mpFirst = pNewInfo; pNewInfo->mpNext = NULL; - if (nIndex < maEntries.size()) - maEntries.insert(maEntries.begin()+nIndex,pData); + if (nIndex < m_Entries.size()) + m_Entries.insert(m_Entries.begin()+nIndex, + std::unique_ptr<ImplFontListNameInfo>(pData)); else - maEntries.push_back(pData); + m_Entries.push_back(std::unique_ptr<ImplFontListNameInfo>(pData)); } } else @@ -372,8 +372,7 @@ FontList::~FontList() // delete FontInfos ImplFontListFontInfo *pTemp, *pInfo; - boost::ptr_vector<ImplFontListNameInfo>::iterator it; - for (it = maEntries.begin(); it != maEntries.end(); ++it) + for (auto const& it : m_Entries) { pInfo = it->mpFirst; while ( pInfo ) @@ -701,7 +700,7 @@ const vcl::FontInfo& FontList::GetFontName( sal_uInt16 nFont ) const { DBG_ASSERT( nFont < GetFontNameCount(), "FontList::GetFontName(): nFont >= Count" ); - return *(maEntries[nFont].mpFirst); + return *(m_Entries[nFont]->mpFirst); } sal_Handle FontList::GetFirstFontInfo(const OUString& rName) const |