From 1feac2e054c70d55eb70c00e68d355a25392d378 Mon Sep 17 00:00:00 2001 From: David Baird Date: Fri, 27 Sep 2013 04:15:13 -0600 Subject: [PATCH] Rename struct to class (to help new C++ users who are unfamiliar that structs are classes). --- easywsclient.cpp | 14 +++++++------- easywsclient.hpp | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/easywsclient.cpp b/easywsclient.cpp index 060b6fb..e293fbe 100644 --- a/easywsclient.cpp +++ b/easywsclient.cpp @@ -47,14 +47,10 @@ int hostname_connect(std::string hostname, int port) { return sockfd; } -} - - -namespace easywsclient { - -struct _DummyWebSocket : public WebSocket +class _DummyWebSocket : public easywsclient::WebSocket { + public: void poll() { } void send(std::string message) { } void close() { } @@ -64,8 +60,9 @@ struct _DummyWebSocket : public WebSocket -struct _RealWebSocket : public WebSocket +class _RealWebSocket : public easywsclient::WebSocket { + public: // http://tools.ietf.org/html/rfc6455#section-5.2 Base Framing Protocol // // 0 1 2 3 @@ -264,9 +261,12 @@ struct _RealWebSocket : public WebSocket +} // end of module-only namespace +namespace easywsclient { + WebSocket::pointer WebSocket::create_dummy() { static pointer dummy = pointer(new _DummyWebSocket); return dummy; diff --git a/easywsclient.hpp b/easywsclient.hpp index f1d2f09..c6ee9ae 100644 --- a/easywsclient.hpp +++ b/easywsclient.hpp @@ -12,7 +12,8 @@ namespace easywsclient { -struct WebSocket { +class WebSocket { + public: typedef WebSocket * pointer; typedef enum readyStateValues { CLOSING, CLOSED, CONNECTING, OPEN } readyStateValues;