33 defineDefaultProperty(
QLatin1String(
"toString"), method_getHref);
34 defineDefaultProperty(
QLatin1String(
"toJSON"), method_getHref);
36 defineAccessorProperty(
QLatin1String(
"hash"), method_getHash, method_setHash);
37 defineAccessorProperty(
QLatin1String(
"host"), method_getHost, method_setHost);
38 defineAccessorProperty(
QLatin1String(
"hostname"), method_getHostname, method_setHostname);
39 defineAccessorProperty(
QLatin1String(
"href"), method_getHref, method_setHref);
40 defineAccessorProperty(
QLatin1String(
"origin"), method_getOrigin,
nullptr);
41 defineAccessorProperty(
QLatin1String(
"password"), method_getPassword, method_setPassword);
42 defineAccessorProperty(
QLatin1String(
"pathname"), method_getPathname, method_setPathname);
43 defineAccessorProperty(
QLatin1String(
"port"), method_getPort, method_setPort);
44 defineAccessorProperty(
QLatin1String(
"protocol"), method_getProtocol, method_setProtocol);
45 defineAccessorProperty(
QLatin1String(
"search"), method_getSearch, method_setSearch);
46 defineAccessorProperty(
QLatin1String(
"searchParams"), method_getSearchParams,
nullptr);
47 defineAccessorProperty(
QLatin1String(
"username"), method_getUsername, method_setUsername);
196 if (firstColonPos != -1)
197 protocolOrScheme.
truncate(firstColonPos);
218 search = search.
mid(1);
262void UrlObject::updateOrigin()
286void UrlObject::updateHost()
321 const Value *argv,
int)
327 String *stringValue =
arg->stringValue();
329 if (stringValue ==
nullptr)
355 const Value *argv,
int)
361 String *stringValue =
arg->stringValue();
363 if (stringValue ==
nullptr)
371 if (!
r->setHost(host))
391 const Value *argv,
int)
397 String *stringValue =
arg->stringValue();
399 if (stringValue ==
nullptr)
407 if (!
r->setHostname(hostname))
427 const Value *argv,
int)
433 String *stringValue =
arg->stringValue();
435 if (stringValue ==
nullptr)
443 if (!
r->setHref(href))
476 const Value *argv,
int)
482 String *stringValue =
arg->stringValue();
484 if (stringValue ==
nullptr)
510 const Value *argv,
int)
516 String *stringValue =
arg->stringValue();
518 if (stringValue ==
nullptr)
544 const Value *argv,
int)
550 String *stringValue =
arg->stringValue();
554 if (stringValue !=
nullptr)
556 else if (
arg->isInt32())
565 if (!
r->setPort(
port))
585 const Value *argv,
int)
591 String *stringValue =
arg->stringValue();
593 if (stringValue ==
nullptr)
619 const Value *argv,
int)
625 String *stringValue =
arg->stringValue();
627 if (stringValue ==
nullptr)
653 const Value *argv,
int)
659 String *stringValue =
arg->stringValue();
661 if (stringValue ==
nullptr)
686 usp->initializeParams(
r->search());
692 int argc,
const Value *newTarget)
696 if (argc < 1 || argc > 2)
710 if (arg2StringValue ==
nullptr)
714 QUrl relativeUrl =
QUrl(arg1String);
733 urlString = arg1String;
742 obj->setProtoFromNewTarget(newTarget);
746 if (!urlObject->
setHref(urlString))
749 return obj->asReturnedValue();
755 Heap::FunctionObject::init(scope,
QLatin1String(
"URLSearchParams"));
765 defineDefaultProperty(
QLatin1String(
"toString"), method_toString);
767 defineDefaultProperty(
QLatin1String(
"append"), method_append);
768 defineDefaultProperty(
QLatin1String(
"delete"), method_delete);
772 defineDefaultProperty(
QLatin1String(
"getAll"), method_getAll);
773 defineDefaultProperty(
QLatin1String(
"forEach"), method_forEach);
774 defineDefaultProperty(
QLatin1String(
"entries"), method_entries);
776 defineDefaultProperty(
QLatin1String(
"values"), method_values);
780 int argc,
const Value *newTarget)
799 obj->setProtoFromNewTarget(newTarget);
803 if (argArrayObject !=
nullptr) {
806 uint len = argArray->getLength();
812 if (pairArrayObject ==
nullptr) {
821 uint pairLen = pairArray->getLength();
832 }
else if (argObject !=
nullptr) {
840 return obj->asReturnedValue();
845 auto *arrayObject =
engine()->newArrayObject(0);
849 d()->params.set(
engine(), arrayObject);
872 if (equalsIndex != -1) {
904 scopedKeys->put(
i,
key);
905 scopedValues->put(
i,
value);
940 auto *arrayObject =
engine()->newArrayObject(0);
955 auto *valuePair =
engine()->newArrayObject(2);
961 valuePairObject->put(
uint(0),
key);
964 scopedKeys->put(
len,
key);
967 scopedArray->put(
len, valuePairObject);
971 d()->params.set(
engine(), arrayObject);
989 auto *valuePair =
engine()->newArrayObject(2);
995 valuePairObject->put(
uint(0), keyScoped);
996 valuePairObject->put(
uint(1), valueScoped);
998 uint len = scopedArray->getLength();
1000 scopedKeys->put(
len, keyScoped);
1001 scopedValues->put(
len, valueScoped);
1003 scopedArray->put(
len, valuePairObject);
1008 auto *arrayObject =
d()->params.get();
1014 uint len = scopedArray->getLength();
1031 return d()->url.get();
1039 for (
int i = 0;
i <
len; ++
i) {
1050 auto *arrayObject =
d()->params.get();
1054 return scopedArray->getLength();
1059 auto *arrayObject =
d()->params.get();
1063 int len = scopedArray->getLength();
1065 for (
int i = last + 1;
i <
len;
i++) {
1078QString UrlSearchParamsObject::stringAt(
int index,
int pairIndex)
const
1080 auto *arrayObject =
d()->params.get();
1084 if (
index >= scopedArray->getLength())
1097 auto *arrayObject =
d()->params.get();
1101 if (
index >= scopedArray->getLength())
1114 return stringAt(
index, 0);
1119 return stringAtRaw(
index, 0);
1125 return stringAt(
index, 1);
1130 return stringAtRaw(
index, 1);
1149 if (arrayIndex <
len) {
1176 if (
id.isArrayIndex()) {
1177 const int index =
id.asArrayIndex();
1179 if (index < usp->
length()) {
1181 p->
value = usp->engine()->newString(usp->nameAt(
index));
1240 const Value *argv,
int argc)
1253 if (argNameString ==
nullptr)
1269 const Value *argv,
int argc)
1281 if (argNameString ==
nullptr)
1293 return pair[0] == name;
1304 const Value *argv,
int argc)
1316 if (argNameString ==
nullptr)
1329 const Value *argv,
int argc)
1342 if (argNameString ==
nullptr)
1354 bool matched =
false;
1376 if (scopedUrlObject)
1377 scopedUrlObject->setSearch(
o->searchString());
1383 const Value *argv,
int argc)
1395 if (argNameString ==
nullptr)
1426 if (argNameString ==
nullptr)
1444 return Encode(arrayObject);
1461 if (
func ==
nullptr)
1468 for (
int i = 0;
i <
o->length();
i++) {
1477 func->call(calldata);
QString arg(Args &&...args) const
iterator erase(const_iterator i)
\macro QT_RESTRICTED_CAST_FROM_ASCII
qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
void chop(qsizetype n)
Removes n characters from the end of the string.
QStringList split(const QString &sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Splits the string into substrings wherever sep occurs, and returns the list of those strings.
void truncate(qsizetype pos)
Truncates the string at the given position index.
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString & append(QChar c)
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString & prepend(QChar c)
QString fragment(ComponentFormattingOptions options=PrettyDecoded) const
Returns the fragment of the URL.
QString query(ComponentFormattingOptions=PrettyDecoded) const
Returns the query string of the URL if there's a query string, or an empty result if not.
void setPassword(const QString &password, ParsingMode mode=DecodedMode)
Sets the URL's password to password.
void setUserName(const QString &userName, ParsingMode mode=DecodedMode)
Sets the URL's user name to userName.
void setFragment(const QString &fragment, ParsingMode mode=TolerantMode)
Sets the fragment of the URL to fragment.
bool isRelative() const
Returns true if the URL is relative; otherwise returns false.
bool isValid() const
Returns true if the URL is non-empty and valid; otherwise returns false.
QString userName(ComponentFormattingOptions options=FullyDecoded) const
Returns the user name of the URL if it is defined; otherwise an empty string is returned.
QString host(ComponentFormattingOptions=FullyDecoded) const
Returns the host of the URL if it is defined; otherwise an empty string is returned.
void setQuery(const QString &query, ParsingMode mode=TolerantMode)
Sets the query string of the URL to query.
QString password(ComponentFormattingOptions=FullyDecoded) const
Returns the password of the URL if it is defined; otherwise an empty string is returned.
static QByteArray toPercentEncoding(const QString &, const QByteArray &exclude=QByteArray(), const QByteArray &include=QByteArray())
Returns an encoded copy of input.
QString scheme() const
Returns the scheme of the URL.
void setScheme(const QString &scheme)
Sets the scheme of the URL to scheme.
void setHost(const QString &host, ParsingMode mode=DecodedMode)
Sets the host of the URL to host.
int port(int defaultPort=-1) const
void setPath(const QString &path, ParsingMode mode=DecodedMode)
Sets the path of the URL to path.
QString toString(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
Returns a string representation of the URL.
void setPort(int port)
Sets the port of the URL to port.
QString path(ComponentFormattingOptions options=FullyDecoded) const
Returns the path of the URL.
QHash< int, QWidget * > hash
[35multi]
list append(new Employee("Blackpool", "Stephen"))
QSet< QString >::iterator it
\qmltype Particle \inqmlmodule QtQuick.Particles
static struct AttrInfo attrs[]
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum GLsizei GLsizei GLint * values
[15]
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLenum GLsizei length
GLenum const GLint * param
GLuint GLuint GLuint GLuint arg1
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
QLatin1StringView QLatin1String
#define QStringLiteral(str)
request setUrl(QUrl("http://qt-project.org"))
static bool checkSearchParamsType(ExecutionEngine *v4, const Scoped< UrlSearchParamsObject > &o)
static bool checkUrlObjectType(ExecutionEngine *v4, const Scoped< UrlObject > &r)
#define DEFINE_OBJECT_VTABLE(classname)
QUrl url("example.com")
[constructor-url-reference]
\inmodule QtCore \reentrant
static constexpr ReturnedValue undefined()
static constexpr ReturnedValue null()
Heap::String * newString(const QString &s=QString())
ReturnedValue throwError(const Value &value)
Heap::UrlSearchParamsObject * newUrlSearchParamsObject()
Heap::UrlObject * newUrlObject()
Heap::ArrayObject * newArrayObject(int count=0)
Heap::Object * newArrayIteratorObject(Object *o)
ReturnedValue throwTypeError()
Heap::ExecutionContext * scope() const
void init(QV4::ExecutionContext *scope)
void init(QV4::ExecutionContext *scope)
ExecutionEngine * engine() const
PropertyKey next(const Object *o, Property *pd=nullptr, PropertyAttributes *attrs=nullptr) override
static PropertyKey fromArrayIndex(uint idx)
QML_NEARLY_ALWAYS_INLINE ReturnedValue asReturnedValue() const
QV4_NEARLY_ALWAYS_INLINE constexpr quint32 value() const
QString toQString() const
bool setSearch(QString search)
Q_QML_AUTOTEST_EXPORT QString search() const
bool setPathname(QString pathname)
bool setHostname(QString hostname)
void setUrl(const QUrl &url)
bool setHash(QString hash)
bool setHref(QString href)
bool setProtocol(QString protocol)
bool setUsername(QString username)
bool setPort(QString port)
bool setPassword(QString password)
bool setHost(QString host)
static ReturnedValue method_getPathname(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_getPort(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_getSearchParams(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_setProtocol(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_getUsername(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_getProtocol(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_setHostname(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_setHref(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_setSearch(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_getHash(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_setHost(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_setPort(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_getPassword(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
void init(ExecutionEngine *engine, Object *ctor)
static ReturnedValue method_getOrigin(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_setUsername(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_getSearch(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_setPassword(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_getHost(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_getHostname(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_getHref(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_setPathname(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_setHash(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
void setParams(QList< QStringList > params)
QString valueAt(int index) const
QList< QStringList > params() const
Heap::UrlObject * urlObject() const
int indexOf(QString name, int last=-1) const
QString searchString() const
Heap::String * nameAtRaw(int index) const
void append(Heap::String *name, Heap::String *value)
Heap::String * valueAtRaw(int index) const
void setUrlObject(const UrlObject *url)
QString nameAt(int index) const
static ReturnedValue method_keys(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_forEach(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_get(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_sort(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_delete(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
void init(ExecutionEngine *engine, Object *ctor)
static ReturnedValue method_getAll(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_toString(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_append(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_has(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_set(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_entries(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_values(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static constexpr VTable::OwnPropertyKeys virtualOwnPropertyKeys
static constexpr VTable::GetOwnProperty virtualGetOwnProperty
static constexpr VTable::CallAsConstructor virtualCallAsConstructor
Heap::String * toString(ExecutionEngine *e) const
QML_NEARLY_ALWAYS_INLINE String * stringValue() const
static Value fromHeapObject(HeapBasePtr m)
QString toQString() const
PropertyKey next(const QV4::Object *o, Property *pd=nullptr, PropertyAttributes *attrs=nullptr) override
~UrlSearchParamsObjectOwnPropertyKeyIterator() override=default