Skip to content

Commit

Permalink
Merge pull request #240 from ejvr/emqtt
Browse files Browse the repository at this point in the history
Emqtt
  • Loading branch information
mwallnoefer authored Apr 12, 2022
2 parents 6abd396 + bccae56 commit d3118ed
Show file tree
Hide file tree
Showing 25 changed files with 58 additions and 58 deletions.
4 changes: 2 additions & 2 deletions examples/qmqtt/client/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Publisher : public QMQTT::Client
public:
explicit Publisher(const QHostAddress& host = EXAMPLE_HOST,
const quint16 port = EXAMPLE_PORT,
QObject* parent = NULL)
QObject* parent = nullptr)
: QMQTT::Client(host, port, parent)
, _number(0)
{
Expand Down Expand Up @@ -88,7 +88,7 @@ class Subscriber : public QMQTT::Client
public:
explicit Subscriber(const QHostAddress& host = EXAMPLE_HOST,
const quint16 port = EXAMPLE_PORT,
QObject* parent = NULL)
QObject* parent = nullptr)
: QMQTT::Client(host, port, parent)
, _qout(stdout)
{
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ QMQTT::Client::Client(const QString& url,
{
Q_D(Client);
#ifndef QT_NO_SSL
d->init(url, origin, version, NULL, ignoreSelfSigned);
d->init(url, origin, version, nullptr, ignoreSelfSigned);
#else
Q_UNUSED(ignoreSelfSigned)
d->init(url, origin, version);
Expand Down
18 changes: 9 additions & 9 deletions src/mqtt/qmqtt_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ class Q_MQTT_EXPORT Client : public QObject
public:
Client(const QHostAddress& host = QHostAddress::LocalHost,
const quint16 port = 1883,
QObject* parent = NULL);
QObject* parent = nullptr);

#ifndef QT_NO_SSL
Client(const QString& hostName,
const quint16 port,
const QSslConfiguration& config,
const bool ignoreSelfSigned=false,
QObject* parent = NULL);
QObject* parent = nullptr);
#endif // QT_NO_SSL

// This function is provided for backward compatibility with older versions of QMQTT.
Expand All @@ -165,31 +165,31 @@ class Q_MQTT_EXPORT Client : public QObject
const quint16 port,
const bool ssl,
const bool ignoreSelfSigned,
QObject* parent = NULL);
QObject* parent = nullptr);

#ifdef QT_WEBSOCKETS_LIB
// Create a connection over websockets
Client(const QString& url,
const QString& origin,
QWebSocketProtocol::Version version,
bool ignoreSelfSigned = false,
QObject* parent = NULL);
QObject* parent = nullptr);

#ifndef QT_NO_SSL
Client(const QString& url,
const QString& origin,
QWebSocketProtocol::Version version,
const QSslConfiguration& config,
const bool ignoreSelfSigned = false,
QObject* parent = NULL);
QObject* parent = nullptr);
#endif // QT_NO_SSL
#endif // QT_WEBSOCKETS_LIB

// for testing purposes only
Client(NetworkInterface* network,
const QHostAddress& host = QHostAddress::LocalHost,
const quint16 port = 1883,
QObject* parent = NULL);
QObject* parent = nullptr);

virtual ~Client();

Expand All @@ -216,7 +216,7 @@ class Q_MQTT_EXPORT Client : public QObject
void setSslConfiguration(const QSslConfiguration& config);
#endif // QT_NO_SSL

public slots:
public Q_SLOTS:
void setHost(const QHostAddress& host);
void setHostName(const QString& hostName);
void setPort(const quint16 port);
Expand Down Expand Up @@ -246,7 +246,7 @@ public slots:
void ignoreSslErrors(const QList<QSslError>& errors);
#endif // QT_NO_SSL

signals:
Q_SIGNALS:
void connected();
void disconnected();
void error(const QMQTT::ClientError error);
Expand All @@ -260,7 +260,7 @@ public slots:
void sslErrors(const QList<QSslError>& errors);
#endif // QT_NO_SSL

