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


C++ QXmlAttributes::qName方法代码示例

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


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

示例1: startElement

bool TsHandler::startElement( const QString& /* namespaceURI */,
                              const QString& /* localName */,
                              const QString& qName,
                              const QXmlAttributes& atts )
{
    if ( qName == QString("byte") ) {
        for ( int i = 0; i < atts.length(); i++ ) {
            if ( atts.qName(i) == QString("value") ) {
                QString value = atts.value( i );
                int base = 10;
                if ( value.startsWith("x") ) {
                    base = 16;
                    value = value.mid( 1 );
                }
                int n = value.toUInt( 0, base );
                if ( n != 0 )
                    accum += QChar( n );
            }
        }
    } else {
        if ( qName == QString("TS") ) {
            m_language = atts.value(QLatin1String("language"));
        } else if ( qName == QString("context") ) {
            context.truncate( 0 );
            source.truncate( 0 );
            comment.truncate( 0 );
            m_translatorComment.truncate( 0 );
            translations.clear();
            contextIsUtf8 = encodingIsUtf8( atts );
        } else if ( qName == QString("message") ) {
            inMessage = true;
            type = MetaTranslatorMessage::Finished;
            source.truncate( 0 );
            comment.truncate( 0 );
            m_translatorComment.truncate( 0 );
            translations.clear();
            messageIsUtf8 = encodingIsUtf8( atts );
            m_isPlural = atts.value(QLatin1String("numerus")).compare(QLatin1String("yes")) == 0;
        } else if (qName == QString("location") && inMessage) {
            bool bOK;
            int lineNo = atts.value(QString("line")).toInt(&bOK);
            if (!bOK) lineNo = -1;
            m_fileName = atts.value(QString("filename"));
            m_lineNumber = lineNo;
        } else if ( qName == QString("translation") ) {
            for ( int i = 0; i < atts.length(); i++ ) {
                if ( atts.qName(i) == QString("type") ) {
                    if ( atts.value(i) == QString("unfinished") )
                        type = MetaTranslatorMessage::Unfinished;
                    else if ( atts.value(i) == QString("obsolete") )
                        type = MetaTranslatorMessage::Obsolete;
                    else
                        type = MetaTranslatorMessage::Finished;
                }
            }
        }
        accum.truncate( 0 );
    }
    return true;
}
开发者ID:nmelchior,项目名称:Tools,代码行数:60,代码来源:metatranslator.cpp

示例2: startElement

bool MapParser::startElement(const QString&, const QString&, const QString& p_qName, const QXmlAttributes& p_atts)
{
    if (p_qName == "Arena")
    {
        int nbRows = 0;
        int nbColumns = 0;
        // Initialize the number of rows and columns
        for (int i = 0; i < p_atts.count(); ++i)
        {
            if (p_atts.qName(i) == "rowCount")
            {
                nbRows = p_atts.value(i).toInt();
            }
            if (p_atts.qName(i) == "colCount")
            {
                nbColumns = p_atts.value(i).toInt();
            }
            //TODO:check for the right arenaFileVersion
            //if (p_atts.qName(i) == "arenaFileVersion")
            //{
            //    m_arenaFileVersion = p_atts.value(i).toInt();
            //}
        }
        // Create the Arena matrix
        m_arena->init(nbRows, nbColumns);
        // initialize random generator
        qsrand(QDateTime::currentDateTime().toTime_t());
    }
    
    return true;
}
开发者ID:jsj2008,项目名称:kdegames,代码行数:31,代码来源:mapparser.cpp

示例3: startElement

