本文整理汇总了C++中std::shared_ptr::AddChild方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_ptr::AddChild方法的具体用法?C++ shared_ptr::AddChild怎么用?C++ shared_ptr::AddChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::shared_ptr
的用法示例。
在下文中一共展示了shared_ptr::AddChild方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseModel
void AssimpParser::ParseModel(aiNode* node, std::shared_ptr<SceneNode> sceneNode)
{
std::shared_ptr<SceneNode> newNode = std::shared_ptr<SceneNode>(new SceneNode(std::string(node->mName.C_Str())));
for(int i=0; i<node->mNumMeshes; i++)
{
int meshIndex = node->mMeshes[i];
aiMesh* mesh = scene->mMeshes[meshIndex];
std::shared_ptr<SceneMesh> newMesh = std::shared_ptr<SceneMesh>(new SceneMesh());
newNode->AddMesh(newMesh);
ParseMesh(newMesh, mesh);
}
if(sceneNode != nullptr)
{
sceneNode->AddChild(newNode);
}
for(int i=0; i<node->mNumChildren; i++)
{
aiNode* child = node->mChildren[i];
ParseModel(child, newNode);
}
}
示例2: AddToNode
void TAstNodeForSentence::AddToNode(TLexer* const lexer, std::shared_ptr<TToken> token, std::shared_ptr<TAstNode> result)
{
if (lexer->GetToken()->Type() != TOKEN_TYPE::STRUCTURE_TO)
{
throw TInterpreterException(TInterpreterException::WRONG_GRAMMAR, token->LineNumber());
}
result->AddChild(TAstNodeOperator::GetAstNode(lexer));
}
示例3: _DeepCopy
void _DeepCopy(std::shared_ptr<touchmind::model::node::NodeModel> srcParent,
std::shared_ptr<touchmind::model::node::NodeModel> destParent) {
for (size_t i = 0; i < srcParent->GetActualChildrenCount(); ++i) {
auto srcChild = srcParent->GetChild(i);
auto destChild = touchmind::model::node::NodeModel::Create(*srcChild.get());
destChild->RemoveAllChildren();
destParent->AddChild(destChild);
_DeepCopy(srcChild, destChild);
}
}
示例4:
/** \brief Save this item to an XML node
* \param node The node we are going to be a child of
* \returns Created XML node
*/
std::shared_ptr<xmlnode::CXmlNode> CTile::XmlSave(const std::shared_ptr<xmlnode::CXmlNode> &node)
{
auto itemNode = node->AddChild(L"tile");
itemNode->SetAttribute(L"x", mX);
itemNode->SetAttribute(L"y", mY);
itemNode->SetAttribute(L"zoning", (int)mZoning);
return itemNode;
}
示例5: GetX
/** \brief Save this item to an XML node
* \param node The node we are going to be a child of
* \returns A pointer to our fish node
*/
std::shared_ptr<xmlnode::CXmlNode> CFish::XmlSave(const std::shared_ptr<xmlnode::CXmlNode> &node)
{
auto itemNode = node->AddChild(L"item");
itemNode->SetAttribute(L"x", GetX());
itemNode->SetAttribute(L"y", GetY());
itemNode->SetAttribute(L"speedx", mSpeedX);
itemNode->SetAttribute(L"speedy", mSpeedY);
itemNode->SetAttribute(L"canBreed", mCanBreed);
itemNode->SetAttribute(L"isInterested", mIsInterested);
itemNode->SetAttribute(L"isMale", mIsMale);
itemNode->SetAttribute(L"isGestating", mIsGestating);
itemNode->SetAttribute(L"interestTime", mInterestTime);
itemNode->SetAttribute(L"gestatingTime", mGestatingTime);
itemNode->SetAttribute(L"feedingTime", mTimeFeeding);
itemNode->SetAttribute(L"isHungry", mIsHungry);
itemNode->SetAttribute(L"age", mAge);
return itemNode;
}