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


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

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


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

示例1: parseTag

bool QQuickStyledTextPrivate::parseTag(const QChar *&ch, const QString &textIn, QString &textOut, QTextCharFormat &format)
{
    skipSpace(ch);

    int tagStart = ch - textIn.constData();
    int tagLength = 0;
    while (!ch->isNull()) {
        if (*ch == greaterThan) {
            if (tagLength == 0)
                return false;
            QStringRef tag(&textIn, tagStart, tagLength);
            const QChar char0 = tag.at(0);
            if (char0 == QLatin1Char('b')) {
                if (tagLength == 1) {
                    format.setFontWeight(QFont::Bold);
                    return true;
                } else if (tagLength == 2 && tag.at(1) == QLatin1Char('r')) {
                    textOut.append(QChar(QChar::LineSeparator));
                    hasSpace = true;
                    prependSpace = false;
                    return false;
                }
            } else if (char0 == QLatin1Char('i')) {
                if (tagLength == 1) {
                    format.setFontItalic(true);
                    return true;
                }
            } else if (char0 == QLatin1Char('p')) {
                if (tagLength == 1) {
                    if (!hasNewLine)
                        textOut.append(QChar::LineSeparator);
                    hasSpace = true;
                    prependSpace = false;
                } else if (tag == QLatin1String("pre")) {
                    preFormat = true;
                    if (!hasNewLine)
                        textOut.append(QChar::LineSeparator);
                    format.setFontFamily(QString::fromLatin1("Courier New,courier"));
                    format.setFontFixedPitch(true);
                    return true;
                }
            } else if (char0 == QLatin1Char('u')) {
                if (tagLength == 1) {
                    format.setFontUnderline(true);
                    return true;
                } else if (tag == QLatin1String("ul")) {
                    List listItem;
                    listItem.level = 0;
                    listItem.type = Unordered;
                    listItem.format = Bullet;
                    listStack.push(listItem);
                }
            } else if (char0 == QLatin1Char('h') && tagLength == 2) {
                int level = tag.at(1).digitValue();
                if (level >= 1 && level <= 6) {
                    if (!hasNewLine)
                        textOut.append(QChar::LineSeparator);
                    hasSpace = true;
                    prependSpace = false;
                    setFontSize(7 - level, format);
                    format.setFontWeight(QFont::Bold);
                    return true;
                }
            } else if (tag == QLatin1String("strong")) {
                format.setFontWeight(QFont::Bold);
                return true;
            } else if (tag == QLatin1String("ol")) {
                List listItem;
                listItem.level = 0;
                listItem.type = Ordered;
                listItem.format = Decimal;
                listStack.push(listItem);
            } else if (tag == QLatin1String("li")) {
                if (!hasNewLine)
                    textOut.append(QChar(QChar::LineSeparator));
                if (!listStack.isEmpty()) {
                    int count = ++listStack.top().level;
                    for (int i = 0; i < listStack.size(); ++i)
                        textOut += QString(tabsize, QChar::Nbsp);
                    switch (listStack.top().format) {
                    case Decimal:
                        textOut += QString::number(count) % QLatin1Char('.');
                        break;
                    case LowerAlpha:
                        textOut += toAlpha(count, false) % QLatin1Char('.');
                        break;
                    case UpperAlpha:
                        textOut += toAlpha(count, true) % QLatin1Char('.');
                        break;
                    case LowerRoman:
                        textOut += toRoman(count, false) % QLatin1Char('.');
                        break;
                    case UpperRoman:
                        textOut += toRoman(count, true) % QLatin1Char('.');
                        break;
                    case Bullet:
                        textOut += bullet;
                        break;
                    case Disc:
                        textOut += disc;
//.........这里部分代码省略.........
开发者ID:Sagaragrawal,项目名称:2gisqt5android,代码行数:101,代码来源:qquickstyledtext.cpp

示例2: frameContentsLoaded

QVector<ApiTraceCall*>
TraceLoader::fetchFrameContents(ApiTraceFrame *currentFrame)
{
    Q_ASSERT(currentFrame);

    if (currentFrame->isLoaded()) {
        return currentFrame->calls();
    }

    if (m_parser.supportsOffsets()) {
        unsigned frameIdx = currentFrame->number;
        int numOfCalls = numberOfCallsInFrame(frameIdx);

        if (numOfCalls) {
            quint64 binaryDataSize = 0;
            QStack<ApiTraceCall*> groups;
            QVector<ApiTraceCall*> topLevelItems;
            QVector<ApiTraceCall*> allCalls(numOfCalls);
            const FrameBookmark &frameBookmark = m_frameBookmarks[frameIdx];

            m_parser.setBookmark(frameBookmark.start);

            trace::Call *call;
            int parsedCalls = 0;
            while ((call = m_parser.parse_call())) {
                ApiTraceCall *apiCall =
                    apiCallFromTraceCall(call, m_helpHash,
                                         currentFrame, groups.isEmpty() ? 0 : groups.top(), this);
                Q_ASSERT(apiCall);
                Q_ASSERT(parsedCalls < allCalls.size());
                allCalls[parsedCalls++] = apiCall;
                if (groups.count() == 0) {
                    topLevelItems.append(apiCall);
                } else {
                    groups.top()->addChild(apiCall);
                }
                if (call->flags & trace::CALL_FLAG_MARKER_PUSH) {
                    groups.push(apiCall);
                } else if (call->flags & trace::CALL_FLAG_MARKER_POP) {
                    if (groups.count()) {
                        groups.top()->finishedAddingChildren();
                        groups.pop();
                    }
                }
                if (apiCall->hasBinaryData()) {
                    QByteArray data =
                        apiCall->arguments()[
                            apiCall->binaryDataIndex()].toByteArray();
                    binaryDataSize += data.size();
                }

                delete call;

                if (apiCall->flags() & trace::CALL_FLAG_END_FRAME) {
                    break;
                }

            }
            // There can be fewer parsed calls when call in different
            // threads cross the frame boundary
            Q_ASSERT(parsedCalls <= numOfCalls);
            Q_ASSERT(parsedCalls <= allCalls.size());
            allCalls.resize(parsedCalls);
            allCalls.squeeze();

            Q_ASSERT(parsedCalls <= currentFrame->numChildrenToLoad());
            if (topLevelItems.count() == allCalls.count()) {
                emit frameContentsLoaded(currentFrame, allCalls,
                                         allCalls, binaryDataSize);
            } else {
                emit frameContentsLoaded(currentFrame, topLevelItems,
                                         allCalls, binaryDataSize);
            }
            return allCalls;
        }
    }
    return QVector<ApiTraceCall*>();
}
开发者ID:is00hcw,项目名称:apitrace,代码行数:78,代码来源:traceloader.cpp

示例3: on_equal_clicked

void fractin::on_equal_clicked()
{
    QStack<QChar> t;
    int d=0;
    QString str=text;
    QChar ch=text[0];
    text.remove(0,1);
    if((!ch.isDigit()&&ch!='(')||text.isEmpty()){
        text="格式不支持!";
        ui->show->setText(text);
        return;
    }
    while(!text.isEmpty()){
        if(ch.isDigit()){
            while(ch.isDigit()&&!text.isEmpty()){
              ch=text[0];
              text.remove(0,1);
            }
            if(ch!='|'||text.isEmpty()){
              text="格式不支持!";
              ui->show->setText(text);
              return;
            }
            ch=text[0];
            text.remove(0,1);
            if(!ch.isDigit()){
                text="格式不支持!";
                ui->show->setText(text);
                return;
            }
            while(ch.isDigit()&&!text.isEmpty()){
                d=d*10+ch.unicode()-48;
                ch=text[0];
                text.remove(0,1);
            }
            if(ch.isDigit())
                d=d*10+ch.unicode()-48;
            if(d==0){
                text="分母不能为零!";
                ui->show->setText(text);
                return;
            }
            if(ch=='.'||ch=='('||ch=='|'){
                text="格式不支持!";
                ui->show->setText(text);
                return;
            }
            continue;
        }
        if(ch=='+'||ch=='-'||ch=='*'||ch=='/'){
           if(text.isEmpty()){
               text="格式不支持!";
               ui->show->setText(text);
               return;
           }
           ch=text[0];
           text.remove(0,1);
           if(!(ch.isDigit()||ch=='(')||(ch.isDigit()&&text.isEmpty())){
               text="格式不支持!";
               ui->show->setText(text);
               return;
           }
           continue;
        }
        if(ch=='('){
            t.push(ch);
            if(text.isEmpty()){
                text="格式不支持!";
                ui->show->setText(text);
                return;
            }
            ch=text[0];
            text.remove(0,1);
            if(!ch.isDigit()&&ch!='('&&ch!='-'){
                text="格式不支持!";
                ui->show->setText(text);
                return;
            }
            if(ch=='-'){
                if(text.isEmpty()){
                    text="格式不支持!";
                    ui->show->setText(text);
                    return;
                }
                ch=text[0];
                text.remove(0,1);
                if(!ch.isDigit()){
                    text="格式不支持!";
                    ui->show->setText(text);
                    return;
                }
                while(ch.isDigit()&&!text.isEmpty()){
                    ch=text[0];
                    text.remove(0,1);
                }
                if(text.isEmpty()||ch!='|'){
                    text="格式不支持!";
                    ui->show->setText(text);
                    return;
                }
//.........这里部分代码省略.........
开发者ID:TinyCreation,项目名称:Calculator-,代码行数:101,代码来源:fractin.cpp

示例4: parse

bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString *errorMessage)
{
#ifdef QT_NO_XMLSTREAMREADER
    if (errorMessage)
        *errorMessage = QString::fromLatin1("QXmlStreamReader is not available, cannot parse.");
    return false;
#else
    QMimeTypePrivate data;
    int priority = 50;
    QStack<QMimeMagicRule *> currentRules; // stack for the nesting of rules
    QList<QMimeMagicRule> rules; // toplevel rules
    QXmlStreamReader reader(dev);
    ParseState ps = ParseBeginning;
    QXmlStreamAttributes atts;
    while (!reader.atEnd()) {
        switch (reader.readNext()) {
        case QXmlStreamReader::StartElement:
            ps = nextState(ps, reader.name());
            atts = reader.attributes();
            switch (ps) {
            case ParseMimeType: { // start parsing a MIME type name
                const QString name = atts.value(QLatin1String(mimeTypeAttributeC)).toString();
                if (name.isEmpty()) {
                    reader.raiseError(QString::fromLatin1("Missing '%1'-attribute").arg(QString::fromLatin1(mimeTypeAttributeC)));
                } else {
                    data.name = name;
                }
            }
                break;
            case ParseGenericIcon:
                data.genericIconName = atts.value(QLatin1String(nameAttributeC)).toString();
                break;
            case ParseIcon:
                data.iconName = atts.value(QLatin1String(nameAttributeC)).toString();
                break;
            case ParseGlobPattern: {
                const QString pattern = atts.value(QLatin1String(patternAttributeC)).toString();
                unsigned weight = atts.value(QLatin1String(weightAttributeC)).toString().toInt();
                const bool caseSensitive = atts.value(QLatin1String(caseSensitiveAttributeC)).toString() == QLatin1String("true");

                if (weight == 0)
                    weight = QMimeGlobPattern::DefaultWeight;

                Q_ASSERT(!data.name.isEmpty());
                const QMimeGlobPattern glob(pattern, data.name, weight, caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive);
                if (!process(glob, errorMessage))   // for actual glob matching
                    return false;
                data.addGlobPattern(pattern); // just for QMimeType::globPatterns()
            }
                break;
            case ParseSubClass: {
                const QString inheritsFrom = atts.value(QLatin1String(mimeTypeAttributeC)).toString();
                if (!inheritsFrom.isEmpty())
                    processParent(data.name, inheritsFrom);
            }
                break;
            case ParseComment: {
                // comments have locale attributes. We want the default, English one
                QString locale = atts.value(QLatin1String(localeAttributeC)).toString();
                const QString comment = reader.readElementText();
                if (locale.isEmpty())
                    locale = QString::fromLatin1("en_US");
                data.localeComments.insert(locale, comment);
            }
                break;
            case ParseAlias: {
                const QString alias = atts.value(QLatin1String(mimeTypeAttributeC)).toString();
                if (!alias.isEmpty())
                    processAlias(alias, data.name);
            }
                break;
            case ParseMagic: {
                priority = 50;
                const QString priorityS = atts.value(QLatin1String(priorityAttributeC)).toString();
                if (!priorityS.isEmpty()) {
                    if (!parseNumber(priorityS, &priority, errorMessage))
                        return false;

                }
                currentRules.clear();
                //qDebug() << "MAGIC start for mimetype" << data.name;
            }
                break;
            case ParseMagicMatchRule: {
                QMimeMagicRule *rule = 0;
                if (!createMagicMatchRule(atts, errorMessage, rule))
                    return false;
                QList<QMimeMagicRule> *ruleList;
                if (currentRules.isEmpty())
                    ruleList = &rules;
                else // nest this rule into the proper parent
                    ruleList = &currentRules.top()->m_subMatches;
                ruleList->append(*rule);
                //qDebug() << " MATCH added. Stack size was" << currentRules.size();
                currentRules.push(&ruleList->last());
                delete rule;
                break;
            }
            case ParseError:
                reader.raiseError(QString::fromLatin1("Unexpected element <%1>").
//.........这里部分代码省略.........
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:101,代码来源:qmimetypeparser.cpp

示例5: prepareCommand

QString Speech::prepareCommand(QString command, const QString &text,
                               const QString &filename, const QString &language)
{
#ifdef macroExpander
    QHash<QChar, QString> map;
    map[QLatin1Char('t')] = text;
    map[QLatin1Char('f')] = filename;
    map[QLatin1Char('l')] = language;
    return KMacroExpander::expandMacrosShellQuote(command, map);
#else
    QStack<bool> stack;  // saved isdoublequote values during parsing of braces
    bool issinglequote = false; // inside '...' ?
    bool isdoublequote = false; // inside "..." ?
    int noreplace = 0; // nested braces when within ${...}
    QString escText = K3ShellProcess::quote(text);

    // character sequences that change the state or need to be otherwise processed
    QRegExp re_singlequote("('|%%|%t|%f|%l)");
    QRegExp re_doublequote("(\"|\\\\|`|\\$\\(|\\$\\{|%%|%t|%f|%l)");
    QRegExp re_noquote("('|\"|\\\\|`|\\$\\(|\\$\\{|\\(|\\{|\\)|\\}|%%|%t|%f|%l)");

    // parse the command:
    for (int i = re_noquote.search(command);
         i != -1;
         i = (issinglequote ? re_singlequote.search(command, i)
              : isdoublequote ? re_doublequote.search(command, i)
              : re_noquote.search(command, i))
        )
        // while there are character sequences that need to be processed
    {
        if ((command[i] == '(') || (command[i] == '{')) { // (...) or {...}
            // assert(isdoublequote == false)
            stack.push(isdoublequote);
            if (noreplace > 0)
                // count nested braces when within ${...}
                noreplace++;
            i++;
        } else if (command[i] == '$') { // $(...) or ${...}
            stack.push(isdoublequote);
            isdoublequote = false;
            if ((noreplace > 0) || (command[i + 1] == '{'))
                // count nested braces when within ${...}
                noreplace++;
            i += 2;
        } else if ((command[i] == ')') || (command[i] == '}')) {
            // $(...) or (...) or ${...} or {...}
            if (!stack.isEmpty())
                isdoublequote = stack.pop();
            else
                qWarning("Parse error.");
            if (noreplace > 0)
                // count nested braces when within ${...}
                noreplace--;
            i++;
        } else if (command[i] == '\'') {
            issinglequote = !issinglequote;
            i++;
        } else if (command[i] == '"') {
            isdoublequote = !isdoublequote;
            i++;
        } else if (command[i] == '\\')
            i += 2;
        else if (command[i] == '`') {
            // Replace all `...` with safer $(...)
            command.replace(i, 1, "$(");
            QRegExp re_backticks("(`|\\\\`|\\\\\\\\|\\\\\\$)");
            for (int i2 = re_backticks.search(command, i + 2);
                 i2 != -1;
                 i2 = re_backticks.search(command, i2)
                ) {
                if (command[i2] == '`') {
                    command.replace(i2, 1, ")");
                    i2 = command.length(); // leave loop
                } else {
                    // remove backslash and ignore following character
                    command.remove(i2, 1);
                    i2++;
                }
            }
            // Leave i unchanged! We need to process "$("
        } else if (noreplace > 0) { // do not replace macros within ${...}
            if (issinglequote)
                i += re_singlequote.matchedLength();
            else if (isdoublequote)
                i += re_doublequote.matchedLength();
            else
                i += re_noquote.matchedLength();
        } else { // replace macro
            QString match, v;

            // get match
            if (issinglequote)
                match = re_singlequote.cap();
            else if (isdoublequote)
                match = re_doublequote.cap();
            else
                match = re_noquote.cap();

            // substitute %variables
            if (match == "%t")
//.........这里部分代码省略.........
开发者ID:KDE,项目名称:kmouth,代码行数:101,代码来源:speech.cpp

示例6: advance

/*!
    \internal
*/
void QDirIteratorPrivate::advance()
{
    // Store the current entry
    if (!fileEngineIterators.isEmpty())
        currentFilePath = fileEngineIterators.top()->currentFilePath();

    // Advance to the next entry
    if (followNextDir) {
        // Start by navigating into the current directory.
        followNextDir = false;

        QAbstractFileEngineIterator *it = fileEngineIterators.top();

        QString subDir = it->currentFilePath();
#ifdef Q_OS_WIN
        if (fileInfo.isSymLink())
            subDir = fileInfo.canonicalFilePath();
#endif
        pushSubDirectory(subDir, it->nameFilters(), it->filters());
    }

    if (fileEngineIterators.isEmpty())
        done = true;

    bool foundValidEntry = false;
    while (!fileEngineIterators.isEmpty()) {
        QAbstractFileEngineIterator *it = fileEngineIterators.top();

        // Find the next valid iterator that matches the filters.
        foundValidEntry = false;
        while (it->hasNext()) {
            it->next();
            if (matchesFilters(it)) {
                foundValidEntry = true;
                break;
            }
        }

        if (!foundValidEntry) {
            // If this iterator is done, pop and delete it, and continue
            // iteration on the parent. Otherwise break, we're done.
            if (!fileEngineIterators.isEmpty()) {
                delete it;
                it = fileEngineIterators.pop();
                continue;
            }
            break;
        }

        fileInfo = it->currentFileInfo();

        // If we're doing flat iteration, we're done.
        if (!(iteratorFlags & QDirIterator::Subdirectories))
            break;

        // Subdirectory iteration.
        QString filePath = fileInfo.filePath();

        // Never follow . and ..
        if (fileInfo.fileName() == QLatin1String(".") || fileInfo.fileName() == QLatin1String(".."))
            break;

        // Never follow non-directory entries
        if (!fileInfo.isDir())
            break;
      
        // Check symlinks
        if (fileInfo.isSymLink() && !(iteratorFlags & QDirIterator::FollowSymlinks)) {
            // Follow symlinks only if FollowSymlinks was passed
            break;
        }

        // Stop link loops
        if (visitedLinks.contains(fileInfo.canonicalFilePath()))
            break;

        // Signal that we want to follow this entry.
        followNextDir = true;
        break;
    }

    if (!foundValidEntry)
        done = true;
}
开发者ID:GodFox,项目名称:qtopia-ezx,代码行数:87,代码来源:qdiriterator.cpp

示例7: fitCurve

/*!
  \param points Series of data points
  \return Curve points
*/
QPolygonF QwtWeedingCurveFitter::fitCurve( const QPolygonF &points ) const
{
    QStack<Line> stack;
    stack.reserve( 500 );

    const QPointF *p = points.data();
    const int nPoints = points.size();

    QVector<bool> usePoint( nPoints, false );

    double distToSegment;

    stack.push( Line( 0, nPoints - 1 ) );

    while ( !stack.isEmpty() )
    {
        const Line r = stack.pop();

        // initialize line segment
        const double vecX = p[r.to].x() - p[r.from].x();
        const double vecY = p[r.to].y() - p[r.from].y();

        const double vecLength = qSqrt( vecX * vecX + vecY * vecY );

        const double unitVecX = ( vecLength != 0.0 ) ? vecX / vecLength : 0.0;
        const double unitVecY = ( vecLength != 0.0 ) ? vecY / vecLength : 0.0;

        double maxDist = 0.0;
        int nVertexIndexMaxDistance = r.from + 1;
        for ( int i = r.from + 1; i < r.to; i++ )
        {
            //compare to anchor
            const double fromVecX = p[i].x() - p[r.from].x();
            const double fromVecY = p[i].y() - p[r.from].y();
            const double fromVecLength =
                qSqrt( fromVecX * fromVecX + fromVecY * fromVecY );

            if ( fromVecX * unitVecX + fromVecY * unitVecY < 0.0 )
            {
                distToSegment = fromVecLength;
            }
            if ( fromVecX * unitVecX + fromVecY * unitVecY < 0.0 )
            {
                distToSegment = fromVecLength;
            }
            else
            {
                const double toVecX = p[i].x() - p[r.to].x();
                const double toVecY = p[i].y() - p[r.to].y();
                const double toVecLength = qSqrt( toVecX * toVecX + toVecY * toVecY );
                const double s = toVecX * ( -unitVecX ) + toVecY * ( -unitVecY );
                if ( s < 0.0 )
                    distToSegment = toVecLength;
                else
                {
                    distToSegment = qSqrt( qFabs( toVecLength * toVecLength - s * s ) );
                }
            }

            if ( maxDist < distToSegment )
            {
                maxDist = distToSegment;
                nVertexIndexMaxDistance = i;
            }
        }
        if ( maxDist <= d_data->tolerance )
        {
            usePoint[r.from] = true;
            usePoint[r.to] = true;
        }
        else
        {
            stack.push( Line( r.from, nVertexIndexMaxDistance ) );
            stack.push( Line( nVertexIndexMaxDistance, r.to ) );
        }
    }

    int cnt = 0;

    QPolygonF stripped( nPoints );
    for ( int i = 0; i < nPoints; i++ )
    {
        if ( usePoint[i] )
            stripped[cnt++] = p[i];
    }
    stripped.resize( cnt );
    return stripped;
}
开发者ID:01iv3r,项目名称:OpenPilot,代码行数:92,代码来源:qwt_curve_fitter.cpp

示例8: progressChanged

void
Volume::findConnectedRegion(int mind, int maxd,
			    int minw, int maxw,
			    int minh, int maxh,
			    QList<int> pos,
			    bool sliceOnly)
{
  m_connectedbitmask.fill(false);

  uchar *lut = Global::lut();
  QStack<int> stack;

  uchar *vslice;
  uchar v0, g0;
  int d = pos[0];
  int w = pos[1];
  int h = pos[2];
  vslice = m_pvlFileManager.rawValue(d, w, h);
  v0 = vslice[0];
//  vslice = m_gradFileManager.rawValue(d, w, h);
//  g0 = vslice[0];
  g0 = 0;


  // put the seeds in
  for(int pi=0; pi<pos.size()/3; pi++)
    {
      int d = pos[3*pi];
      int w = pos[3*pi+1];
      int h = pos[3*pi+2];
      if (d >= mind && d <= maxd &&
	  w >= minw && w <= maxw &&
	  h >= minh && h <= maxh)
	{
	  qint64 idx = d*m_width*m_height + w*m_height + h;
	  if (m_bitmask.testBit(idx))
	    {
	      m_connectedbitmask.setBit(idx);
	      stack.push(d);
	      stack.push(w);
	      stack.push(h);
	    }
	}
    }

  if (sliceOnly)
    stack.clear();

  int pv = 0;
  int progv = 0;
  while(!stack.isEmpty())
    {
      progv++;
      if (progv == 1000)
	{
	  progv = 0;
	  pv = (++pv % 100);
	  emit progressChanged(pv);	  
	}

      int h = stack.pop();
      int w = stack.pop();
      int d = stack.pop();
      qint64 idx = d*m_width*m_height + w*m_height + h;
      if (m_bitmask.testBit(idx))
	{
	  int d0 = qMax(d-1, 0);
	  int d1 = qMin(d+1, m_depth-1);
	  int w0 = qMax(w-1, 0);
	  int w1 = qMin(w+1, m_width-1);
	  int h0 = qMax(h-1, 0);
	  int h1 = qMin(h+1, m_height-1);
	      
	  for(int d2=d0; d2<=d1; d2++)
	    for(int w2=w0; w2<=w1; w2++)
	      for(int h2=h0; h2<=h1; h2++)
		{
		  if (d2 >= mind && d2 <= maxd &&
		      w2 >= minw && w2 <= maxw &&
		      h2 >= minh && h2 <= maxh)
		    {
		      qint64 idx = d2*m_width*m_height +
			           w2*m_height + h2;
		      if ( m_bitmask.testBit(idx) &&
			   !m_connectedbitmask.testBit(idx) )
			{
//			  uchar v, g;
//			  vslice = m_pvlFileManager.rawValue(d2, w2, h2);
//			  v = vslice[0];
//			  vslice = m_gradFileManager.rawValue(d2, w2, h2);
//			  g = vslice[0];
//
//			  if (qAbs(v-v0) < Global::deltaV() &&
//			      g < Global::deltaG())
			    {
			      m_connectedbitmask.setBit(idx);
			      stack.push(d2);
			      stack.push(w2);
			      stack.push(h2);
			    }
//.........这里部分代码省略.........
开发者ID:beyondwolfeagle,项目名称:drishti,代码行数:101,代码来源:volume.cpp

示例9: interpretResourceFile

bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
    const QString &fname, QString currentPath, bool ignoreErrors)
{
    Q_ASSERT(m_errorDevice);
    const QChar slash = QLatin1Char('/');
    if (!currentPath.isEmpty() && !currentPath.endsWith(slash))
        currentPath += slash;

    QXmlStreamReader reader(inputDevice);
    QStack<RCCXmlTag> tokens;

    QString prefix;
    QLocale::Language language = QLocale::c().language();
    QLocale::Country country = QLocale::c().country();
    QString alias;
    int compressLevel = m_compressLevel;
    int compressThreshold = m_compressThreshold;

    while (!reader.atEnd()) {
        QXmlStreamReader::TokenType t = reader.readNext();
        switch (t) {
        case QXmlStreamReader::StartElement:
            if (reader.name() == m_strings.TAG_RCC) {
                if (!tokens.isEmpty())
                    reader.raiseError(QLatin1String("expected <RCC> tag"));
                else
                    tokens.push(RccTag);
            } else if (reader.name() == m_strings.TAG_RESOURCE) {
                if (tokens.isEmpty() || tokens.top() != RccTag) {
                    reader.raiseError(QLatin1String("unexpected <RESOURCE> tag"));
                } else {
                    tokens.push(ResourceTag);

                    QXmlStreamAttributes attributes = reader.attributes();
                    language = QLocale::c().language();
                    country = QLocale::c().country();

                    if (attributes.hasAttribute(m_strings.ATTRIBUTE_LANG)) {
                        QString attribute = attributes.value(m_strings.ATTRIBUTE_LANG).toString();
                        QLocale lang = QLocale(attribute);
                        language = lang.language();
                        if (2 == attribute.length()) {
                            // Language only
                            country = QLocale::AnyCountry;
                        } else {
                            country = lang.country();
                        }
                    }

                    prefix.clear();
                    if (attributes.hasAttribute(m_strings.ATTRIBUTE_PREFIX))
                        prefix = attributes.value(m_strings.ATTRIBUTE_PREFIX).toString();
                    if (!prefix.startsWith(slash))
                        prefix.prepend(slash);
                    if (!prefix.endsWith(slash))
                        prefix += slash;
                }
            } else if (reader.name() == m_strings.TAG_FILE) {
                if (tokens.isEmpty() || tokens.top() != ResourceTag) {
                    reader.raiseError(QLatin1String("unexpected <FILE> tag"));
                } else {
                    tokens.push(FileTag);

                    QXmlStreamAttributes attributes = reader.attributes();
                    alias.clear();
                    if (attributes.hasAttribute(m_strings.ATTRIBUTE_ALIAS))
                        alias = attributes.value(m_strings.ATTRIBUTE_ALIAS).toString();

                    compressLevel = m_compressLevel;
                    if (attributes.hasAttribute(m_strings.ATTRIBUTE_COMPRESS))
                        compressLevel = attributes.value(m_strings.ATTRIBUTE_COMPRESS).toString().toInt();

                    compressThreshold = m_compressThreshold;
                    if (attributes.hasAttribute(m_strings.ATTRIBUTE_THRESHOLD))
                        compressThreshold = attributes.value(m_strings.ATTRIBUTE_THRESHOLD).toString().toInt();

                    // Special case for -no-compress. Overrides all other settings.
                    if (m_compressLevel == -2)
                        compressLevel = 0;
                }
            } else {
                reader.raiseError(QString(QLatin1String("unexpected tag: %1")).arg(reader.name().toString()));
            }
            break;

        case QXmlStreamReader::EndElement:
            if (reader.name() == m_strings.TAG_RCC) {
                if (!tokens.isEmpty() && tokens.top() == RccTag)
                    tokens.pop();
                else
                    reader.raiseError(QLatin1String("unexpected closing tag"));
            } else if (reader.name() == m_strings.TAG_RESOURCE) {
                if (!tokens.isEmpty() && tokens.top() == ResourceTag)
                    tokens.pop();
                else
                    reader.raiseError(QLatin1String("unexpected closing tag"));
            } else if (reader.name() == m_strings.TAG_FILE) {
                if (!tokens.isEmpty() && tokens.top() == FileTag)
                    tokens.pop();
                else
//.........这里部分代码省略.........
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:101,代码来源:rcc.cpp

示例10: parse

/**
    \internal
*/
bool GetOpt::parse( bool untilFirstSwitchOnly )
{
    // qDebug( "parse(%s)", args.join( QString( "," ) ).toLocal8Bit().constData() );
    // push all arguments as we got them on a stack
    // more pushes might following when parsing condensed arguments
    // like --key=value.
    QStack<QString> stack;
    {
        QStringList::const_iterator it = args.isEmpty() ? args.end() : --args.end();

        while ( it != args.constEnd() )
        {
            stack.push( *it );

            if ( it == args.begin() )
            {
                it = args.constEnd();
            }
            else
            {
                --it;
            }
        }
    }

    //qWarning() << stack;

    enum { StartState, ExpectingState, OptionalState } state = StartState;
    enum TokenType { LongOpt, ShortOpt, Arg, End } t, currType = End;

    const OptionConstIterator obegin = options.begin();
    const OptionConstIterator oend = options.end();
    Option currOpt;
    bool extraLoop = true; // we'll do an extra round. fake an End argument

    while ( !stack.isEmpty() || extraLoop )
    {
        QString a;
        QString origA;

        // identify argument type
        if ( !stack.isEmpty() )
        {
            a = stack.pop();
            currArg++;
            origA = a;

            // qDebug( "popped %s", a.toLocal8Bit().constData() );
            if ( a.startsWith( QLatin1String( "--" ) ) )
            {
                // recognized long option
                a = a.mid( 2 );

                if ( a.isEmpty() )
                {
                    qWarning( "'--' feature not supported, yet" );
                    //exit( 2 );
                    return false;
                }

                t = LongOpt;
                int equal = a.indexOf( '=' ); // split key=value style arguments

                if ( equal >= 0 )
                {
                    stack.push( a.mid( equal +1 ) );
                    currArg--;
                    a = a.left( equal );
                }
            }
            else if ( a.length() == 1 )
            {
                t = Arg;
            }
            else if ( a[ 0 ] == '-' )
            {
#if 0 // compat mode for -long style options
                if ( a.length() == 2 )
                {
                    t = ShortOpt;
                    a = a[ 1 ];
                }
                else
                {
                    a = a.mid( 1 );
                    t = LongOpt;
                    int equal = a.find( '=' ); // split key=value style arguments

                    if ( equal >= 0 )
                    {
                        stack.push( a.mid( equal +1 ) );
                        currArg--;
                        a = a.left( equal );
                    }
                }
#else
                // short option
//.........这里部分代码省略.........
开发者ID:pasnox,项目名称:monkeystudio2,代码行数:101,代码来源:GetOpt.cpp

示例11: plainTextToHtml

QString plainTextToHtml(const QString &plaintext, const FlowedFormat flowed)
{
    QRegExp quotemarks;
    switch (flowed) {
    case FlowedFormat::FLOWED:
    case FlowedFormat::FLOWED_DELSP:
        quotemarks = QRegExp(QLatin1String("^>+"));
        break;
    case FlowedFormat::PLAIN:
        // Also accept > interleaved by spaces. That's what KMail happily produces.
        // A single leading space is accepted, too. That's what Gerrit produces.
        quotemarks = QRegExp(QLatin1String("^( >|>)+"));
        break;
    }
    const int SIGNATURE_SEPARATOR = -2;

    auto lines = plaintext.split(QLatin1Char('\n'));
    std::vector<TextInfo> lineBuffer;
    lineBuffer.reserve(lines.size());

    // First pass: determine the quote level for each source line.
    // The quote level is ignored for the signature.
    bool signatureSeparatorSeen = false;
    Q_FOREACH(const QString &line, lines) {

        // Fast path for empty lines
        if (line.isEmpty()) {
            lineBuffer.emplace_back(0, line);
            continue;
        }

        // Special marker for the signature separator
        if (signatureSeparator().exactMatch(line)) {
            lineBuffer.emplace_back(SIGNATURE_SEPARATOR, lineWithoutTrailingCr(line));
            signatureSeparatorSeen = true;
            continue;
        }

        // Determine the quoting level
        int quoteLevel = 0;
        if (!signatureSeparatorSeen && quotemarks.indexIn(line) == 0) {
            quoteLevel = quotemarks.cap(0).count(QLatin1Char('>'));
        }

        lineBuffer.emplace_back(quoteLevel, lineWithoutTrailingCr(line));
    }

    // Second pass:
    // - Remove the quotemarks for everything prior to the signature separator.
    // - Collapse the lines with the same quoting level into a single block
    //   (optionally into a single line if format=flowed is active)
    auto it = lineBuffer.begin();
    while (it < lineBuffer.end() && it->depth != SIGNATURE_SEPARATOR) {

        // Remove the quotemarks
        it->text.remove(quotemarks);

        switch (flowed) {
        case FlowedFormat::FLOWED:
        case FlowedFormat::FLOWED_DELSP:
            if (flowed == FlowedFormat::FLOWED || flowed == FlowedFormat::FLOWED_DELSP) {
                // check for space-stuffing
                if (it->text.startsWith(QLatin1Char(' '))) {
                    it->text.remove(0, 1);
                }

                // quirk: fix a flowed line which actually isn't flowed
                if (it->text.endsWith(QLatin1Char(' ')) && (
                        it+1 == lineBuffer.end() || // end-of-document
                        (it+1)->depth == SIGNATURE_SEPARATOR || // right in front of the separator
                        (it+1)->depth != it->depth // end of paragraph
                   )) {
                    it->text.chop(1);
                }
            }
            break;
        case FlowedFormat::PLAIN:
            if (it->depth > 0 && it->text.startsWith(QLatin1Char(' '))) {
                // Because the space is re-added when we prepend the quotes. Adding that space is done
                // in order to make it look nice, i.e. to prevent lines like ">>something".
                it->text.remove(0, 1);
            }
            break;
        }


        if (it == lineBuffer.begin()) {
            // No "previous line"
            ++it;
            continue;
        }

        // Check for the line joining
        auto prev = it - 1;
        if (prev->depth == it->depth) {

            QString separator = QStringLiteral("\n");
            switch (flowed) {
            case FlowedFormat::PLAIN:
                // nothing fancy to do here, we cannot really join lines
//.........这里部分代码省略.........
开发者ID:ChristopherCotnoir,项目名称:trojita,代码行数:101,代码来源:PlainTextFormatter.cpp

示例12: parseLinks

void FlatTextarea::parseLinks() { // some code is duplicated in text.cpp!
	LinkRanges newLinks;

	QString text(toPlainText());
	if (text.isEmpty()) {
		if (!_links.isEmpty()) {
			_links.clear();
			emit linksChanged();
		}
		return;
	}

	initLinkSets();

	int32 len = text.size();
	const QChar *start = text.unicode(), *end = start + text.size();
	for (int32 offset = 0, matchOffset = offset; offset < len;) {
		QRegularExpressionMatch m = reDomain().match(text, matchOffset);
		if (!m.hasMatch()) break;

		int32 domainOffset = m.capturedStart();

		QString protocol = m.captured(1).toLower();
		QString topDomain = m.captured(3).toLower();

		bool isProtocolValid = protocol.isEmpty() || validProtocols().contains(hashCrc32(protocol.constData(), protocol.size() * sizeof(QChar)));
		bool isTopDomainValid = !protocol.isEmpty() || validTopDomains().contains(hashCrc32(topDomain.constData(), topDomain.size() * sizeof(QChar)));

		if (protocol.isEmpty() && domainOffset > offset + 1 && *(start + domainOffset - 1) == QChar('@')) {
			QString forMailName = text.mid(offset, domainOffset - offset - 1);
			QRegularExpressionMatch mMailName = reMailName().match(forMailName);
			if (mMailName.hasMatch()) {
				offset = matchOffset = m.capturedEnd();
				continue;
			}
		}
		if (!isProtocolValid || !isTopDomainValid) {
			offset = matchOffset = m.capturedEnd();
			continue;
		}

		QStack<const QChar*> parenth;
		const QChar *domainEnd = start + m.capturedEnd(), *p = domainEnd;
		for (; p < end; ++p) {
			QChar ch(*p);
			if (chIsLinkEnd(ch)) break; // link finished
			if (chIsAlmostLinkEnd(ch)) {
				const QChar *endTest = p + 1;
				while (endTest < end && chIsAlmostLinkEnd(*endTest)) {
					++endTest;
				}
				if (endTest >= end || chIsLinkEnd(*endTest)) {
					break; // link finished at p
				}
				p = endTest;
				ch = *p;
			}
			if (ch == '(' || ch == '[' || ch == '{' || ch == '<') {
				parenth.push(p);
			} else if (ch == ')' || ch == ']' || ch == '}' || ch == '>') {
				if (parenth.isEmpty()) break;
				const QChar *q = parenth.pop(), open(*q);
				if ((ch == ')' && open != '(') || (ch == ']' && open != '[') || (ch == '}' && open != '{') || (ch == '>' && open != '<')) {
					p = q;
					break;
				}
			}
		}
		if (p > domainEnd) { // check, that domain ended
			if (domainEnd->unicode() != '/' && domainEnd->unicode() != '?') {
				matchOffset = domainEnd - start;
				continue;
			}
		}
		newLinks.push_back(qMakePair(domainOffset - 1, p - start - domainOffset + 2));
		offset = matchOffset = p - start;
	}

	if (newLinks != _links) {
		_links = newLinks;
		emit linksChanged();
	}
}
开发者ID:NgoHuy,项目名称:tdesktop,代码行数:83,代码来源:flattextarea.cpp

示例13: parse

void MessageLinksParser::parse() {
	const auto &textWithTags = _field->getTextWithTags();
	const auto &text = textWithTags.text;
	const auto &tags = textWithTags.tags;
	const auto &markdownTags = _field->getMarkdownTags();
	if (text.isEmpty()) {
		_list = QStringList();
		return;
	}

	auto ranges = QVector<LinkRange>();

	auto tag = tags.begin();
	const auto tagsEnd = tags.end();
	const auto processTag = [&] {
		Expects(tag != tagsEnd);

		if (Ui::InputField::IsValidMarkdownLink(tag->id)
			&& !IsMentionLink(tag->id)) {
			ranges.push_back({ tag->offset, tag->length, tag->id });
		}
		++tag;
	};
	const auto processTagsBefore = [&](int offset) {
		while (tag != tagsEnd && tag->offset + tag->length <= offset) {
			processTag();
		}
	};
	const auto hasTagsIntersection = [&](int till) {
		if (tag == tagsEnd || tag->offset >= till) {
			return false;
		}
		while (tag != tagsEnd && tag->offset < till) {
			processTag();
		}
		return true;
	};

	auto markdownTag = markdownTags.begin();
	const auto markdownTagsEnd = markdownTags.end();
	const auto markdownTagsAllow = [&](int from, int length) {
		while (markdownTag != markdownTagsEnd
			&& (markdownTag->adjustedStart
				+ markdownTag->adjustedLength <= from
				|| !markdownTag->closed)) {
			++markdownTag;
			continue;
		}
		if (markdownTag == markdownTagsEnd
			|| markdownTag->adjustedStart >= from + length) {
			return true;
		}
		// Ignore http-links that are completely inside some tags.
		// This will allow sending http://test.com/__test__/test correctly.
		return (markdownTag->adjustedStart > from)
			|| (markdownTag->adjustedStart
				+ markdownTag->adjustedLength < from + length);
	};

	const auto len = text.size();
	const QChar *start = text.unicode(), *end = start + text.size();
	for (auto offset = 0, matchOffset = offset; offset < len;) {
		auto m = qthelp::RegExpDomain().match(text, matchOffset);
		if (!m.hasMatch()) break;

		auto domainOffset = m.capturedStart();

		auto protocol = m.captured(1).toLower();
		auto topDomain = m.captured(3).toLower();
		auto isProtocolValid = protocol.isEmpty() || TextUtilities::IsValidProtocol(protocol);
		auto isTopDomainValid = !protocol.isEmpty() || TextUtilities::IsValidTopDomain(topDomain);

		if (protocol.isEmpty() && domainOffset > offset + 1 && *(start + domainOffset - 1) == QChar('@')) {
			auto forMailName = text.mid(offset, domainOffset - offset - 1);
			auto mMailName = TextUtilities::RegExpMailNameAtEnd().match(forMailName);
			if (mMailName.hasMatch()) {
				offset = matchOffset = m.capturedEnd();
				continue;
			}
		}
		if (!isProtocolValid || !isTopDomainValid) {
			offset = matchOffset = m.capturedEnd();
			continue;
		}

		QStack<const QChar*> parenth;
		const QChar *domainEnd = start + m.capturedEnd(), *p = domainEnd;
		for (; p < end; ++p) {
			QChar ch(*p);
			if (chIsLinkEnd(ch)) break; // link finished
			if (chIsAlmostLinkEnd(ch)) {
				const QChar *endTest = p + 1;
				while (endTest < end && chIsAlmostLinkEnd(*endTest)) {
					++endTest;
				}
				if (endTest >= end || chIsLinkEnd(*endTest)) {
					break; // link finished at p
				}
				p = endTest;
				ch = *p;
//.........这里部分代码省略.........
开发者ID:telegramdesktop,项目名称:tdesktop,代码行数:101,代码来源:message_field.cpp

示例14: Toom_Cook

LongInt Algorithm::Toom_Cook(LongInt a, LongInt b)
{
    /*/
    a=LongInt("529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450");
    b=LongInt("29834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450529834750827340585463450");
    qDebug()<<a.length();
    LongInt z=Strassen(a,b);
    /*/
    //===T1===========initialization=table=and=stack===
    qDebug()<<"Hello Lord of Iteration";
    QStack<LongInt> U,V;
    QStack<LongInt> W;
    QStack<int> C;

    int Index,i,j;//for iteration;
    //=======================Table===========
    int k=1;
    int Q=2,R=1;
    Table table={4,2};

    QVector<Table> qv_table;
    qv_table<<table<<table;
    QVector<Table>::iterator iter_table;//=qv_table.begin();

    int last_q=4;

    qDebug()<<qA<<"\"(0)\""<<Q<<R<<table.q<<table.r;
    while(a.length()>(qv_table.last().q+last_q))
    {
        qDebug()<<"algorithm.cpp:"<<"("+QString::number(k)+")"<<Q<<R<<table.q<<table.r;
        k++;
        Q+=R;
        table.q*=table.r;
        R++;
        if(R*R<=Q)//if((R+1)^2>=Q) R++;
        {
            table.r*=2;
        }
        else R--;
        last_q=qv_table.last().q;
        qv_table<<table;
    }
    qDebug()<<"algorithm.cpp:"<<"("+QString::number(k)+")"<<Q<<R<<table.q<<table.r;
    iter_table=qv_table.end();
    iter_table--;
    LongInt numbers[10*iter_table->r+1];
    //===================T2============================
    C.push(-1);
    C<<a.number<<-5<<b.number;
    a.clear();
    b.clear();
    int forSwitch=1;//iter_table--;
    //====================Cycle========================
    //bool isEnd=0;
    while(1)
    {
        switch(forSwitch)
        {
        case 1://T3
        {
            k--;
            iter_table--;
            //qDebug()<<"K="<<k;
            if(!k)
            {
                a.clear();
                b.clear();
                //qDebug()<<"C="<<C;
                while(!C.isEmpty())
                {
                    Q=C.pop();
                    if(Q>=0)
                    {
                        b.push_front(Q);
                    }
                    else
                    {
                        break;
                    }
                }
                //qDebug()<<"C="<<C;
                while(!C.isEmpty())
                {
                    Q=C.pop();
                    if(Q>=0)
                    {
                        a.push_front(Q);
                    }
                    else
                    {
                        C.push(Q);
                        break;
                    }
                }
                //qDebug()<<"algorithm.cpp:"<<a<<"*"<<b<<"=";
                forSwitch=5;
                a*=b;
                //qDebug()<<"algorithm.cpp:"<<a;
            }
            else
//.........这里部分代码省略.........
开发者ID:Mynamesparta,项目名称:Factorization_and_Discrete_Logarithm,代码行数:101,代码来源:algorithm.cpp

示例15: doParse

bool SGFParser::doParse(const QString &toParseStr)
{
	if (toParseStr.isNull() || toParseStr.isEmpty())
	{
		qWarning("Failed loading from file. Is it empty?");
		return false;
	}
	QString tmp;

	if(!loadedfromfile)
	{
		/* This bit of ugliness is because sgfs are used to duplicate boards as well
		 * as load from file FIXME */
		parseProperty(toParseStr, "CA", tmp);		//codec
		if (!tmp.isEmpty())
			readCodec = QTextCodec::codecForName(tmp.toLatin1().constData());
	}
	
	const MyString *toParse = NULL;

//////TODO	if (static_cast<Codec>(setting->readIntEntry("CODEC")) == codecNone)
/////////		toParse = new MySimpleString(toParseStr);
///////	else
		toParse = new MyString(toParseStr);

	Q_CHECK_PTR(toParse);
	
	int 	pos = 0,
		posVarBegin = 0,
		posVarEnd = 0,
		posNode = 0,
		moves = 0,
		i, x=-1, y=-1;

	int 	a_offset = QChar::fromLatin1('a').unicode() - 1 ;

	unsigned int pointer = 0,
		strLength = toParse->length();
	bool black = true,
		setup = false,
        old_label = false;
	isRoot = true;
	bool remember_root;
	QString unknownProperty;
	State state;
	MarkType markType;
	QString moveStr, commentStr;
	Position *position;
	MoveNum *moveNum;
	QStack<Move*> stack;
	QStack<MoveNum*> movesStack;
	/* FIXME toRemove, et., al., appears unused Remove it */
	QStack<Position*> toRemove;
/*
////TODO	stack.setAutoDelete(false);
	movesStack.setAutoDelete(true);
	toRemove.setAutoDelete(true);
*/
	// Initialises the tree with board size
	parseProperty(toParseStr, "SZ", tmp);
//	Tree *tree = new Tree(tmp.isEmpty() ? 19 : tmp.toInt()) ;// boardHandler->getTree();
	
	state = stateVarBegin;
	
	bool cancel = false;
    //FIXME abort does nothing!!
	
	// qDebug("File length = %d", strLength);
	
    tree->setLoadingSGF(true);
	
	QString sss="";
    do {
		posVarBegin = toParse->find('(', pointer);
		posVarEnd = toParse->find(')', pointer);
		posNode = toParse->find(';', pointer);
		
		pos = minPos(posVarBegin, posVarEnd, posNode);

		// Switch states

		// Node -> VarEnd
		if (state == stateNode && pos == posVarEnd)
			state = stateVarEnd;
		
		// Node -> VarBegin
		if (state == stateNode && pos == posVarBegin)
			state = stateVarBegin;
		
		// VarBegin -> Node
		else if (state == stateVarBegin && pos == posNode)
			state = stateNode;
		
		// VarEnd -> VarBegin
		else if (state == stateVarEnd && pos == posVarBegin)
			state = stateVarBegin;
		
		// qDebug("State after switch = %d", state);
		
		// Do the work
//.........这里部分代码省略.........
开发者ID:EPeillard,项目名称:qgo,代码行数:101,代码来源:sgfparser.cpp


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