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


C++ EList::append方法代码示例

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


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

示例1: readData

EList KalziumDataObject::readData(  QDomDocument &dataDocument )
{
	EList list;
	QDomNodeList elementNodes; //the list of all element
	QDomElement  domElement;   //a single element

	//read in all elements
	elementNodes = dataDocument.elementsByTagName( "element" );

	const uint count = elementNodes.count();

	for ( uint i = 0; i < count; ++i )
	{//iterate through all elements
		domElement = ( const QDomElement& ) elementNodes.item( i ).toElement();

		double mass = domElement.namedItem( "mass" ).toElement().text().toDouble();
		double en = domElement.namedItem( "electronegativity" ).toElement().text().toDouble();
		double ea = domElement.namedItem( "electronaffinity" ).toElement().text().toDouble();
		double mp = domElement.namedItem( "meltingpoint" ).toElement().text().toDouble();
		double bp = domElement.namedItem( "boilingpoint" ).toElement().text().toDouble();
		double density = domElement.namedItem( "density" ).toElement().text().toDouble();
		double covalent_radius = domElement.namedItem( "radius" ).namedItem( "covalent" ).toElement().text().toDouble();
		//van der Waals-Radius
		double vdw_radius = domElement.namedItem( "radius" ).namedItem( "vdw" ).toElement().text().toDouble();
		double atomic_radius = domElement.namedItem( "radius" ).namedItem( "atomic" ).toElement().text().toDouble();
		double ionic_radius = domElement.namedItem( "radius" ).namedItem( "ionic" ).toElement().text().toDouble();
		QString ionic_charge = domElement.namedItem( "radius" ).namedItem( "ionic" ).toElement().attributeNode( "charge" ).value();
		
		int bio = domElement.namedItem( "biologicalmeaning" ).toElement().text().toInt();
		int radioactive = domElement.namedItem( "radioactive" ).toElement().text().toInt();
		int period = domElement.namedItem( "period" ).toElement().text().toInt();
		int artificial = domElement.namedItem( "artificial" ).toElement().text().toInt();
		int date = domElement.namedItem( "date" ).toElement().text().toInt();
		int number = domElement.namedItem( "number" ).toElement().text().toInt();
		int abundance = domElement.namedItem( "abundance" ).toElement().text().toInt();
		
		QString scientist = domElement.namedItem( "date" ).toElement().attributeNode( "scientist" ).value();
		QString crystal = domElement.namedItem( "crystalstructure" ).toElement().text();
		
		QDomElement nameE = domElement.namedItem( "name" ).toElement();
		QString name = nameE.text();
		QString origin = i18n( nameE.attributeNode( "origin" ).value().utf8() );
		
		QString block = domElement.namedItem( "block" ).toElement().text();
		QString group = domElement.namedItem( "group" ).toElement().text();
		QString family = domElement.namedItem( "family" ).toElement().text();
		QString orbits = domElement.namedItem( "orbits" ).toElement().text();
		QString symbol = domElement.namedItem( "symbol" ).toElement().text();
		QString oxydation = domElement.namedItem( "oxydation" ).toElement().text();
		QString acidicbehaviour = domElement.namedItem( "acidicbehaviour" ).toElement().text();

		QDomNodeList elist = domElement.elementsByTagName( "energy" );
		QValueList<double> ionlist;
		for( uint i = 0; i < elist.length(); i++ )
		{
			ionlist.append(  elist.item(  i ).toElement().text().toDouble() );
		}
		
		//now read in all the date for the isotopes
		QDomNodeList isotopelist = domElement.elementsByTagName( "isotope" );
		QValueList<Isotope*> isolist;
		for( uint i = 0; i < isotopelist.length(); i++ )
		{
			QDomElement iso = isotopelist.item( i ).toElement();
			double halflife = iso.attributeNode( "halflife" ).value().toDouble();
			double weight = iso.attributeNode( "weight" ).value().toDouble();
			QString format = iso.attributeNode( "halflifeformat" ).value();
			int neutrons  = iso.attributeNode( "neutron" ).value().toInt();
			double percentage = iso.attributeNode( "percentage" ).value().toDouble();
			double alphapercentage = iso.attributeNode( "alphapercentage" ).value().toDouble();
			double betapluspercentage = iso.attributeNode( "betapluspercentage" ).value().toDouble();
			double betaminuspercentage = iso.attributeNode( "betaminuspercentage" ).value().toDouble();
			double ecpercentage = iso.attributeNode( "ecpercentage" ).value().toDouble();
			double alphadecay = iso.attributeNode( "alphadecay" ).value().toDouble();
			double betaplusdecay = iso.attributeNode( "betaplusdecay" ).value().toDouble();
			double betaminusdecay = iso.attributeNode( "betaminusdecay" ).value().toDouble();
			double ecdecay = iso.attributeNode( "ecdecay" ).value().toDouble();
			QString spin = iso.attributeNode( "spin" ).value();
			QString magmoment = iso.attributeNode( "magmoment" ).value();
			
						
			Isotope *isotope = new Isotope( neutrons, 
					number, 
					percentage, 
					weight, 
					halflife, 
					format, 
					alphadecay, 
					betaplusdecay, 
					betaminusdecay, 
					ecdecay, 
					alphapercentage, 
					betapluspercentage, 
					betaminuspercentage, 
					ecpercentage, 
					spin, 
					magmoment );
			isolist.append( isotope );
		}

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


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