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


C++ QDomAttr::value方法代码示例

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


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

示例1: Constraint

ConstraintTypes::PlaylistLength::PlaylistLength( QDomElement& xmlelem, ConstraintNode* p )
        : Constraint( p )
        , m_length( 30 )
        , m_comparison( CompareNumEquals )
        , m_strictness( 1.0 )
{
    QDomAttr a;

    a = xmlelem.attributeNode( "length" );
    if ( !a.isNull() ) {
        m_length = a.value().toInt();
        /* after 2.3.2, what was the PlaylistLength constraint became the
         * PlaylistDuration constraint, so this works around the instance when
         * a user loads an XML file generated with the old code -- sth*/
        if ( m_length > 1000 )
            m_length /= 240000;
    }

    a = xmlelem.attributeNode( "comparison" );
    if ( !a.isNull() )
        m_comparison = a.value().toInt();

    a = xmlelem.attributeNode( "strictness" );
    if ( !a.isNull() )
        m_strictness = a.value().toDouble();
}
开发者ID:phalgun,项目名称:amarok-nepomuk,代码行数:26,代码来源:PlaylistLength.cpp

示例2: Constraint

ConstraintTypes::PlaylistDuration::PlaylistDuration( QDomElement& xmlelem, ConstraintNode* p )
        : Constraint( p )
        , m_duration( 0 )
        , m_comparison( CompareNumEquals )
        , m_strictness( 1.0 )
{
    QDomAttr a;

    a = xmlelem.attributeNode( "duration" );
    if ( !a.isNull() ) {
        m_duration = a.value().toInt();
    } else {
        // Accommodate schema change when PlaylistLength became PlaylistDuration
        a = xmlelem.attributeNode( "length" );
        if ( !a.isNull() )
            m_duration = a.value().toInt();
    }


    a = xmlelem.attributeNode( "comparison" );
    if ( !a.isNull() )
        m_comparison = a.value().toInt();

    a = xmlelem.attributeNode( "strictness" );
    if ( !a.isNull() )
        m_strictness = a.value().toDouble();
}
开发者ID:cancamilo,项目名称:amarok,代码行数:27,代码来源:PlaylistDuration.cpp

示例3: EMalformedPolicy

void
Pattern::xmlAddTransition(QDomElement _element)
{
    // a transition must have a message tag
    QDomAttr attrMessage = _element.attributeNode("message");
    if (attrMessage.isNull() ||
            attrMessage.value().isEmpty()) {
        throw BehaviourEngine::
        EMalformedPolicy(CORBA::string_dup("Transition without message."));
    }
    std::string message = attrMessage.value().latin1();

    // a transition must have a target tag
    QDomAttr attrPattern = _element.attributeNode("target");
    if (attrPattern.isNull() ||
            attrPattern.value().isEmpty()) {
        throw BehaviourEngine::
        EMalformedPolicy(CORBA::string_dup("Transition without target."));
    }
    std::string target = attrPattern.value().latin1();

    // internal transitions are only possible within some policy
    if (parent_ == NULL)
        throw BehaviourEngine::
        EMalformedPolicy(CORBA::string_dup("Internal transition at top level."));

    parent_->transitions_.insert(std::make_pair(std::make_pair(getName(),
                                 message),
                                 target));
}
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:30,代码来源:Pattern.cpp

示例4: loadLine

void LevelLoader::loadLine(QDomElement lineNode)
{
    // Reading the line number
    QDomAttr attribute = lineNode.attributeNode(QStringLiteral("Number"));
    QDomElement attributeNode = lineNode.firstChildElement(QStringLiteral("Number"));
    if (!attribute.isNull()) {
        m_lineNumber = attribute.value().toInt();
    } else if (!attributeNode.isNull()) {
        m_lineNumber = attributeNode.text().toInt();
    } else {
        // Standard line numbering: load next line
        m_lineNumber++;
    }

    // Reading the brick information
    attribute = lineNode.attributeNode(QStringLiteral("Bricks"));
    attributeNode = lineNode.firstChildElement(QStringLiteral("Bricks"));
    QString line;
    if (!attribute.isNull()) {
        line = attribute.value();
    } else if (!attributeNode.isNull()) {
        line = attributeNode.text();
    } else {
        line = lineNode.text();
    }

    if (line.size() > WIDTH) {
        qCritical() << "Invalid levelset " << m_levelname << ": too many bricks in line "
                    << m_lineNumber << endl;
    }

    emit newLine(line, m_lineNumber);
}
开发者ID:KDE,项目名称:kbreakout,代码行数:33,代码来源:levelloader.cpp

示例5: Constraint

