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


C++ TiXmlElement函数代码示例

本文整理汇总了C++中TiXmlElement函数的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlElement函数的具体用法?C++ TiXmlElement怎么用?C++ TiXmlElement使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: SendMessage

void ProjectPanel::buildProjectXml(TiXmlNode *node, HTREEITEM hItem, const TCHAR* fn2write)
{
    TCHAR textBuffer[MAX_PATH];
    TVITEM tvItem;
    tvItem.mask = TVIF_TEXT | TVIF_PARAM;
    tvItem.pszText = textBuffer;
    tvItem.cchTextMax = MAX_PATH;

    for (HTREEITEM hItemNode = _treeView.getChildFrom(hItem);
            hItemNode != NULL;
            hItemNode = _treeView.getNextSibling(hItemNode))
    {
        tvItem.hItem = hItemNode;
        SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem);
        if (tvItem.lParam != NULL)
        {
            generic_string *fn = (generic_string *)tvItem.lParam;
            generic_string newFn = getRelativePath(*fn, fn2write);
            TiXmlNode *fileLeaf = node->InsertEndChild(TiXmlElement(TEXT("File")));
            fileLeaf->ToElement()->SetAttribute(TEXT("name"), newFn.c_str());
        }
        else
        {
            TiXmlNode *folderNode = node->InsertEndChild(TiXmlElement(TEXT("Folder")));
            folderNode->ToElement()->SetAttribute(TEXT("name"), tvItem.pszText);
            buildProjectXml(folderNode, hItemNode, fn2write);
        }
    }
}
开发者ID:tuduf,项目名称:notepad-plus-plus,代码行数:29,代码来源:ProjectPanel.cpp

示例2: TiXmlElement

TiXmlElement* TransformComponent::GenerateXml()
{
	TiXmlElement* pBaseElement = CB_NEW TiXmlElement(GetName());

	// initial transform -> position
	TiXmlElement* pPosition = CB_NEW TiXmlElement("Position");
	Vec3 pos(m_Transform.GetPosition());
	pPosition->SetAttribute("x", ToStr(pos.x).c_str());
	pPosition->SetAttribute("y", ToStr(pos.y).c_str());
	pPosition->SetAttribute("z", ToStr(pos.z).c_str());
	pBaseElement->LinkEndChild(pPosition);

	// initial transform -> LookAt
	TiXmlElement* pDirection = CB_NEW TiXmlElement("YawPitchRoll");
	Vec3 orient(m_Transform.GetYawPitchRoll());
	orient.x = RADIANS_TO_DEGREES(orient.x);
	orient.y = RADIANS_TO_DEGREES(orient.y);
	orient.z = RADIANS_TO_DEGREES(orient.z);
	pDirection->SetAttribute("x", ToStr(orient.x).c_str());
	pDirection->SetAttribute("y", ToStr(orient.y).c_str());
	pDirection->SetAttribute("z", ToStr(orient.z).c_str());
	pBaseElement->LinkEndChild(pDirection);

	return pBaseElement;
}
开发者ID:deanmarsinelli,项目名称:City-Protectors,代码行数:25,代码来源:TransformComponent.cpp

示例3: writeBone

    //---------------------------------------------------------------------
    void XMLSkeletonSerializer::writeSkeleton(const Skeleton* pSkel)
    {
        TiXmlElement* rootNode = mXMLDoc->RootElement();

        TiXmlElement* bonesElem = 
            rootNode->InsertEndChild(TiXmlElement("bones"))->ToElement();

        unsigned short numBones = pSkel->getNumBones();
		LogManager::getSingleton().logMessage("There are " + StringConverter::toString(numBones) + " bones.");
        unsigned short i;
        for (i = 0; i < numBones; ++i)
        {
			LogManager::getSingleton().logMessage("   Exporting Bone number " + StringConverter::toString(i));
            Bone* pBone = pSkel->getBone(i);
            writeBone(bonesElem, pBone);
        }

        // Write parents
        TiXmlElement* hierElem = 
            rootNode->InsertEndChild(TiXmlElement("bonehierarchy"))->ToElement();
        for (i = 0; i < numBones; ++i)
        {
            Bone* pBone = pSkel->getBone(i);
			String name = pBone->getName() ;

			if ((pBone->getParent())!=NULL) // root bone
            {
                Bone* pParent = (Bone*)pBone->getParent();
                writeBoneParent(hierElem, name, pParent->getName());
            }
        }


    }
开发者ID:Strongc,项目名称:game-ui-solution,代码行数:35,代码来源:OgreXMLSkeletonSerializer.cpp

