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


C++ QDomText::isNull方法代码示例

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


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

示例1: parseInstrName

static QString parseInstrName(const QString& name)
      {
      QString sName;
      QDomDocument dom;
      int line, column;
      QString err;
      if (!dom.setContent(name, false, &err, &line, &column)) {
            QString col, ln;
            col.setNum(column);
            ln.setNum(line);
            QString error = err + "\n at line " + ln + " column " + col;
            qDebug("error: %s\n", qPrintable(error));
            qDebug("   data:<%s>\n", qPrintable(name));
            return QString();
            }

      for (QDomNode e = dom.documentElement(); !e.isNull(); e = e.nextSiblingElement()) {
            for (QDomNode ee = e.firstChild(); !ee.isNull(); ee = ee.nextSibling()) {
                  QDomElement el = ee.toElement();
                  const QString& tag(el.tagName());
                  if (tag == "symbol") {
                        QString name = el.attribute(QString("name"));
                        if (name == "flat")
                              sName += "b";
                        else if (name == "sharp")
                              sName += "#";
                        }
                  QDomText t = ee.toText();
                  if (!t.isNull())
                        sName += t.data();
                  }
            }
      return sName;
      }
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:34,代码来源:instrtemplate.cpp

示例2: if

  void
  operator <<= (SensorPositionIDL& position, const QDomNode& node)
  {
    if (!node.isNull()) {
      QDomNode n1 = node.firstChild();
      while(!n1.isNull() ) {
	QDomNode n2 = n1.firstChild();
	if (!n2.isNull()) {
	  QDomText t = n2.toText(); // try to convert the node to a text
	  if(!t.isNull() ) {       // the node was really a text element.
	    if (n1.nodeName() == "height") {
	      position.height = t.data().toInt();
	    }
	    else if (n1.nodeName() == "distance") {
	      position.distance = t.data().toInt();
	    }
	    else if (n1.nodeName() == "alpha") {
	      position.alpha = deg2Rad(t.data().toDouble());
	    }
	    else if (n1.nodeName() == "beta") {
	      position.beta = deg2Rad(t.data().toDouble());
	    }
	    else if (n1.nodeName() == "gamma") {
	      position.gamma = deg2Rad(t.data().toDouble());
	    }
	    else if (n1.nodeName() == "masked") {
	      position.masked = (t.data() == "true");
	    }
	  }
	}
	n1 = n1.nextSibling();
      }
    }
  }
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:34,代码来源:ScanDescriptionHelper.cpp

示例3: parseBlock

void Format::parseBlock( QTextCursor &cursor, const QDomElement &element )
{
//  dbg() << "Format::parseBlock()" << endl;

  QDomNode n;
  for( n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) {
    QDomElement e = n.toElement();
    if ( e.tagName() == "fragment" ) {
      QTextCharFormat format;
      if ( e.hasAttribute( "link" ) ) {
        format.setAnchor( true );
        QString href = e.attribute( "link" );
        format.setAnchorHref( href );
        format.setFontUnderline( true );
        if ( href.startsWith( "todoodle:" ) ) {
          format = TextFormats::topicLinkCharFormat( href );
        } else {
          format = TextFormats::hyperLinkCharFormat( href );
        }
      }
      if ( e.attribute( "bold" ) == "true" ) {
        format.setFontWeight( QFont::Bold );
      }
      if ( e.attribute( "italic" ) == "true" ) {
        format.setFontItalic( true );
      }
      int fontSize = 0;
      if ( e.hasAttribute( "fontsize" ) ) {
        fontSize = e.attribute( "fontsize" ).toInt();
      } else {
        fontSize = 10;
      }
      if ( fontSize > 0 ) format.setFontPointSize( fontSize );
      
      QDomNode n2;
      for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) {
//        dbg() << "TICK" << endl;
        QDomText t = n2.toText();
        if ( !t.isNull() ) {
//          dbg() << "TEXT: '" << t.data() << "'" << endl;
          cursor.insertText( t.data(), format );
//          dbg() << "done" << endl;
        } else {
          QDomElement e2 = n2.toElement();
          if ( !e2.isNull() ) {
            if ( e2.tagName() == "todo" ) {
              QTextImageFormat f;
              if ( e2.attribute( "status" ) == "todo" ) {
                f.setName( ":/images/todo.png" );
              } else {
                f.setName( ":/images/tododone.png" );
              }
              cursor.insertImage( f );
            }
          }
        }
      }
    }
  }
}
开发者ID:cornelius,项目名称:todoodle,代码行数:60,代码来源:format.cpp

示例4: visit

QDomNode EmoticonExpander::visit(QDomText textNode) const
{
    QDomText result = textNode;
    while (!textNode.isNull())
    {
        result = textNode;
        textNode = expandFirstEmoticon(textNode);
    }

    return result;   // last real node
}
开发者ID:vogel,项目名称:kadu,代码行数:11,代码来源:emoticon-expander.cpp

示例5: getFirstText

