QHostInfo: address a Qt 6 todo
Merged the two functions, required adding a friend declaration Change-Id: I86265da19e4b5f53d9e2dc54de3e252f0364225b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
467d215b32
commit
4573d29f64
@ -286,7 +286,7 @@ static int nextId()
|
|||||||
*/
|
*/
|
||||||
int QHostInfo::lookupHost(const QString &name, QObject *receiver, const char *member)
|
int QHostInfo::lookupHost(const QString &name, QObject *receiver, const char *member)
|
||||||
{
|
{
|
||||||
return QHostInfoPrivate::lookupHostImpl(name, receiver, nullptr, member);
|
return QHostInfo::lookupHostImpl(name, receiver, nullptr, member);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -773,14 +773,8 @@ QString QHostInfo::localHostName()
|
|||||||
\sa hostName()
|
\sa hostName()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ### Qt 6 merge with function below
|
/*!
|
||||||
int QHostInfo::lookupHostImpl(const QString &name,
|
\internal
|
||||||
const QObject *receiver,
|
|
||||||
QtPrivate::QSlotObjectBase *slotObj)
|
|
||||||
{
|
|
||||||
return QHostInfoPrivate::lookupHostImpl(name, receiver, slotObj, nullptr);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
Called by the various lookupHost overloads to perform the lookup.
|
Called by the various lookupHost overloads to perform the lookup.
|
||||||
|
|
||||||
Signals either the functor encapuslated in the \a slotObj in the context
|
Signals either the functor encapuslated in the \a slotObj in the context
|
||||||
@ -788,13 +782,13 @@ int QHostInfo::lookupHostImpl(const QString &name,
|
|||||||
|
|
||||||
\a receiver might be the nullptr, but only if a \a slotObj is provided.
|
\a receiver might be the nullptr, but only if a \a slotObj is provided.
|
||||||
*/
|
*/
|
||||||
int QHostInfoPrivate::lookupHostImpl(const QString &name,
|
int QHostInfo::lookupHostImpl(const QString &name,
|
||||||
const QObject *receiver,
|
const QObject *receiver,
|
||||||
QtPrivate::QSlotObjectBase *slotObj,
|
QtPrivate::QSlotObjectBase *slotObj,
|
||||||
const char *member)
|
const char *member)
|
||||||
{
|
{
|
||||||
#if defined QHOSTINFO_DEBUG
|
#if defined QHOSTINFO_DEBUG
|
||||||
qDebug("QHostInfoPrivate::lookupHostImpl(\"%s\", %p, %p, %s)",
|
qDebug("QHostInfo::lookupHostImpl(\"%s\", %p, %p, %s)",
|
||||||
name.toLatin1().constData(), receiver, slotObj, member ? member + 1 : 0);
|
name.toLatin1().constData(), receiver, slotObj, member ? member + 1 : 0);
|
||||||
#endif
|
#endif
|
||||||
Q_ASSERT(!member != !slotObj); // one of these must be set, but not both
|
Q_ASSERT(!member != !slotObj); // one of these must be set, but not both
|
||||||
@ -1098,7 +1092,7 @@ QHostInfo qt_qhostinfo_lookup(const QString &name, QObject *receiver, const char
|
|||||||
}
|
}
|
||||||
|
|
||||||
// was not in cache, trigger lookup
|
// was not in cache, trigger lookup
|
||||||
*id = QHostInfoPrivate::lookupHostImpl(name, receiver, nullptr, member);
|
*id = QHostInfo::lookupHostImpl(name, receiver, nullptr, member);
|
||||||
|
|
||||||
// return empty response, valid==false
|
// return empty response, valid==false
|
||||||
return QHostInfo();
|
return QHostInfo();
|
||||||
|
@ -117,7 +117,7 @@ public:
|
|||||||
"with the return type of the signal.");
|
"with the return type of the signal.");
|
||||||
|
|
||||||
auto slotObj = new QtPrivate::QSlotObject<Func, typename SlotType::Arguments, void>(slot);
|
auto slotObj = new QtPrivate::QSlotObject<Func, typename SlotType::Arguments, void>(slot);
|
||||||
return lookupHostImpl(name, receiver, slotObj);
|
return lookupHostImpl(name, receiver, slotObj, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// lookupHost to a callable (without context)
|
// lookupHost to a callable (without context)
|
||||||
@ -143,7 +143,7 @@ public:
|
|||||||
auto slotObj = new QtPrivate::QFunctorSlotObject<Func1, 1,
|
auto slotObj = new QtPrivate::QFunctorSlotObject<Func1, 1,
|
||||||
typename QtPrivate::List<QHostInfo>,
|
typename QtPrivate::List<QHostInfo>,
|
||||||
void>(std::move(slot));
|
void>(std::move(slot));
|
||||||
return lookupHostImpl(name, context, slotObj);
|
return lookupHostImpl(name, context, slotObj, nullptr);
|
||||||
}
|
}
|
||||||
#endif // Q_QDOC
|
#endif // Q_QDOC
|
||||||
|
|
||||||
@ -153,7 +153,11 @@ private:
|
|||||||
|
|
||||||
static int lookupHostImpl(const QString &name,
|
static int lookupHostImpl(const QString &name,
|
||||||
const QObject *receiver,
|
const QObject *receiver,
|
||||||
QtPrivate::QSlotObjectBase *slotObj);
|
QtPrivate::QSlotObjectBase *slotObj,
|
||||||
|
const char *member);
|
||||||
|
|
||||||
|
friend QHostInfo Q_NETWORK_EXPORT qt_qhostinfo_lookup(const QString &name, QObject *receiver,
|
||||||
|
const char *member, bool *valid, int *id);
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_SHARED(QHostInfo)
|
Q_DECLARE_SHARED(QHostInfo)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user