Kaydet (Commit) ea2ae023 authored tarafından Noel Grandin's avatar Noel Grandin

framework: boost::ptr_vector->std::vector<std::unique_ptr>

Change-Id: If9981b141a591f23e03479c90694e6ffa78f2cb8
üst 2a2b9920
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/uno/XComponentContext.hpp>
#include <vector> #include <vector>
#include <memory>
#include <boost/ptr_container/ptr_vector.hpp> #include <boost/ptr_container/ptr_vector.hpp>
namespace framework namespace framework
...@@ -54,7 +55,7 @@ struct ExternalImageItemDescriptor ...@@ -54,7 +55,7 @@ struct ExternalImageItemDescriptor
OUString aURL; // a URL to an external bitmap OUString aURL; // a URL to an external bitmap
}; };
typedef boost::ptr_vector<ImageItemDescriptor> ImageItemListDescriptor; typedef std::vector<std::unique_ptr<ImageItemDescriptor> > ImageItemListDescriptor;
typedef boost::ptr_vector<ExternalImageItemDescriptor> ExternalImageItemListDescriptor; typedef boost::ptr_vector<ExternalImageItemDescriptor> ExternalImageItemListDescriptor;
......
...@@ -446,7 +446,7 @@ bool ImageManagerImpl::implts_loadUserImages( ...@@ -446,7 +446,7 @@ bool ImageManagerImpl::implts_loadUserImages(
aUserImagesVector.reserve(nCount); aUserImagesVector.reserve(nCount);
for ( sal_Int32 i=0; i < nCount; i++ ) for ( sal_Int32 i=0; i < nCount; i++ )
{ {
const ImageItemDescriptor* pItem = &(*pList->pImageItemList)[i]; const ImageItemDescriptor* pItem = (*pList->pImageItemList)[i].get();
aUserImagesVector.push_back( pItem->aCommandURL ); aUserImagesVector.push_back( pItem->aCommandURL );
} }
...@@ -517,11 +517,10 @@ bool ImageManagerImpl::implts_storeUserImages( ...@@ -517,11 +517,10 @@ bool ImageManagerImpl::implts_storeUserImages(
pList->pImageItemList = new ImageItemListDescriptor; pList->pImageItemList = new ImageItemListDescriptor;
for ( sal_uInt16 i=0; i < pImageList->GetImageCount(); i++ ) for ( sal_uInt16 i=0; i < pImageList->GetImageCount(); i++ )
{ {
ImageItemDescriptor* pItem = new ::framework::ImageItemDescriptor; ImageItemDescriptor* pItem = new ImageItemDescriptor;
pItem->nIndex = i; pItem->nIndex = i;
pItem->aCommandURL = pImageList->GetImageName( i ); pItem->aCommandURL = pImageList->GetImageName( i );
pList->pImageItemList->push_back( pItem ); pList->pImageItemList->push_back( std::unique_ptr<ImageItemDescriptor>(pItem) );
} }
pList->aURL = "Bitmaps/" + OUString::createFromAscii(BITMAP_FILE_NAMES[nImageType]); pList->aURL = "Bitmaps/" + OUString::createFromAscii(BITMAP_FILE_NAMES[nImageType]);
......
...@@ -309,7 +309,7 @@ void SAL_CALL OReadImagesDocumentHandler::startElement( ...@@ -309,7 +309,7 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
m_bImageStartFound = true; m_bImageStartFound = true;
// Create new image item descriptor // Create new image item descriptor
ImageItemDescriptor* pItem = new ImageItemDescriptor; std::unique_ptr<ImageItemDescriptor> pItem(new ImageItemDescriptor);
pItem->nIndex = -1; pItem->nIndex = -1;
// Read attributes for this image definition // Read attributes for this image definition
...@@ -341,7 +341,6 @@ void SAL_CALL OReadImagesDocumentHandler::startElement( ...@@ -341,7 +341,6 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
// Check required attribute "bitmap-index" // Check required attribute "bitmap-index"
if ( pItem->nIndex < 0 ) if ( pItem->nIndex < 0 )
{ {
delete pItem;
delete m_pImages; delete m_pImages;
m_pImages = nullptr; m_pImages = nullptr;
...@@ -353,7 +352,6 @@ void SAL_CALL OReadImagesDocumentHandler::startElement( ...@@ -353,7 +352,6 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
// Check required attribute "command" // Check required attribute "command"
if ( pItem->aCommandURL.isEmpty() ) if ( pItem->aCommandURL.isEmpty() )
{ {
delete pItem;
delete m_pImages; delete m_pImages;
m_pImages = nullptr; m_pImages = nullptr;
...@@ -362,7 +360,7 @@ void SAL_CALL OReadImagesDocumentHandler::startElement( ...@@ -362,7 +360,7 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
} }
m_pImages->pImageItemList->push_back( pItem ); m_pImages->pImageItemList->push_back( std::move(pItem) );
} }
break; break;
...@@ -729,7 +727,7 @@ void OWriteImagesDocumentHandler::WriteImageList( const ImageListItemDescriptor* ...@@ -729,7 +727,7 @@ void OWriteImagesDocumentHandler::WriteImageList( const ImageListItemDescriptor*
if ( pImageItemList ) if ( pImageItemList )
{ {
for ( size_t i = 0; i < pImageItemList->size(); i++ ) for ( size_t i = 0; i < pImageItemList->size(); i++ )
WriteImage( &(*pImageItemList)[i] ); WriteImage( (*pImageItemList)[i].get() );
} }
m_xWriteDocumentHandler->endElement( ELEMENT_NS_IMAGES ); m_xWriteDocumentHandler->endElement( ELEMENT_NS_IMAGES );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment