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;
|
||||
};
|
||||
|
||||
template <class UserData>
|
||||
template <typename UserData>
|
||||
TemplatedApp &&ws(std::string pattern, WebSocketBehavior &&behavior) {
|
||||
/* Don't compile if alignment rules cannot be satisfied */
|
||||
static_assert(alignof(UserData) <= LIBUS_EXT_ALIGNMENT,
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ template <bool SSL>
|
||||
struct AsyncSocket {
|
||||
template <bool> friend struct HttpContext;
|
||||
template <bool, bool> friend struct WebSocketContext;
|
||||
friend class TopicTree;
|
||||
friend struct TopicTree;
|
||||
/* For now, we don't even compile on GCC without this. FIX! */
|
||||
/*protected*/public:
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
namespace uWS {
|
||||
template<bool> struct HttpResponse;
|
||||
class HttpRequest;
|
||||
struct HttpRequest;
|
||||
|
||||
template <bool SSL>
|
||||
struct alignas(16) HttpContextData {
|
||||
|
||||
+3
-3
@@ -32,9 +32,9 @@ namespace uWS {
|
||||
/* We require at least this much post padding */
|
||||
static const int MINIMUM_HTTP_POST_PADDING = 32;
|
||||
|
||||
class HttpRequest {
|
||||
struct HttpRequest {
|
||||
|
||||
friend class HttpParser;
|
||||
friend struct HttpParser;
|
||||
|
||||
private:
|
||||
const static int MAX_HEADERS = 50;
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class HttpParser {
|
||||
struct HttpParser {
|
||||
|
||||
private:
|
||||
std::string fallback;
|
||||
|
||||
+3
-3
@@ -35,14 +35,14 @@
|
||||
|
||||
namespace uWS {
|
||||
|
||||
template <class USERDATA>
|
||||
class HttpRouter {
|
||||
template <typename USERDATA>
|
||||
struct HttpRouter {
|
||||
private:
|
||||
static const unsigned int MAX_URL_SEGMENTS = 100;
|
||||
|
||||
/* Basically a pre-allocated stack */
|
||||
struct RouteParameters {
|
||||
friend class HttpRouter;
|
||||
friend struct HttpRouter;
|
||||
private:
|
||||
std::string_view params[MAX_URL_SEGMENTS];
|
||||
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
|
||||
// sending and publishing will interleave undefined, they are separate streams
|
||||
|
||||
class TopicTree {
|
||||
struct TopicTree {
|
||||
private:
|
||||
struct Node : std::map<std::string, Node *> {
|
||||
/* Add and/or lookup node from topic */
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace uWS {
|
||||
template <bool SSL, bool isServer>
|
||||
struct WebSocketContext {
|
||||
template <bool> friend struct TemplatedApp;
|
||||
template <bool, class> friend class WebSocketProtocol;
|
||||
template <bool, typename> friend struct WebSocketProtocol;
|
||||
private:
|
||||
WebSocketContext() = delete;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ enum ExtensionTokens {
|
||||
TOK_CLIENT_MAX_WINDOW_BITS = 2348
|
||||
};
|
||||
|
||||
class ExtensionsParser {
|
||||
struct ExtensionsParser {
|
||||
private:
|
||||
int *lastInteger = nullptr;
|
||||
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
};
|
||||
|
||||
template <bool isServer>
|
||||
class ExtensionsNegotiator {
|
||||
struct ExtensionsNegotiator {
|
||||
protected:
|
||||
int options;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace uWS {
|
||||
|
||||
class WebSocketHandshake {
|
||||
struct WebSocketHandshake {
|
||||
template <int N, typename T>
|
||||
struct static_for {
|
||||
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
|
||||
template <const bool isServer, class Impl>
|
||||
class WIN32_EXPORT WebSocketProtocol {
|
||||
template <const bool isServer, typename Impl>
|
||||
struct WIN32_EXPORT WebSocketProtocol {
|
||||
public:
|
||||
static const unsigned int SHORT_MESSAGE_HEADER = isServer ? 6 : 2;
|
||||
static const unsigned int MEDIUM_MESSAGE_HEADER = isServer ? 8 : 4;
|
||||
|
||||
Reference in New Issue
Block a user