本文整理汇总了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;
}
示例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);
}
}
}
示例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;
}