4#ifndef QSOCKETABSTRACTION_P_H
5#define QSOCKETABSTRACTION_P_H
7#include <private/qtnetworkglobal_p.h>
9#include <QtNetwork/qabstractsocket.h>
10#include <QtNetwork/qlocalsocket.h>
12#include <QtCore/qxpfunctional.h>
30template <
typename Fn,
typename... Args>
33 if (
auto *
s = qobject_cast<QAbstractSocket *>(
socket))
34 return std::forward<Fn>(fn)(
s, std::forward<Args>(
args)...);
35 if (
auto *
s = qobject_cast<QLocalSocket *>(
socket))
36 return std::forward<Fn>(fn)(
s, std::forward<Args>(
args)...);
45 auto getState = [](
auto *
s) {
46 using T = std::remove_pointer_t<
decltype(
s)>;
47 if constexpr (std::is_same_v<T, QAbstractSocket>) {
49 }
else if constexpr (std::is_same_v<T, QLocalSocket>) {
61 auto getError = [](
auto *
s) {
62 using T = std::remove_pointer_t<
decltype(
s)>;
63 if constexpr (std::is_same_v<T, QAbstractSocket>) {
65 }
else if constexpr (std::is_same_v<T, QLocalSocket>) {
76 auto getPeerName = [](
auto *
s) {
77 using T = std::remove_pointer_t<
decltype(
s)>;
78 if constexpr (std::is_same_v<T, QAbstractSocket>) {
80 }
else if constexpr (std::is_same_v<T, QLocalSocket>) {
81 return s->serverName();
IOBluetoothDevice * device
SocketState
This enum describes the different states in which a socket can be.
SocketError
This enum describes the socket errors that can occur.
\inmodule QtCore \reentrant
LocalSocketState
This enum describes the different states in which a socket can be.
LocalSocketError
The LocalServerError enumeration represents the errors that can occur.
\macro QT_RESTRICTED_CAST_FROM_ASCII
auto visit(Fn &&fn, QIODevice *socket, Args &&...args)
QString socketPeerName(QIODevice *device)
QAbstractSocket::SocketError socketError(QIODevice *device)
QAbstractSocket::SocketState socketState(QIODevice *device)
Combined button and popup list for selecting options.