summaryrefslogtreecommitdiff
path: root/ucb/source/ucp/file/filtask.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-23 16:21:13 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-02 07:38:12 +0100
commit904263cdd05d86756da68f0b843e876747dcf3a2 (patch)
treee02ac479fa80ca9e357a7ac4c2bd7cbedcca0831 /ucb/source/ucp/file/filtask.cxx
parentee4a456d9129ebbf46aa89531e1e8ca3f9a8fa11 (diff)
loplugin:useuniqueptr in TaskManager::UnqPathData
Change-Id: I6b6e7b59113fcae8dfafa4ed8586b87d2c82489e Reviewed-on: https://gerrit.libreoffice.org/49092 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucb/source/ucp/file/filtask.cxx')
-rw-r--r--ucb/source/ucp/file/filtask.cxx56
1 files changed, 9 insertions, 47 deletions
diff --git a/ucb/source/ucp/file/filtask.cxx b/ucb/source/ucp/file/filtask.cxx
index 55344c00edd0..7cca2f8abf16 100644
--- a/ucb/source/ucp/file/filtask.cxx
+++ b/ucb/source/ucp/file/filtask.cxx
@@ -71,46 +71,13 @@ using namespace com::sun::star::ucb;
#define THROW_WHERE ""
#endif
-TaskManager::UnqPathData::UnqPathData()
- : properties( nullptr ),
- notifier( nullptr ),
- xS( nullptr ),
- xC( nullptr ),
- xA( nullptr )
-{
- // empty
-}
-
-
-TaskManager::UnqPathData::UnqPathData( const UnqPathData& a )
- : properties( a.properties ),
- notifier( a.notifier ),
- xS( a.xS ),
- xC( a.xC ),
- xA( a.xA )
-{
-}
+TaskManager::UnqPathData::UnqPathData() = default;
+TaskManager::UnqPathData::UnqPathData(TaskManager::UnqPathData&&) = default;
-TaskManager::UnqPathData& TaskManager::UnqPathData::operator=( UnqPathData& a )
-{
- properties = a.properties;
- notifier = a.notifier;
- xS = a.xS;
- xC = a.xC;
- xA = a.xA;
- a.properties = nullptr;
- a.notifier = nullptr;
- a.xS = nullptr;
- a.xC = nullptr;
- a.xA = nullptr;
- return *this;
-}
TaskManager::UnqPathData::~UnqPathData()
{
- delete properties;
- delete notifier;
}
TaskManager::MyProperty::MyProperty( const OUString& thePropertyName )
@@ -533,10 +500,10 @@ TaskManager::registerNotifier( const OUString& aUnqPath, Notifier* pNotifier )
osl::MutexGuard aGuard( m_aMutex );
ContentMap::iterator it =
- m_aContent.emplace( aUnqPath,UnqPathData() ).first;
+ m_aContent.emplace( aUnqPath, UnqPathData() ).first;
if( ! it->second.notifier )
- it->second.notifier = new NotifierList;
+ it->second.notifier.reset( new NotifierList );
std::vector< Notifier* >& nlist = *( it->second.notifier );
@@ -2245,7 +2212,7 @@ void
TaskManager::load( const ContentMap::iterator& it, bool create )
{
if( ! it->second.properties )
- it->second.properties = new PropertySet;
+ it->second.properties.reset( new PropertySet );
if( ( ! it->second.xS.is() ||
! it->second.xC.is() ||
@@ -2772,14 +2739,11 @@ TaskManager::getContentExchangedEventListeners( const OUString& aOldPrefix,
aNewName,UnqPathData() ).first;
// copy Ownership also
- delete itnew->second.properties;
- itnew->second.properties = itold->second.properties;
- itold->second.properties = nullptr;
+ itnew->second.properties = std::move(itold->second.properties);
// copy existing list
- std::vector< Notifier* >* copyList = itnew->second.notifier;
- itnew->second.notifier = itold->second.notifier;
- itold->second.notifier = nullptr;
+ std::unique_ptr<std::vector< Notifier* >> copyList = std::move(itnew->second.notifier);
+ itnew->second.notifier = std::move(itold->second.notifier);
m_aContent.erase( itold );
@@ -2805,7 +2769,6 @@ TaskManager::getContentExchangedEventListeners( const OUString& aOldPrefix,
++copyIt;
}
}
- delete copyList;
}
}
}
@@ -2903,8 +2866,7 @@ TaskManager::erasePersistentSet( const OUString& aUnqPath,
it->second.xC = nullptr;
it->second.xA = nullptr;
- delete it->second.properties;
- it->second.properties = nullptr;
+ it->second.properties.reset();
}
}