diff --git a/examples/qmqtt/client/example.cpp b/examples/qmqtt/client/example.cpp index 048f3b8..4620c96 100644 --- a/examples/qmqtt/client/example.cpp +++ b/examples/qmqtt/client/example.cpp @@ -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) { @@ -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) { diff --git a/src/mqtt/qmqtt_client.cpp b/src/mqtt/qmqtt_client.cpp index 78542e4..9a5ecd5 100644 --- a/src/mqtt/qmqtt_client.cpp +++ b/src/mqtt/qmqtt_client.cpp @@ -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); diff --git a/src/mqtt/qmqtt_client.h b/src/mqtt/qmqtt_client.h index c502b25..7474a64 100644 --- a/src/mqtt/qmqtt_client.h +++ b/src/mqtt/qmqtt_client.h @@ -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. @@ -165,7 +165,7 @@ 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 @@ -173,7 +173,7 @@ class Q_MQTT_EXPORT Client : public QObject const QString& origin, QWebSocketProtocol::Version version, bool ignoreSelfSigned = false, - QObject* parent = NULL); + QObject* parent = nullptr); #ifndef QT_NO_SSL Client(const QString& url, @@ -181,7 +181,7 @@ class Q_MQTT_EXPORT Client : public QObject QWebSocketProtocol::Version version, const QSslConfiguration& config, const bool ignoreSelfSigned = false, - QObject* parent = NULL); + QObject* parent = nullptr); #endif // QT_NO_SSL #endif // QT_WEBSOCKETS_LIB @@ -189,7 +189,7 @@ class Q_MQTT_EXPORT Client : public QObject Client(NetworkInterface* network, const QHostAddress& host = QHostAddress::LocalHost, const quint16 port = 1883, - QObject* parent = NULL); + QObject* parent = nullptr); virtual ~Client(); diff --git a/src/mqtt/qmqtt_client_p.cpp b/src/mqtt/qmqtt_client_p.cpp index 89329c3..0ac0568 100644 --- a/src/mqtt/qmqtt_client_p.cpp +++ b/src/mqtt/qmqtt_client_p.cpp @@ -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)); } diff --git a/src/mqtt/qmqtt_client_p.h b/src/mqtt/qmqtt_client_p.h index 03d0768..72358db 100644 --- a/src/mqtt/qmqtt_client_p.h +++ b/src/mqtt/qmqtt_client_p.h @@ -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); diff --git a/src/mqtt/qmqtt_network_p.h b/src/mqtt/qmqtt_network_p.h index 0bb5413..6600197 100644 --- a/src/mqtt/qmqtt_network_p.h +++ b/src/mqtt/qmqtt_network_p.h @@ -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); diff --git a/src/mqtt/qmqtt_networkinterface.h b/src/mqtt/qmqtt_networkinterface.h index f37be35..a431d6b 100644 --- a/src/mqtt/qmqtt_networkinterface.h +++ b/src/mqtt/qmqtt_networkinterface.h @@ -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; diff --git a/src/mqtt/qmqtt_router.h b/src/mqtt/qmqtt_router.h index 019aa5e..35b04d7 100644 --- a/src/mqtt/qmqtt_router.h +++ b/src/mqtt/qmqtt_router.h @@ -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; diff --git a/src/mqtt/qmqtt_routesubscription.h b/src/mqtt/qmqtt_routesubscription.h index 17bc39d..f3925ae 100644 --- a/src/mqtt/qmqtt_routesubscription.h +++ b/src/mqtt/qmqtt_routesubscription.h @@ -65,7 +65,7 @@ private Q_SLOTS: private: friend class Router; - explicit RouteSubscription(Router *parent = 0); + explicit RouteSubscription(Router *parent = nullptr); void setRoute(const QString &route); QPointer _client; diff --git a/src/mqtt/qmqtt_socket_p.h b/src/mqtt/qmqtt_socket_p.h index 838233a..cd971af 100644 --- a/src/mqtt/qmqtt_socket_p.h +++ b/src/mqtt/qmqtt_socket_p.h @@ -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(); diff --git a/src/mqtt/qmqtt_socketinterface.h b/src/mqtt/qmqtt_socketinterface.h index 6c80415..88257ef 100644 --- a/src/mqtt/qmqtt_socketinterface.h +++ b/src/mqtt/qmqtt_socketinterface.h @@ -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; diff --git a/src/mqtt/qmqtt_ssl_socket_p.h b/src/mqtt/qmqtt_ssl_socket_p.h index 28ccf7f..45fbc7c 100644 --- a/src/mqtt/qmqtt_ssl_socket_p.h +++ b/src/mqtt/qmqtt_ssl_socket_p.h @@ -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(); diff --git a/src/mqtt/qmqtt_timer_p.h b/src/mqtt/qmqtt_timer_p.h index fc48dfc..699008e 100644 --- a/src/mqtt/qmqtt_timer_p.h +++ b/src/mqtt/qmqtt_timer_p.h @@ -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; diff --git a/src/mqtt/qmqtt_timerinterface.h b/src/mqtt/qmqtt_timerinterface.h index de176d5..2d87415 100644 --- a/src/mqtt/qmqtt_timerinterface.h +++ b/src/mqtt/qmqtt_timerinterface.h @@ -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; diff --git a/src/mqtt/qmqtt_websocket.cpp b/src/mqtt/qmqtt_websocket.cpp index c824786..bb1fa5b 100644 --- a/src/mqtt/qmqtt_websocket.cpp +++ b/src/mqtt/qmqtt_websocket.cpp @@ -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); } diff --git a/src/mqtt/qmqtt_websocket_p.h b/src/mqtt/qmqtt_websocket_p.h index 6d159fa..ca77363 100644 --- a/src/mqtt/qmqtt_websocket_p.h +++ b/src/mqtt/qmqtt_websocket_p.h @@ -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(); diff --git a/src/mqtt/qmqtt_websocketiodevice_p.h b/src/mqtt/qmqtt_websocketiodevice_p.h index 9fb169a..6f79727 100644 --- a/src/mqtt/qmqtt_websocketiodevice_p.h +++ b/src/mqtt/qmqtt_websocketiodevice_p.h @@ -51,7 +51,7 @@ 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); diff --git a/tests/gtest/tests/customprinter.cpp b/tests/gtest/tests/customprinter.cpp index 2cac54a..64b1d80 100644 --- a/tests/gtest/tests/customprinter.cpp +++ b/tests/gtest/tests/customprinter.cpp @@ -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; } @@ -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(); } diff --git a/tests/gtest/tests/routedmessagetests.cpp b/tests/gtest/tests/routedmessagetests.cpp index 16767de..d27ea89 100644 --- a/tests/gtest/tests/routedmessagetests.cpp +++ b/tests/gtest/tests/routedmessagetests.cpp @@ -19,7 +19,7 @@ private slots: }; RoutedMessageTests::RoutedMessageTests() - : _uut(NULL) + : _uut(nullptr) { } diff --git a/tests/gtest/tests/routertests.cpp b/tests/gtest/tests/routertests.cpp index ac5b4f3..42da51c 100644 --- a/tests/gtest/tests/routertests.cpp +++ b/tests/gtest/tests/routertests.cpp @@ -23,7 +23,7 @@ private slots: }; RouterTests::RouterTests() - : _uut(NULL) + : _uut(nullptr) { } @@ -46,7 +46,7 @@ void RouterTests::cleanup() void RouterTests::subscribe_Test() { // QMQTT::RouteSubscription* subscription = _uut->subscribe("route"); -// QVERIFY(NULL != subscription); +// QVERIFY(nullptr != subscription); // QCOMPARE(subscription->route(), QString("route")); } diff --git a/tests/gtest/tests/routesubscriptiontests.cpp b/tests/gtest/tests/routesubscriptiontests.cpp index da8cfda..7e01952 100644 --- a/tests/gtest/tests/routesubscriptiontests.cpp +++ b/tests/gtest/tests/routesubscriptiontests.cpp @@ -19,7 +19,7 @@ private slots: }; RouteSubscriptionTests::RouteSubscriptionTests() - : _uut(NULL) + : _uut(nullptr) { } diff --git a/tests/gtest/tests/socketmock.h b/tests/gtest/tests/socketmock.h index db85e83..16e8724 100644 --- a/tests/gtest/tests/socketmock.h +++ b/tests/gtest/tests/socketmock.h @@ -9,7 +9,7 @@ class SocketMock : public QMQTT::SocketInterface { public: - SocketMock(QObject* parent = NULL) + SocketMock(QObject* parent = nullptr) : QMQTT::SocketInterface (parent) , mockIoDevice(new IODeviceMock) { diff --git a/tests/gtest/tests/tcpserver.cpp b/tests/gtest/tests/tcpserver.cpp index 8eda19f..a188ba8 100644 --- a/tests/gtest/tests/tcpserver.cpp +++ b/tests/gtest/tests/tcpserver.cpp @@ -3,7 +3,7 @@ #include TcpServer::TcpServer(const QHostAddress host, const quint16 port) - : _socket(NULL) + : _socket(nullptr) { connect(this, &QTcpServer::newConnection, this, &TcpServer::on_newConnection); listen(host, port); @@ -15,16 +15,16 @@ TcpServer::~TcpServer() void TcpServer::on_newConnection() { - if(NULL != _socket) + if(nullptr != _socket) { disconnect(_socket, &QTcpSocket::readyRead, this, &TcpServer::on_readyRead); _socket->disconnectFromHost(); _socket->deleteLater(); - _socket = NULL; + _socket = nullptr; _data.clear(); } _socket = nextPendingConnection(); - if(NULL != _socket) + if(nullptr != _socket) { connect(_socket, &QTcpSocket::readyRead, this, &TcpServer::on_readyRead); }