Make everything struct, never use class
This commit is contained in:
@@ -97,7 +97,7 @@ public:
|
|||||||
fu2::unique_function<void(uWS::WebSocket<SSL, true> *, int, std::string_view)> close = nullptr;
|
fu2::unique_function<void(uWS::WebSocket<SSL, true> *, int, std::string_view)> close = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class UserData>
|
template <typename UserData>
|
||||||
TemplatedApp &&ws(std::string pattern, WebSocketBehavior &&behavior) {
|
TemplatedApp &&ws(std::string pattern, WebSocketBehavior &&behavior) {
|
||||||
/* Don't compile if alignment rules cannot be satisfied */
|
/* Don't compile if alignment rules cannot be satisfied */
|
||||||
static_assert(alignof(UserData) <= LIBUS_EXT_ALIGNMENT,
|
static_assert(alignof(UserData) <= LIBUS_EXT_ALIGNMENT,
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ template <bool SSL>
|
|||||||
struct AsyncSocket {
|
struct AsyncSocket {
|
||||||
template <bool> friend struct HttpContext;
|
template <bool> friend struct HttpContext;
|
||||||
template <bool, bool> friend struct WebSocketContext;
|
template <bool, bool> friend struct WebSocketContext;
|
||||||
friend class TopicTree;
|
friend struct TopicTree;
|
||||||
/* For now, we don't even compile on GCC without this. FIX! */
|
/* For now, we don't even compile on GCC without this. FIX! */
|
||||||
/*protected*/public:
|
/*protected*/public:
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
namespace uWS {
|
namespace uWS {
|
||||||
template<bool> struct HttpResponse;
|
template<bool> struct HttpResponse;
|
||||||
class HttpRequest;
|
struct HttpRequest;
|
||||||
|
|
||||||
template <bool SSL>
|
template <bool SSL>
|
||||||
struct alignas(16) HttpContextData {
|
struct alignas(16) HttpContextData {
|
||||||
|
|||||||
+3
-3
@@ -32,9 +32,9 @@ namespace uWS {
|
|||||||
/* We require at least this much post padding */
|
/* We require at least this much post padding */
|
||||||
static const int MINIMUM_HTTP_POST_PADDING = 32;
|
static const int MINIMUM_HTTP_POST_PADDING = 32;
|
||||||
|
|
||||||
class HttpRequest {
|
struct HttpRequest {
|
||||||
|
|
||||||
friend class HttpParser;
|
friend struct HttpParser;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const static int MAX_HEADERS = 50;
|
const static int MAX_HEADERS = 50;
|
||||||
@@ -126,7 +126,7 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class HttpParser {
|
struct HttpParser {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string fallback;
|
std::string fallback;
|
||||||
|
|||||||
+3
-3
@@ -35,14 +35,14 @@
|
|||||||
|
|
||||||
namespace uWS {
|
namespace uWS {
|
||||||
|
|
||||||
template <class USERDATA>
|
template <typename USERDATA>
|
||||||
class HttpRouter {
|
struct HttpRouter {
|
||||||
private:
|
private:
|
||||||
static const unsigned int MAX_URL_SEGMENTS = 100;
|
static const unsigned int MAX_URL_SEGMENTS = 100;
|
||||||
|
|
||||||
/* Basically a pre-allocated stack */
|
/* Basically a pre-allocated stack */
|
||||||
struct RouteParameters {
|
struct RouteParameters {
|
||||||
friend class HttpRouter;
|
friend struct HttpRouter;
|
||||||
private:
|
private:
|
||||||
std::string_view params[MAX_URL_SEGMENTS];
|
std::string_view params[MAX_URL_SEGMENTS];
|
||||||
int paramsTop;
|
int paramsTop;
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ namespace uWS {
|
|||||||
// publishing to a node, then another node, then another node should prioritize draining that way
|
// publishing to a node, then another node, then another node should prioritize draining that way
|
||||||
// sending and publishing will interleave undefined, they are separate streams
|
// sending and publishing will interleave undefined, they are separate streams
|
||||||
|
|
||||||
class TopicTree {
|
struct TopicTree {
|
||||||
private:
|
private:
|
||||||
struct Node : std::map<std::string, Node *> {
|
struct Node : std::map<std::string, Node *> {
|
||||||
/* Add and/or lookup node from topic */
|
/* Add and/or lookup node from topic */
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace uWS {
|
|||||||
template <bool SSL, bool isServer>
|
template <bool SSL, bool isServer>
|
||||||
struct WebSocketContext {
|
struct WebSocketContext {
|
||||||
template <bool> friend struct TemplatedApp;
|
template <bool> friend struct TemplatedApp;
|
||||||
template <bool, class> friend class WebSocketProtocol;
|
template <bool, typename> friend struct WebSocketProtocol;
|
||||||
private:
|
private:
|
||||||
WebSocketContext() = delete;
|
WebSocketContext() = delete;
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ enum ExtensionTokens {
|
|||||||
TOK_CLIENT_MAX_WINDOW_BITS = 2348
|
TOK_CLIENT_MAX_WINDOW_BITS = 2348
|
||||||
};
|
};
|
||||||
|
|
||||||
class ExtensionsParser {
|
struct ExtensionsParser {
|
||||||
private:
|
private:
|
||||||
int *lastInteger = nullptr;
|
int *lastInteger = nullptr;
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <bool isServer>
|
template <bool isServer>
|
||||||
class ExtensionsNegotiator {
|
struct ExtensionsNegotiator {
|
||||||
protected:
|
protected:
|
||||||
int options;
|
int options;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
namespace uWS {
|
namespace uWS {
|
||||||
|
|
||||||
class WebSocketHandshake {
|
struct WebSocketHandshake {
|
||||||
template <int N, typename T>
|
template <int N, typename T>
|
||||||
struct static_for {
|
struct static_for {
|
||||||
void operator()(uint32_t *a, uint32_t *b) {
|
void operator()(uint32_t *a, uint32_t *b) {
|
||||||
|
|||||||
@@ -237,8 +237,8 @@ static inline size_t formatMessage(char *dst, const char *src, size_t length, Op
|
|||||||
}
|
}
|
||||||
|
|
||||||
// essentially this is only a parser
|
// essentially this is only a parser
|
||||||
template <const bool isServer, class Impl>
|
template <const bool isServer, typename Impl>
|
||||||
class WIN32_EXPORT WebSocketProtocol {
|
struct WIN32_EXPORT WebSocketProtocol {
|
||||||
public:
|
public:
|
||||||
static const unsigned int SHORT_MESSAGE_HEADER = isServer ? 6 : 2;
|
static const unsigned int SHORT_MESSAGE_HEADER = isServer ? 6 : 2;
|
||||||
static const unsigned int MEDIUM_MESSAGE_HEADER = isServer ? 8 : 4;
|
static const unsigned int MEDIUM_MESSAGE_HEADER = isServer ? 8 : 4;
|
||||||
|
|||||||
Reference in New Issue
Block a user