protected slots:
protected Q_SLOTS:
void onNetworkConnected();
void onNetworkDisconnected();
void onNetworkReceived(const QMQTT::Frame& frame);
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_client_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void QMQTT::ClientPrivate::init(const QHostAddress& host, const quint16 port, Ne
Q_Q(Client);
_host = host;
_port = port;
if(network == NULL)
if(network == nullptr)
{
init(new Network(q));
}
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_client_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ClientPrivate
ClientPrivate(Client* qq_ptr);
~ClientPrivate();

void init(const QHostAddress& host, const quint16 port, NetworkInterface* network = NULL);
void init(const QHostAddress& host, const quint16 port, NetworkInterface* network = nullptr);
#ifndef QT_NO_SSL
void init(const QString& hostName, const quint16 port, const QSslConfiguration& config,
const bool ignoreSelfSigned=false);
Expand Down
16 changes: 8 additions & 8 deletions src/mqtt/qmqtt_network_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,23 @@ class Network : public NetworkInterface
Q_OBJECT

public:
Network(QObject* parent = NULL);
Network(QObject* parent = nullptr);
#ifndef QT_NO_SSL
Network(const QSslConfiguration& config, QObject* parent = NULL);
Network(const QSslConfiguration& config, QObject* parent = nullptr);
#endif // QT_NO_SSL
#ifdef QT_WEBSOCKETS_LIB
#ifndef QT_NO_SSL
Network(const QString& origin,
QWebSocketProtocol::Version version,
const QSslConfiguration* sslConfig,
QObject* parent = NULL);
QObject* parent = nullptr);
#endif // QT_NO_SSL
Network(const QString& origin,
QWebSocketProtocol::Version version,
QObject* parent = NULL);
QObject* parent = nullptr);
#endif // QT_WEBSOCKETS_LIB
Network(SocketInterface* socketInterface, TimerInterface* timerInterface,
QObject* parent = NULL);
QObject* parent = nullptr);
~Network();

void sendFrame(const Frame &frame);
Expand All @@ -91,15 +91,15 @@ class Network : public NetworkInterface
void setSslConfiguration(const QSslConfiguration& config);
#endif // QT_NO_SSL

public slots:
public Q_SLOTS:
void connectToHost(const QHostAddress& host, const quint16 port);
void connectToHost(const QString& hostName, const quint16 port);
void disconnectFromHost();
#ifndef QT_NO_SSL
void ignoreSslErrors();
#endif // QT_NO_SSL

protected slots:
protected Q_SLOTS:
void onSocketError(QAbstractSocket::SocketError socketError);

protected:
Expand All @@ -125,7 +125,7 @@ protected slots:
int _shift;
QByteArray _data;

