diff --git a/CMakeLists.txt b/CMakeLists.txt index be79c075a7..2bdde92549 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,13 +136,6 @@ if(CMAKE_COMPILER_IS_GNUCXX) "Setting GCC version ${GCC_VERSION} build flags \"${KICAD_GCC_RELEASE_BUILD_FLAGS}\"") endif(CMAKE_BUILD_TYPE STREQUAL Debug) - # needed when using #include , or std::unique_ptr which replaces std::auto_ptr - if(WIN32) - set(CMAKE_CXX_FLAGS "-std=gnu++0x") - else(WIN32) - set(CMAKE_CXX_FLAGS "-std=c++0x") - endif(WIN32) - if(WIN32) # under Windows/mingw, -fPIC option is enabled by default # Set default flags for Release build. set(CMAKE_C_FLAGS_RELEASE "-Wall ${KICAD_GCC_RELEASE_BUILD_FLAGS} -DNDEBUG") diff --git a/common/footprint_info.cpp b/common/footprint_info.cpp index 5f5e32009a..5a5e415782 100644 --- a/common/footprint_info.cpp +++ b/common/footprint_info.cpp @@ -70,7 +70,7 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames ) for( unsigned i=0; i m( pi->FootprintLoad( libPath, fpnames[i] ) ); + std::auto_ptr m( pi->FootprintLoad( libPath, fpnames[i] ) ); // we're loading what we enumerated, all must be there. wxASSERT( m.get() ); diff --git a/eeschema/netform.cpp b/eeschema/netform.cpp index bc7524126d..bfea8ce59f 100644 --- a/eeschema/netform.cpp +++ b/eeschema/netform.cpp @@ -696,7 +696,7 @@ XNODE* NETLIST_EXPORT_TOOL::makeGenericDesignHeader() XNODE* NETLIST_EXPORT_TOOL::makeGenericLibraries() { - XNODE* xlibs = node( wxT( "libraries" ) ); // unique_ptr + XNODE* xlibs = node( wxT( "libraries" ) ); // auto_ptr for( std::set::iterator it = m_Libraries.begin(); it!=m_Libraries.end(); ++it ) { @@ -716,7 +716,7 @@ XNODE* NETLIST_EXPORT_TOOL::makeGenericLibraries() XNODE* NETLIST_EXPORT_TOOL::makeGenericLibParts() { - XNODE* xlibparts = node( wxT( "libparts" ) ); // unique_ptr + XNODE* xlibparts = node( wxT( "libparts" ) ); // auto_ptr wxString sLibpart = wxT( "libpart" ); wxString sLib = wxT( "lib" ); wxString sPart = wxT( "part" ); @@ -833,7 +833,7 @@ XNODE* NETLIST_EXPORT_TOOL::makeGenericLibParts() XNODE* NETLIST_EXPORT_TOOL::makeGenericListOfNets() { - XNODE* xnets = node( wxT( "nets" ) ); // unique_ptr if exceptions ever get used. + XNODE* xnets = node( wxT( "nets" ) ); // auto_ptr if exceptions ever get used. wxString netCodeTxt; wxString netName; wxString ref; @@ -1062,7 +1062,7 @@ bool NETLIST_EXPORT_TOOL::WriteKiCadNetList( const wxString& aOutFileName ) for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ ) g_NetObjectslist[ii]->m_Flag = 0; - std::unique_ptr xroot( makeGenericRoot() ); + std::auto_ptr xroot( makeGenericRoot() ); try { diff --git a/include/hashtables.h b/include/hashtables.h index c9cc1036fc..758a3ae33c 100644 --- a/include/hashtables.h +++ b/include/hashtables.h @@ -29,7 +29,7 @@ // Three strategies for providing a portable hashtable are given. // C++, boost, and wx, in that order. C++ solution is no good for mingw. -// So will soon try boost for all platforms. +// So boost seems best for all platforms. #if 0 // C++ @@ -56,13 +56,13 @@ typedef std::unordered_map< std::string, EDA_RECT > RECT_MAP; // see http://www.boost.org/doc/libs/1_49_0/doc/html/boost/unordered_map.html -/// Map a C string to a wxString, used in PLUGINs. +/// Map a std::string to a wxString, used in PLUGINs. typedef boost::unordered_map< std::string, wxString > PROPERTIES; -/// Map a C string to an integer. Used in DSNLEXER. +/// Map a std::string to an integer. Used in DSNLEXER. typedef boost::unordered_map< std::string, int > KEYWORD_MAP; -/// Map a C string to an EDA_RECT. +/// Map a std::string to an EDA_RECT. /// The key is the classname of the derived wxformbuilder dialog. typedef boost::unordered_map< std::string, EDA_RECT > RECT_MAP; diff --git a/new/sch_lib.cpp b/new/sch_lib.cpp index cf759910d7..a5464fa5d6 100644 --- a/new/sch_lib.cpp +++ b/new/sch_lib.cpp @@ -22,7 +22,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include // std::unique_ptr +#include // std::auto_ptr #include diff --git a/new/sch_lib_table.cpp b/new/sch_lib_table.cpp index 6157044f04..1950371826 100644 --- a/new/sch_lib_table.cpp +++ b/new/sch_lib_table.cpp @@ -79,7 +79,7 @@ void LIB_TABLE::Parse( SCH_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR ) in->NeedSYMBOLorNUMBER(); - std::unique_ptr row( new ROW( this ) ); + std::auto_ptr row( new ROW( this ) ); row->SetLogicalName( in->CurText() ); @@ -244,13 +244,13 @@ void LIB_TABLE::loadLib( ROW* aRow ) throw( IO_ERROR ) if( !libType.compare( "dir" ) ) { // autor_ptr wrap source while we create sink, in case sink throws. - std::unique_ptr source( + std::auto_ptr source( new DIR_LIB_SOURCE( aRow->GetFullURI(), aRow->GetOptions() ) ); /* @todo load LIB_SINK - std::unique_ptr sink( + std::auto_ptr sink( new DIR_LIB_SINK( aRow->GetFullURI(), aRow->GetOptions() ) ); @@ -311,7 +311,7 @@ LIB_TABLE::ROW* LIB_TABLE::FindRow( const STRING& aLogicalName ) const } -bool LIB_TABLE::InsertRow( std::unique_ptr& aRow, bool doReplace ) +bool LIB_TABLE::InsertRow( std::auto_ptr& aRow, bool doReplace ) { // this does not need to be super fast. diff --git a/new/sch_lib_table.h b/new/sch_lib_table.h index 40f27e44cd..d05dfdb569 100644 --- a/new/sch_lib_table.h +++ b/new/sch_lib_table.h @@ -337,7 +337,7 @@ protected: // only a table editor can use these * exists. If false, then fail if the key already exists. * @return bool - true if the operation succeeded. */ - bool InsertRow( std::unique_ptr& aRow, bool doReplace = false ); + bool InsertRow( std::auto_ptr& aRow, bool doReplace = false ); /** * Function FindRow diff --git a/pcb_calculator/datafile_read_write.cpp b/pcb_calculator/datafile_read_write.cpp index efc5285be6..618e426166 100644 --- a/pcb_calculator/datafile_read_write.cpp +++ b/pcb_calculator/datafile_read_write.cpp @@ -86,7 +86,7 @@ bool PCB_CALCULATOR_FRAME::WriteDataFile() // Switch the locale to standard C (needed to read/write floating point numbers LOCALE_IO toggle; - std::unique_ptr datafile( new PCB_CALCULATOR_DATAFILE( &m_RegulatorList ) ); + std::auto_ptr datafile( new PCB_CALCULATOR_DATAFILE( &m_RegulatorList ) ); try { diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index c8fe84eb10..2f872a6328 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -1107,7 +1107,7 @@ BOARD* EAGLE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPE m_board->SetFileName( aFileName ); // delete on exception, iff I own m_board, according to aAppendToMe - unique_ptr deleter( aAppendToMe ? NULL : m_board ); + auto_ptr deleter( aAppendToMe ? NULL : m_board ); try { @@ -1795,7 +1795,7 @@ void EAGLE_PLUGIN::orientModuleText( MODULE* m, const EELEMENT& e, MODULE* EAGLE_PLUGIN::makeModule( CPTREE& aPackage, const std::string& aPkgName ) const { - std::unique_ptr m( new MODULE( NULL ) ); + std::auto_ptr m( new MODULE( NULL ) ); m->SetLibRef( FROM_UTF8( aPkgName.c_str() ) ); diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index efb33ca84b..81f1fbd89e 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -77,7 +77,7 @@ class FP_CACHE_ITEM wxFileName m_file_name; ///< The the full file name and path of the footprint to cache. bool m_writable; ///< Writability status of the footprint file. wxDateTime m_mod_time; ///< The last file modified time stamp. - unique_ptr< MODULE > m_module; + auto_ptr< MODULE > m_module; public: FP_CACHE_ITEM( MODULE* aModule, const wxFileName& aFileName ); diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index e51ca5a11b..dc0b699974 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -148,7 +148,7 @@ static inline unsigned ReadLine( LINE_READER* rdr, const char* caller ) #endif -using namespace std; // unique_ptr +using namespace std; // auto_ptr static inline const char* ShowVertJustify( EDA_TEXT_VJUSTIFY_T vertical ) @@ -237,7 +237,7 @@ BOARD* LEGACY_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPE m_board->SetFileName( aFileName ); // delete on exception, iff I own m_board, according to aAppendToMe - unique_ptr deleter( aAppendToMe ? NULL : m_board ); + auto_ptr deleter( aAppendToMe ? NULL : m_board ); FILE* fp = wxFopen( aFileName, wxT( "r" ) ); if( !fp ) @@ -929,7 +929,7 @@ void LEGACY_PLUGIN::loadSETUP() MODULE* LEGACY_PLUGIN::LoadMODULE() { - unique_ptr module( new MODULE( m_board ) ); + auto_ptr module( new MODULE( m_board ) ); while( READLINE( m_reader ) ) { @@ -1139,7 +1139,7 @@ MODULE* LEGACY_PLUGIN::LoadMODULE() void LEGACY_PLUGIN::loadPAD( MODULE* aModule ) { - unique_ptr pad( new D_PAD( aModule ) ); + auto_ptr pad( new D_PAD( aModule ) ); while( READLINE( m_reader ) ) { @@ -1382,7 +1382,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule ) THROW_IO_ERROR( m_error ); } - unique_ptr dwg( new EDGE_MODULE( aModule, shape ) ); // a drawing + auto_ptr dwg( new EDGE_MODULE( aModule, shape ) ); // a drawing const char* data; @@ -1678,7 +1678,7 @@ void LEGACY_PLUGIN::loadPCB_LINE() $EndDRAWSEGMENT */ - unique_ptr dseg( new DRAWSEGMENT( m_board ) ); + auto_ptr dseg( new DRAWSEGMENT( m_board ) ); while( READLINE( m_reader ) ) { @@ -2069,9 +2069,9 @@ void LEGACY_PLUGIN::loadNETCLASS() // create an empty NETCLASS without a name, but do not add it to the BOARD // yet since that would bypass duplicate netclass name checking within the BOARD. - // store it temporarily in an unique_ptr until successfully inserted into the BOARD + // store it temporarily in an auto_ptr until successfully inserted into the BOARD // just before returning. - unique_ptr nc( new NETCLASS( m_board, wxEmptyString ) ); + auto_ptr nc( new NETCLASS( m_board, wxEmptyString ) ); while( READLINE( m_reader ) ) { @@ -2144,7 +2144,7 @@ void LEGACY_PLUGIN::loadNETCLASS() // Must have been a name conflict, this is a bad board file. // User may have done a hand edit to the file. - // unique_ptr will delete nc on this code path + // auto_ptr will delete nc on this code path m_error.Printf( _( "duplicate NETCLASS name '%s'" ), nc->GetName().GetData() ); THROW_IO_ERROR( m_error ); @@ -2160,7 +2160,7 @@ void LEGACY_PLUGIN::loadNETCLASS() void LEGACY_PLUGIN::loadZONE_CONTAINER() { - unique_ptr zc( new ZONE_CONTAINER( m_board ) ); + auto_ptr zc( new ZONE_CONTAINER( m_board ) ); CPolyLine::HATCH_STYLE outline_hatch = CPolyLine::NO_HATCH; bool sawCorner = false; @@ -2422,7 +2422,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() void LEGACY_PLUGIN::loadDIMENSION() { - unique_ptr dim( new DIMENSION( m_board ) ); + auto_ptr dim( new DIMENSION( m_board ) ); while( READLINE( m_reader ) ) { diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 9e2a486563..9cfd551556 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -262,7 +262,7 @@ S3D_MASTER* PCB_PARSER::parse3DModel() throw( PARSE_ERROR ) T token; - unique_ptr< S3D_MASTER > n3D( new S3D_MASTER( NULL ) ); + auto_ptr< S3D_MASTER > n3D( new S3D_MASTER( NULL ) ); NeedSYMBOL(); n3D->m_Shape3DName = FromUTF8(); @@ -1062,7 +1062,7 @@ void PCB_PARSER::parseNETCLASS() throw( IO_ERROR, PARSE_ERROR ) T token; - unique_ptr nc( new NETCLASS( m_board, wxEmptyString ) ); + auto_ptr nc( new NETCLASS( m_board, wxEmptyString ) ); NeedSYMBOL(); nc->SetName( FromUTF8() ); @@ -1123,7 +1123,7 @@ void PCB_PARSER::parseNETCLASS() throw( IO_ERROR, PARSE_ERROR ) // Must have been a name conflict, this is a bad board file. // User may have done a hand edit to the file. - // unique_ptr will delete nc on this code path + // auto_ptr will delete nc on this code path wxString error; error.Printf( _( "duplicate NETCLASS name '%s' in file %s at line %d, offset %d" ), @@ -1141,7 +1141,7 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT() throw( IO_ERROR, PARSE_ERROR ) T token; wxPoint pt; - unique_ptr< DRAWSEGMENT > segment( new DRAWSEGMENT( NULL ) ); + auto_ptr< DRAWSEGMENT > segment( new DRAWSEGMENT( NULL ) ); switch( CurTok() ) { @@ -1302,7 +1302,7 @@ TEXTE_PCB* PCB_PARSER::parseTEXTE_PCB() throw( IO_ERROR, PARSE_ERROR ) T token; - unique_ptr< TEXTE_PCB > text( new TEXTE_PCB( m_board ) ); + auto_ptr< TEXTE_PCB > text( new TEXTE_PCB( m_board ) ); NeedSYMBOLorNUMBER(); text->SetText( FromUTF8() ); @@ -1370,7 +1370,7 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR ) T token; - unique_ptr< DIMENSION > dimension( new DIMENSION( NULL ) ); + auto_ptr< DIMENSION > dimension( new DIMENSION( NULL ) ); dimension->m_Value = parseBoardUnits( "dimension value" ); NeedLEFT(); @@ -1519,7 +1519,7 @@ MODULE* PCB_PARSER::parseMODULE() throw( IO_ERROR, PARSE_ERROR ) wxPoint pt; T token; - unique_ptr< MODULE > module( new MODULE( m_board ) ); + auto_ptr< MODULE > module( new MODULE( m_board ) ); NeedSYMBOL(); module->SetLibRef( FromUTF8() ); @@ -1735,7 +1735,7 @@ TEXTE_MODULE* PCB_PARSER::parseTEXTE_MODULE() throw( IO_ERROR, PARSE_ERROR ) T token = NextTok(); - unique_ptr< TEXTE_MODULE > text( new TEXTE_MODULE( NULL ) ); + auto_ptr< TEXTE_MODULE > text( new TEXTE_MODULE( NULL ) ); switch( token ) { @@ -1820,7 +1820,7 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE() throw( IO_ERROR, PARSE_ERROR ) wxPoint pt; T token; - unique_ptr< EDGE_MODULE > segment( new EDGE_MODULE( NULL ) ); + auto_ptr< EDGE_MODULE > segment( new EDGE_MODULE( NULL ) ); switch( CurTok() ) { @@ -1985,7 +1985,7 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR ) wxSize sz; wxPoint pt; - unique_ptr< D_PAD > pad( new D_PAD( NULL ) ); + auto_ptr< D_PAD > pad( new D_PAD( NULL ) ); NeedSYMBOLorNUMBER(); pad->SetPadName( FromUTF8() ); @@ -2213,7 +2213,7 @@ TRACK* PCB_PARSER::parseTRACK() throw( IO_ERROR, PARSE_ERROR ) wxPoint pt; T token; - unique_ptr< TRACK > track( new TRACK( m_board ) ); + auto_ptr< TRACK > track( new TRACK( m_board ) ); for( token = NextTok(); token != T_RIGHT; token = NextTok() ) { @@ -2275,7 +2275,7 @@ SEGVIA* PCB_PARSER::parseSEGVIA() throw( IO_ERROR, PARSE_ERROR ) wxPoint pt; T token; - unique_ptr< SEGVIA > via( new SEGVIA( m_board ) ); + auto_ptr< SEGVIA > via( new SEGVIA( m_board ) ); for( token = NextTok(); token != T_RIGHT; token = NextTok() ) { @@ -2360,7 +2360,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR ) // bigger scope since each filled_polygon is concatenated in here std::vector< CPolyPt > pts; - unique_ptr< ZONE_CONTAINER > zone( new ZONE_CONTAINER( m_board ) ); + auto_ptr< ZONE_CONTAINER > zone( new ZONE_CONTAINER( m_board ) ); zone->SetPriority( 0 ); @@ -2665,7 +2665,7 @@ PCB_TARGET* PCB_PARSER::parsePCB_TARGET() throw( IO_ERROR, PARSE_ERROR ) wxPoint pt; T token; - unique_ptr< PCB_TARGET > target( new PCB_TARGET( NULL ) ); + auto_ptr< PCB_TARGET > target( new PCB_TARGET( NULL ) ); for( token = NextTok(); token != T_RIGHT; token = NextTok() )