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

📄 qurl.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    if (!_IPv6Address(ptr, host, errorInfo) && !_IPvFuture(ptr, host, errorInfo)) {        *ptr = ptrBackup;        return false;    }    if (!_char(ptr, ']', errorInfo)) {        *ptr = ptrBackup;        return false;    }    *host += ']';    return true;}// reg-name    = *( unreserved / pct-encoded / sub-delims )static bool QT_FASTCALL _regName(char **ptr, QByteArray *host, ErrorInfo *errorInfo){    char pctTmp[4];    for (;;) {        char ch;        if (!_unreserved(ptr, &ch, errorInfo) && !_subDelims(ptr, &ch, errorInfo)) {            if (!_pctEncoded(ptr, pctTmp, errorInfo))                break;            *host += pctTmp;        } else {            *host += ch;        }    }    return true;}// host        = IP-literal / IPv4address / reg-namestatic bool QT_FASTCALL _host(char **ptr, QByteArray *host, ErrorInfo *errorInfo){    return (_IPLiteral(ptr, host, errorInfo) || _IPv4Address(ptr, host, errorInfo) || _regName(ptr, host, errorInfo));}// userinfo    = *( unreserved / pct-encoded / sub-delims / ":" )static bool QT_FASTCALL _userInfo(char **ptr, QByteArray *userInfo, ErrorInfo *errorInfo){    for (;;) {        char ch;        if (_unreserved(ptr, &ch, errorInfo) || _subDelims(ptr, &ch, errorInfo)) {            *userInfo += ch;        } else {            char pctTmp[4];            if (_pctEncoded(ptr, pctTmp, errorInfo)) {                *userInfo += pctTmp;            } else if (_char(ptr, ':', errorInfo)) {                *userInfo += ':';            } else {                break;            }        }    }    return true;}// port        = *DIGITstatic bool QT_FASTCALL _port(char **ptr, int *port){    bool first = true;    for (;;) {        char *ptrBackup = *ptr;        char ch = *((*ptr)++);        if (ch < '0' || ch > '9') {            *ptr = ptrBackup;            break;        }        if (first) {            first = false;            *port = 0;        }        *port *= 10;        *port += ch - '0';    }    return true;}// authority   = [ userinfo "@" ] host [ ":" port ]static bool QT_FASTCALL _authority(char **ptr, QByteArray *userInfo, QByteArray *host, int *port, ErrorInfo *errorInfo){    char *ptrBackup = *ptr;    if (_userInfo(ptr, userInfo, errorInfo)) {        if (*((*ptr)++) != '@') {            *ptr = ptrBackup;            userInfo->clear();            // fall through        }    }    if (!_host(ptr, host, errorInfo)) {        *ptr = ptrBackup;        return false;    }    char *ptrBackup2 = *ptr;    if (*((*ptr)++) != ':') {        *ptr = ptrBackup2;        return true;    }    if (!_port(ptr, port)) {        *ptr = ptrBackup2;        return false;    }    return true;}// pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"static bool QT_FASTCALL _pchar(char **ptr, char pc[], ErrorInfo *errorInfo){    char c = *(*ptr);    switch (c) {    case '!': case '$': case '&': case '\'': case '(': case ')': case '*':    case '+': case ',': case ';': case '=': case ':': case '@':    case '-': case '.': case '_': case '~':        pc[0] = c;        pc[1] = '\0';        ++(*ptr);        return true;    default:        break;    };    if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) {        pc[0] = c;        pc[1] = '\0';        ++(*ptr);        return true;    }    if (_pctEncoded(ptr, pc, errorInfo))        return true;    errorInfo->setParams(*ptr, QLatin1String(QT_TRANSLATE_NOOP(QUrl, "expected pchar (unreserved / pct-encoded"                         "/ sub-delims / \":\" / \"@\"")), QLatin1Char('\0'), QLatin1Char(c));    return false;}// segment       = *pcharstatic bool QT_FASTCALL _segment(char **ptr, QByteArray *segment, ErrorInfo *errorInfo){    for (;;) {        char pctTmp[4];        if (!_pchar(ptr, pctTmp, errorInfo))            break;        *segment += pctTmp;    }    return true;}// segment       = *pcharstatic bool QT_FASTCALL _segmentNZ(char **ptr, QByteArray *segment, ErrorInfo *errorInfo){    char pctTmp[4];    if (!_pchar(ptr, pctTmp, errorInfo))        return false;    *segment += pctTmp;    for (;;) {        if (!_pchar(ptr, pctTmp, errorInfo))            break;        *segment += pctTmp;    }    return true;}// path-abempty  = *( "/" segment )static bool QT_FASTCALL _pathAbEmpty(char **ptr, QByteArray *path, ErrorInfo *errorInfo){    for (;;) {        char *ptrBackup = *ptr;        if (*((*ptr)++) != '/') {            *ptr = ptrBackup;            break;        }        *path += '/';        char pctTmp[4];        if (_pchar(ptr, pctTmp, errorInfo)) {            *path += pctTmp;            while (_pchar(ptr, pctTmp, errorInfo))                *path += pctTmp;        }    }    return true;}// path-abs      = "/" [ segment-nz *( "/" segment ) ]static bool QT_FASTCALL _pathAbs(char **ptr, QByteArray *path, ErrorInfo *errorInfo){    char *ptrBackup = *ptr;    char ch = *((*ptr)++);    if (ch != '/') {        *ptr = ptrBackup;        errorInfo->setParams(*ptr, QLatin1String(""), QLatin1Char('/'), QLatin1Char(ch));        return false;    }    *path += '/';    // we might be able to unnest this to gain some performance.    QByteArray tmp;    if (!_segmentNZ(ptr, &tmp, errorInfo))        return true;    *path += tmp;    for (;;) {        char *ptrBackup2 = *ptr;        if (*((*ptr)++) != '/') {            *ptr = ptrBackup2;            break;        }        // we might be able to unnest this to gain some        // performance.        QByteArray segment;        if (!_segment(ptr, &segment, errorInfo)) {            *ptr = ptrBackup2;            break;        }        *path += '/';        *path += segment;    }    return true;}// path-rootless = segment-nz *( "/" segment )static bool QT_FASTCALL _pathRootless(char **ptr, QByteArray *path, ErrorInfo *errorInfo){    // we might be able to unnest this to gain some performance.    QByteArray segment;    if (!_segmentNZ(ptr, &segment, errorInfo))        return false;    *path += segment;    for (;;) {        char *ptrBackup2 = *ptr;        if (*((*ptr)++) != '/') {            *ptr = ptrBackup2;            break;        }        // we might be able to unnest this to gain some performance.        QByteArray segment;        if (!_segment(ptr, &segment, errorInfo)) {            *ptr = ptrBackup2;            break;        }        *path += '/';        *path += segment;    }    return true;}// path-empty    = 0<pchar>static bool QT_FASTCALL _pathEmpty(char **, QByteArray *path, ErrorInfo *){    path->truncate(0);    return true;}// hier-part   = "//" authority path-abempty//             / path-abs//             / path-rootless//             / path-emptystatic bool QT_FASTCALL _hierPart(char **ptr, QByteArray *userInfo, QByteArray *host, int *port, QByteArray *path,                                  ErrorInfo *errorInfo){    char *ptrBackup = *ptr;    if (*((*ptr)++) == '/' && *((*ptr)++) == '/') {        if (!_authority(ptr, userInfo, host, port, errorInfo)) { *ptr = ptrBackup; return false; }        if (!_pathAbEmpty(ptr, path, errorInfo)) { *ptr = ptrBackup; return false; }        return true;    } else {        *ptr = ptrBackup;        return (_pathAbs(ptr, path, errorInfo) || _pathRootless(ptr, path, errorInfo)                || _pathEmpty(ptr, path, errorInfo));    }}// query       = *( pchar / "/" / "?" )static bool QT_FASTCALL _query(char **ptr, QByteArray *query, ErrorInfo *errorInfo){    for (;;) {        char tmp[4];        if (_pchar(ptr, tmp, errorInfo)) {            *query += tmp;        } else {            char *ptrBackup = *ptr;            char ch = *((*ptr)++);            if (ch == '/' || ch == '?')                *query += ch;            else {                *ptr = ptrBackup;                break;            }        }    }    return true;}// fragment    = *( pchar / "/" / "?" )static bool QT_FASTCALL _fragment(char **ptr, QByteArray *fragment, ErrorInfo *errorInfo){    for (;;) {        char tmp[4];        if (_pchar(ptr, tmp, errorInfo)) {            *fragment += tmp;        } else {            char *ptrBackup = *ptr;            char ch = *((*ptr)++);            // exception: allow several '#' characters within a            // fragment.            if (ch == '/' || ch == '?' || ch == '#')                *fragment += ch;            else {                *ptr = ptrBackup;                break;            }        }    }    return true;}static bool isMappedToNothing(const QChar &ch){    switch (ch.unicode()) {    case 0x00AD: case 0x034F: case 0x1806: case 0x180B: case 0x180C: case 0x180D:    case 0x200B: case 0x200C: case 0x200D: case 0x2060: case 0xFE00: case 0xFE01:    case 0xFE02: case 0xFE03: case 0xFE04: case 0xFE05: case 0xFE06: case 0xFE07:    case 0xFE08: case 0xFE09: case 0xFE0A: case 0xFE0B: case 0xFE0C: case 0xFE0D:    case 0xFE0E: case 0xFE0F: case 0xFEFF:

⌨️ 快捷键说明

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