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


C++ QDomElement::clear方法代码示例

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


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

示例1: file

QDomElement Masked_grid_geometry_xml_io::
  write_grid_geometry( QDir dir, QDomDocument& dom, const  Geostat_grid* grid) const{

	const Reduced_grid *mgrid =  dynamic_cast<const Reduced_grid*>( grid );

  Cartesian_grid_geometry_xml_io cgrid_io;

  QDomElement elem = cgrid_io.write_grid_geometry(dir, dom, grid);
	elem.setAttribute("nActiveCells",mgrid->size());

  QFile file( dir.absoluteFilePath("gridmask.sgems" ) );
  if( !file.open( QIODevice::WriteOnly ) ) {
  	elem.clear();
  	return elem;
  }
	QDataStream stream( &file );
	#if QT_VERSION >= 0x040600
		stream.setFloatingPointPrecision(QDataStream::SinglePrecision);
	#endif

	const std::vector<bool> mask = mgrid->mask();
	std::vector<bool>::const_iterator it_mask = mask.begin();
	for(; it_mask != mask.end(); ++it_mask) stream<< *it_mask;
	file.close();
	return elem;
}
开发者ID:TUDz,项目名称:ar2tech-SGeMS-public,代码行数:26,代码来源:sgems_folder_grid_geometry.cpp

示例2: elementAt

bool Xml::elementAt(QDomElement root, QString path, QDomElement &element) {
    element.clear();

    QStringList pathFragments = path.split('/');

    if(pathFragments.isEmpty())
        return false;

    return ::elementAt(root.firstChildElement(pathFragments[0]), pathFragments, 0, element);
}
开发者ID:falbrechtskirchinger,项目名称:yadu,代码行数:10,代码来源:xml.cpp

示例3: clearNodes

// Clears nodes within the specified nodeMap
void clearNodes( DefSections &nodeMap )
{
	DefSections::iterator myIter;

	for( myIter = nodeMap.begin(); myIter != nodeMap.end(); ++myIter )
	{
		QDomElement node = myIter.data();
		node.clear(); // Delete all subnodes - i'm unsure if this delets all data
	}

	nodeMap.clear(); // Delete it's contents
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:13,代码来源:wpdefmanager.cpp

示例4: readChildElement

/**
 * This method is used to read a child XML object of a XML object
 * @param parent The parent XML object
 * @param key The name of the child
 * @return The child node
 */
QDomElement CMapFileFilterXML::readChildElement(QDomElement *parent,QString key)
{
	QDomElement e;
	
	// Find Root Zone
    QDomNode n = parent->namedItem(key);
    if (n.isNull())
    {
		e.clear();
		return e;
    }

    e = n.toElement();

    return e;
}
开发者ID:FractalBobz,项目名称:kmuddy,代码行数:22,代码来源:cmapfilefilterxml.cpp

示例5: GetMacroDataFromXml

void CGrammarManagerFromProgram::GetMacroDataFromXml(QList<QString>& categoryList)
{
	QDomElement currentElement = m_domDocument->documentElement();

	/*遍历分类列表*/
	for (int i = 0; i < categoryList.size(); i++)
	{
		/*所查找的分类*/
		QString strCategory = categoryList.at(i);
		/*当前分类下所有子节点*/
		QDomNodeList childNodes = currentElement.childNodes();
		/*遍历子节点*/
		for (int j = 0; j < childNodes.size(); j++)
		{
			if (childNodes.at(j).isElement())
			{
				QDomElement childElement = childNodes.at(j).toElement();
				/*若找到该分类,则遍历该分类下的子节点*/
				if (childElement.attribute(XML_ATTRIBUTE_NAME) == strCategory)
				{
					currentElement.clear();
					currentElement = childElement;
					break;
				}
			}
		}
	}

	/*宏命令列表*/
	QList<QString> strListMacro;
	QDomNodeList childNodes = currentElement.childNodes();
	for (int i = 0; i < childNodes.size(); i++)
	{
		if (childNodes.at(i).isElement())
		{
			strListMacro << childNodes.at(i).toElement().attribute(XML_ATTRIBUTE_NAME);

		}
	}

	//m_modelMacro->UpdateData(strListMacro);

}
开发者ID:6VV,项目名称:TeachingBox,代码行数:43,代码来源:CGrammarManagerFromProgram.cpp


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