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


C++ TiXmlHandle::FirstChild方法代码示例

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


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

示例1: keyset_load

int keyset_load(keyset* keys, const char* fname, int verbose)
{
	TiXmlDocument doc(fname);
	bool loadOkay = doc.LoadFile();

	if (!loadOkay)
	{
		if (verbose)
			fprintf(stderr, "Could not load keyset file \"%s\", error: %s.\n", fname, doc.ErrorDesc() );

		return 0;
	}

	TiXmlHandle root = doc.FirstChild("document");

	keyset_load_rsakey2048(root.FirstChild("ncsdrsakey"), &keys->ncsdrsakey);
	keyset_load_rsakey2048(root.FirstChild("ncchrsakey"), &keys->ncchrsakey);
	keyset_load_rsakey2048(root.FirstChild("ncchdescrsakey"), &keys->ncchdescrsakey);
	keyset_load_rsakey2048(root.FirstChild("firmrsakey"), &keys->firmrsakey);
	/*
	keyset_load_key128(root.FirstChild("ncchfixedsystemkey"), &keys->ncchfixedsystemkey);
	keyset_load_key128(root.FirstChild("ncchkeyxold"), &keys->ncchkeyX_old);
	keyset_load_key128(root.FirstChild("ncchkeyxseven"), &keys->ncchkeyX_seven);
	keyset_load_key128(root.FirstChild("ncchkeyxninethree"), &keys->ncchkeyX_ninethree);
	keyset_load_key128(root.FirstChild("ncchkeyxninesix"), &keys->ncchkeyX_ninesix);
	*/

	return 1;
}
开发者ID:profi200,项目名称:Project_CTR,代码行数:29,代码来源:keyset.cpp

示例2:

int CCrashDescReader::LoadXmlv10(TiXmlHandle hDoc)
{
    TiXmlHandle hRoot = hDoc.FirstChild("Exception").ToElement();
    if(hRoot.ToElement()==NULL)
    {
        return -3; // Invalid XML structure
    }

    // Set CrashRpt version to 1000

    m_dwGeneratorVersion = 1000;

    // Get ExceptionRecord element

    TiXmlHandle hExceptionRecord = hRoot.FirstChild("ExceptionRecord").ToElement();

    if(hExceptionRecord.ToElement()!=NULL)
    {
        const char* szImageName = hRoot.ToElement()->Attribute("ModuleName");
        if(szImageName!=NULL)
        {
            m_sImageName = szImageName;

            m_sAppName = Utility::GetBaseFileName(szImageName);
        }
    }  

    // OK
    m_bLoaded = true;
    return 0;
}
开发者ID:McSimp,项目名称:Borderlands2SDK,代码行数:31,代码来源:CrashDescReader.cpp

示例3: loadParameters

bool TorsoControlStaticGait::loadParameters(const TiXmlHandle& handle) {

  TiXmlHandle handleTorsoConfiguration(handle.FirstChild("TorsoControl").FirstChild("TorsoConfiguration"));
  TiXmlHandle handleDynamicGait(handle.FirstChild("TorsoControl").FirstChild("DynamicGait"));

  if (!comControl_->loadParameters(handleDynamicGait)) {
    return false;
  }

  if (!loadParametersTorsoConfiguration(handleTorsoConfiguration)) {
    return false;
  }

  if (!loadParametersHipConfiguration(handleDynamicGait)) {
    return false;
  }

  TiXmlHandle hStGait(handle.FirstChild("TorsoControl").FirstChild("StaticGait"));
  CoMOverSupportPolygonControlStaticGait* staticComControl = static_cast<CoMOverSupportPolygonControlStaticGait*>(comControl_);
  if (!staticComControl->loadParametersStaticGait(hStGait)) {
    return false;
  }

  return true;
}
开发者ID:caomw,项目名称:loco,代码行数:25,代码来源:TorsoControlStaticGait.cpp

