45 #include "QtNetwork/qnetworkcookie.h" 46 #include "QtCore/qurl.h" 47 #include "QtCore/qdatetime.h" 48 #include "private/qtldurl_p.h" 124 return d_func()->allCookies;
139 d->allCookies = cookieList;
154 return domain == reference;
156 return domain.
endsWith(reference) || domain == reference.
mid(1);
226 for (
int i = 0; i <
d->allCookies.size(); ++i) {
229 if (cookie.
name() == current.
name() &&
233 d->allCookies.removeAt(i);
240 int countForDomain = 0;
241 for (
int i =
d->allCookies.size() - 1; i >= 0; --i) {
246 if (countForDomain >= 49)
247 d->allCookies.removeAt(i);
253 d->allCookies += cookie;
292 end =
d->allCookies.constEnd();
293 for ( ; it !=
end; ++
it) {
298 if (!(*it).isSessionCookie() && (*it).expirationDate() < now)
300 if ((*it).isSecure() && !isEncrypted)
305 while (insertIt != result.
end()) {
308 insertIt = result.
insert(insertIt, *it);
316 if (insertIt == result.
end())
QString domain() const
Returns the domain this cookie is associated with.
#define QT_END_NAMESPACE
This macro expands to.
bool isSessionCookie() const
Returns true if this cookie is a session cookie.
#define it(className, varName)
virtual QList< QNetworkCookie > cookiesForUrl(const QUrl &url) const
Returns the cookies to be added to when a request is sent to url.
virtual ~QNetworkCookieJar()
Destroys this cookie jar object and discards all cookies stored in it.
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
void insert(int i, const T &t)
Inserts value at index position i in the list.
void setDomain(const QString &domain)
Sets the domain associated with this cookie to be domain.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void setPath(const QString &path)
Sets the path associated with this cookie to be path.
The QUrl class provides a convenient interface for working with URLs.
The QString class provides a Unicode character string.
QString host() const
Returns the host of the URL if it is defined; otherwise an empty string is returned.
The QObject class is the base class of all Qt objects.
QString path() const
Returns the path of the URL.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
QString path() const
Returns the path associated with this cookie.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
QDateTime expirationDate() const
Returns the expiration date for this cookie.
virtual bool setCookiesFromUrl(const QList< QNetworkCookie > &cookieList, const QUrl &url)
Adds the cookies in the list cookieList to this cookie jar.
QList< QNetworkCookie > allCookies() const
Returns all cookies stored in this cookie jar.
The QNetworkCookieJar class implements a simple jar of QNetworkCookie objects.
The QNetworkCookie class holds one network cookie.
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
QString scheme() const
Returns the scheme of the URL.
The QDateTime class provides date and time functions.
QNetworkCookieJar(QObject *parent=0)
Creates a QNetworkCookieJar object and sets the parent object to be parent.
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static bool isParentPath(QString path, QString reference)
int length() const
This function is identical to count().
QString toLower() const Q_REQUIRED_RESULT
Returns a lowercase copy of the string.
QByteArray name() const
Returns the name of this cookie.
void setAllCookies(const QList< QNetworkCookie > &cookieList)
Sets the internal list of cookies held by this cookie jar to be cookieList.
static QDateTime currentDateTime()
Returns the current datetime, as reported by the system clock, in the local time zone.
Q_CORE_EXPORT bool qIsEffectiveTLD(const QString &domain)
Return true if domain is a top-level-domain per Qt's copy of the Mozilla public suffix list...
static bool isParentDomain(QString domain, QString reference)
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
static const KeyPair *const end
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.