{
if (!d) return true;
- QMutexLocker lock(&d->mutex);
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed))
return d->encodedOriginal.isEmpty();
else
bool QUrl::hasQuery() const
{
if (!d) return false;
- QMutexLocker lock(&d->mutex);
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
+ if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) {
+ QMutexLocker lock(&d->mutex);
+ d->parse();
+ }
return d->hasQuery;
}
QList<QPair<QString, QString> > QUrl::queryItems() const
{
if (!d) return QList<QPair<QString, QString> >();
- QMutexLocker lock(&d->mutex);
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
+ if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) {
+ QMutexLocker lock(&d->mutex);
+ d->parse();
+ }
QList<QPair<QString, QString> > itemMap;
QList<QPair<QByteArray, QByteArray> > QUrl::encodedQueryItems() const
{
if (!d) return QList<QPair<QByteArray, QByteArray> >();
- QMutexLocker lock(&d->mutex);
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
+ if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) {
+ QMutexLocker lock(&d->mutex);
+ d->parse();
+ }
QList<QPair<QByteArray, QByteArray> > itemMap;
bool QUrl::hasEncodedQueryItem(const QByteArray &key) const
{
if (!d) return false;
- QMutexLocker lock(&d->mutex);
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
+ if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) {
+ QMutexLocker lock(&d->mutex);
+ d->parse();
+ }
int pos = 0;
const char *query = d->query.constData();
QByteArray QUrl::encodedQueryItemValue(const QByteArray &key) const
{
if (!d) return QByteArray();
- QMutexLocker lock(&d->mutex);
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
+ if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) {
+ QMutexLocker lock(&d->mutex);
+ d->parse();
+ }
int pos = 0;
const char *query = d->query.constData();
QStringList QUrl::allQueryItemValues(const QString &key) const
{
if (!d) return QStringList();
- QMutexLocker lock(&d->mutex);
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
+ if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) {
+ QMutexLocker lock(&d->mutex);
+ d->parse();
+ }
QByteArray encodedKey = toPercentEncoding(key, queryExcludeChars);
QStringList values;
QList<QByteArray> QUrl::allEncodedQueryItemValues(const QByteArray &key) const
{
if (!d) return QList<QByteArray>();
- QMutexLocker lock(&d->mutex);
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
+ if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) {
+ QMutexLocker lock(&d->mutex);
+ d->parse();
+ }
QList<QByteArray> values;
QByteArray QUrl::encodedQuery() const
{
if (!d) return QByteArray();
- QMutexLocker lock(&d->mutex);
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
+ if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) {
+ QMutexLocker lock(&d->mutex);
+ d->parse();
+ }
return d->query;
}
bool QUrl::hasFragment() const
{
if (!d) return false;
- QMutexLocker lock(&d->mutex);
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
+ if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) {
+ QMutexLocker lock(&d->mutex);
+ d->parse();
+ }
return d->hasFragment;
}
bool QUrl::isRelative() const
{
if (!d) return true;
- QMutexLocker lock(&d->mutex);
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
+ if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) {
+ QMutexLocker lock(&d->mutex);
+ d->parse();
+ }
return d->scheme.isEmpty();
}
bool QUrl::isLocalFile() const
{
if (!d) return false;
- QMutexLocker lock(&d->mutex);
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
+ if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) {
+ QMutexLocker lock(&d->mutex);
+ d->parse();
+ }
if (d->scheme.compare(QLatin1String("file"), Qt::CaseInsensitive) != 0)
return false; // not file
&& (childUrl.authority().isEmpty())
&& childPath.length() > 0 && childPath.at(0) == QLatin1Char('/'));
- QMutexLocker lock(&d->mutex);
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
- lock.unlock();
+ if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) {
+ QMutexLocker lock(&d->mutex);
+ d->parse();
+ }
QString ourPath = path();
if (!d)
return true; // considered finished
- QMutexLocker locker(&d->mutex);
return d->replyMessage.type() != QDBusMessage::InvalidMessage;
}
{
if (!d)
return false;
- QMutexLocker locker(&d->mutex);
return d->replyMessage.type() == QDBusMessage::ReplyMessage;
}
{
if (!d)
return true; // considered finished and an error
- QMutexLocker locker(&d->mutex);
return d->replyMessage.type() == QDBusMessage::ErrorMessage;
}
QDBusError QDBusPendingCall::error() const
{
if (d) {
- QMutexLocker locker(&d->mutex);
return d->replyMessage;
}
// not connected, return an error
- QDBusError err = QDBusError(QDBusError::Disconnected,
- QLatin1String("Not connected to D-Bus server"));
- return err;
+ return QDBusError(QDBusError::Disconnected,
+ QLatin1String("Not connected to D-Bus server"));
}
/*!
{
if (!d)
return QDBusMessage::createError(error());
- QMutexLocker locker(&d->mutex);
return d->replyMessage;
}