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


C++ ComObjPtr::reference方法代码示例

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


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

示例1: loadSettings

/**
 *  Loads settings from the given adapter node.
 *  May be called once right after this object creation.
 *
 *  @param aAdapterNode <Adapter> node.
 *
 *  @note Locks this object for writing.
 */
HRESULT NetworkAdapter::loadSettings(BandwidthControl *bwctl,
                                     const settings::NetworkAdapter &data)
{
    AutoCaller autoCaller(this);
    AssertComRCReturnRC(autoCaller.rc());

    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);

    /* Note: we assume that the default values for attributes of optional
     * nodes are assigned in the Data::Data() constructor and don't do it
     * here. It implies that this method may only be called after constructing
     * a new BIOSSettings object while all its data fields are in the default
     * values. Exceptions are fields whose creation time defaults don't match
     * values that should be applied when these fields are not explicitly set
     * in the settings file (for backwards compatibility reasons). This takes
     * place when a setting of a newly created object must default to A while
     * the same setting of an object loaded from the old settings file must
     * default to B. */

    HRESULT rc = S_OK;

    mData->mAdapterType = data.type;
    mData->mEnabled = data.fEnabled;
    /* MAC address (can be null) */
    rc = updateMacAddress(data.strMACAddress);
    if (FAILED(rc)) return rc;
    /* cable (required) */
    mData->mCableConnected = data.fCableConnected;
    /* line speed (defaults to 100 Mbps) */
    mData->mLineSpeed = data.ulLineSpeed;
    mData->mPromiscModePolicy = data.enmPromiscModePolicy;
    /* tracing (defaults to false) */
    mData->mTraceEnabled = data.fTraceEnabled;
    mData->mTraceFile = data.strTraceFile;
    /* boot priority (defaults to 0, i.e. lowest) */
    mData->mBootPriority = data.ulBootPriority;
    /* bandwidth group */
    mData->mBandwidthGroup = data.strBandwidthGroup;
    if (mData->mBandwidthGroup.isNotEmpty())
    {
        ComObjPtr<BandwidthGroup> group;
        rc = bwctl->getBandwidthGroupByName(data.strBandwidthGroup, group, true);
        if (FAILED(rc)) return rc;
        group->reference();
    }

    mNATEngine->loadSettings(data.nat);
    mData->mBridgedInterface = data.strBridgedName;
    mData->mInternalNetwork = data.strInternalNetworkName;
    mData->mHostOnlyInterface = data.strHostOnlyName;
    mData->mGenericDriver = data.strGenericDriver;
    mData->mGenericProperties = data.genericProperties;

    // leave the lock before setting attachment type
    alock.release();

    rc = COMSETTER(AttachmentType)(data.mode);
    if (FAILED(rc)) return rc;

    // after loading settings, we are no longer different from the XML on disk
    m_fModified = false;

    return S_OK;
}
开发者ID:,项目名称:,代码行数:72,代码来源:


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