示例4: ParseRegKeyList

int CCrashInfoReader::ParseRegKeyList(TiXmlHandle& hRoot, CErrorReportInfo& eri)
{
    strconv_t strconv;

    TiXmlHandle fl = hRoot.FirstChild("RegKeyList");
    if(fl.ToElement()==0)
    {    
        return 1;
    }

    TiXmlHandle fi = fl.FirstChild("RegKey");
    while(fi.ToElement()!=0)
    {
        const char* pszDestFile = fi.ToElement()->Attribute("destfile");
        const char* pszRegKey = fi.ToElement()->Attribute("name");

        if(pszDestFile!=NULL && pszRegKey!=NULL)
        {
            CString sDestFile = strconv.utf82t(pszDestFile);      
            CString sRegKey = strconv.utf82t(pszRegKey);

            eri.m_RegKeys[sRegKey] = sDestFile;
        }

        fi = fi.ToElement()->NextSibling("RegKey");
    }

    return 0;
}
开发者ID:doo,项目名称:CrashRpt,代码行数:29,代码来源:CrashInfoReader.cpp

示例5: keyset_load_rsakey2048

int keyset_load_rsakey2048(TiXmlHandle node, rsakey2048* key)
{
	key->keytype = RSAKEY_INVALID;

	if (!keyset_load_key(node.FirstChild("N"), key->n, sizeof(key->n), 0))
		goto clean;
	if (!keyset_load_key(node.FirstChild("E"), key->e, sizeof(key->e), 0))
		goto clean;
	key->keytype = RSAKEY_PUB;

	if (!keyset_load_key(node.FirstChild("D"), key->d, sizeof(key->d), 0))
		goto clean;
	if (!keyset_load_key(node.FirstChild("P"), key->p, sizeof(key->p), 0))
		goto clean;
	if (!keyset_load_key(node.FirstChild("Q"), key->q, sizeof(key->q), 0))
		goto clean;
	if (!keyset_load_key(node.FirstChild("DP"), key->dp, sizeof(key->dp), 0))
		goto clean;
	if (!keyset_load_key(node.FirstChild("DQ"), key->dq, sizeof(key->dq), 0))
		goto clean;
	if (!keyset_load_key(node.FirstChild("QP"), key->qp, sizeof(key->qp), 0))
		goto clean;

	key->keytype = RSAKEY_PRIV;
clean:
	return (key->keytype != RSAKEY_INVALID);
}
开发者ID:profi200,项目名称:Project_CTR,代码行数:27,代码来源:keyset.cpp

示例6: ReadXml

bool ReadXml(const char *file_path) {
	TiXmlDocument doc(file_path);
	doc.LoadFile();
	TiXmlHandle doc_handle(&doc);  
	TiXmlElement *p_root2 = doc_handle.FirstChildElement().Element();  
	TiXmlHandle hRoot = TiXmlHandle(p_root2);
	TiXmlElement *pElem=hRoot.FirstChild( "Messages" ).FirstChild().Element();

	TiXmlElement *p_root = doc.RootElement();
	TiXmlElement *p_first = p_root->FirstChildElement();
	TiXmlElement *p_one = p_first->FirstChildElement();
	TiXmlElement *p_two = p_one->NextSiblingElement();
	TiXmlElement *p_three = p_two->NextSiblingElement();
	TiXmlAttribute *p_first_id = p_first->FirstAttribute();

	printf("root:     %s\n", p_root->Value());
	printf("first_id: %s\n", p_first_id->Value());
	printf("one:      %s\n", p_one->FirstChild()->Value());
	printf("two:      %s\n", p_two->FirstChild()->Value());
	const char *aaa = p_first->Attribute("key");

	if (!p_root2)
		printf("error\n");
	else
		printf("three:    %s\n", p_root2->Value());
	printf("pElem:%s\n", pElem->Value());
	return true;
}
开发者ID:SangYang,项目名称:GeneralFeatures,代码行数:28,代码来源:test.cpp

