1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-21 08:27:13 +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

@@ -282,7 +282,7 @@ void QuitAudacity(bool bForce)
// BG: unless force is true
// BG: Are there any projects open?
//- if (!gAudacityProjects.IsEmpty())
//- if (!gAudacityProjects.empty())
/*start+*/
if (gAudacityProjects.empty())
{
@@ -622,7 +622,7 @@ public:
{
// Add the filename to the queue. It will be opened by
// the OnTimer() event when it is safe to do so.
ofqueue.Add(data);
ofqueue.push_back(data);
return true;
}
@@ -696,13 +696,13 @@ IMPLEMENT_APP(AudacityApp)
// in response of an open-document apple event
void AudacityApp::MacOpenFile(const wxString &fileName)
{
ofqueue.Add(fileName);
ofqueue.push_back(fileName);
}
// in response of a print-document apple event
void AudacityApp::MacPrintFile(const wxString &fileName)
{
ofqueue.Add(fileName);
ofqueue.push_back(fileName);
}
// in response of a open-application apple event
@@ -771,7 +771,7 @@ bool AudacityApp::MRUOpen(const wxString &fullPathStr) {
AudacityProject *proj = GetActiveProject();
if (!fullPathStr.IsEmpty())
if (!fullPathStr.empty())
{
// verify that the file exists
if (wxFile::Exists(fullPathStr))
@@ -847,15 +847,15 @@ void AudacityApp::OnTimer(wxTimerEvent& WXUNUSED(event))
// AppleEvent messages (via wxWidgets). So, open any that are
// in the queue and clean the queue.
if (gInited) {
if (ofqueue.GetCount()) {
if (ofqueue.size()) {
// Load each file on the queue
while (ofqueue.GetCount()) {
while (ofqueue.size()) {
wxString name;
name.swap(ofqueue[0]);
ofqueue.RemoveAt(0);
// Get the user's attention if no file name was specified
if (name.IsEmpty()) {
if (name.empty()) {
// Get the users attention
AudacityProject *project = GetActiveProject();
if (project) {
@@ -1021,7 +1021,7 @@ wxString AudacityApp::InitLang( const wxString & lang )
}
mLocale = std::make_unique<wxLocale>(info->Language);
for(unsigned int i=0; i<audacityPathList.GetCount(); i++)
for(unsigned int i=0; i<audacityPathList.size(); i++)
mLocale->AddCatalogLookupPathPrefix(audacityPathList[i]);
// LL: Must add the wxWidgets catalog manually since the search
@@ -1703,7 +1703,7 @@ void AudacityApp::OnKeyDown(wxKeyEvent &event)
// We now disallow temp directory name that puts it where cleaner apps will
// try to clean out the files.
bool AudacityApp::IsTempDirectoryNameOK( const wxString & Name ){
if( Name.IsEmpty() )
if( Name.empty() )
return false;
wxFileName tmpFile;
@@ -1734,7 +1734,7 @@ bool AudacityApp::IsTempDirectoryNameOK( const wxString & Name ){
// result is unchanged if unsuccessful.
void SetToExtantDirectory( wxString & result, const wxString & dir ){
// don't allow path of "".
if( dir.IsEmpty() )
if( dir.empty() )
return;
if( wxDirExists( dir ) ){
result = dir;
@@ -1876,7 +1876,7 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
{
wxFileName filename(parser->GetParam(i));
if (filename.MakeAbsolute())
filenames.Add(filename.GetLongPath());
filenames.push_back(filename.GetLongPath());
}
#if defined(__WXMSW__)
@@ -1894,9 +1894,9 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
if (conn)
{
bool ok = false;
if (filenames.GetCount() > 0)
if (filenames.size() > 0)
{
for (size_t i = 0, cnt = filenames.GetCount(); i < cnt; i++)
for (size_t i = 0, cnt = filenames.size(); i < cnt; i++)
{
ok = conn->Execute(filenames[i]);
}
@@ -1935,9 +1935,9 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
sock->Connect(addr, true);
if (sock->IsConnected())
{
if (filenames.GetCount() > 0)
if (filenames.size() > 0)
{
for (size_t i = 0, cnt = filenames.GetCount(); i < cnt; i++)
for (size_t i = 0, cnt = filenames.size(); i < cnt; i++)
{
const wxString param = filenames[i];
sock->WriteMsg((const wxChar *) param, (param.Len() + 1) * sizeof(wxChar));
@@ -2028,7 +2028,7 @@ void AudacityApp::OnSocketEvent(wxSocketEvent & evt)
{
// Add the filename to the queue. It will be opened by
// the OnTimer() event when it is safe to do so.
ofqueue.Add(name);
ofqueue.push_back(name);
}
}
@@ -2082,12 +2082,12 @@ void AudacityApp::AddUniquePathToPathList(const wxString &pathArg,
pathNorm.Normalize();
const wxString newpath{ pathNorm.GetFullPath() };
for(unsigned int i=0; i<pathList.GetCount(); i++) {
for(unsigned int i=0; i<pathList.size(); i++) {
if (wxFileName(newpath) == wxFileName(pathList[i]))
return;
}
pathList.Add(newpath);
pathList.push_back(newpath);
}
// static
@@ -2116,7 +2116,7 @@ void AudacityApp::FindFilesInPathList(const wxString & pattern,
wxFileName ff;
for(size_t i = 0; i < pathList.GetCount(); i++) {
for(size_t i = 0; i < pathList.size(); i++) {
ff = pathList[i] + wxFILE_SEP_PATH + pattern;
wxDir::GetAllFiles(ff.GetPath(), &results, ff.GetFullName(), flags);
}
@@ -2358,7 +2358,7 @@ void AudacityApp::AssociateFileTypes()
root_key.Empty();
}
}
if (root_key.IsEmpty()) {
if (root_key.empty()) {
//v Warn that we can't set keys. Ask whether to set pref for no retry?
} else {
associateFileTypes = wxT("Audacity.Project"); // Finally set value for .AUP key