bool TsHandler::startElement( const QString& /* namespaceURI */, const QString& /* localName */, const QString& qName, const QXmlAttributes& atts )
{
	if ( qName == QString( "byte" ) )
	{
		for ( int i = 0; i < atts.length(); i++ )
		{
			if ( atts.qName( i ) == QString( "value" ) )
			{
				QString value = atts.value( i );
				int base = 10;
				if ( value.startsWith( "x" ) )
				{
					base = 16;
					value = value.mid( 1 );
				}
				int n = value.toUInt( 0, base );
				if ( n != 0 )
					accum += QChar( n );
			}
		}
	}
	else
	{
		if ( qName == QString( "context" ) )
		{
			context.truncate( 0 );
			source.truncate( 0 );
			comment.truncate( 0 );
			translation.truncate( 0 );
			contextIsUtf8 = encodingIsUtf8( atts );
		}
		else if ( qName == QString( "message" ) )
		{
			inMessage = TRUE;
			type = MetaTranslatorMessage::Finished;
			source.truncate( 0 );
			comment.truncate( 0 );
			translation.truncate( 0 );
			messageIsUtf8 = encodingIsUtf8( atts );
		}
		else if ( qName == QString( "translation" ) )
		{
			for ( int i = 0; i < atts.length(); i++ )
			{
				if ( atts.qName( i ) == QString( "type" ) )
				{
					if ( atts.value( i ) == QString( "unfinished" ) )
						type = MetaTranslatorMessage::Unfinished;
					else if ( atts.value( i ) == QString( "obsolete" ) )
						type = MetaTranslatorMessage::Obsolete;
					else
						type = MetaTranslatorMessage::Finished;
				}
			}
		}
		accum.truncate( 0 );
	}
	return TRUE;
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:59,代码来源:metatranslator.cpp

示例4: return

static bool encodingIsUtf8( const QXmlAttributes& atts )
{
    for ( int i = 0; i < atts.length(); i++ ) {
	// utf8="true" is a pre-3.0 syntax
	if ( atts.qName(i) == QString("utf8") ) {
	    return ( atts.value(i) == QString("true") );
	} else if ( atts.qName(i) == QString("encoding") ) {
	    return ( atts.value(i) == QString("UTF-8") );
	}
    }
    return FALSE;
}
开发者ID:OS2World,项目名称:LIB-QT3_Toolkit_Vbox,代码行数:12,代码来源:metatranslator.cpp

示例5: startElement

		bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
		{
			if(depth == 0) {
				Parser::Event *e = new Parser::Event;
				QXmlAttributes a;
				for(int n = 0; n < atts.length(); ++n) {
					QString uri = atts.uri(n);
					QString ln = atts.localName(n);
					if(a.index(uri, ln) == -1)
						a.append(atts.qName(n), uri, ln, atts.value(n));
				}
				e->setDocumentOpen(namespaceURI, localName, qName, a, nsnames, nsvalues);
				nsnames.clear();
				nsvalues.clear();
				e->setActualString(in->lastString());

				in->resetLastData();
				eventList.append(e);
				in->pause(true);
			}
			else {
				QDomElement e = doc->createElementNS(namespaceURI, qName);
				for(int n = 0; n < atts.length(); ++n) {
					QString uri = atts.uri(n);
					QString ln = atts.localName(n);
					bool have;
					if(!uri.isEmpty()) {
						have = e.hasAttributeNS(uri, ln);
						if(qt_bug_have)
							have = !have;
					}
					else
						have = e.hasAttribute(ln);
					if(!have)
						e.setAttributeNS(uri, atts.qName(n), atts.value(n));
				}

				if(depth == 1) {
					elem = e;
					current = e;
				}
				else {
					current.appendChild(e);
					current = e;
				}
			}
			++depth;
			return true;
		}
开发者ID:BackupTheBerlios,项目名称:synapse-xmpp-svn,代码行数:49,代码来源:parser.cpp

示例6: attrName

bool KWord13Parser::startElementFrame(const QString& name, const QXmlAttributes& attributes, KWord13StackItem *stackItem)
{
    if (stackItem->elementType == KWord13TypeFrameset || stackItem->elementType == KWord13TypePictureFrameset) {
        stackItem->elementType = KWord13TypeEmpty;
        if (stackItem->m_currentFrameset) {
            const int num = ++stackItem->m_currentFrameset->m_numFrames;
            for (int i = 0; i < attributes.count(); ++i) {
                QString attrName(name);
                attrName += ':';
                attrName += QString::number(num);
                attrName += ':';
                attrName += attributes.qName(i);
                stackItem->m_currentFrameset->m_frameData[ attrName ] = attributes.value(i);
                kDebug(30520) << "FrameData:" << attrName << " =" << attributes.value(i);
            }

        } else {
            kError(30520) << "Data of <FRAMESET> not found";
            return false;
        }
    } else if (stackItem->elementType != KWord13TypeUnknownFrameset) {
        kError(30520) << "<FRAME> not child of <FRAMESET>";
        return false;
    }
    return true;
}
开发者ID:KDE,项目名称:calligra-history,代码行数:26,代码来源:kword13parser.cpp

示例7: startElement

bool TemplateQueryHandler::startElement ( const QString & /*namespaceURI*/, const QString & /*localName*/, const QString & qName, const QXmlAttributes & atts )
{
  //qDebug() << "startElement: " << qName;
  if(!m_inTripleList && (qName.compare("triple_list")==0 ))
    {
      m_inTripleList = true;
      return true;
    }
  if(m_currentTriple)
    {
      if(qName.compare("subject") == 0 )
	{
	  // no need to check for element type, since subject are always URIs (when received)
	  m_component = ESubject;
	}
      else if(qName.compare("predicate") == 0 )
	{
	  // no need to check for element type, since predicates are always URIs 
	  m_component = EPredicate;
	}
      else if(qName.compare("object") == 0 && 
	      (atts.length() == 1) && 
	      (atts.qName(0).compare("type") == 0))
	{
	  //check elementtype for object, bNode is illegal when received.
	  QString attrvalue = atts.value(0);
	  m_component = EObject;
	  if( attrvalue.compare("literal", Qt::CaseInsensitive) == 0) 
	    m_elementType = TripleElement::ElementTypeLiteral;
	  else if (attrvalue.compare("URI", Qt::CaseInsensitive) == 0)
	    m_elementType = TripleElement::ElementTypeURI;
	  else
	    {
	      m_errorString = "Invalid object type: ";
	      m_errorString.append(attrvalue);
	      return false;
	    }
	  m_component = EObject;
	}
      else
	{
	  m_errorString = "Invalid element name for a triple: ";
	  m_errorString.append(qName);
	  return false;
	}
    }
  else
    {
      if(qName.compare("triple") == 0 )
	{
	  m_currentTriple = new Triple();
	}
      else
	{
	  m_errorString = "starting something other than triple element";
	  return false;
	}
    }
  return true;
}
开发者ID:smart-m3,项目名称:libwhiteboard-qt4,代码行数:60,代码来源:templatequeryhandler.cpp

示例8: startElement

bool StructureParser::startElement( const QString& namespaceURI,
                                    const QString& ,
                                    const QString& qName,
                                    const QXmlAttributes& attributes)
{
    QTreeWidgetItem * element;


    if (!stack.isEmpty())
    {
        QTreeWidgetItem *lastChild = stack.top().firstChild();

        if ( lastChild )
        {
            while ( lastChild->nextSibling() )
                lastChild = lastChild->nextSibling();
        }
        element = new QTreeWidgetItem( stack.top(), lastChild, qName, namespaceURI );
    }
    else
    {
        element = new QTreeWidgetItem( table, qName, namespaceURI );
    }

    stack.push( element );
    element->setOpen( TRUE );
    if ( attributes.length() > 0 ) {
        for ( int i = 0 ; i < attributes.length(); i++ ) {
            new QTreeWidgetItem( element, attributes.qName(i), attributes.uri(i) );
        }
    }
    return TRUE;
}
开发者ID:aafontoura,项目名称:mission-groundstation,代码行数:33,代码来源:structureparser.cpp

示例9: startElement

	bool startElement( const QString& nsURI, const QString& locName, const QString& qName,
	                   const QXmlAttributes& qattr)
	{
		Xml_attr attr;
		for (int i=0; i < qattr.count(); ++i)
			attr[qattr.qName(i)] = fromSTLString(qattr.value(i).toUtf8().data());
		dig->begin(qName, attr);
		return true;
	}
开发者ID:Fahad-Alsaidi,项目名称:scribus-svn,代码行数:9,代码来源:digester_parse.cpp

示例10: startElement

bool PokedexParser::startElement(const QString		&//namespaceURI
				 ,
				 const QString		&//localName
				 ,
				 const QString		&qName,
				 const QXmlAttributes	&attrs)
{
  if (qName == "pokedex")
    this->inPokedex_ = true;
  else if (qName == "pokemon")
    {
      if ((attrs.count() >= 1) && (attrs.qName(0) == "id"))
	tmpPok_ = new Pokemon(attrs.value(0).toInt());
      else
	tmpPok_ = NULL;
    }
  else if (qName == "evolution")
    {
      if ((attrs.count() >= 1) && (attrs.qName(0) == "id"))
	tmpEvo_ = new Evolution(attrs.value(0).toInt());
      inEvo_ = true;
    }
  else if (qName == "move")
    {
      if ((attrs.count() >= 1) && (attrs.qName(0) == "type"))
	{
	  if (attrs.value(0) == "level-up")
	    {
	      tmpLevel_ = new Level();
	      inLevel_ = true;
	    }
	  else if (attrs.value(0) == "TM/HM")
	    {
	      tmpTm_hm_ = new Tm_hm();
	      inTmHm_ = true;
	    }
	  else if (attrs.value(0) == "egg")
	    inEggs_ = true;
	}
    }
  return true;
}
开发者ID:Baku,项目名称:Pokedex,代码行数:42,代码来源:pokedexParser.cpp

示例11: startElement

bool XmlHandler::startElement(const QString &/*namespaceURI*/, const QString &/*localName*/,
                      const QString &qName, const QXmlAttributes &attributes)
{
	if( qName == this->qName ) {
		IsoCodeEntry entry;
		for(int i=0; i<attributes.count(); i++) {
			entry.insert(attributes.qName(i), attributes.value(i));
		}
		isoEntryList.append(entry);
	}
	return true;
}
开发者ID:KDE,项目名称:kde-workspace,代码行数:12,代码来源:iso_codes.cpp

示例12: startElement

bool XMLSettingParser::startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &attributes)
{
  if (qName.toLower() == "settings")
  {
    for (int i = 0; i < attributes.count(); i++)
    {
      m_map[attributes.qName(i)] = attributes.value(i);
    }
  }

  return true;
}
开发者ID:PavelMr,项目名称:skytechx2,代码行数:12,代码来源:xmlsetting.cpp

