$OpenBSD: patch-eeschema_class_libentry_cpp,v 1.1 2017/12/29 09:22:22 rsadowski Exp $
Replace BOOST_FOREACH with iterator for-loop to fix clang build with boost
1.65.1
Index: eeschema/class_libentry.cpp
--- eeschema/class_libentry.cpp.orig
+++ eeschema/class_libentry.cpp
@@ -17,7 +17,6 @@
 #include "class_libentry.h"
 #include "class_pin.h"
 
-#include <boost/foreach.hpp>
 
 
 /** class CMP_LIB_ENTRY
@@ -214,8 +213,9 @@ LIB_COMPONENT::LIB_COMPONENT( LIB_COMPONENT& aComponen
     m_LastDate            = aComponent.m_LastDate;
     m_options             = aComponent.m_options;
 
-    BOOST_FOREACH( LIB_DRAW_ITEM& oldItem, aComponent.GetDrawItemList() )
+    for(LIB_DRAW_ITEM_LIST::iterator i = aComponent.GetDrawItemList().begin(); i < aComponent.GetDrawItemList().end(); i++ )
     {
+        LIB_DRAW_ITEM& oldItem = *i;
         if( ( oldItem.m_Flags & IS_NEW ) != 0 )
             continue;
 
@@ -266,8 +266,10 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* aPanel, wx
      */
     if( ! (screen->m_IsPrinting && GetGRForceBlackPenState()) && (aColor == -1) )
     {
-        BOOST_FOREACH( LIB_DRAW_ITEM& drawItem, drawings )
+        for(LIB_DRAW_ITEM_LIST::iterator i = drawings.begin(); i < drawings.end(); i++ )
         {
+            LIB_DRAW_ITEM& drawItem = *i;
+
             if( drawItem.m_Fill != FILLED_WITH_BG_BODYCOLOR )
                 continue;
 
@@ -301,8 +303,9 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* aPanel, wx
         }
     }
 
-    BOOST_FOREACH( LIB_DRAW_ITEM& drawItem, drawings )
+    for(LIB_DRAW_ITEM_LIST::iterator i = drawings.begin(); i < drawings.end(); i++ )
     {
+        LIB_DRAW_ITEM& drawItem = *i;
         if( aOnlySelected && drawItem.m_Selected == 0 )
             continue;
 
@@ -367,8 +370,9 @@ void LIB_COMPONENT::Plot( PLOTTER* aPlotter, int aUnit
 {
     wxASSERT( aPlotter != NULL );
 
-    BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
+    for(LIB_DRAW_ITEM_LIST::iterator i = drawings.begin(); i < drawings.end(); i++ )
     {
+        LIB_DRAW_ITEM& item = *i;
         if( aUnit && item.m_Unit && ( item.m_Unit != aUnit ) )
             continue;
         if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
@@ -406,13 +410,11 @@ from component %s in library %s." ),
         }
     }
 
-    LIB_DRAW_ITEM_LIST::iterator i;
-
     if( aDc != NULL )
         aItem->Draw( aPanel, aDc, wxPoint( 0, 0 ), -1, g_XorMode, NULL,
                     DefaultTransformMatrix );
 
-    for( i = drawings.begin(); i < drawings.end(); i++ )
+    for(LIB_DRAW_ITEM_LIST::iterator i = drawings.begin(); i < drawings.end(); i++ )
     {
         if( *i == aItem )
         {
@@ -477,8 +479,9 @@ void LIB_COMPONENT::GetPins( LIB_PIN_LIST& aList, int 
      * when .m_Unit == 0, the body item is common to units
      * when .m_Convert == 0, the body item is common to shapes
      */
-    BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
+    for(LIB_DRAW_ITEM_LIST::iterator i = drawings.begin(); i < drawings.end(); i++ )
     {
+        LIB_DRAW_ITEM& item = *i;
         if( item.Type() != COMPONENT_PIN_DRAW_TYPE )    // we search pins only
             continue;
 
@@ -567,7 +570,7 @@ bool LIB_COMPONENT::Save( FILE* aFile )
     LIB_FIELD_LIST fields;
     GetFields( fields );
 
-    for( i = 0; i < fields.size(); i++ )
+    for(size_t i = 0; i < fields.size(); i++ )
     {
         if( fields[i].m_Text.IsEmpty() && fields[i].m_Name.IsEmpty() )
             continue;
@@ -619,8 +622,9 @@ bool LIB_COMPONENT::Save( FILE* aFile )
         if( fprintf( aFile, "DRAW\n" ) < 0 )
             return false;
 
-        BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
+        for(LIB_DRAW_ITEM_LIST::iterator i = drawings.begin(); i < drawings.end(); i++ )
         {
+            LIB_DRAW_ITEM& item = *i;
             if( item.Type() == COMPONENT_FIELD_DRAW_TYPE )
                 continue;
             if( !item.Save( aFile ) )
@@ -927,8 +931,9 @@ EDA_Rect LIB_COMPONENT::GetBoundaryBox( int aUnit, int
 {
     EDA_Rect bBox( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
 
-    BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
+    for(LIB_DRAW_ITEM_LIST::iterator i = drawings.begin(); i < drawings.end(); i++ )
     {
+        LIB_DRAW_ITEM& item = *i;
         if( ( item.m_Unit > 0 ) && ( ( unitCount > 1 ) && ( aUnit > 0 )
                                      && ( aUnit != item.m_Unit ) ) )
             continue;
@@ -983,8 +988,9 @@ void LIB_COMPONENT::SetFields( const std::vector <LIB_
 
 void LIB_COMPONENT::GetFields( LIB_FIELD_LIST& aList )
 {
-    BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
+    for(LIB_DRAW_ITEM_LIST::iterator i = drawings.begin(); i < drawings.end(); i++ )
     {
+        LIB_DRAW_ITEM& item = *i;
         if( item.Type() != COMPONENT_FIELD_DRAW_TYPE )
             continue;
 
@@ -996,8 +1002,9 @@ void LIB_COMPONENT::GetFields( LIB_FIELD_LIST& aList )
 
 LIB_FIELD* LIB_COMPONENT::GetField( int aId )
 {
-    BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
+    for(LIB_DRAW_ITEM_LIST::iterator i = drawings.begin(); i < drawings.end(); i++ )
     {
+        LIB_DRAW_ITEM& item = *i;
         if( item.Type() != COMPONENT_FIELD_DRAW_TYPE )
             continue;
 
@@ -1078,9 +1085,9 @@ bool LIB_COMPONENT::LoadDateAndTime( char* aLine )
 
 void LIB_COMPONENT::SetOffset( const wxPoint& aOffset )
 {
-    BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
+    for(LIB_DRAW_ITEM_LIST::iterator i = drawings.begin(); i < drawings.end(); i++ )
     {
-        item.SetOffset( aOffset );
+        (*i).SetOffset( aOffset );
     }
 }
 
@@ -1093,8 +1100,9 @@ void LIB_COMPONENT::RemoveDuplicateDrawItems()
 
 bool LIB_COMPONENT::HasConversion() const
 {
-    BOOST_FOREACH( const LIB_DRAW_ITEM& item, drawings )
+    for(LIB_DRAW_ITEM_LIST::const_iterator i = drawings.begin(); i < drawings.end(); i++ )
     {
+        LIB_DRAW_ITEM const& item = *i;
         if( item.m_Convert > 1 )
             return true;
     }
@@ -1105,8 +1113,8 @@ bool LIB_COMPONENT::HasConversion() const
 
 void LIB_COMPONENT::ClearStatus()
 {
-    BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
-        item.m_Flags = 0;
+    for(LIB_DRAW_ITEM_LIST::iterator i = drawings.begin(); i < drawings.end(); i++ )
+        (*i).m_Flags = 0;
 }
 
 
@@ -1115,8 +1123,9 @@ int LIB_COMPONENT::SelectItems( EDA_Rect& aRect, int a
 {
     int itemCount = 0;
 
-    BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
+    for(LIB_DRAW_ITEM_LIST::iterator i = drawings.begin(); i < drawings.end(); i++ )
     {
+        LIB_DRAW_ITEM& item = *i;
         item.m_Selected = 0;
 
         if( ( item.m_Unit && item.m_Unit != aUnit )
@@ -1144,8 +1153,9 @@ int LIB_COMPONENT::SelectItems( EDA_Rect& aRect, int a
 
 void LIB_COMPONENT::MoveSelectedItems( const wxPoint& aOffset )
 {
-    BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
+    for(LIB_DRAW_ITEM_LIST::iterator i = drawings.begin(); i < drawings.end(); i++ )
     {
+        LIB_DRAW_ITEM& item = *i;
         if( item.m_Selected == 0 )
             continue;
 
@@ -1159,8 +1169,8 @@ void LIB_COMPONENT::MoveSelectedItems( const wxPoint& 
 
 void LIB_COMPONENT::ClearSelectedItems()
 {
-    BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
-        item.m_Flags = item.m_Selected = 0;
+    for(LIB_DRAW_ITEM_LIST::iterator i = drawings.begin(); i < drawings.end(); i++ )
+        (*i).m_Flags = (*i).m_Selected = 0;
 }
 
 
@@ -1226,8 +1236,9 @@ void LIB_COMPONENT::CopySelectedItems( const wxPoint& 
 
 void LIB_COMPONENT::MirrorSelectedItemsH( const wxPoint& aCenter )
 {
-    BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
+    for(LIB_DRAW_ITEM_LIST::iterator i = drawings.begin(); i < drawings.end(); i++ )
     {
+        LIB_DRAW_ITEM& item = *i;
         if( item.m_Selected == 0 )
             continue;
 
@@ -1254,8 +1265,9 @@ void LIB_COMPONENT::MirrorSelectedItemsH( const wxPoin
 LIB_DRAW_ITEM* LIB_COMPONENT::LocateDrawItem( int aUnit, int aConvert,
                                               KICAD_T aType, const wxPoint& aPoint )
 {
-    BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
+    for(LIB_DRAW_ITEM_LIST::iterator i = drawings.begin(); i < drawings.end(); i++ )
     {
+        LIB_DRAW_ITEM& item = *i;
         if( ( aUnit && item.m_Unit && ( aUnit != item.m_Unit) )
             || ( aConvert && item.m_Convert && ( aConvert != item.m_Convert ) )
             || ( ( item.Type() != aType ) && ( aType != TYPE_NOT_INIT ) ) )
@@ -1364,9 +1376,9 @@ void LIB_COMPONENT::SetConversion( bool aSetConvert )
     // Duplicate items to create the converted shape
     if( aSetConvert )
     {
-
-        BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
+        for(LIB_DRAW_ITEM_LIST::iterator i = drawings.begin(); i < drawings.end(); i++ )
         {
+            LIB_DRAW_ITEM& item = *i;
             /* Only pins are duplicated. */
             if( item.Type() != COMPONENT_PIN_DRAW_TYPE )
                 continue;
