mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-21 14:02:57 +02:00
Less use of wxArrayString::Index() ...
... instead use the utility make_iterator_range and its index() or contains() method. This generic utility works with any container defining begin() and end(). This further lessens dependency on wxWidgets container idioms.
This commit is contained in:
@@ -1603,7 +1603,7 @@ void CommandManager::GetCategories(wxArrayString &cats)
|
||||
|
||||
for (const auto &entry : mCommandList) {
|
||||
wxString cat = entry->labelTop;
|
||||
if (cats.Index(cat) == wxNOT_FOUND) {
|
||||
if ( ! make_iterator_range( cats ).contains(cat) ) {
|
||||
cats.push_back(cat);
|
||||
}
|
||||
}
|
||||
|
@@ -277,7 +277,7 @@ bool BuiltinCommandsModule::IsPluginValid(const wxString & path, bool bFast)
|
||||
{
|
||||
// bFast is unused as checking in the list is fast.
|
||||
static_cast<void>(bFast); // avoid unused variable warning
|
||||
return mNames.Index(path) != wxNOT_FOUND;
|
||||
return make_iterator_range( mNames ).contains( path );
|
||||
}
|
||||
|
||||
ComponentInterface *BuiltinCommandsModule::CreateInstance(const wxString & path)
|
||||
@@ -302,9 +302,10 @@ void BuiltinCommandsModule::DeleteInstance(ComponentInterface *instance)
|
||||
std::unique_ptr<AudacityCommand> BuiltinCommandsModule::Instantiate(const wxString & path)
|
||||
{
|
||||
wxASSERT(path.StartsWith(BUILTIN_GENERIC_COMMAND_PREFIX));
|
||||
wxASSERT(mNames.Index(path) != wxNOT_FOUND);
|
||||
auto index = make_iterator_range( mNames ).index( path );
|
||||
wxASSERT( index != wxNOT_FOUND );
|
||||
|
||||
switch (mNames.Index(path))
|
||||
switch ( index )
|
||||
{
|
||||
COMMAND_LIST;
|
||||
EXCLUDE_LIST;
|
||||
|
@@ -107,7 +107,7 @@ public:
|
||||
bool Validate(const wxVariant &v) override
|
||||
{
|
||||
SetConverted(v);
|
||||
return (mOptions.Index(v.GetString()) != wxNOT_FOUND);
|
||||
return make_iterator_range( mOptions ).contains( v.GetString() );
|
||||
}
|
||||
wxString GetDescription() const override
|
||||
{
|
||||
|
Reference in New Issue
Block a user