summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2017-08-28 13:04:34 +0200
committerKai Koehne <kai.koehne@qt.io>2017-08-29 09:36:27 +0000
commit022b4392f6ea5586101f68173b0f8b7868e63586 (patch)
tree14c06a2cff39db14e2b61c8ca46edb2b90609d57
parentb5229df6a08a902b11a2fc9529af6385f4d985d5 (diff)
downloadqtwebchannel-022b4392f6ea5586101f68173b0f8b7868e63586.tar.gz
Examples: Do not put example code in Qt namespace
Instead just wrap forward-declared Qt classes. See also https://wiki.qt.io/Writing_Qt_Examples Change-Id: I3707bb6ee5577e49a6b860e8f1c21b6aaf6405c2 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
-rw-r--r--examples/webchannel/chatserver-cpp/chatserver.cpp4
-rw-r--r--examples/webchannel/chatserver-cpp/chatserver.h4
-rw-r--r--examples/webchannel/shared/websocketclientwrapper.cpp4
-rw-r--r--examples/webchannel/shared/websocketclientwrapper.h7
-rw-r--r--examples/webchannel/shared/websockettransport.cpp4
-rw-r--r--examples/webchannel/shared/websockettransport.h5
6 files changed, 6 insertions, 22 deletions
diff --git a/examples/webchannel/chatserver-cpp/chatserver.cpp b/examples/webchannel/chatserver-cpp/chatserver.cpp
index 74da4c3..fb25344 100644
--- a/examples/webchannel/chatserver-cpp/chatserver.cpp
+++ b/examples/webchannel/chatserver-cpp/chatserver.cpp
@@ -54,8 +54,6 @@
#include <QTimer>
#include <QTime>
-QT_BEGIN_NAMESPACE
-
ChatServer::ChatServer(QObject *parent)
: QObject(parent)
{
@@ -140,5 +138,3 @@ QStringList ChatServer::userList() const
{
return m_userList;
}
-
-QT_END_NAMESPACE
diff --git a/examples/webchannel/chatserver-cpp/chatserver.h b/examples/webchannel/chatserver-cpp/chatserver.h
index 20f0928..b34188b 100644
--- a/examples/webchannel/chatserver-cpp/chatserver.h
+++ b/examples/webchannel/chatserver-cpp/chatserver.h
@@ -55,8 +55,8 @@
#include <QStringList>
QT_BEGIN_NAMESPACE
-
class QTimer;
+QT_END_NAMESPACE
class ChatServer : public QObject
{
@@ -100,6 +100,4 @@ private:
QTimer* m_keepAliveCheckTimer;
};
-QT_END_NAMESPACE
-
#endif // ChatServer_H
diff --git a/examples/webchannel/shared/websocketclientwrapper.cpp b/examples/webchannel/shared/websocketclientwrapper.cpp
index 3743bdd..a69e56a 100644
--- a/examples/webchannel/shared/websocketclientwrapper.cpp
+++ b/examples/webchannel/shared/websocketclientwrapper.cpp
@@ -61,8 +61,6 @@
published objects.
*/
-QT_BEGIN_NAMESPACE
-
/*!
Construct the client wrapper with the given parent.
@@ -84,5 +82,3 @@ void WebSocketClientWrapper::handleNewConnection()
{
emit clientConnected(new WebSocketTransport(m_server->nextPendingConnection()));
}
-
-QT_END_NAMESPACE
diff --git a/examples/webchannel/shared/websocketclientwrapper.h b/examples/webchannel/shared/websocketclientwrapper.h
index f03b825..9c8184c 100644
--- a/examples/webchannel/shared/websocketclientwrapper.h
+++ b/examples/webchannel/shared/websocketclientwrapper.h
@@ -53,10 +53,11 @@
#include <QObject>
-QT_BEGIN_NAMESPACE
+class WebSocketTransport;
+QT_BEGIN_NAMESPACE
class QWebSocketServer;
-class WebSocketTransport;
+QT_END_NAMESPACE
class WebSocketClientWrapper : public QObject
{
@@ -75,6 +76,4 @@ private:
QWebSocketServer *m_server;
};
-QT_END_NAMESPACE
-
#endif // WEBSOCKETTRANSPORTSERVER_H
diff --git a/examples/webchannel/shared/websockettransport.cpp b/examples/webchannel/shared/websockettransport.cpp
index a65bc2d..4dbec39 100644
--- a/examples/webchannel/shared/websockettransport.cpp
+++ b/examples/webchannel/shared/websockettransport.cpp
@@ -64,8 +64,6 @@
be send over the QWebSocket to the remote client.
*/
-QT_BEGIN_NAMESPACE
-
/*!
Construct the transport object and wrap the given socket.
@@ -115,5 +113,3 @@ void WebSocketTransport::textMessageReceived(const QString &messageData)
}
emit messageReceived(message.object(), this);
}
-
-QT_END_NAMESPACE
diff --git a/examples/webchannel/shared/websockettransport.h b/examples/webchannel/shared/websockettransport.h
index 44cb92e..7158aa5 100644
--- a/examples/webchannel/shared/websockettransport.h
+++ b/examples/webchannel/shared/websockettransport.h
@@ -54,8 +54,9 @@
#include <QtWebChannel/QWebChannelAbstractTransport>
QT_BEGIN_NAMESPACE
-
class QWebSocket;
+QT_END_NAMESPACE
+
class WebSocketTransport : public QWebChannelAbstractTransport
{
Q_OBJECT
@@ -72,6 +73,4 @@ private:
QWebSocket *m_socket;
};
-QT_END_NAMESPACE
-
#endif // WEBSOCKETTRANSPORT_H