本文整理汇总了C++中TFilePath::isAncestorOf方法的典型用法代码示例。如果您正苦于以下问题:C++ TFilePath::isAncestorOf方法的具体用法?C++ TFilePath::isAncestorOf怎么用?C++ TFilePath::isAncestorOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFilePath
的用法示例。
在下文中一共展示了TFilePath::isAncestorOf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeFolder
void TLevelSet::removeFolder(const TFilePath &folder) {
if (folder == m_defaultFolder) return;
std::vector<TFilePath> folders;
for (int i = 0; i < (int)m_folders.size(); i++)
if (!folder.isAncestorOf(m_folders[i])) folders.push_back(m_folders[i]);
folders.swap(m_folders);
std::map<TXshLevel *, TFilePath>::iterator it;
for (it = m_folderTable.begin(); it != m_folderTable.end(); ++it) {
if (folder.isAncestorOf(it->second)) it->second = m_defaultFolder;
}
}
示例2: TFilePath
TFilePath TFilePath::operator-(const TFilePath &fp) const {
#ifdef WIN32
if (toLower(m_path) == toLower(fp.m_path)) return TFilePath("");
#else
if (m_path == fp.m_path) return TFilePath("");
#endif
if (!fp.isAncestorOf(*this)) return *this;
int len = fp.m_path.length();
if (len == 0 || fp.m_path[len - 1] != slash) len++;
return TFilePath(m_path.substr(len));
}
示例3: renameFolder
TFilePath TLevelSet::renameFolder(const TFilePath &folder,
const std::wstring &newName) {
// Impedisco la creazione di folder con nome "" che creano problemi
// (praticamente Ecome se avessero infinite sottocartelle)
if (newName == L"") return folder;
TFilePath folder2 = folder.withName(newName);
for (int i = 0; i < (int)m_folders.size(); i++) {
if (folder == m_folders[i])
m_folders[i] = folder2;
else if (folder.isAncestorOf(m_folders[i]))
m_folders[i] = folder2 + (m_folders[i] - folder);
}
if (m_defaultFolder == folder) m_defaultFolder = folder2;
std::map<TXshLevel *, TFilePath>::iterator it;
for (it = m_folderTable.begin(); it != m_folderTable.end(); ++it) {
if (folder == it->second)
it->second = folder2;
else if (folder.isAncestorOf(it->second))
it->second = folder2 + (it->second - folder);
}
return folder2;
}