本文整理汇总了C++中ArchiveTreeNode::removeEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ ArchiveTreeNode::removeEntry方法的具体用法?C++ ArchiveTreeNode::removeEntry怎么用?C++ ArchiveTreeNode::removeEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArchiveTreeNode
的用法示例。
在下文中一共展示了ArchiveTreeNode::removeEntry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeEntry
/* Archive::removeEntry
* Removes [entry] from the archive. If [delete_entry] is true, the
* entry will also be deleted. Returns true if the removal succeeded
*******************************************************************/
bool Archive::removeEntry(ArchiveEntry* entry, bool delete_entry)
{
// Abort if read only
if (read_only)
return false;
// Check entry
if (!checkEntry(entry))
return false;
// Check if entry is locked
if (entry->isLocked())
return false;
// Get its directory
ArchiveTreeNode* dir = entry->getParentDir();
// Error if entry has no parent directory
if (!dir)
return false;
// Create undo step
if (UndoRedo::currentlyRecording())
UndoRedo::currentManager()->recordUndoStep(new EntryCreateDeleteUS(false, entry));
// Get the entry index
int index = dir->entryIndex(entry);
// Announce (before actually removing in case entry is still needed)
MemChunk mc;
wxUIntPtr ptr = wxPtrToUInt(entry);
mc.write(&index, sizeof(int));
mc.write(&ptr, sizeof(wxUIntPtr));
announce("entry_removing", mc);
// Remove it from its directory
bool ok = dir->removeEntry(index);
// If it was removed ok
if (ok)
{
// Announce removed
announce("entry_removed", mc);
// Delete if necessary
if (delete_entry)
delete entry;
// Update variables etc
setModified(true);
}
return ok;
}