示例13: formatAttributes

QString ContentHandler::formatAttributes(const QXmlAttributes &atts)
{
    QString result;
    for (int i = 0, cnt = atts.count(); i < cnt; ++i) {
	if (i != 0) result += ", ";
	result += "{localName=\"" + escapeStr(atts.localName(i))
		    + "\", qName=\"" + escapeStr(atts.qName(i))
		    + "\", uri=\"" + escapeStr(atts.uri(i))
		    + "\", type=\"" + escapeStr(atts.type(i))
		    + "\", value=\"" + escapeStr(atts.value(i)) + "\"}";
    }
    return result;
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:13,代码来源:parser.cpp

示例14: startElement

bool LibraryParser::startElement( const QString&, const QString&, const QString &name, const QXmlAttributes &attrs)
{
    // start of a new library definition
    buffer.clear();
    if(name == "library") {
        library = new Library();
        for(int i=0; i<attrs.count(); i++) {
            if (attrs.qName(i) == "name") library->name = attrs.value(i);
        }
    }

    return true;
}
开发者ID:cernst72,项目名称:GoldenCheetah,代码行数:13,代码来源:LibraryParser.cpp

示例15: startElement

bool MyHandler::startElement( const QString&, /* We have omitted the names of the parameters that we don't use. This prevents the compiler from issuing "unused parameter" warnings. */
                              const QString&, const QString& qName,
                              const QXmlAttributes& atts) {
    QString str = QString("\n%1\\%2").arg(indent).arg(qName);
    cout << str;
    if (atts.length()>0) {
        QString fieldName = atts.qName(0);
        QString fieldValue = atts.value(0);
        cout << QString("(%2=%3)").arg(fieldName).arg(fieldValue);
    }
    cout << "{";
    indent += "    ";
    return TRUE;
}
开发者ID:jabouzi,项目名称:qt,代码行数:14,代码来源:myhandler.cpp


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