Eeschema: component library plugin prep work.

* Remove unused functions in the PART_LIB and PART_LIBS objects.
This commit is contained in:
Wayne Stambaugh 2016-07-13 16:36:16 -04:00
parent c2b8a4ee43
commit 959450beed
2 changed files with 1 additions and 120 deletions

View File

@ -140,70 +140,6 @@ void PART_LIB::GetEntryTypePowerNames( wxArrayString& aNames, bool aSort, bool a
} }
/**
* Function sortFunction
* simple function used as comparator to sort a std::vector<wxArrayString>&.
*
* @param aItem1 is the first comparison parameter.
* @param aItem2 is the second.
* @return bool - which item should be put first in the sorted list.
*/
bool sortFunction( wxArrayString aItem1, wxArrayString aItem2 )
{
return( aItem1.Item( 0 ) < aItem2.Item( 0 ) );
}
void PART_LIB::SearchEntryNames( std::vector<wxArrayString>& aNames,
const wxString& aNameSearch,
const wxString& aKeySearch,
bool aSort )
{
for( LIB_ALIAS_MAP::iterator it = m_amap.begin(); it != m_amap.end(); ++it )
{
if( !!aKeySearch && KeyWordOk( aKeySearch, it->second->GetKeyWords() ) )
{
wxArrayString item;
item.Add( it->first );
item.Add( GetLogicalName() );
aNames.push_back( item );
}
if( !aNameSearch.IsEmpty() &&
WildCompareString( aNameSearch, it->second->GetName(), false ) )
{
wxArrayString item;
item.Add( it->first );
item.Add( GetLogicalName() );
aNames.push_back( item );
}
}
if( aSort )
std::sort( aNames.begin(), aNames.end(), sortFunction );
}
void PART_LIB::SearchEntryNames( wxArrayString& aNames, const wxRegEx& aRe, bool aSort )
{
if( !aRe.IsValid() )
return;
LIB_ALIAS_MAP::iterator it;
for( it = m_amap.begin(); it!=m_amap.end(); it++ )
{
if( aRe.Matches( it->second->GetKeyWords() ) )
aNames.Add( it->first );
}
if( aSort )
aNames.Sort();
}
bool PART_LIB::Conflicts( LIB_PART* aPart ) bool PART_LIB::Conflicts( LIB_PART* aPart )
{ {
wxCHECK_MSG( aPart != NULL, false, wxCHECK_MSG( aPart != NULL, false,
@ -950,16 +886,6 @@ LIB_ALIAS* PART_LIBS::FindLibraryEntry( const wxString& aEntryName, const wxStri
return entry; return entry;
} }
void PART_LIBS::FindLibraryEntries( const wxString& aEntryName, std::vector<LIB_ALIAS*>& aEntries )
{
for( PART_LIB& lib : *this )
{
LIB_ALIAS* entry = lib.FindEntry( aEntryName );
if( entry )
aEntries.push_back( entry );
}
}
/* searches all libraries in the list for an entry, using a case insensitive comparison. /* searches all libraries in the list for an entry, using a case insensitive comparison.
* Used to find an entry, when the normal (case sensitive) search fails. * Used to find an entry, when the normal (case sensitive) search fails.
@ -1012,18 +938,6 @@ int PART_LIBS::GetModifyHash()
} }
/*
void PART_LIBS::RemoveCacheLibrary()
{
for( PART_LIBS::iterator it = begin(); it < end(); ++it )
{
if( it->IsCache() )
erase( it-- );
}
}
*/
void PART_LIBS::LibNamesAndPaths( PROJECT* aProject, bool doSave, void PART_LIBS::LibNamesAndPaths( PROJECT* aProject, bool doSave,
wxString* aPaths, wxArrayString* aNames ) wxString* aPaths, wxArrayString* aNames )
throw( IO_ERROR, boost::bad_pointer ) throw( IO_ERROR, boost::bad_pointer )

View File

@ -310,7 +310,7 @@ public:
* @param aEntryName - Name of entry to search for (case sensitive). * @param aEntryName - Name of entry to search for (case sensitive).
* @param aEntries - a std::vector to store entries * @param aEntries - a std::vector to store entries
*/ */
void FindLibraryEntries( const wxString& aEntryName, std::vector<LIB_ALIAS*>& aEntries ); // void FindLibraryEntries( const wxString& aEntryName, std::vector<LIB_ALIAS*>& aEntries );
/** /**
* Function FindLibraryNearEntries * Function FindLibraryNearEntries
@ -328,14 +328,7 @@ public:
void FindLibraryNearEntries( std::vector<LIB_ALIAS*>& aCandidates, const wxString& aEntryName, void FindLibraryNearEntries( std::vector<LIB_ALIAS*>& aCandidates, const wxString& aEntryName,
const wxString& aLibraryName = wxEmptyString ); const wxString& aLibraryName = wxEmptyString );
/**
* Function RemoveCacheLibrary
* removes all cache libraries from library list.
*/
//void RemoveCacheLibrary();
int GetLibraryCount() { return size(); } int GetLibraryCount() { return size(); }
}; };
@ -456,32 +449,6 @@ public:
void GetEntryTypePowerNames( wxArrayString& aNames, bool aSort = true, void GetEntryTypePowerNames( wxArrayString& aNames, bool aSort = true,
bool aMakeUpperCase = false ); bool aMakeUpperCase = false );
/**
* Load string array with entry names matching name and/or key word.
*
* This currently mimics the old behavior of calling KeyWordOk() and
* WildCompareString(). The names array will be populated with the
* library entry names that meat the search criteria on exit.
*
* @param aNames - String array to place entry names into.
* @param aNameSearch - Name wild card search criteria.
* @param aKeySearch - Key word search criteria.
* @param aSort - Sort names if true.
*/
void SearchEntryNames( std::vector<wxArrayString>& aNames,
const wxString& aNameSearch = wxEmptyString,
const wxString& aKeySearch = wxEmptyString,
bool aSort = true );
/**
* Find parts in library by key word regular expression search.
*
* @param aNames - String array to place found part names into.
* @param aRe - Regular expression used to search part key words.
* @param aSort - Sort part name list.
*/
void SearchEntryNames( wxArrayString& aNames, const wxRegEx& aRe, bool aSort = true );
/** /**
* Checks \a aPart for name conflict in the library. * Checks \a aPart for name conflict in the library.
* *