示例7: loadSlotDetails

// Extract slot details from the xml
void converter::loadSlotDetails(TiXmlHandle &hRoot)
{
	//printf("Slot details\n");
	for( TiXmlElement* pElem=hRoot.FirstChild("slot").Element(); pElem; pElem=pElem->NextSiblingElement())
	{
		std::string slotName = pElem->Attribute("name");
		
		std::map<std::string, slotData>::iterator iter = m_slots.find(slotName);
		if ( iter==m_slots.end() ) {
			errlogPrintf("sampleChanger: Unknown slot '%s' in slot details\n", slotName.c_str());
		}
		else {
			iter->second.rackType = pElem->Attribute("rack_type");
			
			if ( pElem->QueryDoubleAttribute("xoff", &(iter->second.xoff))!=TIXML_SUCCESS ) {
				errlogPrintf("sampleChanger: unable to read slot xoff attribute \"%s\"\n", slotName.c_str());
			}
			if ( m_dims>1 && pElem->QueryDoubleAttribute("yoff", &(iter->second.yoff))!=TIXML_SUCCESS ) {
				errlogPrintf("sampleChanger: unable to read slot yoff attribute \"%s\"\n", slotName.c_str());
			}
		
			//printf("Det slot %s %s %f\n", iter->second.name, iter->second.rackType, iter->second.xoff);
		}
	}
}
开发者ID:ISISComputingGroup,项目名称:EPICS-sampleChanger,代码行数:26,代码来源:converter.cpp

示例8: LoadPlayer

PlayerResource ResourceCache::LoadPlayer(
   const PlayerType type,
   const std::string& name,
   const TiXmlHandle& hndl
)
{
   const Size size = { static_cast<int>(mAppConfig.GetCellSize().Width * 1.55f),
                       static_cast<int>(mAppConfig.GetCellSize().Height * 1.75f) };
   const auto walk_len = 1000_ms;
   const auto spawn_len = 1000_ms;
   const auto death_len = 1000_ms;
   const auto player_hndl = hndl.FirstChild(name);

   PlayerResource player(type);
   player.SetFrames(PlayerAnimation::StandUp, walk_len, LoadTextures(player_hndl, "StandUp", size));
   player.SetFrames(PlayerAnimation::StandDown, walk_len, LoadTextures(player_hndl, "StandDown", size));
   player.SetFrames(PlayerAnimation::StandLeft, walk_len, LoadTextures(player_hndl, "StandLeft", size));
   player.SetFrames(PlayerAnimation::StandRight, walk_len, LoadTextures(player_hndl, "StandRight", size));
   player.SetFrames(PlayerAnimation::WalkUp, walk_len, LoadTextures(player_hndl, "WalkUp", size));
   player.SetFrames(PlayerAnimation::WalkDown, walk_len, LoadTextures(player_hndl, "WalkDown", size));
   player.SetFrames(PlayerAnimation::WalkLeft, walk_len, LoadTextures(player_hndl, "WalkLeft", size));
   player.SetFrames(PlayerAnimation::WalkRight, walk_len, LoadTextures(player_hndl, "WalkRight", size));
   player.SetFrames(PlayerAnimation::Spawn, spawn_len, LoadTextures(player_hndl, "Spawn", size));
   player.SetFrames(PlayerAnimation::Destroy, death_len, LoadTextures(player_hndl, "Death", size));
   return player;
}
开发者ID:vobject,项目名称:bomberperson,代码行数:26,代码来源:ResourceCache.cpp

示例9: loadRackDefs

