⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qxmlstream_p.h

📁 奇趣公司比较新的qt/emd版本
💻 H
📖 第 1 页 / 共 5 页
字号:
                text = QStringRef(&textBuffer, pos, textBuffer.size() - pos - 3);            } else {                resume(100);                return false;            }        } break;        case 101: {            if (!scanPublicOrSystem() && atEnd) {                resume(101);                return false;            }            NotationDeclaration &notationDeclaration = notationDeclarations.push();            notationDeclaration.name = symString(3);        } break;        case 102: {            NotationDeclaration &notationDeclaration = notationDeclarations.top();            notationDeclaration.systemId = symString(3);            notationDeclaration.publicId.clear();        } break;        case 103: {            NotationDeclaration &notationDeclaration = notationDeclarations.top();            notationDeclaration.systemId.clear();            checkPublicLiteral((notationDeclaration.publicId = symString(3)));        } break;        case 104: {            NotationDeclaration &notationDeclaration = notationDeclarations.top();            checkPublicLiteral((notationDeclaration.publicId = symString(3)));            notationDeclaration.systemId = symString(5);        } break;        case 126:            isWhitespace = true;            // fall through        case 127:        case 128:        case 129:            setType(QXmlStreamReader::Characters);            sym(1).len += fastScanContentCharList();            if (atEnd && !inParseEntity) {                resume(129);                return false;            }            text = &textBuffer;        break;        case 130:        case 131:            clearSym();        break;        case 132:        case 133:            sym(1) = sym(2);        break;        case 134:        case 135:        case 136:        case 137:            sym(1).len += sym(2).len;        break;        case 163:	    if (normalizeLiterals)                textBuffer.data()[textBuffer.size()-1] = QLatin1Char(' ');        break;        case 164:            sym(1).len += fastScanLiteralContent();            if (atEnd) {                resume(164);                return false;            }        break;        case 165: {            if (!QXmlUtils::isPublicID(symString(1).toString())) {                raiseWellFormedError(QXmlStream::tr("%1 is an invalid PUBLIC identifier.").arg(symString(1).toString()));                resume(165);                return false;            }        } break;        case 166:        case 167:            clearSym();        break;        case 168:        case 169:	    sym(1) = sym(2);        break;        case 170:        case 171:        case 172:        case 173:            sym(1).len += sym(2).len;        break;        case 203:        case 204:            clearSym();        break;        case 205:        case 206:            sym(1) = sym(2);            lastAttributeValue = symString(1);        break;        case 207:        case 208:        case 209:        case 210:            sym(1).len += sym(2).len;        break;        case 219: {            QStringRef prefix = symPrefix(1);            if (prefix.isEmpty() && symString(1) == QLatin1String("xmlns") && namespaceProcessing) {                NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push();                namespaceDeclaration.prefix.clear();                const QStringRef ns(symString(5));                if(ns == QLatin1String("http://www.w3.org/2000/xmlns/") ||                   ns == QLatin1String("http://www.w3.org/XML/1998/namespace"))                    raiseWellFormedError(QXmlStream::tr("Illegal namespace declaration."));                else                    namespaceDeclaration.namespaceUri = addToStringStorage(ns);            } else {                Attribute &attribute = attributeStack.push();                attribute.key = sym(1);                attribute.value = sym(5);                QStringRef attributeQualifiedName = symName(1);                bool normalize = false;                for (int a = 0; a < dtdAttributes.size(); ++a) {                    DtdAttribute &dtdAttribute = dtdAttributes[a];                    if (!dtdAttribute.isCDATA                        && dtdAttribute.tagName == qualifiedName                        && dtdAttribute.attributeQualifiedName == attributeQualifiedName                        ) {                        normalize = true;                        break;                    }                }                if (normalize) {                    // normalize attribute value (simplify and trim)                    int pos = textBuffer.size();                    int n = 0;                    bool wasSpace = true;                    for (int i = 0; i < attribute.value.len; ++i) {                        QChar c = textBuffer.at(attribute.value.pos + i);                        if (c.unicode() == ' ') {                            if (wasSpace)                                continue;                            wasSpace = true;                        } else {                            wasSpace = false;                        }                        textBuffer.inline_append(textBuffer.at(attribute.value.pos + i));                        ++n;                    }                    if (wasSpace)                        while (n && textBuffer.at(pos + n - 1).unicode() == ' ')                            --n;                    attribute.value.pos = pos;                    attribute.value.len = n;                }                if (prefix == QLatin1String("xmlns") && namespaceProcessing) {                    NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push();                    QStringRef namespacePrefix = symString(attribute.key);                    QStringRef namespaceUri = symString(attribute.value);                    attributeStack.pop();                    if ((namespacePrefix == QLatin1String("xml")                         ^ namespaceUri == QLatin1String("http://www.w3.org/XML/1998/namespace"))                        || namespaceUri == QLatin1String("http://www.w3.org/2000/xmlns/")                        || namespaceUri.isEmpty()                        || namespacePrefix == QLatin1String("xmlns"))                        raiseWellFormedError(QXmlStream::tr("Illegal namespace declaration."));                    namespaceDeclaration.prefix = addToStringStorage(namespacePrefix);                    namespaceDeclaration.namespaceUri = addToStringStorage(namespaceUri);                }            }        } break;        case 225: {            normalizeLiterals = true;            Tag &tag = tagStack_push();            prefix = tag.namespaceDeclaration.prefix  = addToStringStorage(symPrefix(2));            name = tag.name = addToStringStorage(symString(2));            qualifiedName = tag.qualifiedName = addToStringStorage(symName(2));            if (!validateName(qualifiedName))                raiseWellFormedError(QXmlStream::tr("Invalid XML name."));        } break;        case 226:            isEmptyElement = true;        // fall through        case 227:            setType(QXmlStreamReader::StartElement);            resolveTag();            if (tagStack.size() == 1 && hasSeenTag && !inParseEntity)                raiseWellFormedError(QXmlStream::tr("Extra content at end of document."));            hasSeenTag = true;        break;        case 228: {            setType(QXmlStreamReader::EndElement);            Tag &tag = tagStack_pop();            namespaceUri = tag.namespaceDeclaration.namespaceUri;            name = tag.name;            qualifiedName = tag.qualifiedName;            if (qualifiedName != symName(3))                raiseWellFormedError(QXmlStream::tr("Opening and ending tag mismatch."));        } break;        case 229: {            sym(1).len += sym(2).len + 1;            QString reference = symString(2).toString();            if (entityHash.contains(reference)) {                Entity &entity = entityHash[reference];                if (entity.unparsed) {                    raiseWellFormedError(QXmlStream::tr("Reference to unparsed entity '%1'.").arg(reference));                } else {                    if (!entity.hasBeenParsed) {                        parseEntity(entity.value);                        entity.hasBeenParsed = true;                    }                    if (entity.literal)                        putStringLiteral(entity.value);                    else if (referenceEntity(entity))                        putReplacement(entity.value);                    textBuffer.chop(2 + sym(2).len);                    clearSym();                }                break;            } else if (entitiesMustBeDeclared()) {                raiseWellFormedError(QXmlStream::tr("Entity '%1' not declared.").arg(reference));                break;            }            setType(QXmlStreamReader::EntityReference);            name = symString(2);        } break;        case 230: {            sym(1).len += sym(2).len + 1;            QString reference = symString(2).toString();            if (parameterEntityHash.contains(reference)) {                referenceToParameterEntityDetected = true;                Entity &entity = parameterEntityHash[reference];                if (entity.unparsed || entity.external) {                    referenceToUnparsedEntityDetected = true;                } else {                    if (referenceEntity(entity))                        putString(entity.value);                    textBuffer.chop(2 + sym(2).len);                    clearSym();                }            } else if (entitiesMustBeDeclared()) {                raiseWellFormedError(QXmlStream::tr("Entity '%1' not declared.").arg(symString(2).toString()));            }        } break;        case 231:            sym(1).len += sym(2).len + 1;        break;        case 232: {            sym(1).len += sym(2).len + 1;            QString reference = symString(2).toString();            if (entityHash.contains(reference)) {                Entity &entity = entityHash[reference];                if (entity.unparsed || entity.value.isNull()) {                    raiseWellFormedError(QXmlStream::tr("Reference to external entity '%1' in attribute value.").arg(reference));                    break;                }                if (!entity.hasBeenParsed) {                    parseEntity(entity.value);                    entity.hasBeenParsed = true;                }                if (entity.literal)                    putStringLiteral(entity.value);                else if (referenceEntity(entity))                    putReplacementInAttributeValue(entity.value);                textBuffer.chop(2 + sym(2).len);                clearSym();            } else if (entitiesMustBeDeclared()) {                raiseWellFormedError(QXmlStream::tr("Entity '%1' not declared.").arg(reference));            }        } break;        case 233: {            if (uint s = resolveCharRef(3)) {                if (s >= 0xffff)                    putStringLiteral(QString::fromUcs4(&s, 1));                else                    putChar((LETTER << 16) | s);                textBuffer.chop(3 + sym(3).len);                clearSym();            } else {                raiseWellFormedError(QXmlStream::tr("Invalid character reference."));            }        } break;        case 236:        case 237:            sym(1).len += sym(2).len;        break;        case 250:            sym(1).len += fastScanSpace();            if (atEnd) {                resume(250);                return false;            }        break;        case 253: {            sym(1).len += fastScanName(&sym(1).prefix);            if (atEnd) {                resume(253);                return false;            }        } break;        case 254:            sym(1).len += fastScanName();            if (atEnd) {                resume(254);                return false;            }        break;        case 255:        case 256:        case 257:        case 258:        case 259:            sym(1).len += fastScanNMTOKEN();            if (atEnd) {                resume(259);                return false;            }        break;    default:        ;    } // switch            act = state_stack[tos] = nt_action (act, lhs[r] - TERMINAL_COUNT);            if (type != QXmlStreamReader::NoToken)                return true;        } else {            parseError();            break;        }    }    return false;}#endif // QXMLSTREAM_P_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -