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


C++ shared_ptr::AddChild方法代码示例

本文整理汇总了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);
	}
}
开发者ID:EiffelOberon,项目名称:WRenderer,代码行数:26,代码来源:AssimpParser.cpp

示例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));
}
开发者ID:6VV,项目名称:NewTeachingBox,代码行数:9,代码来源:TAstNodeForSentence.cpp

示例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);
  }
}
开发者ID:yohei-yoshihara,项目名称:TouchMind,代码行数:10,代码来源:NodeModel.cpp

示例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;
}
开发者ID:rachel-polus,项目名称:cse335,代码行数:14,代码来源:Tile.cpp

示例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;
}
开发者ID:Hutecker,项目名称:Aquarium-Project,代码行数:27,代码来源:Fish.cpp


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