// Extract the definitions of the rack types from the xml
void converter::loadRackDefs(TiXmlHandle &hRoot)
{
	m_racks.clear();
	//printf("Loading rack defs\n");
	
	for( TiXmlElement* pElem=hRoot.FirstChild("racks").FirstChild("rack").Element(); pElem; pElem=pElem->NextSiblingElement())
	{
		//printf("Loading rack defs - racks\n");
		std::map<std::string, samplePosn> posns;
		std::string rackName = pElem->Attribute("name");
		for ( TiXmlElement *pRack = pElem->FirstChildElement("position") ; pRack ; pRack=pRack->NextSiblingElement() ) {
			samplePosn posn;
			const char *attrib = pRack->Attribute("name");
			if ( attrib!=NULL ) {
				posn.name = attrib;
			}
			else {
				errlogPrintf("sampleChanger: rack has no name attribute \"%s\"\n", rackName.c_str());
			}
			//printf("Loading rack defs - %s\n", posn.name.c_str());
			if ( pRack->QueryDoubleAttribute("x", &posn.x)!=TIXML_SUCCESS ) {
				errlogPrintf("sampleChanger: unable to read x attribute \"%s\" \"%s\"\n", rackName.c_str(), posn.name.c_str());
			}
			if ( m_dims>1 && pRack->QueryDoubleAttribute("y", &posn.y)!=TIXML_SUCCESS ) {
				errlogPrintf("sampleChanger: unable to read y attribute \"%s\" \"%s\"\n", rackName.c_str(), posn.name.c_str());
			}
			posns[posn.name] = posn;
		}
		m_racks[rackName] = posns;
	}
}
开发者ID:ISISComputingGroup,项目名称:EPICS-sampleChanger,代码行数:32,代码来源:converter.cpp

示例10: setComponents

void ComponentOptionMust::setComponents(TiXmlHandle docMUSTHandle, string nameOption, string tradeId)
{

	TiXmlElement *Component;
	TiXmlElement *elem;

	TiXmlElement *Trade = docMUSTHandle.FirstChild("BODY").FirstChild("TRADELIST").FirstChild("MUST_TR").ToElement();

	while (Trade)
	{
		if (strcmp(Trade->FirstChild("TradeId")->ToElement()->GetText(), tradeId.c_str()) == 0)
		{
			Component = Trade->FirstChild("MPTradeData")->FirstChild("MPTRDATA")->FirstChild("MPTrDataXML")->FirstChild("MPTRDATAXML")->FirstChild("STRUCTURED_INSTRUMENT")->
				FirstChild("COMPONENT_LIST")->FirstChild("COMPONENT_OPTION")->ToElement();
			while (Component)
			{
				if (strcmp(Component->Value(), "COMPONENT_OPTION") == 0)
				{

					if (strcmp(Component->FirstChild("NAME")->ToElement()->GetText(), nameOption.c_str()) == 0)
					{
						payOrSell = Component->FirstChild("PORS")->ToElement()->GetText();
						freqString = Component->FirstChild("EXPIRY_SCHED")->FirstChild("BASIC_SCHED")->FirstChild("SCHED_DEF")->FirstChild("FREQ")->ToElement()->GetText();
						settlementType = Component->FirstChild("EXPIRY_SCHED")->FirstChild("ACTUAL_SETTLE_MODE")->ToElement()->GetText();

						//firstExpiry = Component->FirstChild("EXPIRY_SCHED")->FirstChild("BASIC_SCHED")->FirstChild("START_DATE")->FirstChild("DATE_FORMULA")->FirstChild("TARGET")->FirstChild("ATTRIBUTE")->ToElement()->GetText();
						//lastExpiry = Component->FirstChild("EXPIRY_SCHED")->FirstChild("BASIC_SCHED")->FirstChild("END_DATE")->FirstChild("DATE_FORMULA")->FirstChild("TARGET")->FirstChild("ATTRIBUTE")->ToElement()->GetText();

					}
				}
				break;
				Component = Component->NextSiblingElement();
			}

			//****** recherche du type de l'option

			elem = Trade->FirstChild("MPTradeData")->FirstChild("MPTRDATA")->FirstChild("MPTrDataXML")->FirstChild("MPTRDATAXML")->FirstChild("STRUCTURED_INSTRUMENT")->
				FirstChild("VARIABLE_LIST")->FirstChild("VARIABLE")->ToElement();

			while (elem)
			{
				if (strcmp(elem->Value(), "VARIABLE") == 0)
				{

					if (strcmp(elem->FirstChild("NAME")->ToElement()->GetText(), "OptionStyle") == 0)
					{
						typeOption = elem->FirstChild("FORMULA")->FirstChild("FORMULA_STRING")->ToElement()->GetText();
					}
					break;
				}
				elem = elem->NextSiblingElement();
			}

			break;
		}
		Trade = Trade->NextSiblingElement();
	}

}
开发者ID:Mbenhachem,项目名称:Efficiency.PricerLib,代码行数:59,代码来源:ComponentOptionMust.cpp

