本文整理汇总了C++中wxArrayString::Alloc方法的典型用法代码示例。如果您正苦于以下问题:C++ wxArrayString::Alloc方法的具体用法?C++ wxArrayString::Alloc怎么用?C++ wxArrayString::Alloc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxArrayString
的用法示例。
在下文中一共展示了wxArrayString::Alloc方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFiles
void SearchThread::GetFiles(const SearchData* data, wxArrayString& files)
{
wxStringSet_t scannedFiles;
const wxArrayString& rootDirs = data->GetRootDirs();
files = data->GetFiles();
// Populate "scannedFiles" with list of files to scan
scannedFiles.insert(files.begin(), files.end());
for(size_t i = 0; i < rootDirs.size(); ++i) {
// make sure it's really a dir (not a fifo, etc.)
clFilesScanner scanner;
std::vector<wxString> filesV;
if(scanner.Scan(rootDirs.Item(i), filesV, data->GetExtensions())) {
std::for_each(filesV.begin(), filesV.end(), [&](const wxString& file) { scannedFiles.insert(file); });
}
}
files.clear();
files.Alloc(scannedFiles.size());
std::for_each(scannedFiles.begin(), scannedFiles.end(), [&](const wxString& file) { files.Add(file); });
// Filter all non matching files
FilterFiles(files, data);
}
示例2: GetPaths
void wxGenericFileDialog::GetPaths( wxArrayString& paths ) const
{
paths.Empty();
if (m_list->GetSelectedItemCount() == 0)
{
paths.Add( GetPath() );
return;
}
paths.Alloc( m_list->GetSelectedItemCount() );
wxString dir = m_list->GetDir();
#ifdef __UNIX__
if (dir != wxT("/"))
#endif
#ifdef __WXWINCE__
if (dir != wxT("/") && dir != wxT("\\"))
#endif
dir += wxFILE_SEP_PATH;
wxListItem item;
item.m_mask = wxLIST_MASK_TEXT;
item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
while ( item.m_itemId != -1 )
{
m_list->GetItem( item );
paths.Add( dir + item.m_text );
item.m_itemId = m_list->GetNextItem( item.m_itemId,
wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
}
}
示例3: GetFilenames
void wxGenericFileDialog::GetFilenames(wxArrayString& files) const
{
#ifdef __WXGTK__
m_list->GetFilenames(files);
#else
files.Empty();
if (m_list->GetSelectedItemCount() == 0)
{
files.Add( GetFilename() );
return;
}
files.Alloc( m_list->GetSelectedItemCount() );
wxListItem item;
item.m_mask = wxLIST_MASK_TEXT;
item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
while ( item.m_itemId != -1 )
{
m_list->GetItem( item );
files.Add( item.m_text );
item.m_itemId = m_list->GetNextItem( item.m_itemId,
wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
}
#endif
}
示例4: ImportM3U
void ImportM3U(const wxString & sM3UPath,wxArrayString & sFiles)
{
sFiles.Clear();
wxTextFile f(sM3UPath);
if(!f.Open(wxConvISO8859_1))
{
wxLogError(_("File %s not found."),sM3UPath.c_str());
return;
}
wxFileName fnM3UPath(sM3UPath);
sFiles.Alloc(f.GetLineCount());
for (size_t n =0; n < f.GetLineCount();n++)
{
wxString sLine(f[n]);
sLine.Trim();
if(sLine.IsEmpty())
continue; // skip empty lines;
else if(sLine.StartsWith(_T("#")))
continue;//skip comments
wxFileName fn(sLine);
fn.Normalize(wxPATH_NORM_ALL,fnM3UPath.GetPath());
sFiles.Add(fn.GetFullPath());
}
return;
}
示例5: Query
void CMusikLibrary::Query( const wxString & query, wxArrayString & aReturn ,bool bClearArray )
{
if(bClearArray)
{
aReturn.Clear();
//--- run the query ---//
aReturn.Alloc( GetSongCount() );// just a guess
}
MusikDb::ResultCB cb(&aReturn, &db_callbackAddToStringArray);
m_pDB->Exec(ConvQueryToMB( query ),cb);
}
示例6:
/* static */
const wxArrayString& PicType::getSupportedPicNames()
{
static wxArrayString picNames;
if (picNames.size() == 0)
{
// cache the array with the names of supported PICs
picNames.Alloc(s_arrSupported.size());
for(unsigned int i=0;i<s_arrSupported.size();i++)
picNames.Add(s_arrSupported[i].name);
picNames.Sort();
}
return picNames;
}
示例7: GetFilenames
void FILEDIALOG::GetFilenames(wxArrayString& files) const
{
files.Empty();
if (m_list->GetSelectedItemCount() == 0)
{
files.Add( GetFilename() );
return;
}
files.Alloc( m_list->GetSelectedItemCount() );
wxListItem item;
item.m_mask = wxLIST_MASK_TEXT;
item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
while ( item.m_itemId != -1 )
{
m_list->GetItem( item );
files.Add( item.m_text );
item.m_itemId = m_list->GetNextItem( item.m_itemId,
wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
}
}