From fb7787d40248c11deb96df766ab987bbdece06dc Mon Sep 17 00:00:00 2001 From: Jan Niklas Hasse Date: Thu, 5 Jan 2017 11:06:56 +0100 Subject: [PATCH] Replace auto_ptr with unique_ptr --- src/rad/appdata.cpp | 30 +++++++++++++++--------------- src/utils/wxfbipc.cpp | 14 +++++++------- src/utils/wxfbipc.h | 4 ++-- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/rad/appdata.cpp b/src/rad/appdata.cpp index 160dae94..ae527f62 100644 --- a/src/rad/appdata.cpp +++ b/src/rad/appdata.cpp @@ -1407,7 +1407,7 @@ bool ApplicationData::ConvertProject( const wxString& path, int fileMajor, int f // Create a clone of now-converted object tree, so it can be linked // underneath the root element - std::auto_ptr< ticpp::Node > objectTree = root->Clone(); + std::unique_ptr objectTree = root->Clone(); // Clear the document to add the declatation and the root element doc.Clear(); @@ -1936,7 +1936,7 @@ void ApplicationData::ConvertObject( ticpp::Element* parent, int fileMajor, int m_warnOnAdditionsUpdate = false; wxLogWarning( _("Updated classes from wxAdditions. You must use the latest version of wxAdditions to continue.\nNote wxScintilla is now wxStyledListCtrl, wxTreeListCtrl is now wxadditions::wxTreeListCtrl, and wxTreeListCtrlColumn is now wxadditions::wxTreeListCtrlColumn") ); } - + typedef std::map< std::string, std::set< std::string > > PropertiesToRemove; static std::set< std::string > propertyRemovalWarnings; @@ -1950,7 +1950,7 @@ void ApplicationData::ConvertObject( ticpp::Element* parent, int fileMajor, int std::stringstream ss; std::ostream_iterator< std::string > out_it (ss, ", "); std::copy( it->second.begin(), it->second.end(), out_it ); - + wxLogMessage( _("Removed properties for class %s because they are no longer supported: %s"), objClass, ss.str() ); propertyRemovalWarnings.insert( objClass ); } @@ -1977,7 +1977,7 @@ void ApplicationData::GetPropertiesToConvert( ticpp::Node* parent, const std::se } } } - + void ApplicationData::RemoveProperties( ticpp::Node* parent, const std::set< std::string >& names ) { ticpp::Iterator< ticpp::Element > prop( "property" ); @@ -1986,15 +1986,15 @@ void ApplicationData::RemoveProperties( ticpp::Node* parent, const std::set< std { ticpp::Element element = *prop; ++prop; - + std::string name; element.GetAttribute( "name", &name ); - + if ( names.find( name ) != names.end() ) { parent->RemoveChild( &element ); } - } + } } void ApplicationData::TransferOptionList( ticpp::Element* prop, std::set< wxString >* options, const std::string& newPropName ) @@ -2909,7 +2909,7 @@ ApplicationData::PropertiesToRemove& ApplicationData::GetPropertiesToRemove_v1_1 propertiesToRemove[ "Dialog" ].insert( "validator_style" ); propertiesToRemove[ "Dialog" ].insert( "validator_type" ); propertiesToRemove[ "Dialog" ].insert( "aui_name" ); - + propertiesToRemove[ "Panel" ].insert( "BottomDockable" ); propertiesToRemove[ "Panel" ].insert( "LeftDockable" ); propertiesToRemove[ "Panel" ].insert( "RightDockable" ); @@ -2932,8 +2932,8 @@ ApplicationData::PropertiesToRemove& ApplicationData::GetPropertiesToRemove_v1_1 propertiesToRemove[ "Panel" ].insert( "show" ); propertiesToRemove[ "Panel" ].insert( "toolbar_pane" ); propertiesToRemove[ "Panel" ].insert( "validator_style" ); - propertiesToRemove[ "Panel" ].insert( "validator_type" ); - + propertiesToRemove[ "Panel" ].insert( "validator_type" ); + propertiesToRemove[ "wxStaticText" ].insert( "validator_style" ); propertiesToRemove[ "wxStaticText" ].insert( "validator_type" ); propertiesToRemove[ "CustomControl" ].insert( "validator_style" ); @@ -2941,18 +2941,18 @@ ApplicationData::PropertiesToRemove& ApplicationData::GetPropertiesToRemove_v1_1 propertiesToRemove[ "wxAuiNotebook" ].insert( "validator_style" ); propertiesToRemove[ "wxAuiNotebook" ].insert( "validator_type" ); propertiesToRemove[ "wxPanel" ].insert( "validator_style" ); - propertiesToRemove[ "wxPanel" ].insert( "validator_type" ); + propertiesToRemove[ "wxPanel" ].insert( "validator_type" ); propertiesToRemove[ "wxToolBar" ].insert( "validator_style" ); - propertiesToRemove[ "wxToolBar" ].insert( "validator_type" ); + propertiesToRemove[ "wxToolBar" ].insert( "validator_type" ); propertiesToRemove[ "wxStyledTextCtrl" ].insert( "use_wxAddition" ); propertiesToRemove[ "wxStyledTextCtrl" ].insert( "validator_style" ); propertiesToRemove[ "wxStyledTextCtrl" ].insert( "validator_type" ); propertiesToRemove[ "wxPropertyGridManager" ].insert( "use_wxAddition" ); propertiesToRemove[ "wxPropertyGridManager" ].insert( "validator_style" ); - propertiesToRemove[ "wxPropertyGridManager" ].insert( "validator_type" ); + propertiesToRemove[ "wxPropertyGridManager" ].insert( "validator_type" ); propertiesToRemove[ "wxadditions::wxTreeListCtrl" ].insert( "validator_style" ); - propertiesToRemove[ "wxadditions::wxTreeListCtrl" ].insert( "validator_type" ); - } + propertiesToRemove[ "wxadditions::wxTreeListCtrl" ].insert( "validator_type" ); + } return propertiesToRemove; } diff --git a/src/utils/wxfbipc.cpp b/src/utils/wxfbipc.cpp index 84e883e4..5c10e8eb 100644 --- a/src/utils/wxfbipc.cpp +++ b/src/utils/wxfbipc.cpp @@ -92,7 +92,7 @@ bool wxFBIPC::VerifySingleInstance( const wxString& file, bool switchTo ) } } - std::auto_ptr< wxSingleInstanceChecker > checker; + std::unique_ptr checker; { // Suspend logging, because error messages here are not useful #ifndef __WXFB_DEBUG__ @@ -106,7 +106,7 @@ bool wxFBIPC::VerifySingleInstance( const wxString& file, bool switchTo ) // This is the first instance of this project, so setup a server and save the single instance checker if ( CreateServer( name ) ) { - m_checker = checker; + m_checker = std::move(checker); return true; } else @@ -135,10 +135,10 @@ bool wxFBIPC::VerifySingleInstance( const wxString& file, bool switchTo ) } // Create the client - std::auto_ptr< AppClient > client( new AppClient ); + std::unique_ptr client(new AppClient); // Create the connection - std::auto_ptr< wxConnectionBase > connection; + std::unique_ptr connection; #ifdef __WXMSW__ connection.reset( client->MakeConnection( wxT("localhost"), name, name ) ); #else @@ -189,12 +189,12 @@ bool wxFBIPC::CreateServer( const wxString& name ) wxLogNull stopLogging; #endif - std::auto_ptr< AppServer > server( new AppServer( name ) ); + auto server = std::unique_ptr(new AppServer(name)); #ifdef __WXMSW__ if ( server->Create( name ) ) { - m_server = server; + m_server = std::move(server); return true; } #else @@ -204,7 +204,7 @@ bool wxFBIPC::CreateServer( const wxString& name ) wxString nameWithPort = wxString::Format( wxT("%i%s"), i, name.c_str() ); if( server->Create( nameWithPort ) ) { - m_server = server; + m_server = std::move(server); return true; } else diff --git a/src/utils/wxfbipc.h b/src/utils/wxfbipc.h index 95cdfabe..d9ce2cb5 100644 --- a/src/utils/wxfbipc.h +++ b/src/utils/wxfbipc.h @@ -35,8 +35,8 @@ class AppServer; class wxFBIPC { private: - std::auto_ptr< wxSingleInstanceChecker > m_checker; - std::auto_ptr< AppServer > m_server; + std::unique_ptr m_checker; + std::unique_ptr m_server; const int m_port; bool CreateServer( const wxString& name );