protected slots:
protected Q_SLOTS:
void onSocketReadReady();
void onDisconnected();
void connectToHost();
Expand Down
6 changes: 3 additions & 3 deletions src/mqtt/qmqtt_networkinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Q_MQTT_EXPORT NetworkInterface : public QObject
{
Q_OBJECT
public:
explicit NetworkInterface(QObject* parent = NULL) : QObject(parent) {}
explicit NetworkInterface(QObject* parent = nullptr) : QObject(parent) {}
virtual ~NetworkInterface() {}

virtual void sendFrame(const Frame& frame) = 0;
Expand All @@ -69,15 +69,15 @@ class Q_MQTT_EXPORT NetworkInterface : public QObject
virtual void setSslConfiguration(const QSslConfiguration& config) = 0;
#endif // QT_NO_SSL

public slots:
public Q_SLOTS:
virtual void connectToHost(const QHostAddress& host, const quint16 port) = 0;
virtual void connectToHost(const QString& hostName, const quint16 port) = 0;
virtual void disconnectFromHost() = 0;
#ifndef QT_NO_SSL
virtual void ignoreSslErrors() = 0;
#endif // QT_NO_SSL

signals:
Q_SIGNALS:
void connected();
void disconnected();
void received(const QMQTT::Frame& frame);
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_router.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Q_MQTT_EXPORT Router : public QObject
{
Q_OBJECT
public:
explicit Router(Client *parent = 0);
explicit Router(Client *parent = nullptr);

RouteSubscription *subscribe(const QString &route);
Client *client() const;
Expand Down
6 changes: 3 additions & 3 deletions src/mqtt/qmqtt_routesubscription.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ class Q_MQTT_EXPORT RouteSubscription : public QObject

QString route() const;

signals:
Q_SIGNALS:
void received(const RoutedMessage &message);

private slots:
private Q_SLOTS:
void routeMessage(const Message &message);

private:
friend class Router;

explicit RouteSubscription(Router *parent = 0);
explicit RouteSubscription(Router *parent = nullptr);
void setRoute(const QString &route);

QPointer<Client> _client;
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_socket_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Socket : public SocketInterface
{
Q_OBJECT
public:
explicit Socket(QObject* parent = NULL);
explicit Socket(QObject* parent = nullptr);
virtual ~Socket();

virtual QIODevice *ioDevice();
Expand Down
4 changes: 2 additions & 2 deletions src/mqtt/qmqtt_socketinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Q_MQTT_EXPORT SocketInterface : public QObject
{
Q_OBJECT
public:
explicit SocketInterface(QObject* parent = NULL) : QObject(parent) {}
explicit SocketInterface(QObject* parent = nullptr) : QObject(parent) {}
virtual ~SocketInterface() {}

virtual QIODevice* ioDevice() = 0;
Expand All @@ -70,7 +70,7 @@ class Q_MQTT_EXPORT SocketInterface : public QObject
virtual void setSslConfiguration(const QSslConfiguration& config) { Q_UNUSED(config); }
#endif // QT_NO_SSL

signals:
Q_SIGNALS:
void connected();
void disconnected();
void error(QAbstractSocket::SocketError socketError);
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_ssl_socket_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class SslSocket : public SocketInterface
{
Q_OBJECT
public:
explicit SslSocket(const QSslConfiguration& config, QObject* parent = NULL);
explicit SslSocket(const QSslConfiguration& config, QObject* parent = nullptr);
virtual ~SslSocket();

virtual QIODevice *ioDevice();
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_timer_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Timer : public TimerInterface
{
Q_OBJECT
public:
explicit Timer(QObject *parent = 0);
explicit Timer(QObject *parent = nullptr);
virtual ~Timer();

bool isSingleShot() const;
Expand Down
4 changes: 2 additions & 2 deletions src/mqtt/qmqtt_timerinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Q_MQTT_EXPORT TimerInterface : public QObject
{
Q_OBJECT
public:
explicit TimerInterface(QObject* parent = NULL) : QObject(parent) {}
explicit TimerInterface(QObject* parent = nullptr) : QObject(parent) {}
virtual ~TimerInterface() {}

virtual bool isSingleShot() const = 0;
Expand All @@ -52,7 +52,7 @@ class Q_MQTT_EXPORT TimerInterface : public QObject
virtual void start() = 0;
virtual void stop() = 0;

signals:
Q_SIGNALS:
void timeout();
};

Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_websocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ QMQTT::WebSocket::WebSocket(const QString& origin,
, _ioDevice(new WebSocketIODevice(_socket, this))
{
initialize();
if (sslConfig != NULL)
if (sslConfig != nullptr)
_socket->setSslConfiguration(*sslConfig);
connect(_socket, &QWebSocket::sslErrors, this, &WebSocket::sslErrors);
}
Expand Down
4 changes: 2 additions & 2 deletions src/mqtt/qmqtt_websocket_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ class WebSocket : public SocketInterface
WebSocket(const QString& origin,
QWebSocketProtocol::Version version,
const QSslConfiguration* sslConfig,
QObject* parent = NULL);
QObject* parent = nullptr);
#endif // QT_NO_SSL

WebSocket(const QString& origin,
QWebSocketProtocol::Version version,
QObject* parent = NULL);
QObject* parent = nullptr);

virtual ~WebSocket();

Expand Down
6 changes: 3 additions & 3 deletions src/mqtt/qmqtt_websocketiodevice_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ class WebSocketIODevice : public QIODevice
{
Q_OBJECT
public:
explicit WebSocketIODevice(QWebSocket *socket, QObject *parent = NULL);
explicit WebSocketIODevice(QWebSocket *socket, QObject *parent = nullptr);

bool connectToHost(const QNetworkRequest &request);

virtual qint64 bytesAvailable() const;

signals:
Q_SIGNALS:
void connected();

void disconnected();
Expand All @@ -71,7 +71,7 @@ class WebSocketIODevice : public QIODevice

virtual qint64 writeData(const char *data, qint64 maxSize);

private slots:
private Q_SLOTS:
void binaryMessageReceived(const QByteArray &frame);

private:
Expand Down
2 changes: 1 addition & 1 deletion tests/benchmarks/message/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class tst_message: public QObject
{
Q_OBJECT

private slots:
private Q_SLOTS:
void emptyMessage();
void message();
void equality_data();
Expand Down
10 changes: 5 additions & 5 deletions tests/gtest/tests/customprinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void CustomPrinter::OnTestCaseStart(const TestCase& test_case)
qout << "[----------] "
<< (test_case.test_to_run_count() == 1 ? "test" : "tests")
<< " from " << test_case.name();
if(NULL == test_case.type_param())
if(nullptr == test_case.type_param())
{
qout << endl;
}
Expand Down Expand Up @@ -88,18 +88,18 @@ void CustomPrinter::OnTestEnd(const TestInfo& test_info)
PrintTestName(test_info.test_case_name(), test_info.name());
if (test_info.result()->Failed())
{
if (NULL != test_info.type_param() || NULL != test_info.value_param())
if (nullptr != test_info.type_param() || nullptr != test_info.value_param())
{
qout << ", where ";
if (NULL != test_info.type_param())
if (nullptr != test_info.type_param())
{
qout << "TypeParam = " << test_info.type_param();
if (NULL != test_info.value_param())
if (nullptr != test_info.value_param())
{
qout << " and ";
}
}
if (NULL != test_info.value_param())
if (nullptr != test_info.value_param())
{
qout << "GetParam() = " << test_info.value_param();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/gtest/tests/routedmessagetests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private slots:
};

RoutedMessageTests::RoutedMessageTests()
: _uut(NULL)
: _uut(nullptr)
{
}

Expand Down
Loading

0 comments on commit d3118ed

Please sign in to comment.