本文整理汇总了C++中Folder::refresh方法的典型用法代码示例。如果您正苦于以下问题:C++ Folder::refresh方法的具体用法?C++ Folder::refresh怎么用?C++ Folder::refresh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Folder
的用法示例。
在下文中一共展示了Folder::refresh方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newChildFolder
Folder* LocalFolder::newChildFolder(string Name) {
//If the name is invalid return 0
if (Name.empty())
return 0;
//If it already exists bottle out return 0
if (searchForChild(Name) != 0)
return 0;
Folder* returnFolder = 0;
//Generate the file path
string fullPath = m_localFolderPath + Name + "/";
if (mkdir(fullPath.c_str(), 0) == 0) {
returnFolder = new LocalFolder(Name, fullPath);
returnFolder->refresh();
m_entryList.push_back(returnFolder);
}
return returnFolder;
}
示例2: refresh
void LocalFolder::refresh() {
#warning May not be compatable with Windows 32
emptyList();
DIR* dir = opendir(m_localFolderPath.c_str());
struct dirent* nextEntry;
if (dir != 0) {
while (true) {
nextEntry = readdir(dir);
if (nextEntry != 0) {
//Check it isn't the current or parent indicators
if (strcmp(nextEntry->d_name, ".") == 0) {
//Do nothing for this dir
} else if (strcmp(nextEntry->d_name, "..") == 0) {
//Do nothing for the dir the level above
} else {
//if its not process it
if (nextEntry->d_type == DT_DIR) {
//Directory
string fullPath = m_localFolderPath + nextEntry->d_name
+ "/";
Folder* subFolder = new LocalFolder(nextEntry->d_name,
fullPath);
subFolder->refresh();
m_entryList.push_back(subFolder);
} else {
//File
string fullPath = m_localFolderPath + nextEntry->d_name;
m_entryList.push_back(new LocalFile(fullPath));
}
}
} else {
break;
}
}
closedir(dir);
dir = 0;
}
}