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


C++ QStringRef::isEmpty方法代码示例

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


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

示例1: parseReflink

QString ZefaniaLex::parseReflink()
{
    const QStringRef fscope = m_xml->attributes().value("fscope");
    const QStringRef mscope = m_xml->attributes().value("mscope");
    const QStringRef target = m_xml->attributes().value("target");

    QString ret;
    if(!mscope.isEmpty()) {
        VerseUrl burl;
        burl.fromMscope(mscope.toString());

        QString text;
        if(!fscope.isEmpty()) {
            text = fscope.toString();
        } else  {
            text = m_refText.toString(burl);
        }
        m_xml->skipCurrentElement();
        ret = "<span class=\"crossreference\"><a class=\"reflink\" href=\"" + burl.toString() + "\">" + text + "</a></span>";

    } else if(!target.isEmpty()) {
       /* if(target == "XXX") {

        }*/
        ret = m_xml->readElementText(QXmlStreamReader::IncludeChildElements);
    }

    return ret;
}
开发者ID:metaxy,项目名称:openBibleViewer,代码行数:29,代码来源:zefania-lex.cpp

示例2: parseSubtask

void parseSubtask(QXmlStreamReader & in, Task & task)
{
    QXmlStreamAttributes attrs = in.attributes();
    QString title = attrs.value("title").toString();
    Task::SubTask& st(task.subTasks[title]);
    QStringRef bgColor = attrs.value("bgcolor");
    QStringRef fgColor = attrs.value("fgcolor");
    QStringRef active = attrs.value("active");
    st.title = title;
    if (!bgColor.isEmpty())
        st.bgColor = QColor(bgColor.toString());
    if (!fgColor.isEmpty())
        st.fgColor = QColor(fgColor.toString());
    if (!active.isEmpty())
        st.active = active.toString().toUInt();

    // read subtask
    while(!in.atEnd()) {
        QXmlStreamReader::TokenType token = in.readNext();
        if (token == QXmlStreamReader::StartElement) {
            QString elementName = in.name().toString();
            if (0) {
            } else if (elementName.compare("description", Qt::CaseInsensitive) == 0){
                st.description = in.readElementText();
            } else if (elementName.compare("hits", Qt::CaseInsensitive) == 0) {
                parseHits(in, task, st.title);
            }
        } else if (token == QXmlStreamReader::EndElement && in.name().toString().compare("subtask", Qt::CaseInsensitive) == 0) {
            return;
        }
    }
}
开发者ID:zanettea,项目名称:SAK,代码行数:32,代码来源:task.cpp

示例3: parseDemos

 void FluidLauncher::parseDemos(QXmlStreamReader& reader)
 {
     while (!reader.atEnd()) {
         reader.readNext();
         if (reader.isStartElement() && reader.name() == "example") {
             QXmlStreamAttributes attrs = reader.attributes();
             QStringRef filename = attrs.value("filename");
             if (!filename.isEmpty()) {
                 QStringRef name = attrs.value("name");
                 QStringRef image = attrs.value("image");
                 QStringRef args = attrs.value("args");
                 QStringRef idpocket = attrs.value("idpocket");
                 QStringRef desc = attrs.value("desc");

                 Launcher* newDemo = new Launcher(
                         idpocket.toString(),
                         filename.toString(),
                         name.isEmpty() ? "Unnamed Demo" : name.toString(),
                         image.toString(),
                         args.toString().split(" "),
                             desc.toString());
                 demoList.append(newDemo);
             }
         } else if(reader.isEndElement() && reader.name() == "demos") {
             return;
         }
     }
 }
开发者ID:TheProjecter,项目名称:pockemul,代码行数:28,代码来源:fluidlauncher.cpp

示例4: rangeAt

// ### the name and behavior of this function is dubious
QmlJS::AST::Node *SemanticInfo::declaringMemberNoProperties(int cursorPosition) const
{
    AST::Node *node = rangeAt(cursorPosition);

    if (UiObjectDefinition *objectDefinition = cast<UiObjectDefinition*>(node)) {
        const QStringRef name = objectDefinition->qualifiedTypeNameId->name;
        if (!name.isEmpty() && name.at(0).isLower()) {
            QList<AST::Node *> path = rangePath(cursorPosition);
            if (path.size() > 1)
                return path.at(path.size() - 2);
        } else if (name.contains(QLatin1String("GradientStop"))) {
            QList<AST::Node *> path = rangePath(cursorPosition);
            if (path.size() > 2)
                return path.at(path.size() - 3);
        }
    } else if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(node)) {
        const QStringRef name = objectBinding->qualifiedTypeNameId->name;
        if (name.contains(QLatin1String("Gradient"))) {
            QList<AST::Node *> path = rangePath(cursorPosition);
            if (path.size() > 1)
                return path.at(path.size() - 2);
        }
    }

    return node;
}
开发者ID:AltarBeastiful,项目名称:qt-creator,代码行数:27,代码来源:qmljssemanticinfo.cpp

