Const modifiers

This commit is contained in:
Maciej Suminski 2017-10-28 12:07:40 +02:00
parent 3bdcdd808b
commit 42220579df
4 changed files with 19 additions and 19 deletions

View File

@ -146,7 +146,7 @@ void PART_LIB::EnableBuffering( bool aEnable )
}
void PART_LIB::GetAliasNames( wxArrayString& aNames )
void PART_LIB::GetAliasNames( wxArrayString& aNames ) const
{
m_plugin->EnumerateSymbolLib( aNames, fileName.GetFullPath(), m_properties.get() );
@ -154,7 +154,7 @@ void PART_LIB::GetAliasNames( wxArrayString& aNames )
}
void PART_LIB::GetAliases( std::vector<LIB_ALIAS*>& aAliases )
void PART_LIB::GetAliases( std::vector<LIB_ALIAS*>& aAliases ) const
{
m_plugin->EnumerateSymbolLib( aAliases, fileName.GetFullPath(), m_properties.get() );
@ -164,7 +164,7 @@ void PART_LIB::GetAliases( std::vector<LIB_ALIAS*>& aAliases )
}
void PART_LIB::GetEntryTypePowerNames( wxArrayString& aNames )
void PART_LIB::GetEntryTypePowerNames( wxArrayString& aNames ) const
{
std::vector<LIB_ALIAS*> aliases;
@ -186,7 +186,7 @@ void PART_LIB::GetEntryTypePowerNames( wxArrayString& aNames )
}
LIB_ALIAS* PART_LIB::FindAlias( const wxString& aName )
LIB_ALIAS* PART_LIB::FindAlias( const wxString& aName ) const
{
LIB_ALIAS* alias = m_plugin->LoadSymbol( fileName.GetFullPath(), aName, m_properties.get() );
@ -194,13 +194,13 @@ LIB_ALIAS* PART_LIB::FindAlias( const wxString& aName )
// symbols. This allows the symbol library table conversion tool to determine the
// correct library where the symbol was found.
if( alias && alias->GetPart() && !alias->GetPart()->GetLib() )
alias->GetPart()->SetLib( this );
alias->GetPart()->SetLib( const_cast<PART_LIB*>( this ) );
return alias;
}
LIB_PART* PART_LIB::FindPart( const wxString& aName )
LIB_PART* PART_LIB::FindPart( const wxString& aName ) const
{
LIB_ALIAS* alias = FindAlias( aName );
@ -211,7 +211,7 @@ LIB_PART* PART_LIB::FindPart( const wxString& aName )
}
bool PART_LIB::HasPowerParts()
bool PART_LIB::HasPowerParts() const
{
// return true if at least one power part is found in lib
std::vector<LIB_ALIAS*> aliases;

View File

@ -401,21 +401,21 @@ public:
*
* @param aNames - String array to place entry names into.
*/
void GetAliasNames( wxArrayString& aNames );
void GetAliasNames( wxArrayString& aNames ) const;
/**
* Load a vector with all the entries in this library.
*
* @param aAliases - vector to receive the aliases.
*/
void GetAliases( std::vector<LIB_ALIAS*>& aAliases );
void GetAliases( std::vector<LIB_ALIAS*>& aAliases ) const;
/**
* Load a string array with the names of entries of type POWER in this library.
*
* @param aNames - String array to place entry names into.
*/
void GetEntryTypePowerNames( wxArrayString& aNames );
void GetEntryTypePowerNames( wxArrayString& aNames ) const;
/**
* Find #LIB_ALIAS by \a aName.
@ -423,7 +423,7 @@ public:
* @param aName - Name of entry, case sensitive.
* @return #LIB_ALIAS* if found. NULL if not found.
*/
LIB_ALIAS* FindAlias( const wxString& aName );
LIB_ALIAS* FindAlias( const wxString& aName ) const;
/**
* Find part by \a aName.
@ -434,7 +434,7 @@ public:
* @param aName - Name of part, case sensitive.
* @return LIB_PART* - part if found, else NULL.
*/
LIB_PART* FindPart( const wxString& aName );
LIB_PART* FindPart( const wxString& aName ) const;
/**
* Add \a aPart entry to library.
@ -481,14 +481,14 @@ public:
*
* @return wxString - Full library file name with path and extension.
*/
wxString GetFullFileName() { return fileName.GetFullPath(); }
wxString GetFullFileName() const { return fileName.GetFullPath(); }
/**
* Function GetLogicalName
* returns the logical name of the library.
* @return wxString - The logical name of this library.
*/
const wxString GetLogicalName()
const wxString GetLogicalName() const
{
/* for now is the filename without path or extension.
@ -518,7 +518,7 @@ public:
* @return true if at least one power part is found in lib
* Useful to select or list only libs containing power parts
*/
bool HasPowerParts();
bool HasPowerParts() const;
};

View File

@ -241,7 +241,7 @@ void CMP_TREE_MODEL_ADAPTER::AttachTo( wxDataViewCtrl* aDataViewCtrl )
}
LIB_ID CMP_TREE_MODEL_ADAPTER::GetAliasFor( wxDataViewItem aSelection ) const
LIB_ID CMP_TREE_MODEL_ADAPTER::GetAliasFor( const wxDataViewItem& aSelection ) const
{
auto node = ToNode( aSelection );
@ -254,7 +254,7 @@ LIB_ID CMP_TREE_MODEL_ADAPTER::GetAliasFor( wxDataViewItem aSelection ) const
}
int CMP_TREE_MODEL_ADAPTER::GetUnitFor( wxDataViewItem aSelection ) const
int CMP_TREE_MODEL_ADAPTER::GetUnitFor( const wxDataViewItem& aSelection ) const
{
auto node = ToNode( aSelection );
return node ? node->Unit : 0;

View File

@ -212,7 +212,7 @@ public:
*
* @return alias, or nullptr if none is selected
*/
LIB_ID GetAliasFor( wxDataViewItem aSelection ) const;
LIB_ID GetAliasFor( const wxDataViewItem& aSelection ) const;
/**
* Return the unit for the given item.
@ -223,7 +223,7 @@ public:
* @return Unit, or zero if the alias itself is selected. Return valid is
* invalid if GetAliasFor() returns nullptr.
*/
int GetUnitFor( wxDataViewItem aSelection ) const;
int GetUnitFor( const wxDataViewItem& aSelection ) const;
/**
* Return the number of components loaded in the tree.