本文整理汇总了C++中FileSpecifier::GetType方法的典型用法代码示例。如果您正苦于以下问题:C++ FileSpecifier::GetType方法的具体用法?C++ FileSpecifier::GetType怎么用?C++ FileSpecifier::GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSpecifier
的用法示例。
在下文中一共展示了FileSpecifier::GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Find
bool FileFinder::Find(DirectorySpecifier &dir, Typecode type, bool recursive)
{
// Get list of entries in directory
vector<dir_entry> entries;
if (!dir.ReadDirectory(entries))
return false;
sort(entries.begin(), entries.end());
// Iterate through entries
vector<dir_entry>::const_iterator i, end = entries.end();
for (i = entries.begin(); i != end; i++) {
// Construct full specifier of file/dir
FileSpecifier file = dir + i->name;
if (i->is_directory) {
// Recurse into directory
if (recursive)
if (Find(file, type, recursive))
return true;
} else {
// Check file type and call found() function
if (type == WILDCARD_TYPE || type == file.GetType())
if (found(file))
return true;
}
}
return false;
}
示例2: found_some_file_callback
// ZZZ: code lifted and slightly altered from preferences_macintosh.h
static bool found_some_file_callback(
FileSpecifier& File,
void *data)
{
bool FoundAll = true;
int Filetype = File.GetType();
for(int i = 0; i < NUMBER_OF_FILE_TYPECODES_TO_FIND; i++)
{
if(!file_types_to_find[i].found && Filetype == file_types_to_find[i].type)
{
file_types_to_find[i].found = true;
file_types_to_find[i].file = File;
}
FoundAll &= file_types_to_find[i].found;
}
// Return value indicates whether we want to continue the search
return !FoundAll;
}
示例3: Find
bool FileFinder::Find(DirectorySpecifier &dir, Typecode type, bool recursive)
{
// Get list of entries in directory
vector<dir_entry> entries;
if (!dir.ReadDirectory(entries)) {
return false;
}
sort(entries.begin(), entries.end());
// Iterate through entries
vector<dir_entry>::const_iterator i, end = entries.end();
for (i = entries.begin(); i != end; i++) {
// Construct full specifier of file/dir
FileSpecifier file = dir + i->name;
// DJB Skip our texture directories
if ( dir.GetPathString().find ( "SpriteTextures" ) != string::npos
|| dir.GetPathString().find ( "TTEP" ) != string::npos ) {
// Don't go down these paths
return false;
}
if (i->is_directory) {
// Recurse into directory
if (recursive) {
if (Find(file, type, recursive)) {
return true;
}
}
}
else {
// Check file type and call found() function
if (type == WILDCARD_TYPE || type == file.GetType()) {
if (found(file)) {
return true;
}
}
}
}
return false;
}