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


C++ TiXmlElement::SetAttribute方法代码示例

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


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

示例1: FlattenSkinVariableConditions

void CGUIIncludes::FlattenSkinVariableConditions()
{
  for (auto& variable : m_skinvariables)
  {
    TiXmlElement* valueNode = variable.second.FirstChildElement("value");
    while (valueNode)
    {
      const char *condition = valueNode->Attribute("condition");
      if (condition)
        valueNode->SetAttribute("condition", ResolveExpressions(condition));

      valueNode = valueNode->NextSiblingElement("value");
    }
  }
}
开发者ID:Razzeee,项目名称:xbmc,代码行数:15,代码来源:GUIIncludes.cpp

示例2: _FormatWrite

static int _FormatWrite(std::map<int, std::string> &mapAll, char *strFMTWrite)
{
	TiXmlDocument *XmlDoc;

	TiXmlElement  *RootElement;
	TiXmlElement  *Segment;
	TiXmlElement  *Colum;
	TiXmlDeclaration HeadDec;
	TiXmlPrinter Printer;

	// 增加XML的头部说明
	XmlDoc = new TiXmlDocument();

	HeadDec.Parse("<?xml version=\"1.0\" encoding=\"gb2312\" ?>", 0, TIXML_ENCODING_UNKNOWN);
	XmlDoc->LinkEndChild(&HeadDec);

	RootElement = new TiXmlElement("SEGMENTS");
	RootElement->SetAttribute("PROGRAMID", "001");
	Segment = new TiXmlElement("SEGMENT");
	Segment->SetAttribute("ID", 2);
	std::map<int, std::string>::iterator iter = mapAll.begin();
	for (; iter != mapAll.end(); ++iter)
	{
		Colum = new TiXmlElement("COLUMN");
		Colum->SetAttribute("ID", iter->first);
		Colum->SetAttribute("VALUE", iter->second.c_str());
		Segment->LinkEndChild(Colum);
	}

	RootElement->LinkEndChild(Segment);
	XmlDoc->LinkEndChild(RootElement);

	XmlDoc->Accept(&Printer);
	strcpy(strFMTWrite, Printer.CStr());
	return 0;
}
开发者ID:jiankeliu5,项目名称:CardProject,代码行数:36,代码来源:WebServiceAssist.cpp

示例3: SaveToXml

bool ConditionStd::SaveToXml(TiXmlElement *node)
{
    TiXmlElement *cond_node = new TiXmlElement("calaos:condition");
    cond_node->SetAttribute("type", "standard");
    cond_node->SetAttribute("trigger", trigger?"true":"false");
    node->LinkEndChild(cond_node);

    for (uint i = 0;i < inputs.size();i++)
    {
        Input *in = inputs[i];

        TiXmlElement *cnode = new TiXmlElement("calaos:input");

        cnode->SetAttribute("id", in->get_param("id"));
        cnode->SetAttribute("oper", ops[in->get_param("id")]);
        cnode->SetAttribute("val", params[in->get_param("id")]);
        if (params_var[in->get_param("id")] != "")
            cnode->SetAttribute("val_var", params_var[in->get_param("id")]);

        cond_node->LinkEndChild(cnode);
    }

    return true;
}
开发者ID:DjMomo,项目名称:calaos_base,代码行数:24,代码来源:ConditionStd.cpp

示例4: SaveTraitsXML

TiXmlElement* SaveTraitsXML(TiXmlElement* pRoot, std::string TagName, const int numTraits, sTrait* traits[], int tempTraits[])
{
	TiXmlElement* pTraits = new TiXmlElement(TagName);
	pRoot->LinkEndChild(pTraits);
	for (int i = 0; i < numTraits; i++)	// save the trait names
	{
		if (traits[i])
		{
			TiXmlElement* pTrait = new TiXmlElement(XMLifyString(traits[i]->m_Name));  // Trait name
			pTraits->LinkEndChild(pTrait);
			if (tempTraits)	pTrait->SetAttribute("Temp", tempTraits[i]);  // Is temporary
		}
	}
	return pTraits;
}
开发者ID:mjsmagalhaes,项目名称:crazys-wm-mod,代码行数:15,代码来源:XmlMisc.cpp

