本文整理汇总了C++中QDomNamedNodeMap::size方法的典型用法代码示例。如果您正苦于以下问题:C++ QDomNamedNodeMap::size方法的具体用法?C++ QDomNamedNodeMap::size怎么用?C++ QDomNamedNodeMap::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDomNamedNodeMap
的用法示例。
在下文中一共展示了QDomNamedNodeMap::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadContent
void DialogEditNodeTable::LoadContent()
{
//Load the element value
m_pValueLine->setText(m_node.toElement().text());
//Get all the attributes
QDomNamedNodeMap attributes = m_node.attributes();
m_pTable->setRowCount(attributes.size());
QTableWidgetItem* item = 0;
//Add each attribute in to the table
for(int indexRow=0; indexRow < attributes.size(); ++indexRow)
{
int columnIndex = 0;
QDomAttr attributeNode = attributes.item(indexRow).toAttr();
item = new QTableWidgetItem(attributeNode.nodeName());// << attribute name
item->setToolTip(attributeNode.nodeName());
m_pTable->setItem(indexRow, columnIndex, item);
columnIndex++;
item = new QTableWidgetItem(attributeNode.nodeValue());// << value
item->setToolTip(attributeNode.nodeValue());
m_pTable->setItem(indexRow, columnIndex, item);
columnIndex++;
}
}
示例2: size
int QDomNamedNodeMapProto:: size() const
{
QDomNamedNodeMap *item = qscriptvalue_cast<QDomNamedNodeMap*>(thisObject());
if (item)
return item->size();
return 0;
}
示例3: ProcessAttributes
bool OsisData::ProcessAttributes(QDomElement& xmlElement)
{
// Parse and save attributes
QDomNamedNodeMap attr = xmlElement.attributes();
int size = attr.size();
if (!size)
{
return false; // Error
}
for (int i = 0; i < size; i++)
{
QDomAttr at = attr.item(i).toAttr();
QString value(at.value());
int key = getEnumKey("OsisElementAttributes", at.name().toLocal8Bit().constData());
if (key != -1)
{
if (Attribute.contains(key))
{
Attribute.remove(key);
}
Attribute[key] = value;
}
else
{
qCritical() << "<" << ElementName << ">: Unknown attribute: " << at.name() << "=" << value << endl;
}
}
return true;
}
示例4: QDate
/** Construct an DrugDrugInteraction object using the XML QDomElement. */
DrugDrugInteraction::DrugDrugInteraction(const QDomElement &element)
{
if (element.tagName()!="DDI") {
LOG_ERROR_FOR("DrugDrugInteraction", "Wrong XML Element");
} else {
m_Data.insert(FirstInteractorName, Constants::correctedUid(Utils::removeAccents(element.attribute("i1"))));
m_Data.insert(SecondInteractorName, Constants::correctedUid(Utils::removeAccents(element.attribute("i2"))));
m_Data.insert(FirstInteractorRouteOfAdministrationIds, element.attribute("i1ra").split(";"));
m_Data.insert(SecondInteractorRouteOfAdministrationIds, element.attribute("i2ra").split(";"));
m_Data.insert(LevelCode, element.attribute("l"));
m_Data.insert(LevelName, ::levelName(element.attribute("l")));
m_Data.insert(DateCreation, QDate::fromString(element.attribute("a", QDate(2010,01,01).toString(Qt::ISODate)), Qt::ISODate));
m_Data.insert(DateLastUpdate, QDate::fromString(element.attribute("lu", QDate(2010,01,01).toString(Qt::ISODate)), Qt::ISODate));
m_Data.insert(IsValid, element.attribute("v", "1").toInt());
m_Data.insert(IsReviewed, element.attribute("rv", "0").toInt());
if (!element.attribute("p").isEmpty())
m_Data.insert(PMIDsStringList, element.attribute("p").split(";"));
m_Data.insert(IsDuplicated, false);
// Read Risk
QDomElement risk = element.firstChildElement("R");
while (!risk.isNull()) {
setRisk(risk.attribute("t"), risk.attribute("l"));
risk = risk.nextSiblingElement("R");
}
// Read Management
QDomElement management = element.firstChildElement("M");
while (!management.isNull()) {
setManagement(management.attribute("t"), management.attribute("l"));
management = management.nextSiblingElement("M");
}
// Read Dose related interactions
QDomElement dose = element.firstChildElement("D");
while (!dose.isNull()) {
DrugDrugInteractionDose *ddidose = 0;
if (dose.attribute("i") == "1") {
ddidose = &m_FirstDose;
} else {
ddidose = &m_SecondDose;
}
if (dose.attribute("uf").toInt()==1) {
ddidose->setData(DrugDrugInteractionDose::UsesFrom, true);
ddidose->setData(DrugDrugInteractionDose::FromValue , dose.attribute("fv"));
ddidose->setData(DrugDrugInteractionDose::FromUnits, dose.attribute("fu"));
ddidose->setData(DrugDrugInteractionDose::FromRepartition , dose.attribute("fr"));
} else if (dose.attribute("ut").toInt()==1) {
ddidose->setData(DrugDrugInteractionDose::UsesTo, true);
ddidose->setData(DrugDrugInteractionDose::ToValue , dose.attribute("tv"));
ddidose->setData(DrugDrugInteractionDose::ToUnits, dose.attribute("tu"));
ddidose->setData(DrugDrugInteractionDose::ToRepartition , dose.attribute("tr"));
}
dose = dose.nextSiblingElement("D");
}
// Read formalized risk
QDomElement form = element.firstChildElement("F");
QDomNamedNodeMap attributeMap = form.attributes();
for(int i=0; i < attributeMap.size(); ++i) {
addFormalized(attributeMap.item(i).nodeName(), form.attribute(attributeMap.item(i).nodeName()));
}
}
}
示例5: helperToXmlAddDomElement
static void helperToXmlAddDomElement(QXmlStreamWriter* stream, const QDomElement& element, const QStringList &omitNamespaces)
{
stream->writeStartElement(element.tagName());
/* attributes */
QString xmlns = element.namespaceURI();
if (!xmlns.isEmpty() && !omitNamespaces.contains(xmlns))
stream->writeAttribute("xmlns", xmlns);
QDomNamedNodeMap attrs = element.attributes();
for (int i = 0; i < attrs.size(); i++)
{
QDomAttr attr = attrs.item(i).toAttr();
stream->writeAttribute(attr.name(), attr.value());
}
/* children */
QDomNode childNode = element.firstChild();
while (!childNode.isNull())
{
if (childNode.isElement())
{
helperToXmlAddDomElement(stream, childNode.toElement(), QStringList() << xmlns);
} else if (childNode.isText()) {
stream->writeCharacters(childNode.toText().data());
}
childNode = childNode.nextSibling();
}
stream->writeEndElement();
}
示例6: fromDom
void ViElement::fromDom(QDomNode &dom)
{
setName(dom.toElement().tagName());
QDomNamedNodeMap attributes = dom.attributes();
for(int i = 0; i < attributes.size(); ++i)
{
addAttribute(ViAttribute(attributes.item(i).nodeName(), attributes.item(i).nodeValue()));
}
QDomNodeList children = dom.childNodes();
if(children.size() > 0)
{
for(int i = 0; i < children.size(); ++i)
{
if(children.item(i).isText())
{
setValue(children.item(i).nodeValue());
}
else
{
ViElement child;
QDomNode node = children.item(i);
child.fromDom(node);
addChild(child);
}
}
}
else
{
setValue(dom.nodeValue());
}
}
示例7: toString
QString QDomNamedNodeMapProto::toString() const
{
QDomNamedNodeMap *item = qscriptvalue_cast<QDomNamedNodeMap*>(thisObject());
if (item)
return QString("[QDomNamedNodeMap(size = %1)]").arg(item->size());
return QString("[QDomNamedNodeMap(unknown)]");
}
示例8: checkAttributes
inline void DefinitionParser::checkAttributes (QDomNode& node) const
{
const QString tag = node.toElement().tagName();
QDomNamedNodeMap attr = node.attributes();
for (int i = 0; i < attr.size(); ++i) {
QDomNode a = attr.item(i);
if (!_attributesMap[a.nodeName()]) {
warning("invalid attribute \'" + a.nodeName() + "\' in \'" + tag + "\'");
}
}
}
示例9: processNodeAttributes
void DebuggerTool::processNodeAttributes(const QDomElement &element)
{
QDomNamedNodeMap namedNodeMap = element.attributes();
for (int i = 0; i < namedNodeMap.size(); ++i) {
QDomNode domNode = namedNodeMap.item(i);
if (domNode.nodeType() == QDomNode::AttributeNode) {
QDomAttr domElement = domNode.toAttr();
m_anyAttribute.insert(domElement.name(), domElement.value());
// vc_dbg << "Any AttributeNode: name: " << domElement.name() << " value: " << domElement.value();
}
}
}
示例10: getElemAttributeValue
/**
* \brief This function return the named attribute's value of a given element
* \author Jules Gorny - ALCoV team, ISIT, UMR 6284 UdA – CNRS
* \param doc : QDomDocument containing the xml tree
* \param elementName : element name
* \param attrName : attribute name
* \return the element attribute value or an empty character
*/
QString getElemAttributeValue(QDomDocument& doc, QString elementName, QString attrName)
{
QDomNodeList elements = doc.elementsByTagName(elementName);
//If we find an element with the same name
if( elements.size() == 1 )
{
QDomNamedNodeMap elemAttributes = elements.at(0).attributes();
for(int j=0; j<elemAttributes.size(); j++)
{
QString atName = elemAttributes.item(j).toAttr().name();
if( attrName == atName )
return elemAttributes.item(j).toAttr().value();
}
}
return "";
}
示例11: processNodeAttributes
void Platform::processNodeAttributes(const QDomElement &element)
{
QDomNamedNodeMap namedNodeMap = element.attributes();
if (namedNodeMap.size() == 1) {
QDomNode domNode = namedNodeMap.item(0);
if (domNode.nodeType() == QDomNode::AttributeNode) {
QDomAttr domElement = domNode.toAttr();
if (domElement.name() == QString("Name")) {
m_name = domElement.value();
// vc_dbg << "AttributeNode: name: " << domElement.name() << " value: " << domElement.value();
}
}
}
}
示例12: htmlToString
void Xml::htmlToString(QDomElement e, int level, QString* s)
{
*s += QString("<%1").arg(e.tagName());
QDomNamedNodeMap map = e.attributes();
int n = map.size();
for (int i = 0; i < n; ++i) {
QDomAttr a = map.item(i).toAttr();
*s += QString(" %1=\"%2\"").arg(a.name()).arg(a.value());
}
*s += ">";
++level;
for (QDomNode ee = e.firstChild(); !ee.isNull(); ee = ee.nextSibling()) {
if (ee.nodeType() == QDomNode::ElementNode)
htmlToString(ee.toElement(), level, s);
else if (ee.nodeType() == QDomNode::TextNode)
*s += Qt::escape(ee.toText().data());
}
*s += QString("</%1>").arg(e.tagName());
--level;
}
示例13:
QVector<Value> AVRStudioXMLParser::GetValues(QDomNodeList nodelist)
{
QVector<Value> values;
for(int i = 0; i < nodelist.size(); i++)
{
QDomNamedNodeMap attributes = nodelist.at(i).attributes();
Value value;
for(int i = 0; i < attributes.size(); i++)
{
QDomNode attribute = attributes.item(i);
if(value.GetMappingMap()[attribute.nodeName()])
*value.GetMappingMap()[attribute.nodeName()] = attribute.nodeValue();
}
values.append(value);
}
return values;
}
示例14: interfaces
QVector<ProgrammingInterface> AVRStudioXMLParser::GetInterfaces(QDomNode node)
{
QVector<ProgrammingInterface> interfaces(0);
while(!node.isNull())
{
QDomNamedNodeMap attributes = node.attributes();
ProgrammingInterface interface;
for(int i = 0; i < attributes.size(); i++)
{
QDomNode attribute = attributes.item(i);
if(interface.GetMappingMap()[attribute.nodeName()])
*interface.GetMappingMap()[attribute.nodeName()] = attribute.nodeValue();
}
interfaces.append(interface);
node = node.nextSibling();
}
return interfaces;
}
示例15: processNodeAttributes
void Project::processNodeAttributes(const QDomElement &nodeElement)
{
// process attributes
QDomNamedNodeMap namedNodeMap = nodeElement.attributes();
for (int i = 0; i < namedNodeMap.size(); ++i) {
QDomNode domNode = namedNodeMap.item(i);
if (domNode.nodeType() == QDomNode::AttributeNode) {
QDomAttr domElement = domNode.toAttr();
if (domElement.name() == QLatin1String("DefaultTargets"))
m_defaultTargets = domElement.value().split(QLatin1Char(';'));
else if (domElement.name() == QLatin1String("InitialTargets"))
m_initialTargets = domElement.value().split(QLatin1Char(';'));
else if (domElement.name() == QLatin1String("ToolsVersion"))
m_toolsVersion = domElement.value();
else if (domElement.name() == QLatin1String("xmlns"))
m_xmlns = domElement.value();
}
}
}