📄 qurl.cpp
字号:
return true;}// pchar = unreserved / pct-encoded / sub-delims / ":" / "@"static bool QT_FASTCALL _pchar(char **ptr, char pc[]){ 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)) return true; return false;}// segment = *pcharstatic bool QT_FASTCALL _segment(char **ptr, QByteArray *segment){ for (;;) { char pctTmp[4]; if (!_pchar(ptr, pctTmp)) break; *segment += pctTmp; } return true;}// segment = *pcharstatic bool QT_FASTCALL _segmentNZ(char **ptr, QByteArray *segment){ char pctTmp[4]; if (!_pchar(ptr, pctTmp)) return false; *segment += pctTmp; for (;;) { if (!_pchar(ptr, pctTmp)) break; *segment += pctTmp; } return true;}// path-abempty = *( "/" segment )static bool QT_FASTCALL _pathAbEmpty(char **ptr, QByteArray *path){ for (;;) { char *ptrBackup = *ptr; if (*((*ptr)++) != '/') { *ptr = ptrBackup; break; } *path += '/'; char pctTmp[4]; if (_pchar(ptr, pctTmp)) { *path += pctTmp; while (_pchar(ptr, pctTmp)) *path += pctTmp; } } return true;}// path-abs = "/" [ segment-nz *( "/" segment ) ]static bool QT_FASTCALL _pathAbs(char **ptr, QByteArray *path){ char *ptrBackup = *ptr; char ch = *((*ptr)++); if (ch != '/') { *ptr = ptrBackup; return false; } *path += '/'; // we might be able to unnest this to gain some performance. QByteArray tmp; if (!_segmentNZ(ptr, &tmp)) 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)) { *ptr = ptrBackup2; break; } *path += '/'; *path += segment; } return true;}// path-rootless = segment-nz *( "/" segment )static bool QT_FASTCALL _pathRootless(char **ptr, QByteArray *path){ // we might be able to unnest this to gain some performance. QByteArray segment; if (!_segmentNZ(ptr, &segment)) 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)) { *ptr = ptrBackup2; break; } *path += '/'; *path += segment; } return true;}// path-empty = 0<pchar>static bool QT_FASTCALL _pathEmpty(char **, QByteArray *path){ 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){ char *ptrBackup = *ptr; if (*((*ptr)++) == '/' && *((*ptr)++) == '/') { if (!_authority(ptr, userInfo, host, port)) { *ptr = ptrBackup; return false; } if (!_pathAbEmpty(ptr, path)) { *ptr = ptrBackup; return false; } return true; } else { *ptr = ptrBackup; return (_pathAbs(ptr, path) || _pathRootless(ptr, path) || _pathEmpty(ptr, path)); }}// query = *( pchar / "/" / "?" )static bool QT_FASTCALL _query(char **ptr, QByteArray *query){ for (;;) { char tmp[4]; if (_pchar(ptr, tmp)) { *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){ for (;;) { char tmp[4]; if (_pchar(ptr, tmp)) { *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: return true; default: return false; }}struct NameprepCaseFoldingEntry { int mapping[5];};static inline bool operator<(int one, const NameprepCaseFoldingEntry &other){ return one < other.mapping[0]; }static inline bool operator<(const NameprepCaseFoldingEntry &one, int other){ return one.mapping[0] < other; }static const NameprepCaseFoldingEntry NameprepCaseFolding[] = { { 0x0041, 0x0061, 0x0000, 0x0000, 0x0000}, { 0x0042, 0x0062, 0x0000, 0x0000, 0x0000}, { 0x0043, 0x0063, 0x0000, 0x0000, 0x0000}, { 0x0044, 0x0064, 0x0000, 0x0000, 0x0000}, { 0x0045, 0x0065, 0x0000, 0x0000, 0x0000}, { 0x0046, 0x0066, 0x0000, 0x0000, 0x0000}, { 0x0047, 0x0067, 0x0000, 0x0000, 0x0000}, { 0x0048, 0x0068, 0x0000, 0x0000, 0x0000}, { 0x0049, 0x0069, 0x0000, 0x0000, 0x0000}, { 0x004A, 0x006A, 0x0000, 0x0000, 0x0000}, { 0x004B, 0x006B, 0x0000, 0x0000, 0x0000}, { 0x004C, 0x006C, 0x0000, 0x0000, 0x0000}, { 0x004D, 0x006D, 0x0000, 0x0000, 0x0000}, { 0x004E, 0x006E, 0x0000, 0x0000, 0x0000}, { 0x004F, 0x006F, 0x0000, 0x0000, 0x0000}, { 0x0050, 0x0070, 0x0000, 0x0000, 0x0000}, { 0x0051, 0x0071, 0x0000, 0x0000, 0x0000}, { 0x0052, 0x0072, 0x0000, 0x0000, 0x0000}, { 0x0053, 0x0073, 0x0000, 0x0000, 0x0000}, { 0x0054, 0x0074, 0x0000, 0x0000, 0x0000}, { 0x0055, 0x0075, 0x0000, 0x0000, 0x0000}, { 0x0056, 0x0076, 0x0000, 0x0000, 0x0000}, { 0x0057, 0x0077, 0x0000, 0x0000, 0x0000}, { 0x0058, 0x0078, 0x0000, 0x0000, 0x0000}, { 0x0059, 0x0079, 0x0000, 0x0000, 0x0000}, { 0x005A, 0x007A, 0x0000, 0x0000, 0x0000}, { 0x00B5, 0x03BC, 0x0000, 0x0000, 0x0000}, { 0x00C0, 0x00E0, 0x0000, 0x0000, 0x0000}, { 0x00C1, 0x00E1, 0x0000, 0x0000, 0x0000}, { 0x00C2, 0x00E2, 0x0000, 0x0000, 0x0000}, { 0x00C3, 0x00E3, 0x0000, 0x0000, 0x0000}, { 0x00C4, 0x00E4, 0x0000, 0x0000, 0x0000}, { 0x00C5, 0x00E5, 0x0000, 0x0000, 0x0000}, { 0x00C6, 0x00E6, 0x0000, 0x0000, 0x0000}, { 0x00C7, 0x00E7, 0x0000, 0x0000, 0x0000}, { 0x00C8, 0x00E8, 0x0000, 0x0000, 0x0000}, { 0x00C9, 0x00E9, 0x0000, 0x0000, 0x0000}, { 0x00CA, 0x00EA, 0x0000, 0x0000, 0x0000}, { 0x00CB, 0x00EB, 0x0000, 0x0000, 0x0000}, { 0x00CC, 0x00EC, 0x0000, 0x0000, 0x0000}, { 0x00CD, 0x00ED, 0x0000, 0x0000, 0x0000}, { 0x00CE, 0x00EE, 0x0000, 0x0000, 0x0000}, { 0x00CF, 0x00EF, 0x0000, 0x0000, 0x0000}, { 0x00D0, 0x00F0, 0x0000, 0x0000, 0x0000}, { 0x00D1, 0x00F1, 0x0000, 0x0000, 0x0000}, { 0x00D2, 0x00F2, 0x0000, 0x0000, 0x0000}, { 0x00D3, 0x00F3, 0x0000, 0x0000, 0x0000}, { 0x00D4, 0x00F4, 0x0000, 0x0000, 0x0000}, { 0x00D5, 0x00F5, 0x0000, 0x0000, 0x0000}, { 0x00D6, 0x00F6, 0x0000, 0x0000, 0x0000}, { 0x00D8, 0x00F8, 0x0000, 0x0000, 0x0000}, { 0x00D9, 0x00F9, 0x0000, 0x0000, 0x0000}, { 0x00DA, 0x00FA, 0x0000, 0x0000, 0x0000}, { 0x00DB, 0x00FB, 0x0000, 0x0000, 0x0000}, { 0x00DC, 0x00FC, 0x0000, 0x0000, 0x0000}, { 0x00DD, 0x00FD, 0x0000, 0x0000, 0x0000}, { 0x00DE, 0x00FE, 0x0000, 0x0000, 0x0000}, { 0x00DF, 0x0073, 0x0073, 0x0000, 0x0000}, { 0x0100, 0x0101, 0x0000, 0x0000, 0x0000}, { 0x0102, 0x0103, 0x0000, 0x0000, 0x0000}, { 0x0104, 0x0105, 0x0000, 0x0000, 0x0000}, { 0x0106, 0x0107, 0x0000, 0x0000, 0x0000}, { 0x0108, 0x0109, 0x0000, 0x0000, 0x0000}, { 0x010A, 0x010B, 0x0000, 0x0000, 0x0000}, { 0x010C, 0x010D, 0x0000, 0x0000, 0x0000}, { 0x010E, 0x010F, 0x0000, 0x0000, 0x0000}, { 0x0110, 0x0111, 0x0000, 0x0000, 0x0000}, { 0x0112, 0x0113, 0x0000, 0x0000, 0x0000}, { 0x0114, 0x0115, 0x0000, 0x0000, 0x0000}, { 0x0116, 0x0117, 0x0000, 0x0000, 0x0000}, { 0x0118, 0x0119, 0x0000, 0x0000, 0x0000}, { 0x011A, 0x011B, 0x0000, 0x0000, 0x0000}, { 0x011C, 0x011D, 0x0000, 0x0000, 0x0000}, { 0x011E, 0x011F, 0x0000, 0x0000, 0x0000}, { 0x0120, 0x0121, 0x0000, 0x0000, 0x0000}, { 0x0122, 0x0123, 0x0000, 0x0000, 0x0000}, { 0x0124, 0x0125, 0x0000, 0x0000, 0x0000}, { 0x0126, 0x0127, 0x0000, 0x0000, 0x0000}, { 0x0128, 0x0129, 0x0000, 0x0000, 0x0000}, { 0x012A, 0x012B, 0x0000, 0x0000, 0x0000}, { 0x012C, 0x012D, 0x0000, 0x0000, 0x0000}, { 0x012E, 0x012F, 0x0000, 0x0000, 0x0000}, { 0x0130, 0x0069, 0x0307, 0x0000, 0x0000}, { 0x0132, 0x0133, 0x0000, 0x0000, 0x0000}, { 0x0134, 0x0135, 0x0000, 0x0000, 0x0000}, { 0x0136, 0x0137, 0x0000, 0x0000, 0x0000}, { 0x0139, 0x013A, 0x0000, 0x0000, 0x0000}, { 0x013B, 0x013C, 0x0000, 0x0000, 0x0000}, { 0x013D, 0x013E, 0x0000, 0x0000, 0x0000}, { 0x013F, 0x0140, 0x0000, 0x0000, 0x0000}, { 0x0141, 0x0142, 0x0000, 0x0000, 0x0000}, { 0x0143, 0x0144, 0x0000, 0x0000, 0x0000}, { 0x0145, 0x0146, 0x0000, 0x0000, 0x0000}, { 0x0147, 0x0148, 0x0000, 0x0000, 0x0000}, { 0x0149, 0x02BC, 0x006E, 0x0000, 0x0000}, { 0x014A, 0x014B, 0x0000, 0x0000, 0x0000}, { 0x014C, 0x014D, 0x0000, 0x0000, 0x0000}, { 0x014E, 0x014F, 0x0000, 0x0000, 0x0000}, { 0x0150, 0x0151, 0x0000, 0x0000, 0x0000}, { 0x0152, 0x0153, 0x0000, 0x0000, 0x0000}, { 0x0154, 0x0155, 0x0000, 0x0000, 0x0000}, { 0x0156, 0x0157, 0x0000, 0x0000, 0x0000}, { 0x0158, 0x0159, 0x0000, 0x0000, 0x0000}, { 0x015A, 0x015B, 0x0000, 0x0000, 0x0000}, { 0x015C, 0x015D, 0x0000, 0x0000, 0x0000}, { 0x015E, 0x015F, 0x0000, 0x0000, 0x0000}, { 0x0160, 0x0161, 0x0000, 0x0000, 0x0000}, { 0x0162, 0x0163, 0x0000, 0x0000, 0x0000}, { 0x0164, 0x0165, 0x0000, 0x0000, 0x0000}, { 0x0166, 0x0167, 0x0000, 0x0000, 0x0000}, { 0x0168, 0x0169, 0x0000, 0x0000, 0x0000}, { 0x016A, 0x016B, 0x0000, 0x0000, 0x0000}, { 0x016C, 0x016D, 0x0000, 0x0000, 0x0000}, { 0x016E, 0x016F, 0x0000, 0x0000, 0x0000}, { 0x0170, 0x0171, 0x0000, 0x0000, 0x0000}, { 0x0172, 0x0173, 0x0000, 0x0000, 0x0000}, { 0x0174, 0x0175, 0x0000, 0x0000, 0x0000}, { 0x0176, 0x0177, 0x0000, 0x0000, 0x0000}, { 0x0178, 0x00FF, 0x0000, 0x0000, 0x0000}, { 0x0179, 0x017A, 0x0000, 0x0000, 0x0000}, { 0x017B, 0x017C, 0x0000, 0x0000, 0x0000}, { 0x017D, 0x017E, 0x0000, 0x0000, 0x0000}, { 0x017F, 0x0073, 0x0000, 0x0000, 0x0000}, { 0x0181, 0x0253, 0x0000, 0x0000, 0x0000}, { 0x0182, 0x0183, 0x0000, 0x0000, 0x0000},
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -