Move from class INSPECTOR as the EDA_ITEM::Visit() callback interface to a std::function

callback.  This improves conciseness and encourages use of Visit() due to the lower cost
of entry in C++.
This commit is contained in:
Dick Hollenbeck
2016-07-12 15:05:54 -04:00
committed by Wayne Stambaugh
parent 98ad5096b0
commit c2b8a4ee43
22 changed files with 189 additions and 324 deletions
+6 -7
View File
@@ -107,10 +107,10 @@ EDA_ITEM* EDA_ITEM::Clone() const
}
SEARCH_RESULT EDA_ITEM::IterateForward( EDA_ITEM* listStart,
INSPECTOR* inspector,
const void* testData,
const KICAD_T scanTypes[] )
SEARCH_RESULT EDA_ITEM::IterateForward( EDA_ITEM* listStart,
INSPECTOR inspector,
void* testData,
const KICAD_T scanTypes[] )
{
EDA_ITEM* p = listStart;
@@ -126,8 +126,7 @@ SEARCH_RESULT EDA_ITEM::IterateForward( EDA_ITEM* listStart,
// see base_struct.h
// many classes inherit this method, be careful:
SEARCH_RESULT EDA_ITEM::Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] )
SEARCH_RESULT EDA_ITEM::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] )
{
KICAD_T stype;
@@ -140,7 +139,7 @@ SEARCH_RESULT EDA_ITEM::Visit( INSPECTOR* inspector, const void* testData,
// If caller wants to inspect my type
if( stype == Type() )
{
if( SEARCH_QUIT == inspector->Inspect( this, testData ) )
if( SEARCH_QUIT == inspector( this, testData ) )
return SEARCH_QUIT;
break;