From 5d85a610bd02473cbcb1fe25f02c6590b31b6be0 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 22 Jan 2024 15:19:33 +0900 Subject: Replace auto_ptr Signed-off-by: Michele Calgaro (cherry picked from commit bfb6a86ee22664339e8922e55216d12e1a5b2008) --- kopete/kopete/contactlist/kopetecontactlistview.cpp | 8 ++++++-- kopete/kopete/contactlist/kopetegroupviewitem.cpp | 6 +++++- kopete/kopete/contactlist/kopetemetacontactlvi.cpp | 4 +++- kopete/libkopete/ui/kopetelistview.cpp | 4 +++- kopete/protocols/jabber/jingle/libjingle/talk/base/scoped_ptr.h | 2 +- krdc/smartptr.h | 2 +- 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/kopete/kopete/contactlist/kopetecontactlistview.cpp b/kopete/kopete/contactlist/kopetecontactlistview.cpp index 7b060d3d..112be721 100644 --- a/kopete/kopete/contactlist/kopetecontactlistview.cpp +++ b/kopete/kopete/contactlist/kopetecontactlistview.cpp @@ -79,7 +79,11 @@ class ContactListViewStrategy; class KopeteContactListViewPrivate { public: - std::auto_ptr viewStrategy; + KopeteContactListViewPrivate() {} + KopeteContactListViewPrivate(KopeteContactListViewPrivate const &) = delete; + KopeteContactListViewPrivate& operator=(KopeteContactListViewPrivate const &) = delete; + + std::unique_ptr viewStrategy; void updateViewStrategy( TDEListView *view ); }; @@ -365,7 +369,7 @@ void KopeteContactListViewPrivate::updateViewStrategy( TDEListView *view ) if ( !viewStrategy.get() || KopetePrefs::prefs()->sortByGroup() != bSortByGroup ) { // delete old strategy first... - viewStrategy.reset( 0 ); + viewStrategy.reset(); // then create and store a new one if ( KopetePrefs::prefs()->sortByGroup() ) viewStrategy.reset( new ArrangeByGroupsViewStrategy(view) ); diff --git a/kopete/kopete/contactlist/kopetegroupviewitem.cpp b/kopete/kopete/contactlist/kopetegroupviewitem.cpp index 55f4165f..c08dfa01 100644 --- a/kopete/kopete/contactlist/kopetegroupviewitem.cpp +++ b/kopete/kopete/contactlist/kopetegroupviewitem.cpp @@ -38,11 +38,15 @@ class KopeteGroupViewItem::Private { public: + Private() {} + Private(Private const &) = delete; + Private& operator=(Private const &) = delete; + Kopete::UI::ListView::GroupBoxComponent *hbox; Kopete::UI::ListView::ImageComponent *image; Kopete::UI::ListView::TextComponent *name; Kopete::UI::ListView::TextComponent *count; - std::auto_ptr toolTipSource; + std::unique_ptr toolTipSource; }; namespace Kopete { diff --git a/kopete/kopete/contactlist/kopetemetacontactlvi.cpp b/kopete/kopete/contactlist/kopetemetacontactlvi.cpp index a4f162d2..d088e971 100644 --- a/kopete/kopete/contactlist/kopetemetacontactlvi.cpp +++ b/kopete/kopete/contactlist/kopetemetacontactlvi.cpp @@ -150,13 +150,15 @@ class KopeteMetaContactLVI::Private public: Private() : metaContactIcon( 0L ), nameText( 0L ), extraText( 0L ), contactIconBox( 0L ), currentMode( -1 ), currentIconMode( -1 ), hbox(NULL) {} + Private(Private const &) = delete; + Private& operator=(Private const &) = delete; ListView::ContactBoxComponent *hbox; ListView::FaceComponent *metaContactIcon; ListView::DisplayNameComponent *nameText; ListView::DisplayNameComponent *extraText; ListView::BoxComponent *contactIconBox; ListView::BoxComponent *spacerBox; - std::auto_ptr toolTipSource; + std::unique_ptr toolTipSource; // metacontact icon size int iconSize; // protocol icon size diff --git a/kopete/libkopete/ui/kopetelistview.cpp b/kopete/libkopete/ui/kopetelistview.cpp index 6d9952ad..8ae78229 100644 --- a/kopete/libkopete/ui/kopetelistview.cpp +++ b/kopete/libkopete/ui/kopetelistview.cpp @@ -97,9 +97,11 @@ void ToolTip::maybeTip( const TQPoint &pos ) struct ListView::Private { TQTimer sortTimer; - std::auto_ptr toolTip; + std::unique_ptr toolTip; //! C-tor Private() {} + Private(Private const &) = delete; + Private& operator=(Private const &) = delete; }; ListView::ListView( TQWidget *parent, const char *name ) diff --git a/kopete/protocols/jabber/jingle/libjingle/talk/base/scoped_ptr.h b/kopete/protocols/jabber/jingle/libjingle/talk/base/scoped_ptr.h index 0470ff83..64eba645 100644 --- a/kopete/protocols/jabber/jingle/libjingle/talk/base/scoped_ptr.h +++ b/kopete/protocols/jabber/jingle/libjingle/talk/base/scoped_ptr.h @@ -15,7 +15,7 @@ // scoped_ptr mimics a built-in pointer except that it guarantees deletion // of the object pointed to, either on destruction of the scoped_ptr or via // an explicit reset(). scoped_ptr is a simple solution for simple needs; -// use shared_ptr or std::auto_ptr if your needs are more complex. +// use shared_ptr or std::unique_ptr if your needs are more complex. // scoped_ptr_malloc added in by Google. When one of // these goes out of scope, instead of doing a delete or delete[], it diff --git a/krdc/smartptr.h b/krdc/smartptr.h index 49fa25c2..1eff196e 100644 --- a/krdc/smartptr.h +++ b/krdc/smartptr.h @@ -50,7 +50,7 @@ struct SmartPtrRefCount { * deletes the object. * * The recommended way to use SmartPtr and @ref WeakPtr is to use SmartPtr - * for all aggregations and WeakPtr for associations. Unlike auto_ptr, + * for all aggregations and WeakPtr for associations. * SmartPtr can be used in collections. * * SmartPtr is not thread-safe. All instances of SmartPtrs pointing -- cgit v1.2.1