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


C++ TiXmlElement类代码示例

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


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

示例1: while

bool SVNCommitLog::parseCommit(RCommit& commit) {

    //fprintf(stderr,"parsing svn log\n");

    std::string line;

    if(!getNextLine(line)) return false;

    //start of log entry
    if(!svn_logentry_start.match(line)) {

        //is this the start of the document
        if(!svn_xml_tag.match(line)) return false;

        //fprintf(stderr,"found xml tag\n");

        //if so find the first logentry tag

        bool found_logentry = false;

        while(getNextLine(line)) {
            if(svn_logentry_start.match(line)) {
                found_logentry = true;
                break;
            }
        }

        if(!found_logentry) return false;
    }

    //fprintf(stderr,"found logentry\n");

    logentry.clear();

    logentry.append(line);
    logentry.append("\n");

    //fprintf(stderr,"found opening tag\n");

    bool endfound = false;

    while(getNextLine(line)) {
        logentry.append(line);
        logentry.append("\n");
        if(svn_logentry_end.match(line)) {
            //fprintf(stderr,"found closing tag\n");
            endfound=true;
            break;
        }
    }

    //incomplete commit
    if(!endfound) return false;

    //fprintf(stderr,"read logentry\n");

    TiXmlDocument doc;

    if(!doc.Parse(logentry.c_str())) return false;

    //fprintf(stderr,"try to parse logentry: %s\n", logentry.c_str());

    TiXmlElement* leE = doc.FirstChildElement( "logentry" );

    std::vector<std::string> entries;

    if(!leE) return false;

    //parse date
    TiXmlElement* dateE = leE->FirstChildElement( "date" );

    if(!dateE) return false;

    std::string timestamp_str(dateE->GetText());

    if(!svn_logentry_timestamp.match(timestamp_str, &entries))
        return false;

    struct tm time_str;

    time_str.tm_year  = atoi(entries[0].c_str()) - 1900;
    time_str.tm_mon   = atoi(entries[1].c_str()) - 1;
    time_str.tm_mday  = atoi(entries[2].c_str());
    time_str.tm_hour  = atoi(entries[3].c_str());
    time_str.tm_min   = atoi(entries[4].c_str());
    time_str.tm_sec   = atoi(entries[5].c_str());
    time_str.tm_isdst = -1;

#ifdef HAVE_TIMEGM
    commit.timestamp = timegm(&time_str);
#else
    commit.timestamp = __timegm_hack(&time_str);
#endif

    //parse author
    TiXmlElement* authorE = leE->FirstChildElement("author");

    if(authorE != 0) {
        // GetText() may return NULL, causing author instantiation to crash.
        std::string author;
//.........这里部分代码省略.........
开发者ID:EthiopionZA,项目名称:Gource,代码行数:101,代码来源:svn.cpp

示例2: docHandle

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

	doc.Parse(data.c_str());

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

	// Retrieving associated account
	EnumIMProtocol::IMProtocol protocol;

	TiXmlElement * lastChildElt = im.Element();
	if (lastChildElt) {
		protocol = EnumIMProtocol::toIMProtocol(lastChildElt->Attribute("protocol"));
	} else {
		return false;
	}

	TiXmlText * login = im.FirstChild("account").FirstChild().Text();
	if (login) {		
		const IMAccount *imAccount = NULL;
		std::string loginValue = std::string(login->Value());

		//VOXOX - JRT - 2009.04.09 
		//for (IMAccountList::const_iterator it = _imAccountList.begin();
		//	it != _imAccountList.end();
		//	++it) {
		//	if ((it->getLogin() == loginValue) &&		
		//		(it->getProtocol() == protocol) ) {
		//		imAccount = &(*it);
		//	}
		//}
		imAccount = _imAccountList.findByLoginInfo( loginValue, protocol );
		//End VOXOX

		if (imAccount) {
			_imContact.setIMAccount(imAccount);
		} else {
			LOG_ERROR("this IMAccount does not exist in IMAccountList: " + std::string(login->Value()));
			return false;
		}
		////
	} else {
		_imContact._imAccount = NULL;
		_imContact._protocol = protocol;
	}
	////

	//Retrieving contactId
	TiXmlText * contactId = im.FirstChild("id").FirstChild().Text();
	if (contactId) {
	
		// wengo or sip account should have a domain
		// (unfortunately not saved before 2.1rc2...
		String completeLogin(contactId->Value());
		if (!completeLogin.contains("@")) 
		{
			if (protocol == EnumIMProtocol::IMProtocolWengo) {
				completeLogin += "@voip.wengo.fr";
			} 
			//else if (protocol == EnumIMProtocol::IMProtocolSIP) {
			//	// TO DO ?
			//}
		}
		////
	
		_imContact._contactId = completeLogin;
	}
	////

	// Retrieving alias
	TiXmlText * alias = im.FirstChild("alias").FirstChild().Text();
	if (alias) {
		_imContact._alias = alias->Value();
	}
	////
	
	//VOXOX CHANGE CJC ADD SUPPORT FOR STATUS MESSAGE
	// Retrieving statusMessage
	TiXmlText * statusMessage = im.FirstChild("statusMessage").FirstChild().Text();
	if (statusMessage) {
		_imContact._statusMessage = statusMessage->Value();
	}

	///VOXOX CHANGE Marin Block option when right clicking contact 4/24/2009
	TiXmlText * blocked = im.FirstChild("blocked").FirstChild().Text();
	if (blocked) {
		String strBlocked = blocked->Value();
		_imContact._blocked = strBlocked.toBoolean();
	}

	// Retrieving icon
	TiXmlText * photo = im.FirstChild("photo").FirstChild().Text();
	if (photo) {
		OWPicture picture = OWPicture::pictureFromData(Base64::decode(photo->Value()));
		_imContact.setIcon(picture);
	}
	////

	return true;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例3: ISerialized

IndexTimeRef::IndexTimeRef(TiXmlNode* xmlNode)
: ISerialized(xmlNode)
{
    #ifdef ConsolePrint
        std::string initialtap_ = FileManager::instance().tap_;
        FileManager::instance().tap_.append("   ");
    #endif 
   //underlyingIndexRefNode ----------------------------------------------------------------------------------------------------------------------
   TiXmlElement* underlyingIndexRefNode = xmlNode->FirstChildElement("underlyingIndexRef");

   if(underlyingIndexRefNode){underlyingIndexRefIsNull_ = false;}
   else{underlyingIndexRefIsNull_ = true;}

   #ifdef ConsolePrint
      FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- underlyingIndexRefNode , address : " << underlyingIndexRefNode << std::endl;
   #endif
   if(underlyingIndexRefNode)
   {
      if(underlyingIndexRefNode->Attribute("href") || underlyingIndexRefNode->Attribute("id"))
      {
          if(underlyingIndexRefNode->Attribute("id"))
          {
             underlyingIndexRefIDRef_ = underlyingIndexRefNode->Attribute("id");
             underlyingIndexRef_ = boost::shared_ptr<UnderlyingIndex>(new UnderlyingIndex(underlyingIndexRefNode));
             underlyingIndexRef_->setID(underlyingIndexRefIDRef_);
             IDManager::instance().setID(underlyingIndexRefIDRef_,underlyingIndexRef_);
          }
          else if(underlyingIndexRefNode->Attribute("href")) { underlyingIndexRefIDRef_ = underlyingIndexRefNode->Attribute("href");}
          else { QL_FAIL("id or href error"); }
      }
      else { underlyingIndexRef_ = boost::shared_ptr<UnderlyingIndex>(new UnderlyingIndex(underlyingIndexRefNode));}
   }

   //fixingDaysNode ----------------------------------------------------------------------------------------------------------------------
   TiXmlElement* fixingDaysNode = xmlNode->FirstChildElement("fixingDays");

   if(fixingDaysNode){fixingDaysIsNull_ = false;}
   else{fixingDaysIsNull_ = true;}

   #ifdef ConsolePrint
      FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- fixingDaysNode , address : " << fixingDaysNode << std::endl;
   #endif
   if(fixingDaysNode)
   {
      if(fixingDaysNode->Attribute("href") || fixingDaysNode->Attribute("id"))
      {
          if(fixingDaysNode->Attribute("id"))
          {
             fixingDaysIDRef_ = fixingDaysNode->Attribute("id");
             fixingDays_ = boost::shared_ptr<FixingDays>(new FixingDays(fixingDaysNode));
             fixingDays_->setID(fixingDaysIDRef_);
             IDManager::instance().setID(fixingDaysIDRef_,fixingDays_);
          }
          else if(fixingDaysNode->Attribute("href")) { fixingDaysIDRef_ = fixingDaysNode->Attribute("href");}
          else { QL_FAIL("id or href error"); }
      }
      else { fixingDays_ = boost::shared_ptr<FixingDays>(new FixingDays(fixingDaysNode));}
   }

    #ifdef ConsolePrint
        FileManager::instance().tap_ = initialtap_;
    #endif 
}
开发者ID:minikie,项目名称:OTCDerivativesCalculatorModule,代码行数:63,代码来源:IndexTimeRef.cpp

示例4: main

int main()
{
	//
	// We start with the 'demoStart' todo list. Process it. And
	// should hopefully end up with the todo list as illustrated.
	//
	const char* demoStart =
		"<?xml version=\"1.0\"  standalone='no' >\n"
		"<!-- Our to do list data -->"
		"<ToDo>\n"
		"<!-- Do I need a secure PDA? -->\n"
		"<Item priority=\"1\" distance='close'> Go to the <bold>Toy store!</bold></Item>"
		"<Item priority=\"2\" distance='none'> Do bills   </Item>"
		"<Item priority=\"2\" distance='far &amp; back'> Look for Evil Dinosaurs! </Item>"
		"</ToDo>";
		
	{

	#ifdef TIXML_USE_STL
		/*	What the todo list should look like after processing.
			In stream (no formatting) representation. */
		const char* demoEnd =
			"<?xml version=\"1.0\" standalone=\"no\" ?>"
			"<!-- Our to do list data -->"
			"<ToDo>"
			"<!-- Do I need a secure PDA? -->"
			"<Item priority=\"2\" distance=\"close\">Go to the"
			"<bold>Toy store!"
			"</bold>"
			"</Item>"
			"<Item priority=\"1\" distance=\"far\">Talk to:"
			"<Meeting where=\"School\">"
			"<Attendee name=\"Marple\" position=\"teacher\" />"
			"<Attendee name=\"Voel\" position=\"counselor\" />"
			"</Meeting>"
			"<Meeting where=\"Lunch\" />"
			"</Item>"
			"<Item priority=\"2\" distance=\"here\">Do bills"
			"</Item>"
			"</ToDo>";
	#endif

		// The example parses from the character string (above):
		#if defined( WIN32 ) && defined( TUNE )
		_CrtMemCheckpoint( &startMemState );
		#endif	

		{
			// Write to a file and read it back, to check file I/O.

			TiXmlDocument doc( "demotest.xml" );
			doc.Parse( demoStart );

			if ( doc.Error() )
			{
				printf( "Error in %s: %s\n", doc.Value(), doc.ErrorDesc() );
				exit( 1 );
			}
			doc.SaveFile();
		}

		TiXmlDocument doc( "demotest.xml" );
		bool loadOkay = doc.LoadFile();

		if ( !loadOkay )
		{
			printf( "Could not load test file 'demotest.xml'. Error='%s'. Exiting.\n", doc.ErrorDesc() );
			exit( 1 );
		}

		printf( "** Demo doc read from disk: ** \n\n" );
		printf( "** Printing via doc.Print **\n" );
		doc.Print( stdout );

		{
			printf( "** Printing via TiXmlPrinter **\n" );
			TiXmlPrinter printer;
			doc.Accept( &printer );
			fprintf( stdout, "%s", printer.CStr() );
		}
		#ifdef TIXML_USE_STL	
		{
			printf( "** Printing via operator<< **\n" );
			std::cout << doc;
		}
		#endif
		TiXmlNode* node = 0;
		TiXmlElement* todoElement = 0;
		TiXmlElement* itemElement = 0;


		// --------------------------------------------------------
		// An example of changing existing attributes, and removing
		// an element from the document.
		// --------------------------------------------------------

		// Get the "ToDo" element.
		// It is a child of the document, and can be selected by name.
		node = doc.FirstChild( "ToDo" );
		assert( node );
//.........这里部分代码省略.........
开发者ID:Snkrnryn,项目名称:casadi,代码行数:101,代码来源:xmltest.cpp

示例5: login

//test GetEntryList. passed
BOOL GDocsAPITest::GetEntryListTest()
{
	login();
	
	TiXmlDocument * pXmlDoc = new TiXmlDocument();

	//lastest 100 items
	//m_pGDocsApi->GetEntryList("https://docs.google.com/feeds/default/private/full?showfolders=true", pXmlDoc);


	//get trashed items
	m_pGDocsApi->GetEntryList("https://docs.google.com/feeds/default/private/full/-/trashed?showfolders=true",pXmlDoc);
	
	//entrylist for aaaa folder
	//m_pGDocsApi->GetEntryList("https://docs.google.com/feeds/default/private/full/folder%3A0B7CmbVXdOi7mYzhlM2NjODgtNzlkZC00ZGZlLWFhN2EtMWJlODA3NmY0YjIy/contents", pXmlDoc);

	//get all documetn
	//m_pGDocsApi->GetEntryList("https://docs.google.com/feeds/default/private/full/-/document?max-results=5", pXmlDoc);
	//m_pGDocsApi->GetEntryList("https://docs.google.com/feeds/default/private/full/-/-mine/folder", pXmlDoc);

	pXmlDoc->SaveFile("d:/trashed.xml");
	
	if (pXmlDoc)
	{
		TiXmlElement* pFeedElement = pXmlDoc->FirstChildElement("feed");
		
		for (TiXmlElement* pElement = pFeedElement->FirstChildElement("entry"); pElement; pElement = pElement->NextSiblingElement("entry"))
		{
			GDocsEntry* pDocsEntry = new GDocsEntry(pElement);

			cout<<"The information of the entry" <<endl<<endl;
			wcout<<L" GDEtag :"	<< pDocsEntry->m_pszGDEtag<<endl;
			wcout<<L" IDURL :"		<< pDocsEntry->m_pszIDUrl <<endl;
			wcout<<L" Published :" << pDocsEntry->m_pszPublished <<endl;
			wcout<<L" Updated :"	<< pDocsEntry->m_pszUpdated<<endl;
			wcout<<L" AppEdited :" << pDocsEntry->m_pszAppEdited<<endl;
			wcout<<L" IsStarred :" << pDocsEntry->m_bIsStarred<<endl;
			wcout<<L" IsHidden :" << pDocsEntry->m_bIsHidden<<endl;
			wcout<<L" IsViewed :" << pDocsEntry->m_bIsViewed<<endl;
			wcout<<L" Title :"		<< pDocsEntry->m_pszTitle<<endl;
			wcout<<L" ContentType :" << pDocsEntry->m_pszContentType<<endl;
			wcout<<L" Content Src :" << pDocsEntry->m_pszContentSrc<<endl;
			wcout<<L" LinkAlternate :" << pDocsEntry->m_pszLinkAlternate<<endl;
			wcout<<L" ResumeableEditMedia :"	<< (pDocsEntry->m_pszLinkResumableEditMedia?pDocsEntry->m_pszLinkResumableEditMedia:L"")<<endl;
			wcout<<L" AuthorName :"	<< pDocsEntry->m_pszAuthorName<<endl;
			wcout<<L" AuthorEmail :"	<< pDocsEntry->m_pszAuthorEmail<<endl;
			wcout<<L" ResourceID :"	<< pDocsEntry->m_pszResourceId<<endl;
			wcout<<L" Type :"	<< pDocsEntry->m_pszType<<endl;
			wcout<<L" ID :"	<< pDocsEntry->m_pszID<<endl;
			wcout<<L" LastModifiedName :"	<< pDocsEntry->m_pszLastModifiedByName<<endl;
			wcout<<L" LastModifiedEmail :"	<< pDocsEntry->m_pszLastModifiedByEmail<<endl;
			wcout<<L" QuotaByteUsed :"	<< (pDocsEntry->m_pszQuotaBytesUsed?pDocsEntry->m_pszQuotaBytesUsed:L"")<<endl;
			wcout<<L" QuotaByteUsedFormat :"	<<(pDocsEntry->m_pszQuotaBytesUsed? pDocsEntry->m_pszQuotaBytesUsedFormated:L"")<<endl;
			wcout<<L" ACL Link :"	<< pDocsEntry->m_pszFeedLinkACL<<endl;
			wcout<<L" Revision Link :"	<< (pDocsEntry->m_pszFeedLinkRevisions?pDocsEntry->m_pszFeedLinkRevisions:L"")<<endl;
			wcout<<L" MD5CheckSum :"	<< (pDocsEntry->m_pszMD5Checksum? pDocsEntry->m_pszMD5Checksum:L"")<<endl;
	
			wcout<<"................................................................................"<<endl;
		}
	}


	delete pXmlDoc;
	return TRUE;
}
开发者ID:jerrywjh,项目名称:gdriveLib,代码行数:66,代码来源:GDocsAPITest.cpp

示例6:

void TiXmlElement::operator=( const TiXmlElement& base )
{
	ClearThis();
	base.CopyTo( this );
}
开发者ID:lorichen,项目名称:xgame,代码行数:5,代码来源:tinyxml.cpp

示例7: TiXmlElement

bool ETHEntityProperties::WriteToXMLFile(TiXmlElement *pHeadRoot) const
{
	TiXmlElement *pRoot = new TiXmlElement(GS_L("Entity"));
	pHeadRoot->LinkEndChild(pRoot); 

	TiXmlElement *pElement;

	if (emissiveColor != ETH_DEFAULT_EMISSIVE_COLOR)
	{
		pElement = new TiXmlElement(GS_L("EmissiveColor"));
		pRoot->LinkEndChild(pElement); 
		pElement->SetDoubleAttribute(GS_L("r"), emissiveColor.x);
		pElement->SetDoubleAttribute(GS_L("g"), emissiveColor.y);
		pElement->SetDoubleAttribute(GS_L("b"), emissiveColor.z);
		pElement->SetDoubleAttribute(GS_L("a"), emissiveColor.w);
	}

	if (spriteCut != ETH_DEFAULT_SPRITE_CUT)
	{
		pElement = new TiXmlElement(GS_L("SpriteCut"));
		pRoot->LinkEndChild(pElement);
		pElement->SetDoubleAttribute(GS_L("x"), spriteCut.x);
		pElement->SetDoubleAttribute(GS_L("y"), spriteCut.y);
	}

	if (scale != ETH_DEFAULT_SCALE)
	{
		pElement = new TiXmlElement(GS_L("Scale"));
		pRoot->LinkEndChild(pElement);
		pElement->SetDoubleAttribute(GS_L("x"), scale.x);
		pElement->SetDoubleAttribute(GS_L("y"), scale.y);
	}

	if (pivotAdjust != ETH_DEFAULT_PIVOT_ADJUST)
	{
		pElement = new TiXmlElement(GS_L("PivotAdjust"));
		pRoot->LinkEndChild(pElement);
		pElement->SetDoubleAttribute(GS_L("x"), pivotAdjust.x);
		pElement->SetDoubleAttribute(GS_L("y"), pivotAdjust.y);
	}

	if (spriteFile != GS_L(""))
	{
		pElement = new TiXmlElement(GS_L("Sprite"));
		pElement->LinkEndChild(new TiXmlText(spriteFile));
		pRoot->LinkEndChild(pElement);
	}

	if (normalFile != GS_L(""))
	{
		pElement = new TiXmlElement(GS_L("Normal"));
		pElement->LinkEndChild(new TiXmlText(normalFile));
		pRoot->LinkEndChild(pElement);
	}

	if (glossFile != GS_L(""))
	{
		pElement = new TiXmlElement(GS_L("Gloss"));
		pElement->LinkEndChild(new TiXmlText(glossFile));
		pRoot->LinkEndChild(pElement);
	}

	if (!particleSystems.empty())
	{
		TiXmlElement *pParticles = new TiXmlElement(GS_L("Particles"));
		pRoot->LinkEndChild(pParticles);
		for (unsigned int t=0; t<particleSystems.size(); t++)
		{
			if (particleSystems[t]->nParticles > 0)
				particleSystems[t]->WriteToXMLFile(pParticles);
		}
	}

	if (light)
	{
		light->WriteToXMLFile(pRoot);
	}

	if (collision)
	{
		TiXmlElement *pCollisionRoot = collision->WriteToXMLFile(pRoot);
		if (pCollisionRoot)
		{
			// Write polygon data
			if (polygon)
			{
				pElement = new TiXmlElement(GS_L("Polygon"));
				TiXmlText* text = new TiXmlText(polygon->GetENMLDeclaration());
				text->SetCDATA(true);
				pElement->LinkEndChild(text);
				pCollisionRoot->LinkEndChild(pElement);
			}
			else if (shape == BS_POLYGON) // it the polygon data is empty, write sample data into it
			{
				pElement = new TiXmlElement(GS_L("Polygon"));
				TiXmlText* text = new TiXmlText(POLYGON_ENML_SAMPLE);
				text->SetCDATA(true);
				pElement->LinkEndChild(text);
				pCollisionRoot->LinkEndChild(pElement);
			}
//.........这里部分代码省略.........
开发者ID:skaflux,项目名称:ethanon,代码行数:101,代码来源:ETHEntityProperties.cpp

示例8: LINFO

bool TransFunc1DKeys::loadOsirixCLUT(const std::string& filename) {
    LINFO("Opening Osirix CLUT: " << filename);

    TiXmlDocument doc(filename.c_str());

    //TODO: this loader is much to specific to a certain order of XML tags and will crash if
    // anything is missing (#276).
    if (doc.LoadFile()) {
        // read and check version of plist file
        TiXmlNode* currNode = doc.FirstChild("plist");
        TiXmlElement* currElement = currNode->ToElement();

        currNode = currNode->FirstChild("dict");
        currNode = currNode->FirstChild("key");
        currElement = currNode->ToElement();

        // get reference to red, green and blue channel
        TiXmlElement* blueElement = 0;
        TiXmlElement* greenElement = 0;
        TiXmlElement* redElement = 0;
        TiXmlNode* blueNode = currElement->NextSibling();
        TiXmlNode* greenNode = ((blueNode->NextSibling())->NextSibling());
        TiXmlNode* redNode = ((greenNode->NextSibling())->NextSibling());
        blueNode = blueNode->FirstChild("integer");
        greenNode = greenNode->FirstChild("integer");
        redNode = redNode->FirstChild("integer");

        unsigned char* data = new unsigned char[256*4];

        for (int i = 0; i < 256; ++i) {
            data[4*i + 0] = 0;
            data[4*i + 1] = 0;
            data[4*i + 2] = 0;
            data[4*i + 3] = 0;

            blueNode = blueNode->NextSibling("integer");
            greenNode = greenNode->NextSibling("integer");
            redNode = redNode->NextSibling("integer");

            if (blueNode == 0 || greenNode == 0 || redNode == 0)
                continue;

            blueElement = blueNode->ToElement();
            greenElement = greenNode->ToElement();
            redElement = redNode->ToElement();

            data[4*i + 0] = atoi(redElement->GetText());
            data[4*i + 1] = atoi(greenElement->GetText());
            data[4*i + 2] = atoi(blueElement->GetText());
            data[4*i + 3] = (char)(255);
        }

        dimensions_ = tgt::ivec3(256, 1, 1);
        generateKeys(data);
        delete[] data;

        return true;
    }
    else
        return false;
}
开发者ID:emmaai,项目名称:fractalM,代码行数:61,代码来源:transfunc1dkeys.cpp

示例9: main

int main(int argc, char *argv[], char *env[])
{

  if (argc < 4)
  {
    cout
        << "Syntax: mdproject2mardyn <inputfile.cfg> <inputfile.inp> <outputfile.xml>"
        << endl;
    exit(1);
  }
  // define the output filename
  string outfile_name = "new-";
  outfile_name.append(argv[2]);

  TiXmlDocument doc;
  TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", "" );
  TiXmlElement * root = new TiXmlElement( "mardyncfg" );
  TiXmlElement * header = new TiXmlElement( "header" );
  TiXmlElement * version = new TiXmlElement( "version" );

  // apply the current date instead because we supposedly up to date
  time_t rawtime;
  struct tm * timeinfo;
  char datestr [10];
  time( &rawtime);
  timeinfo = localtime( &rawtime);
  strftime(datestr, 10, "%Y%m%d", timeinfo);
  TiXmlText * version_text = new TiXmlText( datestr );

  TiXmlElement * required_plugins = new TiXmlElement( "required-plugins" );
  TiXmlElement * experiment = new TiXmlElement( "experiment" );
  TiXmlElement * timestep_length = new TiXmlElement( "timestep-length" );
  TiXmlElement * cutoff_radius = new TiXmlElement( "cutoff-radius" );
  TiXmlElement * temperature = new TiXmlElement( "temperature" );
  TiXmlElement * current_time = new TiXmlElement( "current-time" );
  TiXmlElement * length = new TiXmlElement( "length" );
  TiXmlElement * lengthx = new TiXmlElement( "x" );
  TiXmlElement * lengthy = new TiXmlElement( "y" );
  TiXmlElement * lengthz = new TiXmlElement( "z" );
  TiXmlElement * phase_space = new TiXmlElement( "phase-space" );
  TiXmlElement * components = new TiXmlElement( "components" );
  TiXmlElement * components_data = new TiXmlElement( "data" );
  TiXmlElement * data_structure = new TiXmlElement( "data-structure" );

  root->LinkEndChild(header);
  header->LinkEndChild(version);
  version->LinkEndChild(version_text);
  header->LinkEndChild(required_plugins);
  root->LinkEndChild(experiment);
  experiment->LinkEndChild(timestep_length);
  experiment->LinkEndChild(cutoff_radius);
  experiment->LinkEndChild(temperature);
  experiment->LinkEndChild(current_time);
  experiment->LinkEndChild(length);
  length->LinkEndChild(lengthx);
  length->LinkEndChild(lengthy);
  length->LinkEndChild(lengthz);
  experiment->LinkEndChild(phase_space);
  experiment->LinkEndChild(components);
  components->LinkEndChild(components_data);
  experiment->LinkEndChild(data_structure);

  // Frist parse the .cfg file
  string token;
  fstream inputfstream;
  inputfstream.open(argv[1]);
  if (!inputfstream.is_open())
  {
    cout << "Error opening file " << argv[1] << " for reading.";
    exit(1);
  }
  string output_format, output_freq, output_file = "";

  while (inputfstream)
  {
    token.clear();
    inputfstream >> token;
    if (token.substr(0, 1)=="#")
    {
      inputfstream.ignore(INT_MAX, '\n');
    } else if (token.substr(0, 1)=="")
    {
      inputfstream.ignore(INT_MAX, '\n');
    } else if (token == "MDProjectConfig")
    {
      inputfstream.ignore(INT_MAX, '\n');
    } else if (token == "timestepLength")
    {
      inputfstream >> token;
      TiXmlText * timestep_length_text = new TiXmlText( token.c_str() );
      timestep_length->LinkEndChild(timestep_length_text);
    } else if (token == "cutoffRadius")
开发者ID:andersx,项目名称:ls1-mardyn,代码行数:92,代码来源:mdproject2mardyn.cpp

示例10: ParseExpression

void CScraperParser::ParseExpression(const CStdString& input, CStdString& dest, TiXmlElement* element, bool bAppend)
{
  CStdString strOutput = element->Attribute("output");

  TiXmlElement* pExpression = element->FirstChildElement("expression");
  if (pExpression)
  {
    bool bInsensitive=true;
    const char* sensitive = pExpression->Attribute("cs");
    if (sensitive)
      if (stricmp(sensitive,"yes") == 0)
        bInsensitive=false; // match case sensitive

    CRegExp reg(bInsensitive);
    CStdString strExpression;
    if (pExpression->FirstChild())
      strExpression = pExpression->FirstChild()->Value();
    else
      strExpression = "(.*)";
    ReplaceBuffers(strExpression);
    ReplaceBuffers(strOutput);

    if (!reg.RegComp(strExpression.c_str()))
    {
      return;
    }

    bool bRepeat = false;
    const char* szRepeat = pExpression->Attribute("repeat");
    if (szRepeat)
      if (stricmp(szRepeat,"yes") == 0)
        bRepeat = true;

    const char* szClear = pExpression->Attribute("clear");
    if (szClear)
      if (stricmp(szClear,"yes") == 0)
        dest=""; // clear no matter if regexp fails

    bool bClean[MAX_SCRAPER_BUFFERS];
    GetBufferParams(bClean,pExpression->Attribute("noclean"),true);

    bool bTrim[MAX_SCRAPER_BUFFERS];
    GetBufferParams(bTrim,pExpression->Attribute("trim"),false);

    bool bFixChars[MAX_SCRAPER_BUFFERS];
    GetBufferParams(bFixChars,pExpression->Attribute("fixchars"),false);

    bool bEncode[MAX_SCRAPER_BUFFERS];
    GetBufferParams(bEncode,pExpression->Attribute("encode"),false);

    int iOptional = -1;
    pExpression->QueryIntAttribute("optional",&iOptional);

    int iCompare = -1;
    pExpression->QueryIntAttribute("compare",&iCompare);
    if (iCompare > -1)
      m_param[iCompare-1].ToLower();
    CStdString curInput = input;
    for (int iBuf=0;iBuf<MAX_SCRAPER_BUFFERS;++iBuf)
    {
      if (bClean[iBuf])
        InsertToken(strOutput,iBuf+1,"!!!CLEAN!!!");
      if (bTrim[iBuf])
        InsertToken(strOutput,iBuf+1,"!!!TRIM!!!");
      if (bFixChars[iBuf])
        InsertToken(strOutput,iBuf+1,"!!!FIXCHARS!!!");
      if (bEncode[iBuf])
        InsertToken(strOutput,iBuf+1,"!!!ENCODE!!!");
    }
    int i = reg.RegFind(curInput.c_str());
    while (i > -1 && (i < (int)curInput.size() || curInput.size() == 0))
    {
      if (!bAppend)
      {
        dest = "";
        bAppend = true;
      }
      CStdString strCurOutput=strOutput;

      if (iOptional > -1) // check that required param is there
      {
        char temp[4];
        sprintf(temp,"\\%i",iOptional);
        char* szParam = reg.GetReplaceString(temp);
        CRegExp reg2;
        reg2.RegComp("(.*)(\\\\\\(.*\\\\2.*)\\\\\\)(.*)");
        int i2=reg2.RegFind(strCurOutput.c_str());
        while (i2 > -1)
        {
          char* szRemove = reg2.GetReplaceString("\\2");
          int iRemove = strlen(szRemove);
          int i3 = strCurOutput.find(szRemove);
          if (szParam && strcmp(szParam,""))
          {
            strCurOutput.erase(i3+iRemove,2);
            strCurOutput.erase(i3,2);
          }
          else
            strCurOutput.replace(strCurOutput.begin()+i3,strCurOutput.begin()+i3+iRemove+2,"");

//.........这里部分代码省略.........
开发者ID:SHPURDYdBurt,项目名称:https-github.com-xbmc-atv2,代码行数:101,代码来源:ScraperParser.cpp

示例11: file

void CSlingboxFile::LoadSettings(const CStdString& strHostname)
{
  // Load default settings
  m_sSlingboxSettings.strHostname = strHostname;
  m_sSlingboxSettings.iVideoWidth = 320;
  m_sSlingboxSettings.iVideoHeight = 240;
  m_sSlingboxSettings.iVideoResolution = (int)CSlingbox::RESOLUTION320X240;
  m_sSlingboxSettings.iVideoBitrate = 704;
  m_sSlingboxSettings.iVideoFramerate = 30;
  m_sSlingboxSettings.iVideoSmoothing = 50;
  m_sSlingboxSettings.iAudioBitrate = 64;
  m_sSlingboxSettings.iIFrameInterval = 10;
  m_sSlingboxSettings.uiCodeChannelUp = 0;
  m_sSlingboxSettings.uiCodeChannelDown = 0;
  for (unsigned int i = 0; i < 10; i++)
    m_sSlingboxSettings.uiCodeNumber[i] = 0;

  // Check if a SlingboxSettings.xml file exists
  CStdString slingboxXMLFile = CProfilesManager::Get().GetUserDataItem("SlingboxSettings.xml");
  if (!CFile::Exists(slingboxXMLFile))
  {
    CLog::Log(LOGNOTICE, "No SlingboxSettings.xml file (%s) found - using default settings",
      slingboxXMLFile.c_str());
    return;
  }

  // Load the XML file
  CXBMCTinyXML slingboxXML;
  if (!slingboxXML.LoadFile(slingboxXMLFile))
  {
    CLog::Log(LOGERROR, "%s - Error loading %s - line %d\n%s", __FUNCTION__, 
      slingboxXMLFile.c_str(), slingboxXML.ErrorRow(), slingboxXML.ErrorDesc());
    return;
  }

  // Check to make sure layout is correct
  TiXmlElement * pRootElement = slingboxXML.RootElement();
  if (!pRootElement || strcmpi(pRootElement->Value(), "slingboxsettings") != 0)
  {
    CLog::Log(LOGERROR, "%s - Error loading %s - no <slingboxsettings> node found",
      __FUNCTION__, slingboxXMLFile.c_str());
    return;
  }

  // Success so far
  CLog::Log(LOGNOTICE, "Loaded SlingboxSettings.xml from %s", slingboxXMLFile.c_str());

  // Search for the first settings that specify no hostname or match our hostname
  TiXmlElement *pElement;
  for (pElement = pRootElement->FirstChildElement("slingbox"); pElement;
    pElement = pElement->NextSiblingElement("slingbox"))
  {
    const char *hostname = pElement->Attribute("hostname");
    if (!hostname || StringUtils::EqualsNoCase(m_sSlingboxSettings.strHostname, hostname))
    {
      // Load setting values
      XMLUtils::GetInt(pElement, "width", m_sSlingboxSettings.iVideoWidth, 0, 640);
      XMLUtils::GetInt(pElement, "height", m_sSlingboxSettings.iVideoHeight, 0, 480);
      XMLUtils::GetInt(pElement, "videobitrate", m_sSlingboxSettings.iVideoBitrate, 50, 8000);
      XMLUtils::GetInt(pElement, "framerate", m_sSlingboxSettings.iVideoFramerate, 1, 30);
      XMLUtils::GetInt(pElement, "smoothing", m_sSlingboxSettings.iVideoSmoothing, 0, 100);
      XMLUtils::GetInt(pElement, "audiobitrate", m_sSlingboxSettings.iAudioBitrate, 16, 96);
      XMLUtils::GetInt(pElement, "iframeinterval", m_sSlingboxSettings.iIFrameInterval, 1, 30);

      // Load any button code values
      TiXmlElement * pCodes = pElement->FirstChildElement("buttons");
      if (pCodes)
      {
        XMLUtils::GetHex(pCodes, "channelup", m_sSlingboxSettings.uiCodeChannelUp);
        XMLUtils::GetHex(pCodes, "channeldown", m_sSlingboxSettings.uiCodeChannelDown);
        XMLUtils::GetHex(pCodes, "zero", m_sSlingboxSettings.uiCodeNumber[0]);
        XMLUtils::GetHex(pCodes, "one", m_sSlingboxSettings.uiCodeNumber[1]);
        XMLUtils::GetHex(pCodes, "two", m_sSlingboxSettings.uiCodeNumber[2]);
        XMLUtils::GetHex(pCodes, "three", m_sSlingboxSettings.uiCodeNumber[3]);
        XMLUtils::GetHex(pCodes, "four", m_sSlingboxSettings.uiCodeNumber[4]);
        XMLUtils::GetHex(pCodes, "five", m_sSlingboxSettings.uiCodeNumber[5]);
        XMLUtils::GetHex(pCodes, "six", m_sSlingboxSettings.uiCodeNumber[6]);
        XMLUtils::GetHex(pCodes, "seven", m_sSlingboxSettings.uiCodeNumber[7]);
        XMLUtils::GetHex(pCodes, "eight", m_sSlingboxSettings.uiCodeNumber[8]);
        XMLUtils::GetHex(pCodes, "nine", m_sSlingboxSettings.uiCodeNumber[9]);
      }

      break;
    }
  }

  // Prepare our resolution enum mapping array
  const struct
  {
    unsigned int uiWidth;
    unsigned int uiHeight;
    CSlingbox::Resolution eEnum;
  } m_resolutionMap[11] = {
    {0, 0, CSlingbox::NOVIDEO},
    {128, 96, CSlingbox::RESOLUTION128X96},
    {160, 120, CSlingbox::RESOLUTION160X120},
    {176, 120, CSlingbox::RESOLUTION176X120},
    {224, 176, CSlingbox::RESOLUTION224X176},
    {256, 192, CSlingbox::RESOLUTION256X192},
    {320, 240, CSlingbox::RESOLUTION320X240},
//.........这里部分代码省略.........
开发者ID:Fury04,项目名称:xbmc,代码行数:101,代码来源:SlingboxFile.cpp

示例12: ResponseMessage

ConfirmationDisputed::ConfirmationDisputed(TiXmlNode* xmlNode)
: ResponseMessage(xmlNode)
{
    #ifdef ConsolePrint
        std::string initialtap_ = FileManager::instance().tap_;
        FileManager::instance().tap_.append("   ");
    #endif 
   //originatingEventNode ----------------------------------------------------------------------------------------------------------------------
   TiXmlElement* originatingEventNode = xmlNode->FirstChildElement("originatingEvent");

   if(originatingEventNode){originatingEventIsNull_ = false;}
   else{originatingEventIsNull_ = true;}

   #ifdef ConsolePrint
      FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- originatingEventNode , address : " << originatingEventNode << std::endl;
   #endif
   if(originatingEventNode)
   {
      if(originatingEventNode->Attribute("href") || originatingEventNode->Attribute("id"))
      {
          if(originatingEventNode->Attribute("id"))
          {
             originatingEventIDRef_ = originatingEventNode->Attribute("id");
             originatingEvent_ = boost::shared_ptr<OriginatingEvent>(new OriginatingEvent(originatingEventNode));
             originatingEvent_->setID(originatingEventIDRef_);
             IDManager::instance().setID(originatingEventIDRef_,originatingEvent_);
          }
          else if(originatingEventNode->Attribute("href")) { originatingEventIDRef_ = originatingEventNode->Attribute("href");}
          else { QL_FAIL("id or href error"); }
      }
      else { originatingEvent_ = boost::shared_ptr<OriginatingEvent>(new OriginatingEvent(originatingEventNode));}
   }

   //tradeNode ----------------------------------------------------------------------------------------------------------------------
   TiXmlElement* tradeNode = xmlNode->FirstChildElement("trade");

   if(tradeNode){tradeIsNull_ = false;}
   else{tradeIsNull_ = true;}

   #ifdef ConsolePrint
      FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- tradeNode , address : " << tradeNode << std::endl;
   #endif
   if(tradeNode)
   {
      if(tradeNode->Attribute("href") || tradeNode->Attribute("id"))
      {
          if(tradeNode->Attribute("id"))
          {
             tradeIDRef_ = tradeNode->Attribute("id");
             trade_ = boost::shared_ptr<Trade>(new Trade(tradeNode));
             trade_->setID(tradeIDRef_);
             IDManager::instance().setID(tradeIDRef_,trade_);
          }
          else if(tradeNode->Attribute("href")) { tradeIDRef_ = tradeNode->Attribute("href");}
          else { QL_FAIL("id or href error"); }
      }
      else { trade_ = boost::shared_ptr<Trade>(new Trade(tradeNode));}
   }

   //amendmentNode ----------------------------------------------------------------------------------------------------------------------
   TiXmlElement* amendmentNode = xmlNode->FirstChildElement("amendment");

   if(amendmentNode){amendmentIsNull_ = false;}
   else{amendmentIsNull_ = true;}

   #ifdef ConsolePrint
      FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- amendmentNode , address : " << amendmentNode << std::endl;
   #endif
   if(amendmentNode)
   {
      if(amendmentNode->Attribute("href") || amendmentNode->Attribute("id"))
      {
          if(amendmentNode->Attribute("id"))
          {
             amendmentIDRef_ = amendmentNode->Attribute("id");
             amendment_ = boost::shared_ptr<TradeAmendmentContent>(new TradeAmendmentContent(amendmentNode));
             amendment_->setID(amendmentIDRef_);
             IDManager::instance().setID(amendmentIDRef_,amendment_);
          }
          else if(amendmentNode->Attribute("href")) { amendmentIDRef_ = amendmentNode->Attribute("href");}
          else { QL_FAIL("id or href error"); }
      }
      else { amendment_ = boost::shared_ptr<TradeAmendmentContent>(new TradeAmendmentContent(amendmentNode));}
   }

   //increaseNode ----------------------------------------------------------------------------------------------------------------------
   TiXmlElement* increaseNode = xmlNode->FirstChildElement("increase");

   if(increaseNode){increaseIsNull_ = false;}
   else{increaseIsNull_ = true;}

   #ifdef ConsolePrint
      FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- increaseNode , address : " << increaseNode << std::endl;
   #endif
   if(increaseNode)
   {
      if(increaseNode->Attribute("href") || increaseNode->Attribute("id"))
      {
          if(increaseNode->Attribute("id"))
          {
//.........这里部分代码省略.........
开发者ID:minikie,项目名称:OTCDerivativesCalculatorModule,代码行数:101,代码来源:ConfirmationDisputed.cpp

示例13: garmin_close


//.........这里部分代码省略.........
                <Minor>0</Minor>
              </Version>
              <Description>Missing</Description>
              <ExpectedPartNumber>006-B0478-00</ExpectedPartNumber>
              <CurrentPartNumber>006-B0478-00</CurrentPartNumber>
              <IsErased>true</IsErased>
              <IsUserUpdateable>true</IsUserUpdateable>
            </MemoryRegion>
          </GarminModeExtension>
        </Extensions>
      </GarminMode>

    </Device>


    */
    garmin_unit garmin;
    if ( garmin_init(&garmin,0) != 0 ) {
        garmin_close(&garmin);
    } else {
        Log::err("Opening of garmin device failed. No longer attached!?");
        return "";
    }


    TiXmlDocument doc;
    TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", "no" );
    doc.LinkEndChild( decl );

    /*<Device xmlns="http://www.garmin.com/xmlschemas/GarminDevice/v2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.garmin.com/xmlschemas/GarminDevice/v2 http://www.garmin.com/xmlschemas/GarminDevicev2.xsd">*/

    TiXmlElement * device = new TiXmlElement( "Device" );
    device->SetAttribute("xmlns", "http://www.garmin.com/xmlschemas/GarminDevice/v2");
    device->SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
    device->SetAttribute("xsi:schemaLocation", "http://www.garmin.com/xmlschemas/GarminDevice/v2 http://www.garmin.com/xmlschemas/GarminDevicev2.xsd");
    doc.LinkEndChild( device );

    /*<Model>
        <PartNumber>006-B0450-00</PartNumber>
        <SoftwareVersion>320</SoftwareVersion>
        <Description>EDGE305 Software Version 3.20</Description>
      </Model> */
    TiXmlElement * model = new TiXmlElement( "Model" );
    TiXmlElement * partnumber = new TiXmlElement( "PartNumber" );
    partnumber->LinkEndChild(new TiXmlText("006-B0450-00"));
    TiXmlElement * version = new TiXmlElement( "SoftwareVersion" );
    std::stringstream ss;
    ss << garmin.product.software_version;
    version->LinkEndChild(new TiXmlText( ss.str() ));
    TiXmlElement * descr = new TiXmlElement( "Description" );
    descr->LinkEndChild(new TiXmlText(this->displayName));
    model->LinkEndChild(partnumber);
    model->LinkEndChild(version);
    model->LinkEndChild(descr);
    device->LinkEndChild( model );

    /*  <Id>3333333333</Id> */
    TiXmlElement * id = new TiXmlElement( "Id" );
    ss.str(""); // empty stringstream
    ss << garmin.id;
    id->LinkEndChild(new TiXmlText(ss.str()));
    device->LinkEndChild(id);
    /*  <DisplayName>Your name</DisplayName>*/
    TiXmlElement * dispName = new TiXmlElement( "DisplayName" );
开发者ID:daijoubu,项目名称:GarminPlugin,代码行数:67,代码来源:edge305Device.cpp

示例14: final_xml_file

bool final_xml_file(const char* xml_name, cat_items_mgr& mgr)
{
	if(xml_name == NULL)return false;
	TiXmlDocument* pdoc = new TiXmlDocument;

	TiXmlElement* root = new TiXmlElement("Items");
	pdoc->LinkEndChild(root);
	
	std::map<int, cat_items>::iterator pItr = mgr.cat_items_map.begin();
	for(; pItr != mgr.cat_items_map.end(); ++pItr)
	{
		cat_items* p_cat = &(pItr->second);
		TiXmlElement* pCat = new TiXmlElement("Cat");
		pCat->SetAttribute("ID",  p_cat->cat_id);
		pCat->SetAttribute("DbCatID", p_cat->db_cat_id);
		pCat->SetAttribute("Name", p_cat->name);
		pCat->SetAttribute("Max", p_cat->max);
		
		map<int, item_attire_data>::iterator pItr2 = p_cat->item_map.begin();
		for(; pItr2 != p_cat->item_map.end(); ++pItr2)
		{
			item_attire_data* p_data= &(pItr2->second);
			TiXmlElement* pData = new TiXmlElement("Item");	
			pData->SetAttribute("ID", p_data->id);
			pData->SetAttribute("Name", p_data->name);
			pData->SetAttribute("DropLv", p_data->droplv);
			pData->SetAttribute("QualityLevel", p_data->quality_level);
			pData->SetAttribute("EquipPart", p_data->equip_part);
			pData->SetAttribute("Price", p_data->price);
			pData->SetAttribute("SellPrice", p_data->sell_price);
			pData->SetAttribute("RepairPrice", p_data->repair_price);
			pData->SetAttribute("UseLv", p_data->uselv);
			pData->SetAttribute("Strength", p_data->strength);
			pData->SetAttribute("Agility", p_data->agility);
			pData->SetAttribute("BodyQuality", p_data->body_quality);
			pData->SetAttribute("Stamina", p_data->stamina);
			if(strlen(p_data->atk) > 0)
			{
				pData->SetAttribute("Atk", p_data->atk);
			}
			pData->SetAttribute("Def", p_data->def);
			pData->SetAttribute("Duration", p_data->duration);
			pData->SetAttribute("Hit", p_data->hit);
			pData->SetAttribute("Dodge", p_data->dodge);
			pData->SetAttribute("Crit", p_data->crit);
			pData->SetAttribute("Hp", p_data->hp);
			pData->SetAttribute("Mp", p_data->mp);
			pData->SetAttribute("AddHp", p_data->add_hp);
			pData->SetAttribute("AddMp", p_data->add_mp);
			pData->SetAttribute("Slot",  p_data->slot);
			pData->SetAttribute("Tradability", p_data->trade_ability);
			pData->SetAttribute("VipTradability", p_data->vip_trade_ability);
			pData->SetAttribute("Tradable", p_data->trade_able);
			pData->SetAttribute("ExploitValue", p_data->exploit_value);
			pData->SetAttribute("SetID", p_data->setid);
			pData->SetAttribute("honorLevel", p_data->honor_level);
			pData->SetAttribute("LifeTime", p_data->life_time);
			pData->SetAttribute("VipOnly", p_data->vip_only);
			pData->SetAttribute("DailyId", p_data->dailyid);
			pData->SetAttribute("decompose", p_data->decompose);
			pData->SetAttribute("Shop", p_data->shop);
			pData->SetAttribute("UnStorage", p_data->un_storage);
			pData->SetAttribute("resID", p_data->res_id);
			if(strlen(p_data->descipt) > 0)
			{
				TiXmlElement* pdescipt = new TiXmlElement("descript");
				TiXmlText *pText = new TiXmlText(p_data->descipt);
				pText->SetCDATA(true);
				pdescipt->InsertEndChild(*pText);
				pData->InsertEndChild(*pdescipt);
			}
	
			pCat->InsertEndChild(*pData);	
		}
		root->InsertEndChild(*pCat);
	}
	return pdoc->SaveFile(xml_name);
}
开发者ID:Zhanyin,项目名称:taomee,代码行数:78,代码来源:item_attire.cpp

示例15: XDEVL_MODULE_ERROR

	xdl_int XdevLFTDI::readInfoFromXMLFile() {
		if(getMediator()->getXmlFilename() == nullptr)
			return RET_FAILED;

		TiXmlDocument xmlDocument;
		if(!xmlDocument.LoadFile(getMediator()->getXmlFilename())) {
			XDEVL_MODULE_ERROR("Could not parse xml file: " << getMediator()->getXmlFilename() << std::endl);
			return RET_FAILED;
		}

		TiXmlHandle docHandle(&xmlDocument);
		TiXmlElement* root = docHandle.FirstChild(XdevLCorePropertiesName.c_str()).FirstChildElement("XdevLSerial").ToElement();
		if(!root) {
			XDEVL_MODULE_WARNING("<XdevLSerial> section not found. Using default values for the device.\n");
			return RET_SUCCESS;
		}

		while(root != nullptr) {
			if(root->Attribute("id")) {
				XdevLID id(root->Attribute("id"));
				if(getID() == id) {
					if(root->Attribute("device")) {
						m_deviceName = XdevLString(root->Attribute("device"));
					}
					if(root->Attribute("usb_in_size")) {
						std::istringstream ss(root->Attribute("usb_in_size"));
						ss >> m_usbInSize;
					}
					if(root->Attribute("usb_out_size")) {
						std::istringstream ss(root->Attribute("usb_out_size"));
						ss >> m_usbOutSize;
					}
					if(root->Attribute("latency_timer")) {
						std::istringstream ss(root->Attribute("latency_timer"));
						ss >> m_latencyTimer;
					}
开发者ID:yaakuro,项目名称:XdevLSDK,代码行数:36,代码来源:XdevLFTDI.cpp


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