示例5: ExceptionThrown

STDMETHODIMP CYashProfiler::ExceptionThrown(ObjectID thrownObjectID)
{
    LogString("Exception %d Thrown\r\n\r\n", thrownObjectID);

	ThreadID threadId;
	m_pICorProfilerInfo->GetCurrentThreadID(&threadId);
	std::stringstream threadStr;
	threadStr << threadId;
	
	// add to XML
	TiXmlElement * methodEvent = new TiXmlElement( "exceptionEvent" );
	char *exceptionId = new char(256);
	sprintf(exceptionId, "%d", thrownObjectID);
	methodEvent->SetAttribute("exceptionId", exceptionId);
	methodEvent->SetAttribute("threadId", threadStr.str().c_str());
	methodEvent->SetAttribute("type", "ExceptionThrown");
	LARGE_INTEGER time, freq;
	QueryPerformanceCounter(&time);
	QueryPerformanceFrequency(&freq);
	methodEvent->SetDoubleAttribute("timestamp", (float) time.QuadPart / (float) freq.QuadPart);
	m_events->LinkEndChild( methodEvent );  

	return S_OK;
}
开发者ID:matjack1,项目名称:yashp,代码行数:24,代码来源:YashProfiler.cpp

示例6: serialise

void SceneImporter::serialise()
{
	BinaryDataStore<char> binaryDataStore;
	TiXmlDocument doc;
	TiXmlDeclaration* decl = new TiXmlDeclaration("1.0", "", "");
	doc.LinkEndChild(decl);
	TiXmlElement* root = new TiXmlElement("root");
	doc.LinkEndChild(root);
	TiXmlElement* header = new TiXmlElement("Header");
	header->SetAttribute("type", "SkinnedCharacter");
	root->LinkEndChild(header);
	TiXmlElement* prefab = new TiXmlElement("Model");
	root->LinkEndChild(prefab);
	TiXmlElement* meshes = new TiXmlElement("Meshes");
	prefab->LinkEndChild(meshes);
	meshes->SetAttribute("count", _meshes.size());
	for (auto It = _meshes.begin(); It != _meshes.end(); It++)
	{
		auto_ptr<Mesh>& meshPtr = *(It);
		meshPtr->serialise(meshes, binaryDataStore);
	}
	Animator::get()->serialise(prefab, binaryDataStore);
	const char* fileName = "prefab.xml";
	ofstream os;
	binaryDataStore.compact();
	os.open(fileName, ios::binary);
	long numBinaryBytes = binaryDataStore.size();
	os.write((const char*)&numBinaryBytes, sizeof(long));
	const vector<char>& buffer = binaryDataStore.getBuffer();
	os.write(&buffer[0], numBinaryBytes);
	os.close();
	FILE* fp;
	fp = fopen(fileName, "a");
	doc.Print(fp);
	fclose(fp);
}
开发者ID:fawnha,项目名称:morftech,代码行数:36,代码来源:SceneImporter.cpp

示例7: SaveToXml

bool Internal::SaveToXml(TiXmlElement *node)
{
    TiXmlElement *cnode = new TiXmlElement("calaos:internal");
    node->LinkEndChild(cnode);

    for (int i = 0;i < get_params().size();i++)
    {
        string key, value;
        get_params().get_item(i, key, value);
        if (key == "value" && get_param("save") != "true") continue;
        cnode->SetAttribute(key, value);
    }

    return true;
}
开发者ID:giapdangle,项目名称:calaos_base,代码行数:15,代码来源:IntValue.cpp

示例8: FillTextures