示例4: switch

bool wxsMenuItem::OnXmlWrite(TiXmlElement* Element,bool IsXRC,bool IsExtra)
{
    bool Ret = wxsParent::OnXmlWrite(Element,IsXRC,IsExtra);

    if ( IsXRC )
    {
        // Type information is stored differently
        switch ( m_Type )
        {
            case Separator:
                Element->SetAttribute("class","separator");
                break;

            case Break:
                Element->SetAttribute("class","break");
                break;

            case Radio:
                Element->InsertEndChild(TiXmlElement("radio"))->ToElement()->InsertEndChild(TiXmlText("1"));
                break;

            case Check:
                Element->InsertEndChild(TiXmlElement("checkable"))->ToElement()->InsertEndChild(TiXmlText("1"));
                break;

            case Normal:
                break;
        }
    }

    return Ret;
}
开发者ID:DowerChest,项目名称:codeblocks,代码行数:32,代码来源:wxsmenuitem.cpp

示例5: switch

bool wxsToolBarItem::OnXmlWrite(TiXmlElement* Element,bool IsXRC,bool IsExtra)
{
    bool Ret = wxsParent::OnXmlWrite(Element,IsXRC,IsExtra);

    if ( IsXRC )
    {
        Element->SetAttribute("class","tool");

        switch ( m_Type )
        {
            case Separator:
                Element->SetAttribute("class","separator");
                break;

            case Radio:
                Element->InsertEndChild(TiXmlElement("radio"))->ToElement()->InsertEndChild(TiXmlText("1"));
                break;

            case Check:
                Element->InsertEndChild(TiXmlElement("check"))->ToElement()->InsertEndChild(TiXmlText("1"));
                break;

            case Normal:
                break;
        }
    }

    return Ret;
}
开发者ID:DowerChest,项目名称:codeblocks,代码行数:29,代码来源:wxstoolbaritem.cpp

示例6: projDoc

bool ProjectPanel::writeWorkSpace(TCHAR *projectFileName)
{
    //write <NotepadPlus>: use the default file name if new file name is not given
    const TCHAR * fn2write = projectFileName?projectFileName:_workSpaceFilePath.c_str();
    TiXmlDocument projDoc(fn2write);
    TiXmlNode *root = projDoc.InsertEndChild(TiXmlElement(TEXT("NotepadPlus")));

    TCHAR textBuffer[MAX_PATH];
    TVITEM tvItem;
    tvItem.mask = TVIF_TEXT;
    tvItem.pszText = textBuffer;
    tvItem.cchTextMax = MAX_PATH;

    //for each project, write <Project>
    HTREEITEM tvRoot = _treeView.getRoot();
    if (!tvRoot)
        return false;

    for (HTREEITEM tvProj = _treeView.getChildFrom(tvRoot);
            tvProj != NULL;
            tvProj = _treeView.getNextSibling(tvProj))
    {
        tvItem.hItem = tvProj;
        SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem);
        //printStr(tvItem.pszText);

        TiXmlNode *projRoot = root->InsertEndChild(TiXmlElement(TEXT("Project")));
        projRoot->ToElement()->SetAttribute(TEXT("name"), tvItem.pszText);
        buildProjectXml(projRoot, tvProj, fn2write);
    }
    projDoc.SaveFile();
    return true;
}
开发者ID:tuduf,项目名称:notepad-plus-plus,代码行数:33,代码来源:ProjectPanel.cpp

示例7: TiXmlElement

TiXmlElement* TransformComponent::VGenerateXml(void)
{
    TiXmlElement* pBaseElement = AC_NEW TiXmlElement(VGetName());

    // initial transform -> position
    TiXmlElement* pPosition = AC_NEW TiXmlElement("Position");
    Vec3 pos(m_transform.GetPosition());
    pPosition->SetAttribute("x", ToStr(pos.x).c_str());
    pPosition->SetAttribute("y", ToStr(pos.y).c_str());
    pPosition->SetAttribute("z", ToStr(pos.z).c_str());
    pBaseElement->LinkEndChild(pPosition);

    // initial transform -> LookAt
    TiXmlElement* pDirection = AC_NEW TiXmlElement("YawPitchRoll");
	Vec3 orient(m_transform.GetYawPitchRoll());
	orient.x = RADIANS_TO_DEGREES(orient.x);
	orient.y = RADIANS_TO_DEGREES(orient.y);
	orient.z = RADIANS_TO_DEGREES(orient.z);
    pDirection->SetAttribute("x", ToStr(orient.x).c_str());
    pDirection->SetAttribute("y", ToStr(orient.y).c_str());
    pDirection->SetAttribute("z", ToStr(orient.z).c_str());
    pBaseElement->LinkEndChild(pDirection);

	/***
	// This is not supported yet
    // initial transform -> position
    TiXmlElement* pScale = AC_NEW TiXmlElement("Scale");
    pPosition->SetAttribute("x", ToStr(m_scale.x).c_str());
    pPosition->SetAttribute("y", ToStr(m_scale.y).c_str());
    pPosition->SetAttribute("z", ToStr(m_scale.z).c_str());
    pBaseElement->LinkEndChild(pScale);
	**/

    return pBaseElement;
}
开发者ID:JDHDEV,项目名称:AlphaEngine,代码行数:35,代码来源:TransformComponent.cpp

