Skip to content

Commit

Permalink
Replace auto_ptr with unique_ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
jhasse committed Jan 5, 2017
1 parent 4a67664 commit fb7787d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
30 changes: 15 additions & 15 deletions src/rad/appdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ticpp::Node> objectTree = root->Clone();

// Clear the document to add the declatation and the root element
doc.Clear();
Expand Down Expand Up @@ -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;
Expand All @@ -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 );
}
Expand All @@ -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" );
Expand All @@ -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 )
Expand Down Expand Up @@ -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" );
Expand All @@ -2932,27 +2932,27 @@ 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" );
propertiesToRemove[ "CustomControl" ].insert( "validator_type" );
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;
}
14 changes: 7 additions & 7 deletions src/utils/wxfbipc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ bool wxFBIPC::VerifySingleInstance( const wxString& file, bool switchTo )
}
}

std::auto_ptr< wxSingleInstanceChecker > checker;
std::unique_ptr<wxSingleInstanceChecker> checker;
{
// Suspend logging, because error messages here are not useful
#ifndef __WXFB_DEBUG__
Expand All @@ -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
Expand Down Expand Up @@ -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<AppClient> client(new AppClient);

// Create the connection
std::auto_ptr< wxConnectionBase > connection;
std::unique_ptr<wxConnectionBase> connection;
#ifdef __WXMSW__
connection.reset( client->MakeConnection( wxT("localhost"), name, name ) );
#else
Expand Down Expand Up @@ -189,12 +189,12 @@ bool wxFBIPC::CreateServer( const wxString& name )
wxLogNull stopLogging;
#endif

std::auto_ptr< AppServer > server( new AppServer( name ) );
auto server = std::make_unique<AppServer>(name);

#ifdef __WXMSW__
if ( server->Create( name ) )
{
m_server = server;
m_server = std::move(server);
return true;
}
#else
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/utils/wxfbipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class AppServer;
class wxFBIPC
{
private:
std::auto_ptr< wxSingleInstanceChecker > m_checker;
std::auto_ptr< AppServer > m_server;
std::unique_ptr<wxSingleInstanceChecker> m_checker;
std::unique_ptr<AppServer> m_server;
const int m_port;

bool CreateServer( const wxString& name );
Expand Down

0 comments on commit fb7787d

Please sign in to comment.