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


C++ BDiskDevice::Unset方法代码示例

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


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

示例1: Visit

/*!	\brief Pre-order traverses the trees spanned by the BDiskDevices and their
		   subobjects.

	The supplied visitor's Visit(BDiskDevice*) method is invoked for each
	disk device and Visit(BPartition*) for each (non-disk device) partition.
	If Visit() returns \c true, the iteration is terminated and this method
	returns \c true. If supplied, \a device is set to the concerned device
	and in \a partition the pointer to the partition object is returned.

	\param visitor The visitor.
	\param device Pointer to a pre-allocated BDiskDevice to be initialized
		   to the device at which the iteration was terminated.
		   May be \c NULL.
	\param partition Pointer to a pre-allocated BPartition pointer to be set
		   to the partition at which the iteration was terminated.
		   May be \c NULL.
	\return \c true, if the iteration was terminated, \c false otherwise.
*/
bool
BDiskDeviceRoster::VisitEachPartition(BDiskDeviceVisitor* visitor,
	BDiskDevice* device, BPartition** partition)
{
	bool terminatedEarly = false;
	if (visitor) {
		int32 oldCookie = fDeviceCookie;
		fDeviceCookie = 0;
		BDiskDevice deviceOnStack;
		BDiskDevice* useDevice = device ? device : &deviceOnStack;
		BPartition* foundPartition = NULL;
		while (GetNextDevice(useDevice) == B_OK) {
			foundPartition = useDevice->VisitEachDescendant(visitor);
			if (foundPartition) {
				terminatedEarly = true;
				break;
			}
		}
		fDeviceCookie = oldCookie;
		if (!terminatedEarly)
			useDevice->Unset();
		else if (device && partition)
			*partition = foundPartition;
	}
	return terminatedEarly;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:44,代码来源:DiskDeviceRoster.cpp


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