示例8: TiXmlElement

//------------------------------------------------------------------------------
void CToolsHistory::SaveFile(  )
{
	TiXmlDocument aDoc;
	TiXmlNode* pRootNode = aDoc.InsertEndChild( TiXmlElement( "cache" ));

	TiXmlNode* pSceneNode = pRootNode->InsertEndChild( TiXmlElement("Scenes"));
	TiXmlNode* pPathsNode = pRootNode->InsertEndChild( TiXmlElement("paths"));

	//Scene
	for( unsigned i=0; i<m_sceneHistory.size(); ++i )
	{
		TiXmlElement aHistoryNode("history");
		aHistoryNode.SetAttribute("Scene", m_sceneHistory[i].first.c_str());
		aHistoryNode.SetAttribute("path", m_sceneHistory[i].second.c_str());
		pSceneNode->InsertEndChild(aHistoryNode);
	}

	//path
	for( unsigned i=0; i<m_pathHistory.size(); ++i )
	{
		TiXmlElement aHistoryNode("history");
		aHistoryNode.SetAttribute("path", m_pathHistory[i].c_str());
		pPathsNode->InsertEndChild(aHistoryNode);
	}

	//default editor
	TiXmlElement aEditorNode("default_editor");
	aEditorNode.SetAttribute("path", m_strDefaultEditor.c_str());
	pRootNode->InsertEndChild(aEditorNode);

	aDoc.SaveFile(m_strCacheFile.c_str());
}
开发者ID:Abyss116,项目名称:libguiex,代码行数:33,代码来源:toolshistory.cpp

示例9: writeAnimation

    //---------------------------------------------------------------------
    void XMLSkeletonSerializer::writeAnimation(TiXmlElement* animsNode, 
        const Animation* anim)
    {
        TiXmlElement* animNode = 
            animsNode->InsertEndChild(TiXmlElement("animation"))->ToElement();

        animNode->SetAttribute("name", anim->getName());
        animNode->SetAttribute("length", StringConverter::toString(anim->getLength()));
		
		// Optional base keyframe information
		if (anim->getUseBaseKeyFrame())
		{
			TiXmlElement* baseInfoNode = 
				animNode->InsertEndChild(TiXmlElement("baseinfo"))->ToElement();
			baseInfoNode->SetAttribute("baseanimationname", anim->getBaseKeyFrameAnimationName());
			baseInfoNode->SetAttribute("basekeyframetime", StringConverter::toString(anim->getBaseKeyFrameTime()));
		}

        // Write all tracks
        TiXmlElement* tracksNode = 
            animNode->InsertEndChild(TiXmlElement("tracks"))->ToElement();

        Animation::NodeTrackIterator trackIt = anim->getNodeTrackIterator();
        while (trackIt.hasMoreElements())
        {
            writeAnimationTrack(tracksNode, trackIt.getNext());
        }

    }
开发者ID:redkaras,项目名称:Demi3D,代码行数:30,代码来源:OgreXMLSkeletonSerializer.cpp

示例10: WriteConfiguration