示例11: ParseFileList

int CCrashInfoReader::ParseFileList(TiXmlHandle& hRoot, CErrorReportInfo& eri)
{
    strconv_t strconv;

    TiXmlHandle fl = hRoot.FirstChild("FileList");
    if(fl.ToElement()==0)
    {    
        return 1;
    }

    TiXmlHandle fi = fl.FirstChild("FileItem");
    while(fi.ToElement()!=0)
    {
        const char* pszDestFile = fi.ToElement()->Attribute("destfile");
        const char* pszSrcFile = fi.ToElement()->Attribute("srcfile");
        const char* pszDesc = fi.ToElement()->Attribute("description");
        const char* pszMakeCopy = fi.ToElement()->Attribute("makecopy");

        if(pszDestFile!=NULL)
        {
            CString sDestFile = strconv.utf82t(pszDestFile);      
            ERIFileItem item;
            item.m_sDestFile = sDestFile;
            if(pszSrcFile)
                item.m_sSrcFile = strconv.utf82t(pszSrcFile);
            if(pszDesc)
                item.m_sDesc = strconv.utf82t(pszDesc);

            if(pszMakeCopy)
            {
                if(strcmp(pszMakeCopy, "1")==0)
                    item.m_bMakeCopy = TRUE;
                else
                    item.m_bMakeCopy = FALSE;
            }
            else
                item.m_bMakeCopy = FALSE;

            eri.m_FileItems[sDestFile] = item;
        }

        fi = fi.ToElement()->NextSibling("FileItem");
    }

    return 0;
}
开发者ID:doo,项目名称:CrashRpt,代码行数:46,代码来源:CrashInfoReader.cpp

示例12: getIt

bool OutputFile::getIt(ParamQt * p)
{
  int deb=0;
  currentIteration++;
  p->setRho(0);
  p->setTheta(0);
  p->setLL(0);
  TiXmlHandle root(&mDoc);
  TiXmlHandle h = root.FirstChild("outputFile");
  TiXmlHandle hIter = h.Child("Iteration", currentIteration);

  TiXmlElement* t;
  // <Tree>
  t = hIter.FirstChild("Tree").ToElement();
  if (t == NULL) // Can I use hIter to return false?
    return false;
  string s(t->GetText());
  while (s.at(0)==10 || s.at(0)==13) s=s.substr(1,s.length()-1);
  while (s.at(s.size()-1)==10 || s.at(s.size()-1)==13) s=s.substr(0,s.length()-1);
  p->setTreeData(new RecTree(getL(),s,false,false),blocks);

  // <number>, <theta>, <delta>, <rho>, <ll>.
  t = hIter.FirstChild("number").ToElement(); p->setNumber(atol(t->GetText()));
  t = hIter.FirstChild("theta").ToElement();  p->setTheta(p->getTheta() + atof(t->GetText()));
  t = hIter.FirstChild("delta").ToElement();  p->setDelta(atof(t->GetText()));
  t = hIter.FirstChild("rho").ToElement();    p->setRho(p->getRho() + atof(t->GetText()));
  t = hIter.FirstChild("ll").ToElement();     p->setLL(p->getLL() + atof(t->GetText()));

  // <recedge>
  TiXmlElement* parent = hIter.ToElement(); 
  TiXmlElement* child = 0;
  while (child = (TiXmlElement*) parent->IterateChildren("recedge", child))
    {
      int start=0,end=0,efrom=0,eto=0;
      double ato=0,afrom=0;
      t = child->FirstChildElement("start"); start = deb + atoi(t->GetText());
      t = child->FirstChildElement("end"); end = deb + atoi(t->GetText());
      t = child->FirstChildElement("efrom"); efrom = atoi(t->GetText());
      t = child->FirstChildElement("eto"); eto = atoi(t->GetText());
      t = child->FirstChildElement("afrom"); afrom = atof(t->GetText());
      t = child->FirstChildElement("ato"); ato = atof(t->GetText());
      p->getTree()->addRecEdge(afrom,ato,start,end,efrom,eto);
    }
  return true;
}
开发者ID:ConstantinV,项目名称:Mauve-Analysis,代码行数:45,代码来源:outputfile.cpp

