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


C++ Component::GetTypeName方法代码示例

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


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

示例1: CloneRecursive

Node* Node::CloneRecursive(Node* parent, SceneResolver& resolver, CreateMode mode)
{
    // Create clone node
    Node* cloneNode = parent->CreateChild(0, (mode == REPLICATED && id_ < FIRST_LOCAL_ID) ? REPLICATED : LOCAL);
    resolver.AddNode(id_, cloneNode);

    // Copy attributes
    const Vector<AttributeInfo>* attributes = GetAttributes();
    for (unsigned j = 0; j < attributes->Size(); ++j)
    {
        const AttributeInfo& attr = attributes->At(j);
        // Do not copy network-only attributes, as they may have unintended side effects
        if (attr.mode_ & AM_FILE)
            cloneNode->SetAttribute(j, GetAttribute(j));
    }

    // Clone components
    for (Vector<SharedPtr<Component> >::ConstIterator i = components_.Begin(); i != components_.End(); ++i)
    {
        Component* component = *i;
        Component* cloneComponent = cloneNode->SafeCreateComponent(component->GetTypeName(), component->GetType(), 
            (mode == REPLICATED && component->GetID() < FIRST_LOCAL_ID) ? REPLICATED : LOCAL, 0);
        if (!cloneComponent)
        {
            LOGERROR("Could not clone component " + component->GetTypeName());
            continue;
        }
        resolver.AddComponent(component->GetID(), cloneComponent);

        const Vector<AttributeInfo>* compAttributes = component->GetAttributes();
        if (compAttributes)
        {
            for (unsigned j = 0; j < compAttributes->Size(); ++j)
            {
                const AttributeInfo& attr = compAttributes->At(j);
                if (attr.mode_ & AM_FILE)
                    cloneComponent->SetAttribute(j, component->GetAttribute(j));
            }
        }
    }

    // Clone child nodes recursively
    for (Vector<SharedPtr<Node> >::ConstIterator i = children_.Begin(); i != children_.End(); ++i)
    {
        Node* node = *i;
        node->CloneRecursive(cloneNode, resolver, mode);
    }

    return cloneNode;
}
开发者ID:Canardian,项目名称:Urho3D,代码行数:50,代码来源:Node.cpp

示例2: InitJun

void PageDetail::InitJun(HTREEITEM hitem)
{
	CString strSubText; //节点名称
	CString strMainText;//节点类型名称
	CString strName;
    CString strType;
	int nNum = 0;
	int nKey;
	int nID;
	HTREEITEM hMainItem = NULL;
    HTREEITEM hSubItem = NULL;
	Component *pTemp = NULL;
	for(int i=1; i< 30; i++)
	{
		nNum = 0;
		IteratorPtr<Component> iteratorPtr(m_pCompManager->CreatJunIterator());
		hMainItem = m_tree.InsertItem(strMainText,hitem);
		for(iteratorPtr->Fist();!iteratorPtr->IsDone();iteratorPtr->Next())
		{
			pTemp = &iteratorPtr->CurrentItem();
			if(i == pTemp->GetID())
			{
				nKey = iteratorPtr->CurrentKey();
				nID = pTemp->GetKey();
				strName = pTemp->GetName(m_pScenario);
				strSubText.Format(_T("J%d(%s)"),nID,strName);
				hSubItem = m_tree.InsertItem(strSubText,hMainItem);
				m_tree.SetItemData(hSubItem,nKey);
				strType = pTemp->GetTypeName();
				nNum++;
			}
		}
		if(nNum != 0)
		{
			strMainText.Format(_T("%s(%d)"),strType,nNum);
			m_tree.SetItemText(hMainItem,strMainText);
			m_tree.SetItemData(hMainItem,2);
		}
		else
		{
			m_tree.DeleteItem(hMainItem);
		}
	}
}
开发者ID:uesoft,项目名称:AutoPFA,代码行数:44,代码来源:PageDetail.cpp

示例3: CloneRecursive

Node* Node::CloneRecursive(Node* parent, SceneResolver& resolver, CreateMode mode)
{
    // Create clone node
    Node* cloneNode = parent->CreateChild(0, (mode == REPLICATED && id_ < FIRST_LOCAL_ID) ? REPLICATED : LOCAL);
    resolver.AddNode(id_, cloneNode);

    // Copy attributes
    unsigned numAttributes = GetNumAttributes();
    for (unsigned j = 0; j < numAttributes; ++j)
        cloneNode->SetAttribute(j, GetAttribute(j));

    // Clone components
    for (Vector<SharedPtr<Component> >::ConstIterator i = components_.Begin(); i != components_.End(); ++i)
    {
        Component* component = *i;
        Component* cloneComponent = cloneNode->CreateComponent(component->GetType(), (mode == REPLICATED && component->GetID() <
            FIRST_LOCAL_ID) ? REPLICATED : LOCAL);
        if (!cloneComponent)
        {
            LOGERROR("Could not clone component " + component->GetTypeName());
            continue;
        }
        resolver.AddComponent(component->GetID(), cloneComponent);

        numAttributes = component->GetNumAttributes();
        for (unsigned j = 0; j < numAttributes; ++j)
            cloneComponent->SetAttribute(j, component->GetAttribute(j));
    }

    // Clone child nodes recursively
    for (Vector<SharedPtr<Node> >::ConstIterator i = children_.Begin(); i != children_.End(); ++i)
    {
        Node* node = *i;
        node->CloneRecursive(cloneNode, resolver, mode);
    }

    return cloneNode;
}
开发者ID:eberan,项目名称:urho3d_old_mirror,代码行数:38,代码来源:Node.cpp


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