Qt 4.8
Functions
qnetworkcookiejar.cpp File Reference
#include "qnetworkcookiejar.h"
#include "qnetworkcookiejar_p.h"
#include "QtNetwork/qnetworkcookie.h"
#include "QtCore/qurl.h"
#include "QtCore/qdatetime.h"
#include "private/qtldurl_p.h"

Go to the source code of this file.

Functions

static bool isParentDomain (QString domain, QString reference)
 
static bool isParentPath (QString path, QString reference)
 

Function Documentation

◆ isParentDomain()

static bool isParentDomain ( QString  domain,
QString  reference 
)
inlinestatic

Definition at line 151 of file qnetworkcookiejar.cpp.

Referenced by QNetworkCookieJar::cookiesForUrl(), and QNetworkCookieJar::setCookiesFromUrl().

152 {
153  if (!reference.startsWith(QLatin1Char('.')))
154  return domain == reference;
155 
156  return domain.endsWith(reference) || domain == reference.mid(1);
157 }
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
Definition: qstring.cpp:3734
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...
Definition: qstring.cpp:3706
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
Definition: qstring.cpp:3796
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ isParentPath()

static bool isParentPath ( QString  path,
QString  reference 
)
inlinestatic

Definition at line 142 of file qnetworkcookiejar.cpp.

Referenced by QNetworkCookieJar::cookiesForUrl().

143 {
144  if (!path.endsWith(QLatin1Char('/')))
145  path += QLatin1Char('/');
146  if (!reference.endsWith(QLatin1Char('/')))
147  reference += QLatin1Char('/');
148  return path.startsWith(reference);
149 }
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
Definition: qstring.cpp:3734
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
Definition: qstring.cpp:3796
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55