本文整理汇总了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;
}
示例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);
}
示例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
}
示例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;
}
示例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);
}