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


C++ ArchiveTreeNode::getParent方法代码示例

本文整理汇总了C++中ArchiveTreeNode::getParent方法的典型用法代码示例。如果您正苦于以下问题:C++ ArchiveTreeNode::getParent方法的具体用法?C++ ArchiveTreeNode::getParent怎么用?C++ ArchiveTreeNode::getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArchiveTreeNode的用法示例。


在下文中一共展示了ArchiveTreeNode::getParent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: removeDir

/* Archive::removeDir
 * Deletes the directory matching [path], starting from [base]. If
 * [base] is NULL, the root directory is used. Returns false if
 * the directory does not exist, true otherwise
 *******************************************************************/
bool Archive::removeDir(string path, ArchiveTreeNode* base)
{
	// Abort if read only
	if (read_only)
		return false;

	// Get the dir to remove
	ArchiveTreeNode* dir = getDir(path, base);

	// Check it exists (and that it isn't the root dir)
	if (!dir || dir == getRoot())
		return false;

	// Record undo step
	if (UndoRedo::currentlyRecording())
		UndoRedo::currentManager()->recordUndoStep(new DirCreateDeleteUS(false, dir));

	// Remove the directory from its parent
	if (dir->getParent())
		dir->getParent()->removeChild(dir);

	// Delete the directory
	delete dir;

	// Set the archive state to modified
	setModified(true);

	return true;
}
开发者ID:Aeyesx,项目名称:SLADE,代码行数:34,代码来源:Archive.cpp

示例2: detectNamespace

/* ADatArchive::detectNamespace
 * Returns the namespace that [entry] is within
 *******************************************************************/
string ADatArchive::detectNamespace(ArchiveEntry* entry) {
	// Check entry
	if (!checkEntry(entry))
		return "global";

	// If the entry is in the root dir, it's in the global namespace
	if (entry->getParentDir() == getRoot())
		return "global";

	// Get the entry's *first* parent directory after root (ie <root>/namespace/)
	ArchiveTreeNode* dir = entry->getParentDir();
	while (dir && dir->getParent() != getRoot())
		dir = (ArchiveTreeNode*)dir->getParent();

	// Namespace is the directory's name (in lowercase)
	if (dir)
		return dir->getName().Lower();
	else
		return "global"; // Error, just return global
}
开发者ID:doomtech,项目名称:slade,代码行数:23,代码来源:ADatArchive.cpp

示例3: deleteBookmarksInDir

/* ArchiveManager::deleteBookmarksInDir
 * Removes any bookmarked entries in [node] from the list
 *******************************************************************/
bool ArchiveManager::deleteBookmarksInDir(ArchiveTreeNode* node)
{
	// Go through bookmarks
	Archive * archive = node->getArchive();
	bool removed = deleteBookmark(node->getDirEntry());
	for (unsigned a = 0; a < bookmarks.size(); ++a)
	{
		// Check bookmarked entry's parent archive
		if (bookmarks[a]->getParent() == archive)
		{
			// Now check if the bookmarked entry is within 
			// the removed dir or one of its descendants
			ArchiveTreeNode* anode = bookmarks[a]->getParentDir();
			bool remove = false;
			while (anode != archive->getRoot() && !remove)
			{
				if (anode == node)
					remove = true;
				else anode = (ArchiveTreeNode*)anode->getParent();
			}
			if (remove)
			{
				bookmarks.erase(bookmarks.begin() + a);
				--a;
				removed = true;
			}
		}
	}

	if (removed)
	{
		// Announce
		announce("bookmarks_changed");
		return true;
	}
	else
		return false;
}
开发者ID:Genghoidal,项目名称:SLADE,代码行数:41,代码来源:ArchiveManager.cpp


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