mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-13 14:13:32 +02: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:
@@ -135,7 +135,7 @@ void Importer::StringToList(wxString &str, wxString &delims, wxArrayString &list
|
||||
wxStringTokenizer toker;
|
||||
|
||||
for (toker.SetString(str, delims, mod);
|
||||
toker.HasMoreTokens(); list.Add (toker.GetNextToken()));
|
||||
toker.HasMoreTokens(); list.push_back(toker.GetNextToken()));
|
||||
}
|
||||
|
||||
void Importer::ReadImportItems()
|
||||
@@ -195,14 +195,14 @@ void Importer::ReadImportItems()
|
||||
/* Filters are stored in one list, but the position at which
|
||||
* unused filters start is remembered
|
||||
*/
|
||||
new_item->divider = new_item->filters.Count();
|
||||
new_item->divider = new_item->filters.size();
|
||||
StringToList (unused_filters, delims, new_item->filters);
|
||||
}
|
||||
else
|
||||
new_item->divider = -1;
|
||||
|
||||
/* Find corresponding filter object for each filter ID */
|
||||
for (size_t i = 0; i < new_item->filters.Count(); i++)
|
||||
for (size_t i = 0; i < new_item->filters.size(); i++)
|
||||
{
|
||||
bool found = false;
|
||||
for (const auto &importPlugin : mImportPluginList)
|
||||
@@ -235,7 +235,7 @@ void Importer::ReadImportItems()
|
||||
{
|
||||
int index = new_item->divider;
|
||||
if (new_item->divider < 0)
|
||||
index = new_item->filters.Count();
|
||||
index = new_item->filters.size();
|
||||
new_item->filters.Insert(importPlugin->GetPluginStringID(),index);
|
||||
new_item->filter_objects.insert(
|
||||
new_item->filter_objects.begin() + index, importPlugin.get());
|
||||
@@ -254,35 +254,35 @@ void Importer::WriteImportItems()
|
||||
for (i = 0; i < this->mExtImportItems.size(); i++)
|
||||
{
|
||||
ExtImportItem *item = mExtImportItems[i].get();
|
||||
val.Clear();
|
||||
val.clear();
|
||||
|
||||
for (size_t j = 0; j < item->extensions.Count(); j++)
|
||||
for (size_t j = 0; j < item->extensions.size(); j++)
|
||||
{
|
||||
val.Append (item->extensions[j]);
|
||||
if (j < item->extensions.Count() - 1)
|
||||
if (j < item->extensions.size() - 1)
|
||||
val.Append (wxT(":"));
|
||||
}
|
||||
val.Append (wxT("\\"));
|
||||
for (size_t j = 0; j < item->mime_types.Count(); j++)
|
||||
for (size_t j = 0; j < item->mime_types.size(); j++)
|
||||
{
|
||||
val.Append (item->mime_types[j]);
|
||||
if (j < item->mime_types.Count() - 1)
|
||||
if (j < item->mime_types.size() - 1)
|
||||
val.Append (wxT(":"));
|
||||
}
|
||||
val.Append (wxT("|"));
|
||||
for (size_t j = 0; j < item->filters.Count() && ((int) j < item->divider || item->divider < 0); j++)
|
||||
for (size_t j = 0; j < item->filters.size() && ((int) j < item->divider || item->divider < 0); j++)
|
||||
{
|
||||
val.Append (item->filters[j]);
|
||||
if (j < item->filters.Count() - 1 && ((int) j < item->divider - 1 || item->divider < 0))
|
||||
if (j < item->filters.size() - 1 && ((int) j < item->divider - 1 || item->divider < 0))
|
||||
val.Append (wxT(":"));
|
||||
}
|
||||
if (item->divider >= 0)
|
||||
{
|
||||
val.Append (wxT("\\"));
|
||||
for (size_t j = item->divider; j < item->filters.Count(); j++)
|
||||
for (size_t j = item->divider; j < item->filters.size(); j++)
|
||||
{
|
||||
val.Append (item->filters[j]);
|
||||
if (j < item->filters.Count() - 1)
|
||||
if (j < item->filters.size() - 1)
|
||||
val.Append (wxT(":"));
|
||||
}
|
||||
}
|
||||
@@ -311,12 +311,12 @@ void Importer::WriteImportItems()
|
||||
std::unique_ptr<ExtImportItem> Importer::CreateDefaultImportItem()
|
||||
{
|
||||
auto new_item = std::make_unique<ExtImportItem>();
|
||||
new_item->extensions.Add(wxT("*"));
|
||||
new_item->mime_types.Add(wxT("*"));
|
||||
new_item->extensions.push_back(wxT("*"));
|
||||
new_item->mime_types.push_back(wxT("*"));
|
||||
|
||||
for (const auto &importPlugin : mImportPluginList)
|
||||
{
|
||||
new_item->filters.Add (importPlugin->GetPluginStringID());
|
||||
new_item->filters.push_back(importPlugin->GetPluginStringID());
|
||||
new_item->filter_objects.push_back(importPlugin.get());
|
||||
}
|
||||
new_item->divider = -1;
|
||||
@@ -396,7 +396,7 @@ bool Importer::Import(const wxString &fName,
|
||||
ExtImportItem *item = uItem.get();
|
||||
bool matches_ext = false, matches_mime = false;
|
||||
wxLogDebug(wxT("Testing extensions"));
|
||||
for (size_t j = 0; j < item->extensions.Count(); j++)
|
||||
for (size_t j = 0; j < item->extensions.size(); j++)
|
||||
{
|
||||
wxLogDebug(wxT("%s"), item->extensions[j].Lower());
|
||||
if (wxMatchWild (item->extensions[j].Lower(),fName.Lower(), false))
|
||||
@@ -406,7 +406,7 @@ bool Importer::Import(const wxString &fName,
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (item->extensions.Count() == 0)
|
||||
if (item->extensions.size() == 0)
|
||||
{
|
||||
wxLogDebug(wxT("Match! (empty list)"));
|
||||
matches_ext = true;
|
||||
@@ -415,7 +415,7 @@ bool Importer::Import(const wxString &fName,
|
||||
wxLogDebug(wxT("Testing mime types"));
|
||||
else
|
||||
wxLogDebug(wxT("Not testing mime types"));
|
||||
for (size_t j = 0; matches_ext && j < item->mime_types.Count(); j++)
|
||||
for (size_t j = 0; matches_ext && j < item->mime_types.size(); j++)
|
||||
{
|
||||
if (wxMatchWild (item->mime_types[j].Lower(),mime_type.Lower(), false))
|
||||
{
|
||||
@@ -424,7 +424,7 @@ bool Importer::Import(const wxString &fName,
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (item->mime_types.Count() == 0)
|
||||
if (item->mime_types.size() == 0)
|
||||
{
|
||||
wxLogDebug(wxT("Match! (empty list)"));
|
||||
matches_mime = true;
|
||||
|
@@ -453,7 +453,7 @@ bool FFmpegImportFileHandle::InitCodecs()
|
||||
}
|
||||
strinfo.Printf(_("Index[%02x] Codec[%s], Language[%s], Bitrate[%s], Channels[%d], Duration[%d]"),
|
||||
sc->m_stream->id,codec->name,lang,bitrate,(int)sc->m_stream->codec->channels,(int)duration);
|
||||
mStreamInfo.Add(strinfo);
|
||||
mStreamInfo.push_back(strinfo);
|
||||
mScs->get()[mNumStreams++] = std::move(sc);
|
||||
}
|
||||
//for video and unknown streams do nothing
|
||||
|
@@ -192,7 +192,7 @@ void MyFLACFile::metadata_callback(const FLAC__StreamMetadata *metadata)
|
||||
{
|
||||
case FLAC__METADATA_TYPE_VORBIS_COMMENT:
|
||||
for (FLAC__uint32 i = 0; i < metadata->data.vorbis_comment.num_comments; i++) {
|
||||
mComments.Add(UTF8CTOWX((char *)metadata->data.vorbis_comment.comments[i].entry));
|
||||
mComments.push_back(UTF8CTOWX((char *)metadata->data.vorbis_comment.comments[i].entry));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -528,7 +528,7 @@ ProgressResult FLACImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
outTracks.push_back(std::move(mChannels));
|
||||
|
||||
tags->Clear();
|
||||
size_t cnt = mFile->mComments.GetCount();
|
||||
size_t cnt = mFile->mComments.size();
|
||||
for (size_t c = 0; c < cnt; c++) {
|
||||
wxString name = mFile->mComments[c].BeforeFirst(wxT('='));
|
||||
wxString value = mFile->mComments[c].AfterFirst(wxT('='));
|
||||
|
@@ -302,7 +302,7 @@ GetGStreamerImportPlugin(ImportPluginList &importPluginList,
|
||||
auto plug = std::make_unique<GStreamerImportPlugin>();
|
||||
|
||||
// No supported extensions...no gstreamer plugins installed
|
||||
if (plug->GetSupportedExtensions().GetCount() == 0)
|
||||
if (plug->GetSupportedExtensions().size() == 0)
|
||||
return;
|
||||
|
||||
// Add to list of importers
|
||||
@@ -391,7 +391,7 @@ GStreamerImportPlugin::GetSupportedExtensions()
|
||||
wxString extension = wxString::FromUTF8(extensions[i]);
|
||||
if (mExtensions.Index(extension, false) == wxNOT_FOUND)
|
||||
{
|
||||
mExtensions.Add(extension);
|
||||
mExtensions.push_back(extension);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -403,7 +403,7 @@ GStreamerImportPlugin::GetSupportedExtensions()
|
||||
|
||||
// Log it for debugging
|
||||
wxString extensions = wxT("Extensions:");
|
||||
for (size_t i = 0; i < mExtensions.GetCount(); i++)
|
||||
for (size_t i = 0; i < mExtensions.size(); i++)
|
||||
{
|
||||
extensions = extensions + wxT(" ") + mExtensions[i];
|
||||
}
|
||||
@@ -892,7 +892,7 @@ GStreamerImportFileHandle::~GStreamerImportFileHandle()
|
||||
wxInt32
|
||||
GStreamerImportFileHandle::GetStreamCount()
|
||||
{
|
||||
return mStreamInfo.GetCount();
|
||||
return mStreamInfo.size();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -991,7 +991,7 @@ GStreamerImportFileHandle::Init()
|
||||
wxString::FromUTF8(c->mType.get()),
|
||||
(int) c->mNumChannels,
|
||||
(int) c->mSampleRate);
|
||||
mStreamInfo.Add(strinfo);
|
||||
mStreamInfo.push_back(strinfo);
|
||||
}
|
||||
|
||||
return success;
|
||||
|
@@ -382,7 +382,7 @@ void MP3ImportFileHandle::ImportID3(Tags *tags)
|
||||
v = UTF8CTOWX(str.get());
|
||||
}
|
||||
|
||||
if (!n.IsEmpty() && !v.IsEmpty()) {
|
||||
if (!n.empty() && !v.empty()) {
|
||||
tags->SetTag(n, v);
|
||||
}
|
||||
}
|
||||
|
@@ -115,7 +115,7 @@ public:
|
||||
{
|
||||
wxString strinfo;
|
||||
strinfo.Printf(wxT("Index[%02x] Version[%d], Channels[%d], Rate[%ld]"), (unsigned int) i,mVorbisFile->vi[i].version,mVorbisFile->vi[i].channels,mVorbisFile->vi[i].rate);
|
||||
mStreamInfo.Add(strinfo);
|
||||
mStreamInfo.push_back(strinfo);
|
||||
mStreamUsage[i] = 0;
|
||||
}
|
||||
|
||||
|
@@ -692,7 +692,7 @@ ProgressResult PCMImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
v = UTF8CTOWX(convStr.get());
|
||||
}
|
||||
|
||||
if (!n.IsEmpty() && !v.IsEmpty()) {
|
||||
if (!n.empty() && !v.empty()) {
|
||||
tags->SetTag(n, v);
|
||||
}
|
||||
}
|
||||
|
@@ -526,7 +526,7 @@ void QTImportFileHandle::AddMetadata(Tags *tags)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!v.IsEmpty()) {
|
||||
if (!v.empty()) {
|
||||
tags->SetTag(names[i].name, v);
|
||||
}
|
||||
}
|
||||
|
@@ -345,7 +345,7 @@ ImportRawDialog::ImportRawDialog(wxWindow * parent,
|
||||
|
||||
if (sf_format_check(&info)) {
|
||||
mEncodingSubtype[mNumEncodings] = subtype;
|
||||
encodings.Add(sf_encoding_index_name(i));
|
||||
encodings.push_back(sf_encoding_index_name(i));
|
||||
|
||||
if ((mEncoding & SF_FORMAT_SUBMASK) == subtype)
|
||||
selection = mNumEncodings;
|
||||
@@ -387,7 +387,7 @@ ImportRawDialog::ImportRawDialog(wxWindow * parent,
|
||||
chans.Add(_("1 Channel (Mono)"));
|
||||
chans.Add(_("2 Channels (Stereo)"));
|
||||
for (i=2; i<16; i++) {
|
||||
chans.Add(wxString::Format(_("%d Channels"), i + 1));
|
||||
chans.push_back(wxString::Format(_("%d Channels"), i + 1));
|
||||
}
|
||||
|
||||
S.StartVerticalLay(false);
|
||||
|
Reference in New Issue
Block a user