ConstraintTypes::PlaylistFileSize::PlaylistFileSize( QDomElement& xmlelem, ConstraintNode* p )
        : Constraint( p )
        , m_size( 700 )
        , m_unit( 1 )
        , m_comparison( CompareNumEquals )
        , m_strictness( 1.0 )
{
    QDomAttr a;

    a = xmlelem.attributeNode( "size" );
    if ( !a.isNull() )
        m_size = a.value().toInt();

    a = xmlelem.attributeNode( "unit" );
    if ( !a.isNull() )
        m_unit = a.value().toInt();

    a = xmlelem.attributeNode( "comparison" );
    if ( !a.isNull() )
        m_comparison = a.value().toInt();

    a = xmlelem.attributeNode( "strictness" );
    if ( !a.isNull() )
        m_strictness = a.value().toDouble();
}
开发者ID:cancamilo,项目名称:amarok,代码行数:25,代码来源:PlaylistFileSize.cpp

示例6: Unmarshall

void Block::Unmarshall( QDomElement& blockElement, Level* level )
{
  QDomAttr blockRowAttr = blockElement.attributeNode(BLOCK_ROW_ATTR);
  QDomAttr blockColumnAttr = blockElement.attributeNode(BLOCK_COLUMN_ATTR);

  UrAsset::setRow( blockRowAttr.value().toUInt() );
  UrAsset::setColumn( blockColumnAttr.value().toUInt() );
  UrAsset::calculateLevelEditorPosition(level->Row);
}
开发者ID:ursaRAGE,项目名称:UrLevelEditor,代码行数:9,代码来源:Block.cpp

示例7: setAttribute

void Language::setAttribute( QDomAttr &attr) {
  if(attr.localName().compare("Value", Qt::CaseInsensitive)==0) {
    setValue(attr.value());
    return;
  }
  if(attr.localName().compare("Lang", Qt::CaseInsensitive)==0) {
    setLang(attr.value());
    return;
  }
}
开发者ID:juriad,项目名称:tvp,代码行数:10,代码来源:Language.cpp

示例8: setAttribute

void PreviouslyShown::setAttribute( QDomAttr &attr) {
  if(attr.localName().compare("Channel", Qt::CaseInsensitive)==0) {
    setChannel(attr.value());
    return;
  }
  if(attr.localName().compare("Start", Qt::CaseInsensitive)==0) {
    setStart(attr.value());
    return;
  }
}
开发者ID:juriad,项目名称:tvp,代码行数:10,代码来源:PreviouslyShown.cpp

示例9: if

  void
  operator <<= (Miro::SensorGroupIDL& group, const QDomNode& node)
  {
    if (!node.isNull()) {

      // set sensor defaults
      Miro::SensorPositionIDL sensor;
      sensor.masked = false;
      QDomNamedNodeMap map = node.attributes();
      QDomNode n;
      n = map.namedItem("height");
      if (!n.isNull()) {
	QDomAttr attr = n.toAttr();
	if (!attr.isNull()) 
	  sensor.height = attr.value().toInt();
      }
      n = map.namedItem("distance");
      if (!n.isNull()) {
	QDomAttr attr = n.toAttr();
	if (!attr.isNull()) 
	  sensor.distance =attr.value().toInt();
      }
      n = map.namedItem("alpha");
      if (!n.isNull()) {
	QDomAttr attr = n.toAttr();
	if (!attr.isNull()) 
	  sensor.alpha = deg2Rad(attr.value().toDouble());
      }
      n = map.namedItem("beta");
      if (!n.isNull()) {
	QDomAttr attr = n.toAttr();
	if (!attr.isNull()) 
	  sensor.beta = deg2Rad(attr.value().toDouble());
      }
      n = map.namedItem("gamma");
      if (!n.isNull()) {
	QDomAttr attr = n.toAttr();
	if (!attr.isNull()) 
	  sensor.gamma = deg2Rad(attr.value().toDouble());
      }
      QDomNode n1 = node.firstChild();
      while(!n1.isNull() ) {
	if (n1.nodeName() == "description") {
	  group.description <<= n1;
	}
	else if (n1.nodeName() == "sensor") {
	  group.sensor.length(group.sensor.length() + 1);
	  group.sensor[group.sensor.length() - 1] = sensor;
	  group.sensor[group.sensor.length() - 1] <<= n1;
	}
	n1 = n1.nextSibling();
      }
    }
  }
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:54,代码来源:ScanDescriptionHelper.cpp

示例10: importKeySet