示例5: attr

QPair<QStringRef,QStringRef> QDeclarativeStyledTextPrivate::parseAttribute(const QChar *&ch, const QString &textIn)
{
    skipSpace(ch);

    int attrStart = ch - textIn.constData();
    int attrLength = 0;
    while (!ch->isNull()) {
        if (*ch == greaterThan) {
            break;
        } else if (*ch == equals) {
            ++ch;
            if (*ch != singleQuote && *ch != doubleQuote) {
                while (*ch != greaterThan && !ch->isNull())
                    ++ch;
                break;
            }
            ++ch;
            if (!attrLength)
                break;
            QStringRef attr(&textIn, attrStart, attrLength);
            QStringRef val = parseValue(ch, textIn);
            if (!val.isEmpty())
                return QPair<QStringRef,QStringRef>(attr,val);
            break;
        } else {
            ++attrLength;
        }
        ++ch;
    }

    return QPair<QStringRef,QStringRef>();
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:32,代码来源:qdeclarativestyledtext.cpp

示例6:

void AccelTreeBuilder<FromDocument>::whitespaceOnly(const QStringRef &ch)
{
    Q_ASSERT(!ch.isEmpty());
    Q_ASSERT(ch.toString().trimmed().isEmpty());

    /* This gets problematic due to how QXmlStreamReader works(which
     * is the only one we get whitespaceOnly() events from). Namely, text intermingled
     * with CDATA gets reported as individual Characters events, and
     * QXmlStreamReader::isWhitespace() can return differently for each of those. However,
     * it will occur very rarely, so this workaround of 1) mistakenly compressing 2) decompressing 3)
     * appending, will happen infrequently.
     */
    if(m_hasCharacters)
    {
        if(m_isCharactersCompressed)
        {
            m_characters = CompressedWhitespace::decompress(m_characters);
            m_isCharactersCompressed = false;
        }

        m_characters.append(ch.toString());
    }
    else
    {
        /* We haven't received a text node previously. */
        m_characters = CompressedWhitespace::compress(ch);
        m_isCharactersCompressed = true;
        m_isPreviousAtomic = false;
        m_hasCharacters = true;
    }
}
开发者ID:Suneal,项目名称:qt,代码行数:31,代码来源:qacceltreebuilder.cpp

示例7: startDocument

void XMLDocumentParser::startDocument()
{
    initializeParserContext();
    ExceptionCode ec = 0;

    if (!m_parsingFragment) {
        document()->setXMLStandalone(m_stream.isStandaloneDocument(), ec);

        QStringRef version = m_stream.documentVersion();
        if (!version.isEmpty())
            document()->setXMLVersion(version, ec);
        QStringRef encoding = m_stream.documentEncoding();
        if (!encoding.isEmpty())
            document()->setXMLEncoding(encoding);
    }
}
开发者ID:13W,项目名称:phantomjs,代码行数:16,代码来源:XMLDocumentParserQt.cpp

示例8: handleStartElement

void MessageFactory::handleStartElement(const QStringRef &name, const QStringRef &uri,
										const QXmlStreamAttributes &attributes)
{
	m_depth++;
	if (m_depth == 1)
		m_stanza.reset(new MessagePrivate);
	StanzaFactory::handleStartElement(name, uri, attributes);
	if (m_depth == 1) {
		m_state = AtMessage;
		MessagePrivate *p = static_cast<MessagePrivate*>(m_stanza.data());
		QStringRef subtype = attributes.value(QLatin1String("type"));
		if (subtype.isEmpty())
			p->subtype = Message::Normal;
		else
			p->subtype = strToEnum<Message::Type>(subtype, message_types);
		if (p->subtype < 0)
			p->subtype = Message::Invalid;
	} else if(m_depth == 2) {
		if(name == QLatin1String("body"))
			m_state = AtBody;
		else if(name == QLatin1String("subject"))
			m_state = AtSubject;
		else if(name == QLatin1String("thread"))
			m_state = AtThread;
	}
}
开发者ID:AlexeyProkhin,项目名称:jreen,代码行数:26,代码来源:messagefactory.cpp

示例9: ParseSeq

void WplParser::ParseSeq(const QDir& dir, QXmlStreamReader* reader,
                         SongList* songs) const {
  while (!reader->atEnd()) {
    QXmlStreamReader::TokenType type = reader->readNext();
    switch (type) {
      case QXmlStreamReader::StartElement: {
        QStringRef name = reader->name();
        if (name == "media") {
          QStringRef src = reader->attributes().value("src");
          if (!src.isEmpty()) {
            Song song = LoadSong(src.toString(), 0, dir);
            if (song.is_valid()) {
              songs->append(song);
            }
          }
        } else {
          Utilities::ConsumeCurrentElement(reader);
        }
        break;
      }
      case QXmlStreamReader::EndElement: {
        if (reader->name() == "seq") {
          return;
        }
        break;
      }
      default:
        break;
    }
  }
}
开发者ID:Aceler,项目名称:Clementine,代码行数:31,代码来源:wplparser.cpp

示例10:

void
Attr::Load(QXmlStreamAttributes &attrs)
{
	const QString &full_prefix = prefix_.With(name_);
	QStringRef ref = attrs.value(full_prefix);
	if (!ref.isEmpty())
		value_ = ref.toString();
}
开发者ID:ralincristian,项目名称:QOds-1,代码行数:8,代码来源:Attr.cpp

示例11: valueAsString

QString ScXmlStreamAttributes::valueAsString (const QString& attrName, const QString def) const
{
	QString retValue = def;
	QStringRef att = value(attrName);
	if (!att.isEmpty() || hasAttribute(attrName))
		retValue = att.toString();
	return retValue;
}
开发者ID:moceap,项目名称:scribus,代码行数:8,代码来源:scxmlstreamreader.cpp

示例12: booleanAttributeValue

static inline bool booleanAttributeValue(const QXmlStreamReader &r, const char *nameC,
                                         bool defaultValue)
{
    const QStringRef attributeValue = r.attributes().value(QLatin1String(nameC));
    if (attributeValue.isEmpty())
        return defaultValue;
    return attributeValue == QLatin1String("true");
}
开发者ID:jlehtoranta,项目名称:sailfish-qtcreator,代码行数:8,代码来源:customwizardparameters.cpp

示例13: typeByName

static T typeByName(const QStringRef &name, const char* types[], int n)
{
	if (name.isEmpty())
		return static_cast<T>(-2); // Empty
	ActivityLessThen activityLessThen;
	const char **res = qBinaryFind(types, types + n, name, activityLessThen);
	return static_cast<T>((res == types + n) ? -1 : (res - types));
}
开发者ID:NeutronStein,项目名称:jreen,代码行数:8,代码来源:activityfactory.cpp

示例14: compress

QString CompressedWhitespace::compress(const QStringRef &input)
{
    Q_ASSERT(!isEven(1) && isEven(0) && isEven(2));
    Q_ASSERT(!input.isEmpty());

    QString result;
    const int len = input.length();

    /* The amount of compressed characters. For instance, if input is
     * four spaces followed by one tab, compressedChars will be 2, and the resulting
     * QString will have a length of 1, two compressedChars stored in one QChar. */
    int compressedChars = 0;

    for(int i = 0; i < len; ++i)
    {
        const QChar c(input.at(i));

        int start = i;

        while(true)
        {
            if(i + 1 == input.length() || input.at(i + 1) != c)
                break;
            else
                ++i;
        }

        /* The length of subsequent whitespace characters in the input. */
        int wsLen = (i - start) + 1;

        /* We might get a sequence of whitespace that is so long, that we can't
         * store it in one unit/byte. In that case we chop it into as many subsequent
         * ones that is needed. */
        while(true)
        {
            const int unitLength = qMin(wsLen, int(MaxCharCount));
            wsLen -= unitLength;

            ushort resultCP = toCompressedChar(c, unitLength);

            if(isEven(compressedChars))
                result += QChar(resultCP);
            else
            {
                resultCP = resultCP << 8;
                resultCP |= result.at(result.size() - 1).unicode();
                result[result.size() - 1] = resultCP;
            }

            ++compressedChars;

            if(wsLen == 0)
                break;
        }
    }

    return result;
}
开发者ID:BGmot,项目名称:Qt,代码行数:58,代码来源:qcompressedwhitespace.cpp

示例15: startDocument

void XMLTokenizer::startDocument()
{
    initializeParserContext();
    ExceptionCode ec = 0;

    if (!m_parsingFragment) {
        m_doc->setXMLStandalone(m_stream.isStandaloneDocument(), ec);

#if QT_VERSION >= 0x040400
        QStringRef version = m_stream.documentVersion();
        if (!version.isEmpty())
            m_doc->setXMLVersion(version, ec);
        QStringRef encoding = m_stream.documentEncoding();
        if (!encoding.isEmpty())
            m_doc->setXMLEncoding(encoding);
#endif
    }
}
开发者ID:boyliang,项目名称:ComponentSuperAccessor,代码行数:18,代码来源:XMLTokenizerQt.cpp


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