当前位置: 首页>>代码示例>>C++>>正文


C++ Folder::refresh方法代码示例

本文整理汇总了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;
}
开发者ID:jawline,项目名称:Virtus,代码行数:25,代码来源:LocalFolder.cpp

示例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;
	}

}
开发者ID:jawline,项目名称:Virtus,代码行数:58,代码来源:LocalFolder.cpp


注:本文中的Folder::refresh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。