Refactor a bit, put everything in uWS namespace

This commit is contained in:
Alex Hultman
2019-06-09 07:53:43 +02:00
parent 3b36ea3a45
commit 762b18459e
22 changed files with 82 additions and 69 deletions
+4 -5
View File
@@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef APP_H
#define APP_H
#ifndef UWS_APP_H
#define UWS_APP_H
/* An app is a convenience wrapper of some of the most used fuctionalities and allows a
* builder-pattern kind of init. Apps operate on the implicit thread local Loop */
@@ -26,8 +26,7 @@
#include "WebSocketContext.h"
#include "WebSocket.h"
#include "WebSocketExtensions.h"
#include "libwshandshake.hpp"
#include "WebSocketHandshake.h"
namespace uWS {
@@ -320,4 +319,4 @@ typedef TemplatedApp<true> SSLApp;
}
#endif // APP_H
#endif // UWS_APP_H
+3 -3
View File
@@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef ASYNCSOCKET_H
#define ASYNCSOCKET_H
#ifndef UWS_ASYNCSOCKET_H
#define UWS_ASYNCSOCKET_H
/* This class implements async socket memory management strategies */
@@ -223,4 +223,4 @@ struct AsyncSocket {
}
#endif // ASYNCSOCKET_H
#endif // UWS_ASYNCSOCKET_H
+7 -3
View File
@@ -15,8 +15,10 @@
* limitations under the License.
*/
#ifndef ASYNCSOCKETDATA_H
#define ASYNCSOCKETDATA_H
#ifndef UWS_ASYNCSOCKETDATA_H
#define UWS_ASYNCSOCKETDATA_H
namespace uWS {
/* Depending on how we want AsyncSocket to function, this will need to change */
@@ -36,4 +38,6 @@ struct AsyncSocketData {
AsyncSocketData() = default;
};
#endif // ASYNCSOCKETDATA_H
}
#endif // UWS_ASYNCSOCKETDATA_H
+3 -3
View File
@@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef HTTPCONTEXT_H
#define HTTPCONTEXT_H
#ifndef UWS_HTTPCONTEXT_H
#define UWS_HTTPCONTEXT_H
/* This class defines the main behavior of HTTP and emits various events */
@@ -359,4 +359,4 @@ public:
}
#endif // HTTPCONTEXT_H
#endif // UWS_HTTPCONTEXT_H
+3 -3
View File
@@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef HTTPCONTEXTDATA_H
#define HTTPCONTEXTDATA_H
#ifndef UWS_HTTPCONTEXTDATA_H
#define UWS_HTTPCONTEXTDATA_H
#include "HttpRouter.h"
@@ -45,4 +45,4 @@ private:
}
#endif // HTTPCONTEXTDATA_H
#endif // UWS_HTTPCONTEXTDATA_H
+3 -3
View File
@@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef HTTPPARSER_H
#define HTTPPARSER_H
#ifndef UWS_HTTPPARSER_H
#define UWS_HTTPPARSER_H
// todo: HttpParser is in need of a few clean-ups and refactorings
@@ -331,4 +331,4 @@ public:
}
#endif // HTTPPARSER_H
#endif // UWS_HTTPPARSER_H
+3 -3
View File
@@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef HTTPRESPONSE_H
#define HTTPRESPONSE_H
#ifndef UWS_HTTPRESPONSE_H
#define UWS_HTTPRESPONSE_H
/* An HttpResponse is the channel on which you send back a response */
@@ -315,4 +315,4 @@ public:
}
#endif // HTTPRESPONSE_H
#endif // UWS_HTTPRESPONSE_H
+3 -3
View File
@@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef HTTPRESPONSEDATA_H
#define HTTPRESPONSEDATA_H
#ifndef UWS_HTTPRESPONSEDATA_H
#define UWS_HTTPRESPONSEDATA_H
/* This data belongs to the HttpResponse */
@@ -54,4 +54,4 @@ private:
}
#endif // HTTPRESPONSEDATA_H
#endif // UWS_HTTPRESPONSEDATA_H
+3 -3
View File
@@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef HTTPROUTER_HPP
#define HTTPROUTER_HPP
#ifndef UWS_HTTPROUTER_HPP
#define UWS_HTTPROUTER_HPP
// todo: this module also needs a few clean-ups and simplifications
@@ -282,4 +282,4 @@ public:
}
#endif // HTTPROUTER_HPP
#endif // UWS_HTTPROUTER_HPP
+3 -3
View File
@@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef LOOP_H
#define LOOP_H
#ifndef UWS_LOOP_H
#define UWS_LOOP_H
/* The loop is lazily created per-thread and run with uWS::run() */
@@ -162,4 +162,4 @@ inline void run() {
}
#endif // LOOP_H
#endif // UWS_LOOP_H
+3 -3
View File
@@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef LOOPDATA_H
#define LOOPDATA_H
#ifndef UWS_LOOPDATA_H
#define UWS_LOOPDATA_H
#include <thread>
#include <functional>
@@ -70,4 +70,4 @@ public:
}
#endif // LOOPDATA_H
#endif // UWS_LOOPDATA_H
+12 -6
View File
@@ -17,8 +17,14 @@
/* This standalone module implements deflate / inflate streams */
#ifndef PERMESSAGEDEFLATE_H
#define PERMESSAGEDEFLATE_H
#ifndef UWS_PERMESSAGEDEFLATE_H
#define UWS_PERMESSAGEDEFLATE_H
#include <zlib.h>
#include <string>
namespace uWS {
/* Do not compile this module if we don't want it */
#ifdef UWS_NO_ZLIB
struct ZlibContext {};
@@ -34,9 +40,6 @@ struct DeflationStream {
};
#else
#include <zlib.h>
#include <string>
#define LARGE_BUFFER_SIZE 1024 * 16 // todo: fix this
struct ZlibContext {
@@ -161,4 +164,7 @@ struct InflationStream {
};
#endif
#endif // PERMESSAGEDEFLATE_H
}
#endif // UWS_PERMESSAGEDEFLATE_H
+3 -3
View File
@@ -19,8 +19,8 @@
#include "Loop.h"
#include "AsyncSocket.h"
#ifndef TOPICTREE_H
#define TOPICTREE_H
#ifndef UWS_TOPICTREE_H
#define UWS_TOPICTREE_H
#include <map>
#include <string>
@@ -195,4 +195,4 @@ public:
};
}
#endif // TOPICTREE_H
#endif // UWS_TOPICTREE_H
+3 -3
View File
@@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef UTILITIES_H
#define UTILITIES_H
#ifndef UWS_UTILITIES_H
#define UWS_UTILITIES_H
/* Various common utilities */
@@ -63,4 +63,4 @@ inline int u32toa(uint32_t value, char *dst) {
}
}
#endif // UTILITIES_H
#endif // UWS_UTILITIES_H
+3 -3
View File
@@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef WEBSOCKET_H
#define WEBSOCKET_H
#ifndef UWS_WEBSOCKET_H
#define UWS_WEBSOCKET_H
#include "WebSocketData.h"
#include "WebSocketProtocol.h"
@@ -159,4 +159,4 @@ public:
}
#endif // WEBSOCKET_H
#endif // UWS_WEBSOCKET_H
+3 -3
View File
@@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef WEBSOCKETCONTEXT_H
#define WEBSOCKETCONTEXT_H
#ifndef UWS_WEBSOCKETCONTEXT_H
#define UWS_WEBSOCKETCONTEXT_H
#include "WebSocketContextData.h"
#include "WebSocketProtocol.h"
@@ -371,4 +371,4 @@ public:
}
#endif // WEBSOCKETCONTEXT_H
#endif // UWS_WEBSOCKETCONTEXT_H
+3 -3
View File
@@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef WEBSOCKETCONTEXTDATA_H
#define WEBSOCKETCONTEXTDATA_H
#ifndef UWS_WEBSOCKETCONTEXTDATA_H
#define UWS_WEBSOCKETCONTEXTDATA_H
#include "f2/function2.hpp"
#include <string_view>
@@ -47,4 +47,4 @@ struct WebSocketContextData {
}
#endif // WEBSOCKETCONTEXTDATA_H
#endif // UWS_WEBSOCKETCONTEXTDATA_H
+3 -3
View File
@@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef WEBSOCKETDATA_H
#define WEBSOCKETDATA_H
#ifndef UWS_WEBSOCKETDATA_H
#define UWS_WEBSOCKETDATA_H
#include "WebSocketProtocol.h"
#include "AsyncSocketData.h"
@@ -60,4 +60,4 @@ public:
}
#endif // WEBSOCKETDATA_H
#endif // UWS_WEBSOCKETDATA_H
+3 -3
View File
@@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef WEBSOCKETEXTENSIONS_H
#define WEBSOCKETEXTENSIONS_H
#ifndef UWS_WEBSOCKETEXTENSIONS_H
#define UWS_WEBSOCKETEXTENSIONS_H
#include <string_view>
@@ -158,4 +158,4 @@ public:
}
#endif // WEBSOCKETEXTENSIONS_H
#endif // UWS_WEBSOCKETEXTENSIONS_H
@@ -15,12 +15,14 @@
* limitations under the License.
*/
#ifndef LIBWSHANDSHAKE_H
#define LIBWSHANDSHAKE_H
#ifndef UWS_WEBSOCKETHANDSHAKE_H
#define UWS_WEBSOCKETHANDSHAKE_H
#include <cstdint>
#include <cstddef>
namespace uWS {
class WebSocketHandshake {
template <int N, typename T>
struct static_for {
@@ -127,4 +129,6 @@ public:
}
};
#endif // LIBWSHANDSHAKE_H
}
#endif // UWS_WEBSOCKETHANDSHAKE_H
+3 -3
View File
@@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef WEBSOCKETPROTOCOL_UWS_H
#define WEBSOCKETPROTOCOL_UWS_H
#ifndef UWS_WEBSOCKETPROTOCOL_H
#define UWS_WEBSOCKETPROTOCOL_H
#include <cstdint>
#include <cstring>
@@ -430,4 +430,4 @@ public:
}
#endif // WEBSOCKETPROTOCOL_UWS_H
#endif // UWS_WEBSOCKETPROTOCOL_H