1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-03-09 16:05:39 +01:00

Use standard library style members of wxArrayString (and wxString) ...

... which will make it easier to change the types of those containers to
std::vectors of other string-like classes

for wxString,

IsEmpty => empty
Clear => clear
Alloc => reserve

for wxArrayString,

Count => size
GetCount => size
IsEmpty => empty
Add => push_back
Clear => clear
Empty => clear
Sort => std::sort (only with default comparator)
SetCount => resize
Last => back
Item => operator []
Alloc => reserve
This commit is contained in:
Paul Licameli
2019-02-11 19:10:48 -05:00
parent 5daa67dfe6
commit 2db49dc1f0
115 changed files with 728 additions and 728 deletions

View File

@@ -37,7 +37,7 @@ void FileHistory::AddFileToHistory(const wxString & file, bool update)
{
// Needed to transition from wxFileHistory to FileHistory since there
// can be empty history "slots".
if (file.IsEmpty()) {
if (file.empty()) {
return;
}
@@ -51,8 +51,8 @@ void FileHistory::AddFileToHistory(const wxString & file, bool update)
mHistory.RemoveAt(i);
}
if (mMaxFiles == mHistory.GetCount()) {
mHistory.RemoveAt(mHistory.GetCount() - 1);
if (mMaxFiles == mHistory.size()) {
mHistory.RemoveAt(mHistory.size() - 1);
}
mHistory.Insert(file, 0);
@@ -64,9 +64,9 @@ void FileHistory::AddFileToHistory(const wxString & file, bool update)
void FileHistory::RemoveFileFromHistory(size_t i, bool update)
{
wxASSERT(i < mHistory.GetCount());
wxASSERT(i < mHistory.size());
if (i < mHistory.GetCount()) {
if (i < mHistory.size()) {
mHistory.RemoveAt(i);
if (update) {
@@ -77,16 +77,16 @@ void FileHistory::RemoveFileFromHistory(size_t i, bool update)
void FileHistory::Clear()
{
mHistory.Clear();
mHistory.clear();
AddFilesToMenu();
}
const wxString &FileHistory::GetHistoryFile(size_t i) const
{
wxASSERT(i < mHistory.GetCount());
wxASSERT(i < mHistory.size());
if (i < mHistory.GetCount()) {
if (i < mHistory.size()) {
return mHistory[i];
}
@@ -96,7 +96,7 @@ const wxString &FileHistory::GetHistoryFile(size_t i) const
size_t FileHistory::GetCount()
{
return mHistory.GetCount();
return mHistory.size();
}
void FileHistory::UseMenu(wxMenu *menu)
@@ -116,7 +116,7 @@ void FileHistory::UseMenu(wxMenu *menu)
void FileHistory::Load(wxConfigBase & config, const wxString & group)
{
mHistory.Clear();
mHistory.clear();
config.SetPath(group);
@@ -140,8 +140,8 @@ void FileHistory::Save(wxConfigBase & config, const wxString & group)
config.SetPath(group);
// Stored in reverse order
int n = mHistory.GetCount() - 1;
for (size_t i = 1; i <= mHistory.GetCount(); i++) {
int n = mHistory.size() - 1;
for (size_t i = 1; i <= mHistory.size(); i++) {
config.Write(wxString::Format(wxT("file%02d"), (int)i), mHistory[n--]);
}
@@ -162,17 +162,17 @@ void FileHistory::AddFilesToMenu(wxMenu *menu)
for (auto end = items.end(), iter = items.begin(); iter != end;)
menu->Destroy(*iter++);
for (size_t i = 0; i < mHistory.GetCount(); i++) {
for (size_t i = 0; i < mHistory.size(); i++) {
wxString item = mHistory[i];
item.Replace( "&", "&&" );
menu->Append(mIDBase + 1 + i,item);
}
if (mHistory.GetCount() > 0) {
if (mHistory.size() > 0) {
menu->AppendSeparator();
}
menu->Append(mIDBase, _("&Clear"));
menu->Enable(mIDBase, mHistory.GetCount() > 0);
menu->Enable(mIDBase, mHistory.size() > 0);
}
void FileHistory::Compress()