示例13: startOver

// Read Blocks, comment, nameMap, regions.
void OutputFile::startOver()
{
  currentIteration=-1;
  TiXmlHandle root(&mDoc);
  TiXmlElement* t;
  TiXmlHandle h = root.FirstChild("outputFile");

  t = h.FirstChild("Blocks").ToElement(); blocks = t->GetText();
  while (blocks.at(0)==10 || blocks.at(0)==13) blocks=blocks.substr(1,blocks.length()-1);
  while (blocks.at(blocks.size()-1)==10 || blocks.at(blocks.size()-1)==13) blocks=blocks.substr(0,blocks.length()-1);
  vector<string> blocksString = Daniweb::Split (blocks, ",");
  for (int i = 0; i < blocksString.size(); i++)
    blocksInt.push_back(atoi(blocksString[i].c_str()));

  t = h.FirstChild("comment").ToElement(); comment = t->GetText();
  t = h.FirstChild("nameMap").ToElement(); names = t->GetText();
  t = h.FirstChild("regions").ToElement(); regionsString = t->GetText();
}
开发者ID:ConstantinV,项目名称:Mauve-Analysis,代码行数:19,代码来源:outputfile.cpp

示例14: unserialize

bool DateXMLSerializer::unserialize(const std::string & data) {
	TiXmlDocument doc;

	doc.Parse(data.c_str());

	TiXmlHandle docHandle(&doc);
	TiXmlHandle date = docHandle.FirstChild("date");

	//Retrieving day
	_date._day = String(date.FirstChild("day").FirstChild().Text()->Value()).toInteger();

	//Retrieving month
	_date._month = String(date.FirstChild("month").FirstChild().Text()->Value()).toInteger();

	//Retrieving year
	_date._year = String(date.FirstChild("year").FirstChild().Text()->Value()).toInteger();

	return true;
}
开发者ID:gabrieldelsaint,项目名称:UIM,代码行数:19,代码来源:DateXMLSerializer.cpp

示例15: unserialize

bool TimeXMLSerializer::unserialize(const std::string & data) {
	TiXmlDocument doc;

	doc.Parse(data.c_str());

	TiXmlHandle docHandle(&doc);
	TiXmlHandle date = docHandle.FirstChild("time");

	//Retrieving hour
	_time._hour = String(date.FirstChild("hour").FirstChild().Text()->Value()).toInteger();

	//Retrieving minute
	_time._minute = String(date.FirstChild("minute").FirstChild().Text()->Value()).toInteger();

	//Retrieving second
	_time._second = String(date.FirstChild("second").FirstChild().Text()->Value()).toInteger();

	return true;
}
开发者ID:gabrieldelsaint,项目名称:UIM,代码行数:19,代码来源:TimeXMLSerializer.cpp


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