summaryrefslogtreecommitdiff
path: root/UnoControls
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-07-22 13:05:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-07-22 14:06:02 +0200
commitd1de326b0b2a1208969e36f19010fdd8ee2a4fb7 (patch)
tree9de294c2e95e94210a3c6f54d968e75c30c3e88b /UnoControls
parent717ec99667f5a9ab570f1c8581e2d7a0241c32f6 (diff)
no need to use unique_ptr here
for such a small object Change-Id: Idbcad7469b3871c05226e90b8d46223fe746cce2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119369 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'UnoControls')
-rw-r--r--UnoControls/source/controls/progressmonitor.cxx44
-rw-r--r--UnoControls/source/inc/progressmonitor.hxx4
2 files changed, 23 insertions, 25 deletions
diff --git a/UnoControls/source/controls/progressmonitor.cxx b/UnoControls/source/controls/progressmonitor.cxx
index bf384dfb7243..e8dca471b816 100644
--- a/UnoControls/source/controls/progressmonitor.cxx
+++ b/UnoControls/source/controls/progressmonitor.cxx
@@ -204,11 +204,11 @@ void SAL_CALL ProgressMonitor::addText(
}
// Else ... take memory for new item ...
- std::unique_ptr<IMPL_TextlistItem> pTextItem(new IMPL_TextlistItem);
+ IMPL_TextlistItem aTextItem;
// Set values ...
- pTextItem->sTopic = rTopic;
- pTextItem->sText = rText;
+ aTextItem.sTopic = rTopic;
+ aTextItem.sText = rText;
// Ready for multithreading
MutexGuard aGuard ( m_aMutex );
@@ -216,11 +216,11 @@ void SAL_CALL ProgressMonitor::addText(
// ... and insert it in right list.
if ( bbeforeProgress )
{
- maTextlist_Top.push_back( std::move(pTextItem) );
+ maTextlist_Top.push_back( aTextItem );
}
else
{
- maTextlist_Bottom.push_back( std::move(pTextItem) );
+ maTextlist_Bottom.push_back( aTextItem );
}
// ... update window
@@ -248,22 +248,20 @@ void SAL_CALL ProgressMonitor::removeText ( const OUString& rTopic, sal_Bool bbe
if ( bbeforeProgress )
{
auto itr = std::find_if( maTextlist_Top.begin(), maTextlist_Top.end(),
- [&] (std::unique_ptr<IMPL_TextlistItem> const &p)
- { return p.get() == pSearchItem; } );
+ [&] (IMPL_TextlistItem const &p)
+ { return &p == pSearchItem; } );
if (itr != maTextlist_Top.end())
maTextlist_Top.erase(itr);
}
else
{
auto itr = std::find_if( maTextlist_Bottom.begin(), maTextlist_Bottom.end(),
- [&] (std::unique_ptr<IMPL_TextlistItem> const &p)
- { return p.get() == pSearchItem; } );
+ [&] (IMPL_TextlistItem const &p)
+ { return &p == pSearchItem; } );
if (itr != maTextlist_Bottom.end())
maTextlist_Bottom.erase(itr);
}
- delete pSearchItem;
-
// ... and update window.
impl_rebuildFixedText ();
impl_recalcLayout ();
@@ -720,9 +718,9 @@ void ProgressMonitor::impl_rebuildFixedText ()
// Collect all topics from list and format text.
// "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!!
- for (auto const & pSearchItem : maTextlist_Top)
+ for (auto const & rSearchItem : maTextlist_Top)
{
- aCollectString.append(pSearchItem->sTopic + "\n");
+ aCollectString.append(rSearchItem.sTopic + "\n");
}
m_xTopic_Top->setText ( aCollectString.makeStringAndClear() );
@@ -735,9 +733,9 @@ void ProgressMonitor::impl_rebuildFixedText ()
// Collect all topics from list and format text.
// "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!!
- for (auto const & pSearchItem : maTextlist_Top)
+ for (auto const & rSearchItem : maTextlist_Top)
{
- aCollectString.append(pSearchItem->sText + "\n");
+ aCollectString.append(rSearchItem.sText + "\n");
}
m_xText_Top->setText ( aCollectString.makeStringAndClear() );
@@ -752,9 +750,9 @@ void ProgressMonitor::impl_rebuildFixedText ()
// Collect all topics from list and format text.
// "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!!
- for (auto const & pSearchItem : maTextlist_Bottom)
+ for (auto const & rSearchItem : maTextlist_Bottom)
{
- aCollectString.append(pSearchItem->sTopic + "\n");
+ aCollectString.append(rSearchItem.sTopic + "\n");
}
m_xTopic_Bottom->setText ( aCollectString.makeStringAndClear() );
@@ -768,9 +766,9 @@ void ProgressMonitor::impl_rebuildFixedText ()
// Collect all topics from list and format text.
// "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!!
- for (auto const & pSearchItem : maTextlist_Bottom)
+ for (auto const & rSearchItem : maTextlist_Bottom)
{
- aCollectString.append(pSearchItem->sText + "\n");
+ aCollectString.append(rSearchItem.sText + "\n");
}
m_xText_Bottom->setText ( aCollectString.makeStringAndClear() );
@@ -791,7 +789,7 @@ void ProgressMonitor::impl_cleanMemory ()
IMPL_TextlistItem* ProgressMonitor::impl_searchTopic ( std::u16string_view rTopic, bool bbeforeProgress )
{
// Get right textlist for following operations.
- ::std::vector< std::unique_ptr<IMPL_TextlistItem> >* pTextList;
+ ::std::vector< IMPL_TextlistItem >* pTextList;
// Ready for multithreading
{
@@ -814,12 +812,12 @@ IMPL_TextlistItem* ProgressMonitor::impl_searchTopic ( std::u16string_view rTopi
for ( nPosition = 0; nPosition < nCount; ++nPosition )
{
- auto pSearchItem = pTextList->at( nPosition ).get();
+ auto& rSearchItem = pTextList->at( nPosition );
- if ( pSearchItem->sTopic == rTopic )
+ if ( rSearchItem.sTopic == rTopic )
{
// We have found this topic... return a valid pointer.
- return pSearchItem;
+ return &rSearchItem;
}
}
diff --git a/UnoControls/source/inc/progressmonitor.hxx b/UnoControls/source/inc/progressmonitor.hxx
index baa06de66ded..f8a463ca88a1 100644
--- a/UnoControls/source/inc/progressmonitor.hxx
+++ b/UnoControls/source/inc/progressmonitor.hxx
@@ -229,11 +229,11 @@ private:
// private variables
private:
- ::std::vector < std::unique_ptr<IMPL_TextlistItem> > maTextlist_Top; // Elements before progress
+ ::std::vector < IMPL_TextlistItem > maTextlist_Top; // Elements before progress
css::uno::Reference< css::awt::XFixedText > m_xTopic_Top; // (used, if parameter "beforeProgress"=true in "addText, updateText, removeText")
css::uno::Reference< css::awt::XFixedText > m_xText_Top;
- ::std::vector < std::unique_ptr<IMPL_TextlistItem> > maTextlist_Bottom; // Elements below of progress
+ ::std::vector < IMPL_TextlistItem > maTextlist_Bottom; // Elements below of progress
css::uno::Reference< css::awt::XFixedText > m_xTopic_Bottom; // (used, if parameter "beforeProgress"=false in "addText, updateText, removeText")
css::uno::Reference< css::awt::XFixedText > m_xText_Bottom;