本文整理汇总了C++中DocumentPtr::ReferencesObject方法的典型用法代码示例。如果您正苦于以下问题:C++ DocumentPtr::ReferencesObject方法的具体用法?C++ DocumentPtr::ReferencesObject怎么用?C++ DocumentPtr::ReferencesObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentPtr
的用法示例。
在下文中一共展示了DocumentPtr::ReferencesObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CloseDocument
///////////////////////////////////////////////////////////////////////////////
// Closes the specified file. Determines if the file needs to be saved, and
// handles any other revision control interactions. Notifies any interested
// listeners if the file is successfully closed. If prompt is set to true,
// the user will be prompted to save their file before it is closed.
//
// Fires an event to notify listeners that this document is now closed. Any
// objects that are holding pointers to this document should release them.
//
bool DocumentManager::CloseDocument( DocumentPtr document, bool prompt )
{
HELIUM_ASSERT( document.ReferencesObject() );
bool shouldClose = !prompt;
bool wasClosed = false;
if ( prompt )
{
std::string unused;
switch ( QueryClose( document ) )
{
case SaveActions::Save:
shouldClose = SaveDocument( document, unused );
break;
case SaveActions::Skip:
shouldClose = true;
break;
case SaveActions::Abort:
shouldClose = false;
break;
case SaveActions::SaveAll:
case SaveActions::SkipAll:
break;
}
}
if ( shouldClose )
{
// This will raise the e_Closed event when the document is finished closing and
// callback to OnDocumentClosed, which will remove the document from m_Documents
document->Close();
wasClosed = true;
}
return wasClosed;
}