本文整理汇总了C++中ComObjPtr::setModified方法的典型用法代码示例。如果您正苦于以下问题:C++ ComObjPtr::setModified方法的具体用法?C++ ComObjPtr::setModified怎么用?C++ ComObjPtr::setModified使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ComObjPtr
的用法示例。
在下文中一共展示了ComObjPtr::setModified方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: COMSETTER
STDMETHODIMP USBDeviceFilter::COMSETTER(MaskedInterfaces) (ULONG aMaskedIfs)
{
AutoCaller autoCaller(this);
if (FAILED(autoCaller.rc())) return autoCaller.rc();
/* the machine needs to be mutable */
AutoMutableStateDependency adep(mParent->getMachine());
if (FAILED(adep.rc())) return adep.rc();
AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
if (mData->mMaskedIfs != aMaskedIfs)
{
m_fModified = true;
ComObjPtr<Machine> pMachine = mParent->getMachine();
mData.backup();
mData->mMaskedIfs = aMaskedIfs;
// leave the lock before informing callbacks
alock.release();
AutoWriteLock mlock(pMachine COMMA_LOCKVAL_SRC_POS);
pMachine->setModified(Machine::IsModified_USB);
mlock.release();
return mParent->onDeviceFilterChange(this);
}
return S_OK;
}
示例2: usbFilterFieldSetter
/**
* Generic USB filter field setter, expects UTF-8 input.
*
* @param aIdx The field index.
* @param aStr The new value.
*
* @return COM status.
*/
HRESULT USBDeviceFilter::usbFilterFieldSetter(USBFILTERIDX aIdx,
const Utf8Str &strNew)
{
AutoCaller autoCaller(this);
if (FAILED(autoCaller.rc())) return autoCaller.rc();
/* the machine needs to be mutable */
AutoMutableStateDependency adep(mParent->getMachine());
if (FAILED(adep.rc())) return adep.rc();
AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
Utf8Str strOld;
usbFilterFieldToString(&mData->mUSBFilter, aIdx, strOld);
if (strOld != strNew)
{
m_fModified = true;
ComObjPtr<Machine> pMachine = mParent->getMachine();
mData.backup();
Utf8Str errStr;
HRESULT rc = usbFilterFieldFromString(&mData->mUSBFilter, aIdx, strNew, errStr);
if (FAILED(rc))
{
mData.rollback();
return setError(rc, "%s", errStr.c_str());
}
// leave the lock before informing callbacks
alock.release();
AutoWriteLock mlock(pMachine COMMA_LOCKVAL_SRC_POS);
pMachine->setModified(Machine::IsModified_USB);
mlock.release();
return mParent->onDeviceFilterChange(this);
}
return S_OK;
}