void wxsProject::WriteConfiguration(TiXmlElement* element)
{
    TiXmlElement* SmithElement = element->FirstChildElement("wxsmith");

    if ( !m_GUI && m_Resources.empty() && m_UnknownConfig.NoChildren() && m_UnknownResources.NoChildren() )
    {
        // Nothing to write
        if ( SmithElement )
        {
            element->RemoveChild(SmithElement);
        }
        return;
    }

    if ( !SmithElement )
    {
		SmithElement = element->InsertEndChild(TiXmlElement("wxsmith"))->ToElement();
    }
	SmithElement->Clear();
    SmithElement->SetAttribute("version",CurrentVersionStr);

    // saving GUI item
    if ( m_GUI )
    {
        TiXmlElement* GUIElement = SmithElement->InsertEndChild(TiXmlElement("gui"))->ToElement();
        GUIElement->SetAttribute("name",cbU2C(m_GUI->GetName()));
        m_GUI->WriteConfig(GUIElement);
    }

    // saving resources
    if ( !m_Resources.empty() || !m_UnknownResources.NoChildren() )
    {
        TiXmlElement* ResElement = SmithElement->InsertEndChild(TiXmlElement("resources"))->ToElement();
        size_t Count = m_Resources.Count();
        for ( size_t i=0; i<Count; i++ )
        {
            const wxString& Name = m_Resources[i]->GetResourceName();
            const wxString& Type = m_Resources[i]->GetResourceType();
            TiXmlElement* Element = ResElement->InsertEndChild(TiXmlElement(cbU2C(Type)))->ToElement();
            // TODO: Check value returned from WriteConfig
            m_Resources[i]->WriteConfig(Element);
            Element->SetAttribute("name",cbU2C(Name));
        }

        // Saving all unknown resources
        for ( TiXmlNode* Node = m_UnknownResources.FirstChild(); Node; Node=Node->NextSibling() )
        {
            SmithElement->InsertEndChild(*Node);
        }
    }

    // Saving all unknown configuration nodes
    for ( TiXmlNode* Node = m_UnknownConfig.FirstChild(); Node; Node=Node->NextSibling() )
    {
        SmithElement->InsertEndChild(*Node);
    }

}
开发者ID:469306621,项目名称:Languages,代码行数:58,代码来源:wxsproject.cpp

示例11: _Encode

static int _Encode( TiXmlNode *pNode, sqbind::CSqMulti *pData, int bIndexed, int nDepth = 0 )
{_STT();
	if ( !pNode || !pData )
		return 0;

	// For each element
	for ( sqbind::CSqMulti::iterator it = pData->list().begin(); it != pData->list().end(); it++ )
	{
		// Key name?
		if ( it->first == oexT( "$" ) )
			; // Ignore

		else
		{
			// Is it just an attribute
			if ( nDepth && !it->second.size() )
			{
				((TiXmlElement*)pNode)->SetAttribute( oexStrToMbPtr( it->first.c_str() ), oexStrToMbPtr( it->second.str().c_str() ) );

			} // end else if

			// Handle nested tag
			else
			{
				TiXmlNode *pItem = oexNULL;

				if ( !bIndexed )
				{	if ( it->first.length() )
						pItem = pNode->InsertEndChild( TiXmlElement( oexStrToMbPtr( it->first.c_str() ) ) );
				} // end if

				else if ( it->second.isset( oexT( "$" ) ) && it->second[ oexT( "$" ) ].str().length() )
					pItem = pNode->InsertEndChild( TiXmlElement( oexStrToMbPtr( it->second[ oexT( "$" ) ].str().c_str() ) ) );

				// Did we get an item?
				if ( pItem )
				{
					// Default value?
					if ( it->second.str().length() )
						pItem->InsertEndChild( TiXmlText( oexStrToMbPtr( it->second.str().c_str() ) ) );

					// Encode sub items
					_Encode( pItem, &it->second, bIndexed, nDepth + 1 );

				} // end if

			} // end else if

		} // end if

	} // end for

	return 1;
}
开发者ID:MangoCats,项目名称:winglib,代码行数:54,代码来源:sq_tinyxml.cpp

示例12: TiXmlElement

void GridRenderComponent::CreateInheritedXmlElements(TiXmlElement* pBaseElement)
{
	TiXmlElement* pTextureNode = CB_NEW TiXmlElement("Texture");
	TiXmlText* pTextureText = CB_NEW TiXmlText(m_TextureResource.c_str());
	pTextureNode->LinkEndChild(pTextureText);
	pBaseElement->LinkEndChild(pTextureNode);

	TiXmlElement* pDivisionNode = CB_NEW TiXmlElement("Division");
	TiXmlText* pDivisionText = CB_NEW TiXmlText(ToStr(m_Squares).c_str());
	pDivisionNode->LinkEndChild(pDivisionText);
	pBaseElement->LinkEndChild(pDivisionNode);
}
开发者ID:deanmarsinelli,项目名称:City-Protectors,代码行数:12,代码来源:RenderComponent.cpp

示例13: GatherExtraFromOldResourceReq

