本文整理汇总了C++中CFileList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileList::begin方法的具体用法?C++ CFileList::begin怎么用?C++ CFileList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileList
的用法示例。
在下文中一共展示了CFileList::begin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChangeDir
void CFileBrowser::ChangeDir(const std::string & filename, int selection)
{
std::string newpath;
if((m_Mode != ModeSC) && (filename == ".."))
{
std::string::size_type pos = Path.substr(0,Path.length()-1).rfind('/');
#ifdef ENABLE_MOVIEPLAYER_VLC
bool is_vlc = (strncmp(Path.c_str(), VLC_URI, strlen(VLC_URI)) == 0);
#endif
if (pos == std::string::npos)
{
newpath = Path;
}
else
{
#ifdef ENABLE_MOVIEPLAYER_VLC
if (is_vlc && (pos < strlen(VLC_URI) - 1))
newpath = VLC_URI;
else
#endif
newpath = Path.substr(0, pos + 1);
}
#ifdef ENABLE_MOVIEPLAYER_VLC
if (strncmp(is_vlc ? &(newpath.c_str()[strlen(VLC_URI)]) : newpath.c_str(), base.c_str(), base.length()) != 0)
return;
#endif
}
else
{
newpath=filename;
}
if(m_Mode != ModeSC && (newpath.rfind('/') != newpath.length()-1 || newpath.length() == 0))
{
newpath += '/';
}
filelist.clear();
Path = newpath;
name = newpath;
CFileList allfiles;
readDir(newpath, &allfiles);
// filter
CFileList::iterator file = allfiles.begin();
for(; file != allfiles.end() ; file++)
{
if(Filter != NULL && (!S_ISDIR(file->Mode)) && use_filter)
{
if(!Filter->matchFilter(file->Name))
{
continue;
}
if(Hide_records) {
int ext_pos = file->Name.rfind('.');
if( ext_pos > 0) {
std::string extension = file->Name.substr(ext_pos + 1, name.length() - ext_pos);
if(strcasecmp(extension.c_str(), "ts") == 0) {
std::string fname = file->Name.substr(0, ext_pos) + ".xml";
if(access(fname.c_str(), F_OK) == 0)
continue;
}
}
}
}
if(Dir_Mode && (!S_ISDIR(file->Mode)))
{
continue;
}
filelist.push_back(*file);
}
// sort result
sort(filelist.begin(), filelist.end(), sortBy[g_settings.filebrowser_sortmethod]);
selected = 0;
if ((selection != -1) && (selection < (int)filelist.size()))
selected = selection;
paintHead();
paint();
}
示例2: ChangeDir
void CFileBrowser::ChangeDir(const std::string& filename, int selection)
{
dprintf(DEBUG_INFO, "CFileBrowser::ChangeDir %s\n", filename.c_str());
std::string newpath;
if((filename == ".."))
{
std::string::size_type pos = Path.substr(0, Path.length()-1).rfind('/');
if (pos == std::string::npos)
{
newpath = Path;
}
else
{
newpath = Path.substr(0, pos + 1);
}
if (strncmp(newpath.c_str(), base.c_str(), base.length()) != 0)
return;
}
else
{
newpath = filename;
}
if((newpath.rfind('/') != newpath.length()-1 || newpath.length() == 0))
{
newpath += '/';
}
Path = newpath;
name = newpath;
CFileList allfiles;
readDir(newpath, &allfiles);
filelist.clear();
// filter
CFileList::iterator file = allfiles.begin();
for(; file != allfiles.end() ; file++)
{
if(Filter != NULL && (!S_ISDIR(file->Mode)) && use_filter)
{
if(!Filter->matchFilter(file->Name))
{
continue;
}
// ts filter
if(Hide_records)
{
int ext_pos = file->Name.rfind('.');
if( ext_pos > 0)
{
std::string extension = file->Name.substr(ext_pos + 1, name.length() - ext_pos);
if(strcasecmp(extension.c_str(), "ts") == 0)
{
std::string fname = file->Name.substr(0, ext_pos) + ".xml";
if(access(fname.c_str(), F_OK) == 0)
continue;
}
}
}
}
if(Dir_Mode && (!S_ISDIR(file->Mode)))
{
continue;
}
filelist.push_back(*file);
}
// sort result
sort(filelist.begin(), filelist.end(), sortBy[g_settings.filebrowser_sortmethod]);
selected = 0;
if ((selection != -1) && (selection < (int)filelist.size()))
selected = selection;
paintHead();
paint();
}