static QString getFirstText(QDomElement element)
{
    for (QDomNode dname = element.firstChild(); !dname.isNull();
         dname = dname.nextSibling())
    {
        QDomText t = dname.toText();
        if (!t.isNull())
            return t.data();
    }
    return QString();
}
开发者ID:DocOnDev,项目名称:mythtv,代码行数:11,代码来源:xmltvparser.cpp

示例6: load

/**
 * Loads the <UML:CheckConstraint> XMI element.
 */
bool UMLCheckConstraint::load( QDomElement & element )
{
    QDomNode node = element.firstChild();

    QDomText checkConstraintText = node.toText();
    if ( checkConstraintText.isNull() )
        return false;

    m_CheckCondition = checkConstraintText.data();

    return true;
}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:15,代码来源:checkconstraint.cpp

示例7: tagContent

QString tagContent(const QDomElement &e)
{
	// look for some tag content
	for(QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) {
		QDomText i = n.toText();
		if(i.isNull())
			continue;
		return i.data();
	}

	return "";
}
开发者ID:studzien,项目名称:iris,代码行数:12,代码来源:xmpp_xmlcommon.cpp

示例8:

/*!
 *\en
 *	Sets text for current node.
 *	\param text (in) - new text value.
 *	\return void.
 *\_en \ru
 *	Устанавливает текст текущего узла.
 *	\param text (in) - Значение нового текста.
 *	\return ничего.
 *\_ru
 */
bool
AExtXML::setText( const QString &text )
{
	QDomText t;
	if (current.isNull()) return false;
	while (!current.firstChild().isNull()) {
		current.removeChild( current.firstChild() );
	}
	t = xml.createTextNode( text );
	if ( t.isNull() ) return false;
	current.appendChild( t );
	return true;
}
开发者ID:K-Be,项目名称:ananas-labs-qt4,代码行数:24,代码来源:aextxml.cpp

示例9: getResultFilePathFromResult

/**
 * Parses an xml reply form a start
 * @param xmlMessage XML message with tags data as root
 * @return Path of the decode file, or "" if there have been an error while parsing
 */
QString NMGNetperfXMLInterpret::getResultFilePathFromResult ( const QString & xmlMessage )
{
	QDomDocument doc;
	if ( !doc.setContent ( xmlMessage ) )
	{
		cerr << "Error: the document is not well formed." << endl;
		return "";
	}
	QDomElement root = doc.documentElement();
	QString resultPath = "";

	if ( root.tagName() != TAG_DATA )
		cerr << "Error root element at NMGNetperfXMLInterpret different from data (" << qPrintable ( root.tagName() ) << ")." << endl;
	else
	{
		for ( QDomNode node = root.firstChild(); !node.isNull(); node = node.nextSibling() )
		{
			if ( node.isElement() )
			{
				QDomElement elem = node.toElement();
				if ( elem.tagName() == TAG_DECODE_FILE )
				{
					QDomText id = elem.firstChild().toText();
					if ( id.isNull() )
						cerr << "Result file path node has no value!" << endl;
				}
				else if ( elem.tagName() == TAG_TEST_FILE )
				{
					QDomText id = elem.firstChild().toText();
					if ( !id.isNull() ) resultPath = id.nodeValue();
					else cerr << "Result file path node has no value!" << endl;
				}
				else cerr << "Incorrect Tag in Netperf XML reply (" << qPrintable ( elem.tagName() ) << ")." << endl;
			}
		}
	}
	return resultPath;
}
开发者ID:Shwe-123,项目名称:netmeter,代码行数:43,代码来源:nmgnetperfxmlinterpret.cpp

示例10: if

  void
  Parameters::operator <<= (const QDomNode& node)
  {
    Super::operator <<= (node);
    if (!node.isNull()) {
      QDomNode n1 = node.firstChild();
      while(!n1.isNull() ) {
	QDomNode n2 = n1.firstChild();
	if (!n2.isNull()) {
	  if (n1.nodeName() == "stdcrystal") {
	    QDomText t = n2.toText(); // try to convert the node to a text
	    if(!t.isNull() ) {        // the node was really a text element.
	      stdcrystal = (t.data() == "true");
	    }
	  } 
	  else if (n1.nodeName() == "continousmode") {
	    QDomText t = n2.toText(); // try to convert the node to a text
	    if(!t.isNull() ) {        // the node was really a text element.
	      continousmode = (t.data() == "true");
	    }
	  } 
	  else if (n1.nodeName() == "pollintervall") {
	    QDomText t = n2.toText(); // try to convert the node to a text
	    if(!t.isNull() ) {        // the node was really a text element.
	      pollintervall = t.data().toInt();
	    }
	  } 
	  else if (n1.nodeName() == "notify") {
	    QDomText t = n2.toText(); // try to convert the node to a text
	    if(!t.isNull() ) {        // the node was really a text element.
	      notify = (t.data() == "true");
	    }
	  } 
	  else if (n1.nodeName() == "positionstamps") {
	    QDomText t = n2.toText(); // try to convert the node to a text
	    if(!t.isNull() ) {        // the node was really a text element.
	      positionStamps = (t.data() == "true");
	    }
	  } 
	  else if (n1.nodeName() == "statistics") {
	    QDomText t = n2.toText(); // try to convert the node to a text
	    if(!t.isNull() ) {        // the node was really a text element.
	      statistics = (t.data() == "true");
	    }
	  } 
	  else if (n1.nodeName() == "laser") {
	    while (!n2.isNull()) {
	      if (n2.nodeName() == "scandescription") 
		laserDescription <<= n2;
	      n2 = n2.nextSibling();
	    }
	  }
	}
      n1 = n1.nextSibling();
      }
    }
  }
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:57,代码来源:SickLaserParameters.cpp