void wxsVersionConverter::GatherExtraFromOldResourceReq(TiXmlElement* Object,TiXmlElement* Extra,bool Root) const
{
    // The only extra information in old wxSmith was:
    //  * variable / member attributes of <object> node
    //  * event handlers enteries
    // These fields are extracted and put into wxs file
    if ( !strcmp(Object->Value(),"object") )
    {
        if ( Object->Attribute("class") && (Root || Object->Attribute("name")) )
        {
            TiXmlElement* ThisExtra = 0;

            // Checking if we got variable name
            if ( Object->Attribute("variable") && Object->Attribute("member") )
            {
                ThisExtra = Extra->InsertEndChild(TiXmlElement("object"))->ToElement();
                ThisExtra->SetAttribute("variable",Object->Attribute("variable"));
                ThisExtra->SetAttribute("member",Object->Attribute("member"));
            }

            // Checking for event handlers

            for ( TiXmlElement* Handler = Object->FirstChildElement("handler"); Handler; Handler = Handler->NextSiblingElement("handler") )
            {
                if ( !ThisExtra )
                {
                    ThisExtra = Extra->InsertEndChild(TiXmlElement("object"))->ToElement();
                }
                ThisExtra->InsertEndChild(*Handler);
            }

            if ( ThisExtra )
            {
                if ( Root )
                {
                    ThisExtra->SetAttribute("root","1");
                }
                else
                {
                    ThisExtra->SetAttribute("name",Object->Attribute("name"));
                    ThisExtra->SetAttribute("class",Object->Attribute("class"));
                }
            }
        }
    }

    for ( TiXmlElement* Child = Object->FirstChildElement(); Child; Child = Child->NextSiblingElement() )
    {
        GatherExtraFromOldResourceReq(Child,Extra,false);
    }
}
开发者ID:WinterMute,项目名称:codeblocks_sf,代码行数:51,代码来源:wxsversionconverter.cpp

示例14: newProxySettings

void GupExtraOptions::writeProxyInfo(const char *fn, const char *proxySrv, long port)
{
	TiXmlDocument newProxySettings(fn);
	TiXmlNode *root = newProxySettings.InsertEndChild(TiXmlElement("GUPOptions"));
	TiXmlNode *proxy = root->InsertEndChild(TiXmlElement("Proxy"));
	TiXmlNode *server = proxy->InsertEndChild(TiXmlElement("server"));
	server->InsertEndChild(TiXmlText(proxySrv));
	TiXmlNode *portNode = proxy->InsertEndChild(TiXmlElement("port"));
	char portStr[10];
	sprintf(portStr, "%d", port);
	portNode->InsertEndChild(TiXmlText(portStr));

	newProxySettings.SaveFile();
}
开发者ID:AnsonX10,项目名称:bitfighter,代码行数:14,代码来源:xmlTools.cpp

示例15: cbThrow

ConfigManager* CfgMgrBldr::Build(const wxString& name_space)
{
    if (name_space.IsEmpty())
        cbThrow(_T("You attempted to get a ConfigManager instance without providing a namespace."));

    wxCriticalSectionLocker locker(cs);
    NamespaceMap::iterator it = namespaces.find(name_space);
    if (it != namespaces.end())
        return it->second;

    TiXmlElement* docroot;

    if (name_space.StartsWith(_T("volatile:")))
    {
        if (!volatile_doc)
        {
            volatile_doc = new TiXmlDocument();
            volatile_doc->InsertEndChild(TiXmlElement("CodeBlocksConfig"));
            volatile_doc->SetCondenseWhiteSpace(false);
        }
        docroot = volatile_doc->FirstChildElement("CodeBlocksConfig");
    }
    else
    {
        docroot = doc->FirstChildElement("CodeBlocksConfig");
        if (!docroot)
        {
            wxString err(_("Fatal error parsing supplied configuration file.\nParser error message:\n"));
            err << wxString::Format(_T("%s\nAt row %d, column: %d."), cbC2U(doc->ErrorDesc()).c_str(), doc->ErrorRow(), doc->ErrorCol());
            cbThrow(err);
        }
    }

    TiXmlElement* root = docroot->FirstChildElement(cbU2C(name_space));

    if (!root) // namespace does not exist
    {
        docroot->InsertEndChild(TiXmlElement(cbU2C(name_space)));
        root = docroot->FirstChildElement(cbU2C(name_space));
    }

    if (!root) // now what!
        cbThrow(_T("Unable to create namespace in document tree (actually not possible..?)"));

    ConfigManager *c = new ConfigManager(root);
    namespaces[name_space] = c;

    return c;
}
开发者ID:alpha0010,项目名称:codeblocks_sf,代码行数:49,代码来源:configmanager.cpp


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