![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
#include "qurl.h"
#include "private/qstringconverter_p.h"
#include "private/qtools_p.h"
#include "private/qsimd_p.h"
Go to the source code of this file.
Enumerations | |
enum | EncodingAction { DecodeCharacter = 0 , LeaveCharacter = 1 , EncodeCharacter = 2 , DecodeCharacter = 0 , LeaveCharacter = 1 , EncodeCharacter = 2 } |
enum | EncodingAction { DecodeCharacter = 0 , LeaveCharacter = 1 , EncodeCharacter = 2 , DecodeCharacter = 0 , LeaveCharacter = 1 , EncodeCharacter = 2 } |
Functions | |
static bool | isHex (char16_t c) |
static bool | isUpperHex (char16_t c) |
static char16_t | toUpperHex (char16_t c) |
static ushort | decodeNibble (char16_t c) |
static char16_t | decodePercentEncoding (const char16_t *input) |
static char16_t | encodeNibble (ushort c) |
static void | ensureDetached (QString &result, char16_t *&output, const char16_t *begin, const char16_t *input, const char16_t *end, int add=0) |
static bool | encodedUtf8ToUtf16 (QString &result, char16_t *&output, const char16_t *begin, const char16_t *&input, const char16_t *end, char16_t decoded) |
static void | unicodeToEncodedUtf8 (QString &result, char16_t *&output, const char16_t *begin, const char16_t *&input, const char16_t *end, char16_t decoded) |
static int | recode (QString &result, const char16_t *begin, const char16_t *end, QUrl::ComponentFormattingOptions encoding, const uchar *actionTable, bool retryBadEncoding) |
static bool | simdCheckNonEncoded (...) |
static qsizetype | decode (QString &appendTo, QStringView in) |
template<size_t N> | |
static void | maskTable (uchar(&table)[N], const uchar(&mask)[N]) |
Q_AUTOTEST_EXPORT qsizetype | qt_urlRecode (QString &appendTo, QStringView in, QUrl::ComponentFormattingOptions encoding, const ushort *tableModifications) |
qsizetype | qt_encodeFromUser (QString &appendTo, const QString &in, const ushort *tableModifications) |
Variables | |
static const uchar | defaultActionTable [96] |
static const uchar | reservedMask [96] |
enum EncodingAction |
Enumerator | |
---|---|
DecodeCharacter | |
LeaveCharacter | |
EncodeCharacter | |
DecodeCharacter | |
LeaveCharacter | |
EncodeCharacter |
Definition at line 13 of file qurlrecode.cpp.
enum EncodingAction |
Enumerator | |
---|---|
DecodeCharacter | |
LeaveCharacter | |
EncodeCharacter | |
DecodeCharacter | |
LeaveCharacter | |
EncodeCharacter |
Definition at line 13 of file qurlrecode.cpp.
|
static |
This function decodes a percent-encoded string located in in by appending each character to appendTo. It returns the number of characters appended. Each percent-encoded sequence is decoded as follows:
\list
Given the above, it's important for the input to already have all UTF-8 percent sequences decoded by qt_urlRecode (that is, the input should not have been processed with QUrl::EncodeUnicode).
The input should also be a valid percent-encoded sequence (the output of qt_urlRecode is always valid).
Definition at line 546 of file qurlrecode.cpp.
References isHex().
|
inlinestatic |
Definition at line 151 of file qurlrecode.cpp.
|
inlinestatic |
Definition at line 159 of file qurlrecode.cpp.
References isHex().
Referenced by recode().
|
static |
Definition at line 256 of file qurlrecode.cpp.
|
inlinestatic |
Definition at line 168 of file qurlrecode.cpp.
|
static |
Definition at line 173 of file qurlrecode.cpp.
|
inlinestatic |
Definition at line 135 of file qurlrecode.cpp.
Referenced by decode(), and decodePercentEncoding().
|
inlinestatic |
Definition at line 140 of file qurlrecode.cpp.
Referenced by recode(), and toUpperHex().
Definition at line 600 of file qurlrecode.cpp.
qsizetype qt_encodeFromUser | ( | QString & | appendTo, |
const QString & | in, | ||
const ushort * | tableModifications ) |
Definition at line 664 of file qurlrecode.cpp.
References defaultActionTable, and EncodeCharacter.
Q_AUTOTEST_EXPORT qsizetype qt_urlRecode | ( | QString & | appendTo, |
QStringView | in, | ||
QUrl::ComponentFormattingOptions | encoding, | ||
const ushort * | tableModifications ) |
Recodes the string from begin to end. If any transformations are done, append them to appendTo and return the number of characters added. If no transformations were required, return 0.
The encoding option modifies the default behaviour: \list
Other flags are ignored (including QUrl::EncodeReserved).
The tableModifications argument can be used to supply extra modifications to the tables, to be applied after the flags above are handled. It consists of a sequence of 16-bit values, where the low 8 bits indicate the character in question and the high 8 bits are either EncodeCharacter
, LeaveCharacter
or DecodeCharacter
.
This function corrects percent-encoded errors by interpreting every '' as meaning "%25" (all percents in the same content).
Definition at line 641 of file qurlrecode.cpp.
|
static |
Definition at line 339 of file qurlrecode.cpp.
References DecodeCharacter, decodePercentEncoding(), EncodeCharacter, isUpperHex(), LeaveCharacter, and toUpperHex().
|
static |
Definition at line 519 of file qurlrecode.cpp.
|
inlinestatic |
Definition at line 146 of file qurlrecode.cpp.
References isUpperHex().
Referenced by recode().
|
static |
Definition at line 285 of file qurlrecode.cpp.
|
static |
Definition at line 25 of file qurlrecode.cpp.
Referenced by qt_encodeFromUser().
|
static |
Definition at line 82 of file qurlrecode.cpp.