void Prefs_KeyboardShortcuts::importKeySet(QString filename)
{
	searchTextLineEdit->clear();
	QFileInfo fi = QFileInfo(filename);
	if (fi.exists())
	{
		//import the file into qdomdoc
		QDomDocument doc( "keymapentries" );
		QFile file1( filename );
		if ( !file1.open( QIODevice::ReadOnly ) )
			return;
		QTextStream ts(&file1);
		ts.setCodec("UTF-8");
		QString errorMsg;
		int eline;
		int ecol;
		if ( !doc.setContent( ts.readAll(), &errorMsg, &eline, &ecol ))
		{
			qDebug("%s", QString("Could not open key set file: %1\nError:%2 at line: %3, row: %4").arg(filename).arg(errorMsg).arg(eline).arg(ecol).toLatin1().constData());
			file1.close();
			return;
		}
		file1.close();
		//load the file now
		QDomElement docElem = doc.documentElement();
		if (docElem.tagName()=="shortcutset" && docElem.hasAttribute("name"))
		{
			QDomAttr keysetAttr = docElem.attributeNode( "name" );

			//clear current menu entries
			for (QMap<QString,Keys>::Iterator it=keyMap.begin(); it!=keyMap.end(); ++it)
				it.value().keySequence = QKeySequence();

			//load in new set
			QDomNode n = docElem.firstChild();
			while( !n.isNull() )
			{
				QDomElement e = n.toElement(); // try to convert the node to an element.
				if( !e.isNull() )
				{
					if (e.hasAttribute("name")  && e.hasAttribute( "shortcut" ))
					{
						QDomAttr nameAttr = e.attributeNode( "name" );
						QDomAttr shortcutAttr = e.attributeNode( "shortcut" );
						if (keyMap.contains(nameAttr.value()))
							keyMap[nameAttr.value()].keySequence=QKeySequence(shortcutAttr.value());
					}
				}
				n = n.nextSibling();
			}
		}
	}
	insertActions();
}
开发者ID:gyuris,项目名称:scribus,代码行数:54,代码来源:prefs_keyboardshortcuts.cpp

示例11: loadGift

void LevelLoader::loadGift(QDomElement giftNode)
{
    bool nodeTextRead = false;
    // Reading the brick type
    QDomAttr attribute = giftNode.attributeNode(QStringLiteral("Type"));
    QDomElement attributeNode = giftNode.firstChildElement(QStringLiteral("Type"));
    QString giftType;
    if (!attribute.isNull()) {
        giftType = attribute.value();
    } else if (!attributeNode.isNull()) {
        giftType = attributeNode.text();
        nodeTextRead = true;
    } else {
        giftType = giftNode.text();
        nodeTextRead = true;
    }

    // Reading number of gifts to be distributed. If not specified one gift is placed.
    attribute = giftNode.attributeNode(QStringLiteral("Count"));
    attributeNode = giftNode.firstChildElement(QStringLiteral("Count"));
    int times = 1;
    bool ok = true;
    if (!attribute.isNull()) {
        times = attribute.value().toInt(&ok);
    } else if (!attributeNode.isNull()) {
        times = attributeNode.text().toInt(&ok);
        nodeTextRead = true;
    } else if (!nodeTextRead) {
        times = giftNode.text().toInt(&ok);
        if (!ok) {
            times = 1;
        }
    }

    // If only one brick to be placed: see if position is given
    QString position;
    if (times == 1) {
        attribute = giftNode.attributeNode(QStringLiteral("Position"));
        attributeNode = giftNode.firstChildElement(QStringLiteral("Position"));
        if (!attribute.isNull()) {
            position = attribute.value();
        } else if (!attributeNode.isNull()) {
            position = attributeNode.text();
            nodeTextRead = true;
        } else if (!nodeTextRead && giftNode.text().contains(QLatin1Char(','))) {
            position = giftNode.text();
            nodeTextRead = true;
        }
    }

    emit newGift(giftType, times, position);
}
开发者ID:KDE,项目名称:kbreakout,代码行数:52,代码来源:levelloader.cpp

示例12: parse

void UBOEmbedParser::parse(const QString& html)
{
    mContents.clear();
    QString query = "<link([^>]*)>";
    QRegExp exp(query);
    QStringList results;
    int count = 0;
    int pos = 0;
    while ((pos = exp.indexIn(html, pos)) != -1) {
        ++count;
        pos += exp.matchedLength();
        QStringList res = exp.capturedTexts();
        if("" != res.at(1)) {
            results << res.at(1);
        }
    }

    QVector<QString> oembedUrls;

    if(2 <= results.size()) {
        for(int i=1; i<results.size(); i++) {
            if("" != results.at(i)) {
                QString qsNode = QString("<link%0>").arg(results.at(i));
                QDomDocument domDoc;
                domDoc.setContent(qsNode);
                QDomNode linkNode = domDoc.documentElement();

                //  At this point, we have a node that is the <link> element. Now we have to parse its attributes
                //  in order to check if it is a oEmbed node or not
                QDomAttr typeAttribute = linkNode.toElement().attributeNode("type");
                if(typeAttribute.value().contains("oembed")) {
                    // The node is an oembed one! We have to get the url and the type of oembed encoding
                    QDomAttr hrefAttribute = linkNode.toElement().attributeNode("href");
                    QString url = hrefAttribute.value();
                    oembedUrls.append(url);
                }
            }
        }
    }

    mPending = oembedUrls.size();

    if(0 == mPending) {
        emit oembedParsed(mContents);
    } else {
        // Here we start the parsing (finally...)!
        for(int i=0; i<oembedUrls.size(); i++) {
            emit parseContent(oembedUrls.at(i));
        }
    }
}
开发者ID:juanjojuanjo,项目名称:Sankore-3.1,代码行数:51,代码来源:UBOEmbedParser.cpp

示例13: setAttribute

void Programme::setAttribute( QDomAttr &attr) {
  if(attr.localName().compare("VpsStart", Qt::CaseInsensitive)==0) {
    setVpsStart(attr.value());
    return;
  }
  if(attr.localName().compare("Channel", Qt::CaseInsensitive)==0) {
    setChannel(attr.value());
    return;
  }
  if(attr.localName().compare("Showview", Qt::CaseInsensitive)==0) {
    setShowview(attr.value());
    return;
  }
  if(attr.localName().compare("Start", Qt::CaseInsensitive)==0) {
    setStart(attr.value());
    return;
  }
  if(attr.localName().compare("Stop", Qt::CaseInsensitive)==0) {
    setStop(attr.value());
    return;
  }
  if(attr.localName().compare("Clumpidx", Qt::CaseInsensitive)==0) {
    setClumpidx(attr.value());
    return;
  }
  if(attr.localName().compare("PdcStart", Qt::CaseInsensitive)==0) {
    setPdcStart(attr.value());
    return;
  }
  if(attr.localName().compare("Videoplus", Qt::CaseInsensitive)==0) {
    setVideoplus(attr.value());
    return;
  }
}
开发者ID:juriad,项目名称:tvp,代码行数:34,代码来源:Programme.cpp

示例14: writeConfig

void PrefPortaudio::writeConfig()
{
    /* We can do better error control here, can't we? */
    ISettings *_settings = new ISettings();
    QDomElement cfg = _settings->getConfigNode("portaudio.conf");
    QDomNodeList nl = cfg.elementsByTagName("param");
    for (int i = 0; i < nl.count(); i++) {
        QDomAttr var = nl.at(i).toElement().attributeNode("name");
        QDomAttr val = nl.at(i).toElement().attributeNode("value");
        if (var.value() == "indev") {
            val.setValue(QString::number(_ui->PaIndevCombo->itemData(_ui->PaIndevCombo->currentIndex(), Qt::UserRole).toInt()));
        }
        if (var.value() == "outdev") {
            val.setValue(QString::number(_ui->PaOutdevCombo->itemData(_ui->PaOutdevCombo->currentIndex(), Qt::UserRole).toInt()));
        }
        if (var.value() == "ringdev") {
            val.setValue(QString::number(_ui->PaRingdevCombo->itemData(_ui->PaRingdevCombo->currentIndex(), Qt::UserRole).toInt()));
        }
        if (var.value() == "ring-file") {
            val.setValue(_ui->PaRingFileEdit->text());
        }
        if (var.value() == "ring-interval") {
            val.setValue(QString::number(_ui->PaRingIntervalSpin->value()));
        }
        if (var.value() == "hold-file") {
            val.setValue(_ui->PaHoldFileEdit->text());
        }
        if (var.value() == "cid-name") {
            val.setValue(_ui->PaCallerIdNameEdit->text());
        }
        if (var.value() == "cid-num") {
            val.setValue(_ui->PaCallerIdNumEdit->text());
        }
        if (var.value() == "sample-rate") {
            val.setValue(_ui->PaSampleRateEdit->text());
        }
        if (var.value() == "codec-ms") {
            val.setValue(_ui->PaCodecMSEdit->text());
        }
        /* Not used currently
        if (var.value() == "dialplan") {
            val.setValue();
        }
        if (var.value() == "timer-name") {
            val.setValue();
        }*/
    }
    /* Save the config to the file */
    _settings->setConfigNode(cfg, "portaudio.conf");
}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:50,代码来源:prefportaudio.cpp

示例15: scanForAttributes

void XSchemaSimpleTypeUnion::scanForAttributes(QDomAttr &attribute, void * /*context*/)
{
    QString name = attribute.nodeName();

    if(name == IO_GENERIC_ID) {
        _id = attribute.value() ;
    } else if(name == IO_SIMPLETYPE_UNION_ATTR_MEMBERTYPES) {
        _memberTypes = attribute.value() ;
    } else {
        if(!readOtherAttributes(attribute)) {
            raiseError(this, attribute, false);
        }
    }
}
开发者ID:superliujian,项目名称:ICD_Creator,代码行数:14,代码来源:xsdsctypes.cpp


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