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


C++ Ref::Get方法代码示例

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


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

示例1: ReadRef

// ReadRef
//------------------------------------------------------------------------------
bool TextReader::ReadRef()
{
    // Name
    AStackString<> name;
    if ( !GetToken( name ) )
    {
        Error( "Missing ref name" );
        return false;
    }

    AStackString<> value;
    if ( !GetString( value ) )
    {
        Error( "Missing ref value" );
        return false;
    }

    Ref< RefObject > ref;
    if ( value != "null" )
    {
        ref = (RefObject *)ReflectionInfo::CreateObject( value );
        if ( ref.Get() == nullptr )
        {
            Error( "Unable to create sub-object" );
            ASSERT( false ); // TODO: Handle failure/skipping gracefully
            return false;
        }
    }

    const StackFrame & sf = m_DeserializationStack.Top();

    if ( sf.m_ArrayProperty )
    {
        void * arrayBase = (void *)( (size_t)sf.m_Base + (size_t)sf.m_ArrayProperty->GetOffset() );
        Array< Ref< RefObject > > *array = ( Array< Ref< RefObject > > *)( arrayBase );
        array->Append( ref );
    }
    else
    {
        sf.m_Reflection->SetProperty( sf.m_Base, name.Get(), ref );
    }

    // do sub-object properties if needed
    if ( ref.Get() )
    {
        StackFrame newFrame;
        newFrame.m_Base = (void *)ref.Get();
        newFrame.m_Reflection = ref->GetReflectionInfoV();
        newFrame.m_ArrayProperty = nullptr;
        #ifdef DEBUG
            newFrame.m_RefObject = ref.Get();
            newFrame.m_Struct = nullptr;
        #endif
        m_DeserializationStack.Append( newFrame );
    }

    return true;
}
开发者ID:dontnod,项目名称:fastbuild,代码行数:60,代码来源:TextReader.cpp

示例2: AddChild

nsresult mozApocPolicyModelNode::AddChild(Ref const & aNode)
{
    NS_PRECONDITION(aNode, "apoc - Trying to add a NULL node as child");
    NS_PRECONDITION(!aNode->mNext, "apoc - Trying to add an entire list as child");
    NS_PRECONDITION(! ImplGetChild(aNode->mName), "apoc - Child being added already exists");
    
    MODEL_TRACE(stderr, "apoc data model: Adding Node '%s' at %p as new child to Node '%s' at %p\n", 
                PromiseFlatCString(aNode->mName).get(), (void*)aNode.Get(), 
                PromiseFlatCString(mName).get(), (void*)this ); 

    aNode->mNext = mChildren;
    mChildren = aNode;

    return NS_OK;
}
开发者ID:freedesktop-unofficial-mirror,项目名称:apoc-firefox-adapter,代码行数:15,代码来源:mozApocPolicyModel.cpp


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