void xmlFrondsSave::FillTextures( const dataFronds &_data  , TiXmlElement* root )
{
	//заполнить данными о текстурах

	//создать запись для текстур
	TiXmlElement *pTextures = NULL;
	pTextures = new TiXmlElement( m_FrondsNames.m_sTextures.c_str() );

	//количество текстур
	pTextures->SetAttribute( m_FrondsNames.m_sNum.c_str() , _data.m_vTextures.size() );

	for ( int i = 0 ; i < _data.m_vTextures.size() ; ++i )
	{
		TiXmlElement *pTexture = NULL;
		pTexture = new TiXmlElement( m_FrondsNames.m_sTexture.c_str() );

		//количество текстур
		pTexture->SetAttribute( m_FrondsNames.m_sVal.c_str() , _data.m_vTextures[ i ].c_str() );

		pTextures->LinkEndChild( pTexture );
	}

	root->LinkEndChild( pTextures );
}
开发者ID:wangfeilong321,项目名称:osgtraining,代码行数:24,代码来源:xmlFrondsSave.cpp

示例9: TiXmlElement

bool            ParsingXml::storeScore(std::string &playerName, int data)
{
  TiXmlElement *players = this->_doc.FirstChildElement("players");
  if (players)
    {
      unsigned int nb = 0;
      for(TiXmlElement *player = players->FirstChildElement("player"); player; player = player->NextSiblingElement("player"))
        {
	  nb++;
          if (player->Attribute("name") == playerName)
	    {
	      player->SetAttribute("score", data);
	      return _doc.SaveFile();
	    }
        }
      TiXmlElement *player = new TiXmlElement("player");
      player->SetAttribute("id", nb);
      player->SetAttribute("name", playerName);
      player->SetAttribute("score", data);
      players->LinkEndChild(player);
      return _doc.SaveFile();
    }
  return false;
}
开发者ID:Nedwor,项目名称:rtype,代码行数:24,代码来源:ParsingXml.cpp

示例10:

int em::EmXml::WriteRootAttr( const char* szAttrName, const char* szAttrValue )
{
	int iResult = 0;
	
	TiXmlElement *pElemRoot = m_pDoc->RootElement();
	if(pElemRoot == NULL)
	{
		return EM_ERR_XML_LOST_ROOT;
	}
	pElemRoot->SetAttribute(szAttrName,szAttrValue);

	m_bUpdated = true;
	
	return iResult;
}
开发者ID:lidongqiang,项目名称:FWFactoryTool,代码行数:15,代码来源:EmXml.cpp

示例11: SetPowerOpt

BOOL SetPowerOpt(BOOL bAllowSuspendMode)
{
	TiXmlDocument doc;

	if( CheckValidXML(&doc) == FALSE )
	{
		return FALSE;
	}

	TiXmlElement* pElem = doc.FirstChild("BBS_WiFiConfig")->FirstChild("Setting")->FirstChild("Option")->FirstChildElement("PowerOption");

	pElem->SetAttribute("AllowSuspend", bAllowSuspendMode);
	
	return doc.SaveFile();
}
开发者ID:NemProjects,项目名称:WLAN,代码行数:15,代码来源:BBS_WifiXml.cpp

示例12: ToXml

bool ConferenceInfo::ToXml(const char* szPath)
{
	TiXmlDocument xmlDocument;
	TiXmlDeclaration *pDeclaration = new TiXmlDeclaration(_T("1.0"),_T("utf-8"),_T(""));
	if (!pDeclaration)	return false;
	xmlDocument.LinkEndChild(pDeclaration);

	TiXmlElement *rootElement = TinyXmlFunction::DocNewElement("root", &xmlDocument);
	if (!rootElement)	return false;
	rootElement->SetAttribute("updatetime", updatetime);
	rootElement->SetAttribute("version", version);
	
	TiXmlElement *boxElement = TinyXmlFunction::NewElement("box", rootElement);
	if (!boxElement)	return false;
	boxElement->SetAttribute("boxnos", boxnos);

	list<ConferenceRecord>::iterator it;
	for (it = record.begin(); it != record.end(); it++)
	{
		SetRecord(boxElement, it);
	}
	xmlDocument.SaveFile(szPath);//保存到文件
	return true;
}
开发者ID:wyrover,项目名称:myhistoryprojects,代码行数:24,代码来源:DataProcess.cpp

