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


C++ DocumentPtr::ReferencesObject方法代码示例

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


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