diff --git a/CMakeModules/PerformFeatureChecks.cmake b/CMakeModules/PerformFeatureChecks.cmake index 330cc2cb8b..6f8bc8586b 100644 --- a/CMakeModules/PerformFeatureChecks.cmake +++ b/CMakeModules/PerformFeatureChecks.cmake @@ -93,7 +93,7 @@ macro(perform_feature_checks) # CMakes check_cxx_symbol_exists() doesn't work for templates so we must create a # small program to verify isinf() exists in cmath. - check_cxx_source_compiles( "#include \nusing namespace std;\nint main(int argc, char** argv)\n{\n (void)argv;\n isinf(1.0); (void)argc;\n return 0;\n}\n" HAVE_CMATH_ISINF ) + check_cxx_source_compiles( "#include \nint main(int argc, char** argv)\n{\n (void)argv;\n std::isinf(1.0); (void)argc;\n return 0;\n}\n" HAVE_CMATH_ISINF ) #check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) non-standard library, does not work check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME) diff --git a/common/geometry/shape_line_chain.cpp b/common/geometry/shape_line_chain.cpp index a78e94a584..7ac8c10eae 100644 --- a/common/geometry/shape_line_chain.cpp +++ b/common/geometry/shape_line_chain.cpp @@ -25,7 +25,6 @@ #include #include -using namespace std; using boost::optional; bool SHAPE_LINE_CHAIN::Collide( const VECTOR2I& aP, int aClearance ) const @@ -137,7 +136,7 @@ int SHAPE_LINE_CHAIN::Distance( const VECTOR2I& aP ) const int d = INT_MAX; for( int s = 0; s < SegmentCount(); s++ ) - d = min( d, CSegment( s ).Distance( aP ) ); + d = std::min( d, CSegment( s ).Distance( aP ) ); return d; } @@ -437,7 +436,7 @@ const optional SHAPE_LINE_CHAIN::SelfIntersectin SHAPE_LINE_CHAIN& SHAPE_LINE_CHAIN::Simplify() { - vector pts_unique; + std::vector pts_unique; if( PointCount() < 2 ) { @@ -524,9 +523,9 @@ const VECTOR2I SHAPE_LINE_CHAIN::NearestPoint( const VECTOR2I& aP ) const } -const string SHAPE_LINE_CHAIN::Format() const +const std::string SHAPE_LINE_CHAIN::Format() const { - stringstream ss; + std::stringstream ss; ss << m_points.size() << " " << ( m_closed ? 1 : 0 ) << " "; diff --git a/common/gr_basic.cpp b/common/gr_basic.cpp index 8c7f70131d..9052ac74f5 100644 --- a/common/gr_basic.cpp +++ b/common/gr_basic.cpp @@ -1358,8 +1358,8 @@ void ClipAndDrawPoly( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPoints[], int n ) } // A clip box exists: clip and draw the polygon. - static vector clippedPolygon; - static pointVector inputPolygon, outputPolygon; + static std::vector clippedPolygon; + static pointVector inputPolygon, outputPolygon; inputPolygon.clear(); outputPolygon.clear(); diff --git a/common/tool/tool_event.cpp b/common/tool/tool_event.cpp index 15ae3314e7..402f9798f2 100644 --- a/common/tool/tool_event.cpp +++ b/common/tool/tool_event.cpp @@ -31,8 +31,6 @@ #include -using namespace std; - struct FlagString { int flag; @@ -153,7 +151,7 @@ const std::string TOOL_EVENT::Format() const const std::string TOOL_EVENT_LIST::Format() const { - string s; + std::string s; BOOST_FOREACH( TOOL_EVENT e, m_events ) s += e.Format() + " "; diff --git a/common/tool/tool_manager.cpp b/common/tool/tool_manager.cpp index 75ac02574e..6d887a291c 100644 --- a/common/tool/tool_manager.cpp +++ b/common/tool/tool_manager.cpp @@ -47,7 +47,6 @@ #include using boost::optional; -using namespace std; /// Struct describing the current execution state of a TOOL struct TOOL_MANAGER::TOOL_STATE diff --git a/eeschema/annotate.cpp b/eeschema/annotate.cpp index c59d48efde..30881e4fa1 100644 --- a/eeschema/annotate.cpp +++ b/eeschema/annotate.cpp @@ -26,8 +26,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include // to use sort vector -#include +#include #include #include diff --git a/eeschema/component_references_lister.cpp b/eeschema/component_references_lister.cpp index e352f785df..10b67d3678 100644 --- a/eeschema/component_references_lister.cpp +++ b/eeschema/component_references_lister.cpp @@ -30,7 +30,7 @@ #include -#include // to use sort vector +#include #include #include diff --git a/eeschema/hierarch.cpp b/eeschema/hierarch.cpp index ff00871935..6ff3cba4f8 100644 --- a/eeschema/hierarch.cpp +++ b/eeschema/hierarch.cpp @@ -169,7 +169,7 @@ HIERARCHY_NAVIG_DLG::HIERARCHY_NAVIG_DLG( SCH_EDIT_FRAME* parent, wxDC* DC, cons // Set dialog window size to be large enough m_TreeSize.x = itemrect.GetWidth() + 20; - m_TreeSize.x = max( m_TreeSize.x, 250 ); + m_TreeSize.x = std::max( m_TreeSize.x, 250 ); // Readjust the size of the frame to an optimal value. m_TreeSize.y = m_nbsheets * itemrect.GetHeight(); diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index 8a92a95908..6f14824083 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -246,7 +246,7 @@ bool SCH_BUS_ENTRY_BASE::IsSelectStateChanged( const wxRect& aRect ) } -void SCH_BUS_ENTRY_BASE::GetConnectionPoints( vector< wxPoint >& aPoints ) const +void SCH_BUS_ENTRY_BASE::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const { aPoints.push_back( m_pos ); aPoints.push_back( m_End() ); diff --git a/eeschema/sch_bus_entry.h b/eeschema/sch_bus_entry.h index 771469830e..1b0a8ab0de 100644 --- a/eeschema/sch_bus_entry.h +++ b/eeschema/sch_bus_entry.h @@ -96,7 +96,7 @@ public: bool IsConnectable() const { return true; } - void GetConnectionPoints( vector< wxPoint >& aPoints ) const; + void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const; BITMAP_DEF GetMenuImage() const { return add_entry_xpm; } diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 3b0bdd7d6a..d83c892591 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -1605,7 +1605,7 @@ bool SCH_COMPONENT::IsSelectStateChanged( const wxRect& aRect ) } -void SCH_COMPONENT::GetConnectionPoints( vector< wxPoint >& aPoints ) const +void SCH_COMPONENT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const { LIB_PIN* pin; LIB_COMPONENT* component = CMP_LIBRARY::FindLibraryComponent( m_ChipName ); @@ -1876,7 +1876,7 @@ bool SCH_COMPONENT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccura bool SCH_COMPONENT::doIsConnected( const wxPoint& aPosition ) const { - vector< wxPoint > pts; + std::vector< wxPoint > pts; GetConnectionPoints( pts ); diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h index d145f78404..aac7dac913 100644 --- a/eeschema/sch_component.h +++ b/eeschema/sch_component.h @@ -357,7 +357,7 @@ public: bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ); - void GetEndPoints( std::vector & aItemList ); + void GetEndPoints( std::vector& aItemList ); wxPoint GetPinPhysicalPosition( LIB_PIN* Pin ); @@ -372,7 +372,7 @@ public: */ bool IsInNetlist() const; - void GetConnectionPoints( vector< wxPoint >& aPoints ) const; + void GetConnectionPoints( std::vector& aPoints ) const; SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData, const KICAD_T scanTypes[] ); diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp index cc26dc5f3a..44e6a03d83 100644 --- a/eeschema/sch_junction.cpp +++ b/eeschema/sch_junction.cpp @@ -168,7 +168,7 @@ bool SCH_JUNCTION::IsSelectStateChanged( const wxRect& aRect ) } -void SCH_JUNCTION::GetConnectionPoints( vector< wxPoint >& aPoints ) const +void SCH_JUNCTION::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const { aPoints.push_back( m_pos ); } diff --git a/eeschema/sch_junction.h b/eeschema/sch_junction.h index 1e8d90fc29..0e93d846b2 100644 --- a/eeschema/sch_junction.h +++ b/eeschema/sch_junction.h @@ -81,7 +81,7 @@ public: bool IsConnectable() const { return true; } - void GetConnectionPoints( vector< wxPoint >& aPoints ) const; + void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const; wxString GetSelectMenuText() const { return wxString( _( "Junction" ) ); } diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index 20929a8c61..96e36ebc59 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -461,7 +461,7 @@ bool SCH_LINE::IsConnectable() const } -void SCH_LINE::GetConnectionPoints( vector< wxPoint >& aPoints ) const +void SCH_LINE::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const { aPoints.push_back( m_start ); aPoints.push_back( m_end ); diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h index 08f983db2f..87a3972a8d 100644 --- a/eeschema/sch_line.h +++ b/eeschema/sch_line.h @@ -113,9 +113,9 @@ public: */ bool MergeOverlap( SCH_LINE* aLine ); - void GetEndPoints( vector & aItemList ); + void GetEndPoints( std::vector& aItemList ); - bool IsDanglingStateChanged( vector< DANGLING_END_ITEM >& aItemList ); + bool IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList ); bool IsDangling() const { return m_startIsDangling || m_endIsDangling; } @@ -123,7 +123,7 @@ public: bool IsConnectable() const; - void GetConnectionPoints( vector< wxPoint >& aPoints ) const; + void GetConnectionPoints(std::vector< wxPoint >& aPoints ) const; wxString GetSelectMenuText() const; diff --git a/eeschema/sch_no_connect.cpp b/eeschema/sch_no_connect.cpp index ecda593c83..b92ebe5003 100644 --- a/eeschema/sch_no_connect.cpp +++ b/eeschema/sch_no_connect.cpp @@ -182,7 +182,7 @@ bool SCH_NO_CONNECT::IsSelectStateChanged( const wxRect& aRect ) } -void SCH_NO_CONNECT::GetConnectionPoints( vector< wxPoint >& aPoints ) const +void SCH_NO_CONNECT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const { aPoints.push_back( m_pos ); } diff --git a/eeschema/sch_no_connect.h b/eeschema/sch_no_connect.h index acd9ec4aa9..65ecd423bc 100644 --- a/eeschema/sch_no_connect.h +++ b/eeschema/sch_no_connect.h @@ -81,7 +81,7 @@ public: bool IsConnectable() const { return true; } - void GetConnectionPoints( vector< wxPoint >& aPoints ) const; + void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const; wxString GetSelectMenuText() const { return wxString( _( "No Connect" ) ); } diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 4cc05e83d6..dd54465b99 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -1000,7 +1000,7 @@ bool SCH_SHEET::IsSelectStateChanged( const wxRect& aRect ) } -void SCH_SHEET::GetConnectionPoints( vector< wxPoint >& aPoints ) const +void SCH_SHEET::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const { for( size_t i = 0; i < GetPins().size(); i++ ) aPoints.push_back( GetPins()[i].GetPosition() ); diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index 8eb016963c..a663c11e28 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -533,7 +533,7 @@ public: bool IsConnectable() const { return true; } - void GetConnectionPoints( vector< wxPoint >& aPoints ) const; + void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const; SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData, const KICAD_T scanTypes[] ); diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index e6e3bbf915..90f932cf2d 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -564,7 +564,7 @@ bool SCH_TEXT::IsSelectStateChanged( const wxRect& aRect ) } -void SCH_TEXT::GetConnectionPoints( vector< wxPoint >& aPoints ) const +void SCH_TEXT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const { // Normal text labels do not have connection points. All others do. if( Type() == SCH_TEXT_T ) diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h index 12efd1a967..a2384ace36 100644 --- a/eeschema/sch_text.h +++ b/eeschema/sch_text.h @@ -189,7 +189,7 @@ public: virtual bool IsSelectStateChanged( const wxRect& aRect ); - virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const; + virtual void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const; virtual bool CanIncrementLabel() const { return true; } diff --git a/include/sch_item_struct.h b/include/sch_item_struct.h index 788ef66160..e425e1d6b1 100644 --- a/include/sch_item_struct.h +++ b/include/sch_item_struct.h @@ -34,9 +34,6 @@ #include #include -using namespace std; - - class SCH_ITEM; class SCH_SHEET_PATH; class LINE_READER; @@ -49,7 +46,7 @@ class NETLIST_OBJECT_LIST; typedef boost::ptr_vector< SCH_ITEM > SCH_ITEMS; typedef SCH_ITEMS::iterator SCH_ITEMS_ITR; -typedef vector< SCH_ITEMS_ITR > SCH_ITEMS_ITRS; +typedef std::vector< SCH_ITEMS_ITR > SCH_ITEMS_ITRS; #define FMT_IU SCH_ITEM::FormatInternalUnits @@ -228,7 +225,7 @@ public: * * @param aItemList - List of DANGLING_END_ITEMS to add to. */ - virtual void GetEndPoints( vector< DANGLING_END_ITEM >& aItemList ) {} + virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) {} /** * Function IsDanglingStateChanged @@ -243,7 +240,7 @@ public: * @param aItemList - List of items to test item against. * @return True if the dangling state has changed from it's current setting. */ - virtual bool IsDanglingStateChanged( vector< DANGLING_END_ITEM >& aItemList ) { return false; } + virtual bool IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList ) { return false; } virtual bool IsDangling() const { return false; } @@ -273,7 +270,7 @@ public: * * @param aPoints List of connection points to add to. */ - virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const { } + virtual void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const { } /** * Function ClearConnections diff --git a/include/tool/examples/coroutine_example.cpp b/include/tool/examples/coroutine_example.cpp index 64fbcdc518..c36de8bbef 100644 --- a/include/tool/examples/coroutine_example.cpp +++ b/include/tool/examples/coroutine_example.cpp @@ -3,8 +3,6 @@ #include -using namespace std; - typedef COROUTINE MyCoroutine; class MyClass diff --git a/include/tool/examples/delegate_example.cpp b/include/tool/examples/delegate_example.cpp index b01a5caeea..3d3c7829a3 100644 --- a/include/tool/examples/delegate_example.cpp +++ b/include/tool/examples/delegate_example.cpp @@ -3,8 +3,6 @@ #include -using namespace std; - class MyClass { public: diff --git a/kicad/dialogs/dialog_template_selector.h b/kicad/dialogs/dialog_template_selector.h index f4ea0f3229..2b59ea66c0 100644 --- a/kicad/dialogs/dialog_template_selector.h +++ b/kicad/dialogs/dialog_template_selector.h @@ -79,7 +79,7 @@ public: class DIALOG_TEMPLATE_SELECTOR : public DIALOG_TEMPLATE_SELECTOR_BASE { protected: - vector m_panels; + std::vector m_panels; void AddTemplate( int aPage, PROJECT_TEMPLATE* aTemplate ); TEMPLATE_WIDGET* m_selectedWidget; diff --git a/kicad/project_template.cpp b/kicad/project_template.cpp index 125f6896e6..5ac5db4ff6 100644 --- a/kicad/project_template.cpp +++ b/kicad/project_template.cpp @@ -33,8 +33,6 @@ #include #include -using namespace std; - #define SEP() wxFileName::GetPathSeparator() @@ -71,9 +69,9 @@ PROJECT_TEMPLATE::PROJECT_TEMPLATE( const wxString& aPath ) metaIcon = new wxBitmap( templateMetaIconFile.GetFullPath(), wxBITMAP_TYPE_PNG ); } -vector PROJECT_TEMPLATE::GetFileList() +std::vector PROJECT_TEMPLATE::GetFileList() { - vector files; + std::vector files; wxString f = templateBasePath.GetPath(); wxArrayString allfiles; wxFileName p; @@ -122,8 +120,8 @@ bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath ) { bool result = true; - vector srcFiles = GetFileList(); - vector dstFiles; + std::vector srcFiles = GetFileList(); + std::vector dstFiles; for( size_t i=0; i < srcFiles.size(); i++ ) { diff --git a/kicad/project_template.h b/kicad/project_template.h index 98234755a9..4ab96fac71 100644 --- a/kicad/project_template.h +++ b/kicad/project_template.h @@ -110,9 +110,6 @@ #include #include -using namespace std; - - /** * @brief A directory which contains information about the project template and does not get * copied. This define is the default filename for this directory @@ -200,7 +197,7 @@ public: * @brief Get a vector list of filenames for the template. The files are the source files, * and have not yet been through any renaming */ - vector GetFileList(); + std::vector GetFileList(); }; #endif diff --git a/new/sch_dir_lib_source.cpp b/new/sch_dir_lib_source.cpp index 8edf331bbb..5b3913d7ac 100644 --- a/new/sch_dir_lib_source.cpp +++ b/new/sch_dir_lib_source.cpp @@ -52,9 +52,6 @@ #include #include -#include -using namespace std; - #include using namespace SCH; diff --git a/new/sch_lib_table.cpp b/new/sch_lib_table.cpp index 1950371826..0e4fbb0903 100644 --- a/new/sch_lib_table.cpp +++ b/new/sch_lib_table.cpp @@ -31,7 +31,6 @@ #include -//using namespace std; // screws up Doxygen using namespace SCH; using namespace LT; // tokens, enum T for LIB_TABLE diff --git a/pcbnew/github/github_plugin.cpp b/pcbnew/github/github_plugin.cpp index b552669381..b6e1cf819c 100644 --- a/pcbnew/github/github_plugin.cpp +++ b/pcbnew/github/github_plugin.cpp @@ -63,15 +63,12 @@ #include #include // ExpandSubstitutions() -using namespace std; - - static const char* PRETTY_DIR = "allow_pretty_writing_to_this_dir"; -typedef boost::ptr_map MODULE_MAP; -typedef MODULE_MAP::iterator MODULE_ITER; -typedef MODULE_MAP::const_iterator MODULE_CITER; +typedef boost::ptr_map MODULE_MAP; +typedef MODULE_MAP::iterator MODULE_ITER; +typedef MODULE_MAP::const_iterator MODULE_CITER; /** @@ -166,7 +163,7 @@ MODULE* GITHUB_PLUGIN::FootprintLoad( const wxString& aLibraryPath, } } - string fp_name = TO_UTF8( aFootprintName ); + std::string fp_name = TO_UTF8( aFootprintName ); MODULE_CITER it = m_gh_cache->find( fp_name ); @@ -233,7 +230,7 @@ void GITHUB_PLUGIN::FootprintSave( const wxString& aLibraryPath, // IsFootprintLibWritable() to determine if calling FootprintSave() is // even legal, so I spend no time on internationalization here: - string msg = StrPrintf( "Github library\n'%s'\nis only writable if you set option '%s' in Library Tables dialog.", + std::string msg = StrPrintf( "Github library\n'%s'\nis only writable if you set option '%s' in Library Tables dialog.", (const char*) TO_UTF8( aLibraryPath ), PRETTY_DIR ); THROW_IO_ERROR( msg ); @@ -275,7 +272,7 @@ void GITHUB_PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxStrin // IsFootprintLibWritable() to determine if calling FootprintSave() is // even legal, so I spend no time on internationalization here: - string msg = StrPrintf( "Github library\n'%s'\nis only writable if you set option '%s' in Library Tables dialog.", + std::string msg = StrPrintf( "Github library\n'%s'\nis only writable if you set option '%s' in Library Tables dialog.", (const char*) TO_UTF8( aLibraryPath ), PRETTY_DIR ); THROW_IO_ERROR( msg ); @@ -356,7 +353,7 @@ void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath, const PROPERTIES* aP if( aProperties ) { - string pretty_dir; + std::string pretty_dir; if( aProperties->Value( PRETTY_DIR, &pretty_dir ) ) { @@ -409,7 +406,7 @@ void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath, const PROPERTIES* aP if( fn.GetExt() == kicad_mod ) { - string fp_name = TO_UTF8( fn.GetName() ); // omit extension & path + std::string fp_name = TO_UTF8( fn.GetName() ); // omit extension & path m_gh_cache->insert( fp_name, entry ); } @@ -420,7 +417,7 @@ void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath, const PROPERTIES* aP } -bool GITHUB_PLUGIN::repoURL_zipURL( const wxString& aRepoURL, string* aZipURL ) +bool GITHUB_PLUGIN::repoURL_zipURL( const wxString& aRepoURL, std::string* aZipURL ) { // e.g. "https://github.com/liftoff-sr/pretty_footprints" //D(printf("aRepoURL:%s\n", TO_UTF8( aRepoURL ) );) @@ -460,7 +457,7 @@ bool GITHUB_PLUGIN::repoURL_zipURL( const wxString& aRepoURL, string* aZipURL ) void GITHUB_PLUGIN::remote_get_zip( const wxString& aRepoURL ) throw( IO_ERROR ) { - string zip_url; + std::string zip_url; if( !repoURL_zipURL( aRepoURL, &zip_url ) ) { @@ -478,7 +475,7 @@ void GITHUB_PLUGIN::remote_get_zip( const wxString& aRepoURL ) throw( IO_ERROR ) try { - ostringstream os; + std::ostringstream os; h.open( zip_url ); // only one file, therefore do it synchronously. os << &h; @@ -495,10 +492,8 @@ void GITHUB_PLUGIN::remote_get_zip( const wxString& aRepoURL ) throw( IO_ERROR ) // https "GET" has faild, report this to API caller. wxString fmt( _( "Cannot GET zip: '%s'\nfor lib-path: '%s'.\nWhat: '%s'" ) ); - string msg = StrPrintf( TO_UTF8( fmt ), - zip_url.c_str(), - TO_UTF8( aRepoURL ), - e.what() ); + std::string msg = StrPrintf( TO_UTF8( fmt ), zip_url.c_str(), + TO_UTF8( aRepoURL ), e.what() ); THROW_IO_ERROR( msg ); } diff --git a/pcbnew/gpcb_plugin.cpp b/pcbnew/gpcb_plugin.cpp index 4593af26e3..663c560f62 100644 --- a/pcbnew/gpcb_plugin.cpp +++ b/pcbnew/gpcb_plugin.cpp @@ -48,9 +48,6 @@ #include #include -using namespace std; - - /** * Definition for enabling and disabling footprint library trace output. See the * wxWidgets documentation on using the WXTRACE environment variable. @@ -118,7 +115,7 @@ class GPCB_FPL_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. - auto_ptr< MODULE > m_module; + std::auto_ptr m_module; public: GPCB_FPL_CACHE_ITEM( MODULE* aModule, const wxFileName& aFileName ); @@ -385,13 +382,13 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) throw( IO_ERROR, // Old version unit = 1 mil, so conv_unit is 10 or 0.1 #define NEW_GPCB_UNIT_CONV ( 0.01*IU_PER_MILS ) - int paramCnt; - double conv_unit = NEW_GPCB_UNIT_CONV; // GPCB unit = 0.01 mils and Pcbnew 0.1 - wxPoint refPos( 0, 0 ); - wxPoint textPos; - wxString msg; - wxArrayString parameters; - auto_ptr< MODULE > module( new MODULE( NULL ) ); + int paramCnt; + double conv_unit = NEW_GPCB_UNIT_CONV; // GPCB unit = 0.01 mils and Pcbnew 0.1 + wxPoint refPos( 0, 0 ); + wxPoint textPos; + wxString msg; + wxArrayString parameters; + std::auto_ptr module( new MODULE( NULL ) ); if( aLineReader->ReadLine() == NULL ) diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index a50a299663..c60e409898 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -52,9 +52,6 @@ #include #include -using namespace std; - - #define FMTIU BOARD_ITEM::FormatInternalUnits /** @@ -78,7 +75,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. - auto_ptr< MODULE > m_module; + std::auto_ptr m_module; public: FP_CACHE_ITEM( MODULE* aModule, const wxFileName& aFileName ); diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 055dd02cee..1b47c69158 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -51,9 +51,6 @@ #include -using namespace std; - - void PCB_PARSER::init() { m_layerIndices.clear(); @@ -263,7 +260,7 @@ S3D_MASTER* PCB_PARSER::parse3DModel() throw( PARSE_ERROR ) T token; - auto_ptr< S3D_MASTER > n3D( new S3D_MASTER( NULL ) ); + std::auto_ptr< S3D_MASTER > n3D( new S3D_MASTER( NULL ) ); NeedSYMBOLorNUMBER(); n3D->m_Shape3DName = FromUTF8(); @@ -1084,7 +1081,7 @@ void PCB_PARSER::parseNETCLASS() throw( IO_ERROR, PARSE_ERROR ) T token; - auto_ptr nc( new NETCLASS( m_board, wxEmptyString ) ); + std::auto_ptr nc( new NETCLASS( m_board, wxEmptyString ) ); // Read netclass name (can be a name or just a number like track width) NeedSYMBOLorNUMBER(); @@ -1164,7 +1161,7 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT() throw( IO_ERROR, PARSE_ERROR ) T token; wxPoint pt; - auto_ptr< DRAWSEGMENT > segment( new DRAWSEGMENT( NULL ) ); + std::auto_ptr< DRAWSEGMENT > segment( new DRAWSEGMENT( NULL ) ); switch( CurTok() ) { @@ -1325,7 +1322,7 @@ TEXTE_PCB* PCB_PARSER::parseTEXTE_PCB() throw( IO_ERROR, PARSE_ERROR ) T token; - auto_ptr< TEXTE_PCB > text( new TEXTE_PCB( m_board ) ); + std::auto_ptr text( new TEXTE_PCB( m_board ) ); NeedSYMBOLorNUMBER(); text->SetText( FromUTF8() ); @@ -1393,7 +1390,7 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR ) T token; - auto_ptr< DIMENSION > dimension( new DIMENSION( NULL ) ); + std::auto_ptr dimension( new DIMENSION( NULL ) ); dimension->SetValue( parseBoardUnits( "dimension value" ) ); NeedLEFT(); @@ -1545,7 +1542,7 @@ MODULE* PCB_PARSER::parseMODULE( wxArrayString* aInitialComments ) throw( IO_ERR T token; FPID fpid; - auto_ptr< MODULE > module( new MODULE( m_board ) ); + std::auto_ptr module( new MODULE( m_board ) ); module->SetInitialComments( aInitialComments ); @@ -1773,7 +1770,7 @@ TEXTE_MODULE* PCB_PARSER::parseTEXTE_MODULE() throw( IO_ERROR, PARSE_ERROR ) T token = NextTok(); - auto_ptr< TEXTE_MODULE > text( new TEXTE_MODULE( NULL ) ); + std::auto_ptr text( new TEXTE_MODULE( NULL ) ); switch( token ) { @@ -1858,7 +1855,7 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE() throw( IO_ERROR, PARSE_ERROR ) wxPoint pt; T token; - auto_ptr< EDGE_MODULE > segment( new EDGE_MODULE( NULL ) ); + std::auto_ptr< EDGE_MODULE > segment( new EDGE_MODULE( NULL ) ); switch( CurTok() ) { @@ -2023,7 +2020,7 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR ) wxSize sz; wxPoint pt; - auto_ptr< D_PAD > pad( new D_PAD( NULL ) ); + std::auto_ptr< D_PAD > pad( new D_PAD( NULL ) ); NeedSYMBOLorNUMBER(); pad->SetPadName( FromUTF8() ); @@ -2260,7 +2257,7 @@ TRACK* PCB_PARSER::parseTRACK() throw( IO_ERROR, PARSE_ERROR ) wxPoint pt; T token; - auto_ptr< TRACK > track( new TRACK( m_board ) ); + std::auto_ptr< TRACK > track( new TRACK( m_board ) ); for( token = NextTok(); token != T_RIGHT; token = NextTok() ) { @@ -2322,7 +2319,7 @@ SEGVIA* PCB_PARSER::parseSEGVIA() throw( IO_ERROR, PARSE_ERROR ) wxPoint pt; T token; - auto_ptr< SEGVIA > via( new SEGVIA( m_board ) ); + std::auto_ptr< SEGVIA > via( new SEGVIA( m_board ) ); for( token = NextTok(); token != T_RIGHT; token = NextTok() ) { @@ -2407,7 +2404,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR ) // bigger scope since each filled_polygon is concatenated in here CPOLYGONS_LIST pts; - auto_ptr< ZONE_CONTAINER > zone( new ZONE_CONTAINER( m_board ) ); + std::auto_ptr< ZONE_CONTAINER > zone( new ZONE_CONTAINER( m_board ) ); zone->SetPriority( 0 ); @@ -2721,8 +2718,7 @@ PCB_TARGET* PCB_PARSER::parsePCB_TARGET() throw( IO_ERROR, PARSE_ERROR ) wxPoint pt; T token; - auto_ptr< PCB_TARGET > target( new PCB_TARGET( NULL ) ); - + std::auto_ptr< PCB_TARGET > target( new PCB_TARGET( NULL ) ); for( token = NextTok(); token != T_RIGHT; token = NextTok() ) { diff --git a/pcbnew/router/pns_line.cpp b/pcbnew/router/pns_line.cpp index 7600d65400..63011b6b75 100644 --- a/pcbnew/router/pns_line.cpp +++ b/pcbnew/router/pns_line.cpp @@ -29,7 +29,6 @@ #include "pns_utils.h" #include "pns_router.h" -using namespace std; using boost::optional; PNS_LINE* PNS_LINE::Clone() const @@ -321,10 +320,10 @@ void PNS_LINE::NewWalkaround( const SHAPE_LINE_CHAIN& aObstacle, SHAPE_LINE_CHAIN l_orig( m_line ); SHAPE_LINE_CHAIN l_hull; - vector outside, on_edge, inside; + std::vector outside, on_edge, inside; SHAPE_LINE_CHAIN path; - vector isects; + std::vector isects; // don't calculate walkaround for empty lines if( m_line.PointCount() < 2 ) diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index 294da09695..a03183c45c 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -18,7 +18,6 @@ * with this program. If not, see . */ -#include #include #include @@ -30,7 +29,6 @@ #include "pns_shove.h" #include "pns_utils.h" -using namespace std; using boost::optional; PNS_LINE_PLACER::PNS_LINE_PLACER( PNS_NODE* aWorld ) @@ -528,7 +526,7 @@ bool PNS_LINE_PLACER::optimizeTailHeadTransition() const int TailLookbackSegments = 5; - int threshold = min( tail.PointCount(), TailLookbackSegments + 1 ); + int threshold = std::min( tail.PointCount(), TailLookbackSegments + 1 ); if( tail.SegmentCount() < 3 ) return false; diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp index c1a14d81a8..e2349c4800 100644 --- a/pcbnew/router/pns_node.cpp +++ b/pcbnew/router/pns_node.cpp @@ -37,8 +37,6 @@ #include "pns_joint.h" #include "pns_index.h" -using namespace std; - using boost::unordered_set; using boost::unordered_map; @@ -138,7 +136,7 @@ void PNS_NODE::unlinkParent() if( isRoot() ) return; - for( vector::iterator i = m_parent->m_children.begin(); + for( std::vector::iterator i = m_parent->m_children.begin(); i != m_parent->m_children.end(); ++i ) { if( *i == this ) @@ -284,7 +282,7 @@ PNS_NODE::OptObstacle PNS_NODE::NearestObstacle( const PNS_LINE* aItem, int aKin VECTOR2I ip_first, ip_last; int dist_max = INT_MIN; - vector isect_list; + std::vector isect_list; int clearance = GetClearance( obs.item, &aLine ); @@ -564,7 +562,7 @@ void PNS_NODE::removeSegment( PNS_SEGMENT* aSeg ) void PNS_NODE::removeLine( PNS_LINE* aLine ) { - vector* segRefs = aLine->GetLinkedSegments(); + std::vector* segRefs = aLine->GetLinkedSegments(); if( !segRefs ) return; @@ -700,7 +698,7 @@ void PNS_NODE::FindLineEnds( PNS_LINE* aLine, PNS_JOINT& a, PNS_JOINT& b ) } -int PNS_NODE::FindLinesBetweenJoints( PNS_JOINT& a, PNS_JOINT& b, vector& aLines ) +int PNS_NODE::FindLinesBetweenJoints( PNS_JOINT& a, PNS_JOINT& b, std::vector& aLines ) { BOOST_FOREACH( PNS_ITEM* item, a.GetLinkList() ) { @@ -763,7 +761,7 @@ PNS_JOINT& PNS_NODE::touchJoint( const VECTOR2I& aPos, const PNS_LAYERSET& aLaye // try to find the joint in this node. JointMap::iterator f = m_joints.find( tag ); - pair range; + std::pair range; // not found and we are not root? find in the root and copy results here. if( f == m_joints.end() && !isRoot() ) @@ -895,7 +893,7 @@ void PNS_NODE::Dump( bool aLong ) printf( "Line: %s, net %d ", l->GetLine().Format().c_str(), l->GetNet() ); - for( vector::iterator j = seg_refs->begin(); j != seg_refs->end(); ++j ) + for( std::vector::iterator j = seg_refs->begin(); j != seg_refs->end(); ++j ) { printf( "%s ", (*j)->GetSeg().A.Format().c_str() ); @@ -932,7 +930,7 @@ void PNS_NODE::GetUpdatedItems( ItemVector& aRemoved, ItemVector& aAdded ) void PNS_NODE::releaseChildren() { // copy the kids as the PNS_NODE destructor erases the item from the parent node. - vector kids = m_children; + std::vector kids = m_children; BOOST_FOREACH( PNS_NODE * node, kids ) { node->releaseChildren(); diff --git a/pcbnew/router/pns_optimizer.cpp b/pcbnew/router/pns_optimizer.cpp index 49e3f8cc5c..48e84207e5 100644 --- a/pcbnew/router/pns_optimizer.cpp +++ b/pcbnew/router/pns_optimizer.cpp @@ -28,8 +28,6 @@ #include "pns_optimizer.h" #include "pns_utils.h" -using namespace std; - /** * * Cost Estimator Methods @@ -620,8 +618,8 @@ int PNS_OPTIMIZER::smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd, const int ForbiddenAngles = DIRECTION_45::ANG_ACUTE | DIRECTION_45::ANG_RIGHT | DIRECTION_45::ANG_HALF_FULL | DIRECTION_45::ANG_UNDEFINED; - typedef pair RtVariant; - vector variants; + typedef std::pair RtVariant; + std::vector variants; BreakoutList breakouts = computeBreakouts( aLine->GetWidth(), aPad, true ); @@ -629,7 +627,7 @@ int PNS_OPTIMIZER::smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd, // bool startDiagonal = DIRECTION_45( line.CSegment(0) ).IsDiagonal(); - int p_end = min( aEndVertex, min( 3, line.PointCount() - 1 ) ); + int p_end = std::min( aEndVertex, std::min( 3, line.PointCount() - 1 ) ); for( int p = 1; p <= p_end; p++ ) { diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index 7921feab19..5b6b5f6b31 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -51,8 +51,6 @@ #include #include -using namespace std; - // an ugly singleton for drawing debug items within the router context. // To be fixed sometime in the future. static PNS_ROUTER* theRouter; @@ -89,7 +87,7 @@ public: } private: - vector m_clearanceCache; + std::vector m_clearanceCache; int m_defaultClearance; }; @@ -232,7 +230,7 @@ int PNS_ROUTER::NextCopperLayer( bool aUp ) void PNS_ROUTER::SyncWorld() { - vector pads; + std::vector pads; if( !m_board ) { @@ -662,7 +660,7 @@ PNS_NODE* PNS_ROUTER::removeLoops( PNS_NODE* aNode, PNS_SEGMENT* aLatestSeg ) PNS_NODE* cleaned = aNode->Branch(); PNS_JOINT a, b; - vector lines; + std::vector lines; cleaned->FindLineEnds( ourLine, a, b ); cleaned->FindLinesBetweenJoints( a, b, lines ); @@ -699,7 +697,7 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) if( aEndItem && m_currentNet >= 0 && m_currentNet == aEndItem->GetNet() ) real_end = true; - int last = ( real_end || m_placingVia ) ? l.SegmentCount() : max( 1, l.SegmentCount() - 1 ); + int last = ( real_end || m_placingVia ) ? l.SegmentCount() : std::max( 1, l.SegmentCount() - 1 ); PNS_NODE* latest = m_placer->GetCurrentNode(); @@ -771,7 +769,7 @@ void PNS_ROUTER::FlipPosture() if( m_placer->GetTail().GetCLine().SegmentCount() == 0 ) { m_start_diagonal = !m_start_diagonal; - m_placer->SetInitialDirection( m_start_diagonal ? + m_placer->SetInitialDirection( m_start_diagonal ? DIRECTION_45( DIRECTION_45::NE ) : DIRECTION_45( DIRECTION_45::N ) ); } else diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp index 35677230bd..ad58ee1feb 100644 --- a/pcbnew/router/pns_shove.cpp +++ b/pcbnew/router/pns_shove.cpp @@ -35,8 +35,6 @@ #include -using namespace std; - PNS_SHOVE::PNS_SHOVE( PNS_NODE* aWorld ) { m_root = aWorld; @@ -280,9 +278,9 @@ const PNS_COST_ESTIMATOR PNS_SHOVE::TotalCost() const PNS_SHOVE::ShoveStatus PNS_SHOVE::ShoveLines( PNS_LINE* aCurrentHead ) { - stack lineStack; + std::stack lineStack; PNS_NODE* node, * parent; - PNS_VIA* headVia = NULL; + PNS_VIA* headVia = NULL; bool fail = false; int iter = 0; diff --git a/pcbnew/router/pns_walkaround.cpp b/pcbnew/router/pns_walkaround.cpp index e2a13ac358..185def64d2 100644 --- a/pcbnew/router/pns_walkaround.cpp +++ b/pcbnew/router/pns_walkaround.cpp @@ -18,8 +18,6 @@ * with this program. If not, see . */ -#include - #include #include @@ -29,8 +27,6 @@ #include "pns_optimizer.h" #include "pns_utils.h" #include "pns_router.h" - -using namespace std; using boost::optional; void PNS_WALKAROUND::start( const PNS_LINE& aInitialPath ) diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index d85b1470ae..116e27f316 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -39,7 +39,6 @@ #include "trace.h" using namespace KIGFX; -using namespace std; using boost::optional; static TOOL_ACTION ACT_AutoEndRoute( "AutoEndRoute", AS_CONTEXT, 'F' ); diff --git a/polygon/SutherlandHodgmanClipPoly.h b/polygon/SutherlandHodgmanClipPoly.h index 4e0378448b..43512bf9f8 100644 --- a/polygon/SutherlandHodgmanClipPoly.h +++ b/polygon/SutherlandHodgmanClipPoly.h @@ -31,7 +31,6 @@ #include #include -using namespace std; #ifndef _GDIPLUS_H // I designed this with GDI+ in mind. However, this particular code doesn't @@ -80,9 +79,9 @@ public: #endif // _GDIPLUS_H -typedef vector pointVector; -typedef vector::iterator pointIterator; -typedef vector::const_iterator cpointIterator; +typedef std::vector pointVector; +typedef std::vector::iterator pointIterator; +typedef std::vector::const_iterator cpointIterator; class SutherlandHodgman { @@ -249,10 +248,10 @@ private: // rectangles, we include the left and top boundaries, but not the right and bottom boundaries. // In other words: a vertex on the left boundary is considered to be inside, but a vertex // on the right boundary is considered to be outside. - typedef BoundaryVert < less > BoundaryRight; - typedef BoundaryHor < greater_equal > BoundaryTop; - typedef BoundaryVert < greater_equal > BoundaryLeft; - typedef BoundaryHor < less > BoundaryBottom; + typedef BoundaryVert > BoundaryRight; + typedef BoundaryHor > BoundaryTop; + typedef BoundaryVert > BoundaryLeft; + typedef BoundaryHor > BoundaryBottom; // Next typedefs define the four stages. First template parameter is the boundary, // second template parameter is the next stage. diff --git a/polygon/poly2tri/common/shapes.cc b/polygon/poly2tri/common/shapes.cc index 77bafa1501..b8c4c2f9b0 100644 --- a/polygon/poly2tri/common/shapes.cc +++ b/polygon/poly2tri/common/shapes.cc @@ -1,4 +1,4 @@ -/* +/* * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors * http://code.google.com/p/poly2tri/ * @@ -96,14 +96,14 @@ void Triangle::ClearNeighbor(Triangle *triangle ) } else if( neighbors_[1] == triangle ) { - neighbors_[1] = NULL; + neighbors_[1] = NULL; } else { neighbors_[2] = NULL; } } - + void Triangle::ClearNeighbors() { neighbors_[0] = NULL; @@ -357,10 +357,9 @@ Triangle& Triangle::NeighborAcross(Point& opoint) void Triangle::DebugPrint() { - using namespace std; - cout << points_[0]->x << "," << points_[0]->y << " "; - cout << points_[1]->x << "," << points_[1]->y << " "; - cout << points_[2]->x << "," << points_[2]->y << endl; + std::cout << points_[0]->x << "," << points_[0]->y << " "; + std::cout << points_[1]->x << "," << points_[1]->y << " "; + std::cout << points_[2]->x << "," << points_[2]->y << "\n"; } } diff --git a/scripting/kicad.i b/scripting/kicad.i index 42c1bc41ab..5887886204 100644 --- a/scripting/kicad.i +++ b/scripting/kicad.i @@ -63,8 +63,6 @@ #include #include - using namespace std; - #include #include #include