示例13: CreateElement

TiXmlElement* Base64CreateElement(const string& name,const string& value)
{
	TiXmlElement* e = NULL;

	if (value != "")
	{
		e = CreateElement(name,base64_encode((const unsigned char*)value.c_str(),value.size()));
		if (e != NULL) e->SetAttribute("encode","base64");
	}
	else 
	{
		e = CreateElement(name,value);
	}

	return e;
}
开发者ID:Andy1985,项目名称:myLib,代码行数:16,代码来源:xml.cpp

示例14: SaveToFile

void Template::SaveToFile(const std::string &path)
{
    TiXmlDocument *doc = new TiXmlDocument();
    TiXmlElement *baseEle = new TiXmlElement("Template");

    TiXmlElement *descEle = new TiXmlElement("Description");
    descEle->LinkEndChild(new TiXmlText(m_description.c_str()));

    TiXmlElement *ele = new TiXmlElement("Keyframes");

    ele->SetDoubleAttribute("period", m_period);
    ele->SetAttribute("types", m_types);

    for(std::map<std::string, BoneAnimation>::iterator it = m_keyFrames.begin(); it != m_keyFrames.end(); it++)
    {
        TiXmlElement *boneEle = new TiXmlElement("Bone");
        boneEle->SetAttribute("name", it->first.c_str());

        for(std::map<KeyFrameType, std::vector<KeyFrame> >::iterator it2 = it->second.keyFrames.begin(); it2 != it->second.keyFrames.end(); it2++)
        {
            TiXmlElement *keyframetypeEle = new TiXmlElement("Type");
            keyframetypeEle->SetDoubleAttribute("type", static_cast<int>(it2->first));

            for(unsigned int a = 0; a < it2->second.size(); a++)
            {
                TiXmlElement *timefloatEle = new TiXmlElement("Keyframe");
                timefloatEle->SetDoubleAttribute("time", it2->second.at(a).time);
                timefloatEle->SetDoubleAttribute("value", it2->second.at(a).value);
                timefloatEle->SetAttribute("valueStr", it2->second.at(a).valueStr.c_str());
                timefloatEle->SetAttribute("interpolation", it2->second.at(a).interpolation.c_str());

                keyframetypeEle->LinkEndChild(timefloatEle);
            }

            boneEle->LinkEndChild(keyframetypeEle);
        }
        ele->LinkEndChild(boneEle);
    }

    TiXmlElement *descriptionsEle = baseEle->LinkEndChild(new TiXmlElement("BonesDescriptions"))->ToElement();
    for(unsigned int a = 0; a < m_boneDescriptions.size(); a++)
    {
        TiXmlElement *boneDescrEle = new TiXmlElement("BoneDescription");
        boneDescrEle->SetAttribute("bone", m_boneDescriptions[a].first.c_str());
        boneDescrEle->SetAttribute("description", m_boneDescriptions[a].second.c_str());

        descriptionsEle->LinkEndChild(boneDescrEle);
    }

    baseEle->LinkEndChild(descEle);
    baseEle->LinkEndChild(ele);
    doc->LinkEndChild(baseEle);

    doc->SaveFile(path.c_str());
}
开发者ID:victorlevasseur,项目名称:Skeleton-Extension,代码行数:55,代码来源:Template.cpp

示例15: SaveSegment

void XMLSaver::SaveSegment(Segment *s, TiXmlElement *m)
{
    TiXmlElement *se = new TiXmlElement("Segment");
    se->SetAttribute("name", s->name);
    se->SetDoubleAttribute("mass", s->mass);
    se->SetDoubleAttribute("rot_inertia", s->rot_inertia);

    for (list <Connector *>::iterator i = s->connectors.begin(); i != s->connectors.end(); i++)
    {
        Connector *c = *i;
        if (c != s->polus)
            SaveConnector(c, se);
    }

    m->LinkEndChild(se);
}
开发者ID:just-another-one-timmy,项目名称:mechanism-cpp,代码行数:16,代码来源:XMLSaver.cpp


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