示例11: GetValue

QString XmlConfiguration::GetValue( const QString &sSetting, QString sDefault ) 
{
    QDomNode node = FindNode( sSetting );

    if (!node.isNull())
    {
        // -=>TODO: This Always assumes firstChild is a Text Node... should change
        QDomText  oText = node.firstChild().toText();

        if (!oText.isNull())
            return oText.nodeValue();
    }

    return sDefault;
}
开发者ID:jhludwig,项目名称:mythtv,代码行数:15,代码来源:configuration.cpp

示例12: Exception

  void
  DifferentialMotionParameters::operator <<= (const QDomNode& _node)
  {
    Super::operator<<=(_node);

    QDomNode n = _node.firstChild();
    while( !n.isNull() ) {
      QDomElement e = n.toElement(); // try to convert the node to an element.
      if( !e.isNull() ) {            // the node was really an element.
	if (e.tagName()=="parameter") {
	  QDomAttr parameterName = e.attributeNode("name");
	  QString name;
	  QString value;

	  if (!parameterName.isNull()) {
	    name = parameterName.value();
	  }
	  else {
	    throw Exception("Parameter tag without name.");
	  }

	  QDomNode n2 = n.firstChild();
	  while (!n2.isNull()) {
	    QDomText t = n2.toText(); // try to convert the node to a text
	    if(!t.isNull() ) {        // the node was really a text element.
	      value = t.data();
	      break;
	    }
	    n2 = n2.nextSibling();
	  }
	  if (n2.isNull())
	    throw Exception("Parameter " + std::string(name) + "without value.");
	  
	  if (name == "MinLTranslation")
	    minLTranslation = value.toInt();
	  else if (name == "MaxLTranslation")
	    maxLTranslation = value.toInt();
	  else if (name == "MinRTranslation")
	    minRTranslation = value.toInt();
	  else if (name == "MaxRTranslation")
	    maxRTranslation = value.toInt();
	  else if (name == "WheelBase")
	    wheelBase = value.toInt();
	}
      }
      n = n.nextSibling();
    }
  }
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:48,代码来源:MotionParameters.cpp

示例13: while

  void
  DevParameters::operator <<= (const QDomNode& node)
  {
    if (!node.isNull()) {
      QDomNode n1 = node.firstChild();
      while(!n1.isNull() ) {
	if (n1.nodeName() == "device") {
	  QDomNode n2 = n1.firstChild();
	  QDomText t = n2.toText(); // try to convert the node to a text
	  if(!t.isNull() ) { // the node was really an element.
	    device = t.data();
	  }
	}
	n1 = n1.nextSibling();
      }
    }
  }
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:17,代码来源:DevParameters.cpp

示例14: value

// Author & Date: Ehsan Azar       15 June 2010
// Purpose: Get current node value
// Inputs:
//   val - the default value
QVariant XmlFile::value(const QVariant & val)
{
    QVariant res = val;

    if (!m_nodes.isEmpty())
    {
        // Get the current node
        QDomElement node = m_nodes.last();
        if (!node.isNull())
        {
            // Array Type is how we distinguish lists
            if (node.attribute("Type").compare("Array", Qt::CaseInsensitive) == 0)
            {
                QVariantList varlist;
                QStringList keys = childKeys();
                for (int i = 0; i < keys.count(); ++i)
                {
                    QString key = keys[i];
                    if (i > 0 && key == keys[i - 1])
                        key = QString(key + "<%1>").arg(i);
                    // Recursively return the list
                    beginGroup(key);
                    QVariant nodevalue = value(QString());
                    endGroup();
                    // Make sure value is meaningful
                    if (nodevalue.isValid())
                        varlist += nodevalue; // add new value
                }
                if (!keys.isEmpty())
                    res = varlist;
            } else {
                QDomNode child = node.firstChild();
                if (!child.isNull())
                {
                    QDomText domText = child.toText();
                    if (!domText.isNull())
                        res = domText.data();
                    else
                        return toString();
                }
            }
        }
    }
    return res;
}
开发者ID:jsoutherland,项目名称:CereLink,代码行数:49,代码来源:XmlFile.cpp

示例15: fromXml

void VarList::fromXml(const QDomElement &e)
{
	clear();

	for(QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) {
		QDomElement i = n.toElement();
		if(i.isNull())
			continue;
		if(i.tagName() == "item") {
			QString var, val;
			var = i.attribute("name");
			QDomText t = i.firstChild().toText();
			if(!t.isNull())
				val = t.data();
			set(var, val);
		}
	}
}
开发者ID:sapo,项目名称:sapo-messenger-for-mac,代码行数:18,代码来源:varlist.cpp


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