diff --git a/ixwebsocket/IXBase64.h b/ixwebsocket/IXBase64.h index cdfdc04d..56406461 100644 --- a/ixwebsocket/IXBase64.h +++ b/ixwebsocket/IXBase64.h @@ -25,6 +25,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include #include namespace macaron { diff --git a/ixwebsocket/IXBench.h b/ixwebsocket/IXBench.h index c4f904b7..a0cd1b77 100644 --- a/ixwebsocket/IXBench.h +++ b/ixwebsocket/IXBench.h @@ -6,7 +6,7 @@ #pragma once #include -#include +#include #include namespace ix diff --git a/ixwebsocket/IXConnectionState.h b/ixwebsocket/IXConnectionState.h index b7530d0b..aa08d381 100644 --- a/ixwebsocket/IXConnectionState.h +++ b/ixwebsocket/IXConnectionState.h @@ -7,9 +7,9 @@ #pragma once #include +#include #include #include -#include #include namespace ix diff --git a/ixwebsocket/IXDNSLookup.h b/ixwebsocket/IXDNSLookup.h index d5a8ab52..b0bbc182 100644 --- a/ixwebsocket/IXDNSLookup.h +++ b/ixwebsocket/IXDNSLookup.h @@ -12,6 +12,7 @@ #include "IXCancellationRequest.h" #include +#include #include #include #include diff --git a/ixwebsocket/IXHttp.h b/ixwebsocket/IXHttp.h index 2cf4f29d..c9fc0bfd 100644 --- a/ixwebsocket/IXHttp.h +++ b/ixwebsocket/IXHttp.h @@ -9,6 +9,7 @@ #include "IXProgressCallback.h" #include "IXWebSocketHttpHeaders.h" #include +#include #include #include diff --git a/ixwebsocket/IXHttpClient.cpp b/ixwebsocket/IXHttpClient.cpp index 00226712..48700f50 100644 --- a/ixwebsocket/IXHttpClient.cpp +++ b/ixwebsocket/IXHttpClient.cpp @@ -12,6 +12,7 @@ #include "IXUserAgent.h" #include "IXWebSocketHttpHeaders.h" #include +#include #include #include #include diff --git a/ixwebsocket/IXHttpServer.cpp b/ixwebsocket/IXHttpServer.cpp index 406d7d25..c5c5f84e 100644 --- a/ixwebsocket/IXHttpServer.cpp +++ b/ixwebsocket/IXHttpServer.cpp @@ -10,6 +10,7 @@ #include "IXNetSystem.h" #include "IXSocketConnect.h" #include "IXUserAgent.h" +#include #include #include #include diff --git a/ixwebsocket/IXNetSystem.h b/ixwebsocket/IXNetSystem.h index 96395443..c7f376a4 100644 --- a/ixwebsocket/IXNetSystem.h +++ b/ixwebsocket/IXNetSystem.h @@ -6,6 +6,8 @@ #pragma once +#include + #ifdef _WIN32 #ifndef WIN32_LEAN_AND_MEAN diff --git a/ixwebsocket/IXSelectInterrupt.h b/ixwebsocket/IXSelectInterrupt.h index de6db127..c4fda098 100644 --- a/ixwebsocket/IXSelectInterrupt.h +++ b/ixwebsocket/IXSelectInterrupt.h @@ -6,8 +6,8 @@ #pragma once +#include #include -#include #include namespace ix diff --git a/ixwebsocket/IXSelectInterruptEvent.h b/ixwebsocket/IXSelectInterruptEvent.h index d965661d..fc8505fa 100644 --- a/ixwebsocket/IXSelectInterruptEvent.h +++ b/ixwebsocket/IXSelectInterruptEvent.h @@ -5,8 +5,8 @@ #pragma once #include "IXSelectInterrupt.h" +#include #include -#include #include #include #ifdef _WIN32 diff --git a/ixwebsocket/IXSelectInterruptPipe.h b/ixwebsocket/IXSelectInterruptPipe.h index 76689151..26078b2a 100644 --- a/ixwebsocket/IXSelectInterruptPipe.h +++ b/ixwebsocket/IXSelectInterruptPipe.h @@ -7,6 +7,7 @@ #pragma once #include "IXSelectInterrupt.h" +#include #include #include #include diff --git a/ixwebsocket/IXSocket.cpp b/ixwebsocket/IXSocket.cpp index dc14bc9d..af604fa5 100644 --- a/ixwebsocket/IXSocket.cpp +++ b/ixwebsocket/IXSocket.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include diff --git a/ixwebsocket/IXSocket.h b/ixwebsocket/IXSocket.h index d1fa9691..af8bda0b 100644 --- a/ixwebsocket/IXSocket.h +++ b/ixwebsocket/IXSocket.h @@ -7,6 +7,7 @@ #pragma once #include +#include #include #include #include diff --git a/ixwebsocket/IXSocketMbedTLS.cpp b/ixwebsocket/IXSocketMbedTLS.cpp index 600061cb..f5c0cf6a 100644 --- a/ixwebsocket/IXSocketMbedTLS.cpp +++ b/ixwebsocket/IXSocketMbedTLS.cpp @@ -14,6 +14,7 @@ #include "IXNetSystem.h" #include "IXSocket.h" #include "IXSocketConnect.h" +#include #include #ifdef _WIN32 diff --git a/ixwebsocket/IXUuid.cpp b/ixwebsocket/IXUuid.cpp index 0d82ef79..94d0516a 100644 --- a/ixwebsocket/IXUuid.cpp +++ b/ixwebsocket/IXUuid.cpp @@ -16,6 +16,7 @@ #include "IXUuid.h" +#include #include #include #include diff --git a/ixwebsocket/IXWebSocket.cpp b/ixwebsocket/IXWebSocket.cpp index 86b6c3ee..1a879a78 100644 --- a/ixwebsocket/IXWebSocket.cpp +++ b/ixwebsocket/IXWebSocket.cpp @@ -13,6 +13,7 @@ #include "IXWebSocketHandshake.h" #include #include +#include namespace diff --git a/ixwebsocket/IXWebSocket.h b/ixwebsocket/IXWebSocket.h index 70868bba..7adfe166 100644 --- a/ixwebsocket/IXWebSocket.h +++ b/ixwebsocket/IXWebSocket.h @@ -21,6 +21,7 @@ #include "IXWebSocketTransport.h" #include #include +#include #include #include #include diff --git a/ixwebsocket/IXWebSocketPerMessageDeflate.cpp b/ixwebsocket/IXWebSocketPerMessageDeflate.cpp index 1c5f1959..d255f490 100644 --- a/ixwebsocket/IXWebSocketPerMessageDeflate.cpp +++ b/ixwebsocket/IXWebSocketPerMessageDeflate.cpp @@ -46,6 +46,8 @@ * */ +#include + #include "IXWebSocketPerMessageDeflate.h" #include "IXUniquePtr.h" diff --git a/ixwebsocket/IXWebSocketPerMessageDeflateCodec.h b/ixwebsocket/IXWebSocketPerMessageDeflateCodec.h index 8c0d6b1b..f613e5a2 100644 --- a/ixwebsocket/IXWebSocketPerMessageDeflateCodec.h +++ b/ixwebsocket/IXWebSocketPerMessageDeflateCodec.h @@ -10,6 +10,7 @@ #include "zlib.h" #endif #include +#include #include #include #include "IXWebSocketSendData.h" diff --git a/ixwebsocket/IXWebSocketPerMessageDeflateOptions.h b/ixwebsocket/IXWebSocketPerMessageDeflateOptions.h index 7cd33c0c..95751b61 100644 --- a/ixwebsocket/IXWebSocketPerMessageDeflateOptions.h +++ b/ixwebsocket/IXWebSocketPerMessageDeflateOptions.h @@ -6,6 +6,7 @@ #pragma once +#include #include namespace ix diff --git a/ixwebsocket/IXWebSocketSendData.h b/ixwebsocket/IXWebSocketSendData.h index 86031aa0..0ca1d510 100644 --- a/ixwebsocket/IXWebSocketSendData.h +++ b/ixwebsocket/IXWebSocketSendData.h @@ -1,128 +1,129 @@ -/* - * IXWebSocketSendData.h - * - * WebSocket (Binary/Text) send data buffer - */ - -#pragma once - -#include -#include -#include - -namespace ix -{ - /* - * IXWebSocketSendData implements a wrapper for std::string, std:vector and char*. - * It removes the necessarity to copy the data or string into a std::string - */ - class IXWebSocketSendData { - public: - - template - struct IXWebSocketSendData_const_iterator - //: public std::iterator - { - typedef IXWebSocketSendData_const_iterator const_iterator; - - using iterator_category = std::forward_iterator_tag; - using difference_type = std::ptrdiff_t; - using value_type = T; - using pointer = value_type*; - using reference = const value_type&; - - pointer _ptr; - public: - IXWebSocketSendData_const_iterator() : _ptr(nullptr) {} - IXWebSocketSendData_const_iterator(pointer ptr) : _ptr(ptr) {} - ~IXWebSocketSendData_const_iterator() {} - - const_iterator operator++(int) { return const_iterator(_ptr++); } - const_iterator& operator++() { ++_ptr; return *this; } - reference operator* () const { return *_ptr; } - pointer operator->() const { return _ptr; } - const_iterator operator+ (const difference_type offset) const { return const_iterator(_ptr + offset); } - const_iterator operator- (const difference_type offset) const { return const_iterator(_ptr - offset); } - difference_type operator- (const const_iterator& rhs) const { return _ptr - rhs._ptr; } - bool operator==(const const_iterator& rhs) const { return _ptr == rhs._ptr; } - bool operator!=(const const_iterator& rhs) const { return _ptr != rhs._ptr; } - const_iterator& operator+=(const difference_type offset) { _ptr += offset; return *this; } - const_iterator& operator-=(const difference_type offset) { _ptr -= offset; return *this; } - }; - - using const_iterator = IXWebSocketSendData_const_iterator; - - /* The assigned std::string must be kept alive for the lifetime of the input buffer */ - IXWebSocketSendData(const std::string& str) - : _data(str.data()) - , _size(str.size()) - { - } - - /* The assigned std::vector must be kept alive for the lifetime of the input buffer */ - IXWebSocketSendData(const std::vector& v) - : _data(v.data()) - , _size(v.size()) - { - } - - /* The assigned std::vector must be kept alive for the lifetime of the input buffer */ - IXWebSocketSendData(const std::vector& v) - : _data(reinterpret_cast(v.data())) - , _size(v.size()) - { - } - - /* The assigned memory must be kept alive for the lifetime of the input buffer */ - IXWebSocketSendData(const char* data, size_t size) - : _data(data) - , _size(data == nullptr ? 0 : size) - { - } - - bool empty() const - { - return _data == nullptr || _size == 0; - } - - const char* c_str() const - { - return _data; - } - - const char* data() const - { - return _data; - } - - size_t size() const - { - return _size; - } - - inline const_iterator begin() const - { - return const_iterator(const_cast(_data)); - } - - inline const_iterator end() const - { - return const_iterator(const_cast(_data) + _size); - } - - inline const_iterator cbegin() const - { - return begin(); - } - - inline const_iterator cend() const - { - return end(); - } - - private: - const char* _data; - const size_t _size; - }; - +/* + * IXWebSocketSendData.h + * + * WebSocket (Binary/Text) send data buffer + */ + +#pragma once + +#include +#include +#include +#include + +namespace ix +{ + /* + * IXWebSocketSendData implements a wrapper for std::string, std:vector and char*. + * It removes the necessarity to copy the data or string into a std::string + */ + class IXWebSocketSendData { + public: + + template + struct IXWebSocketSendData_const_iterator + //: public std::iterator + { + typedef IXWebSocketSendData_const_iterator const_iterator; + + using iterator_category = std::forward_iterator_tag; + using difference_type = std::ptrdiff_t; + using value_type = T; + using pointer = value_type*; + using reference = const value_type&; + + pointer _ptr; + public: + IXWebSocketSendData_const_iterator() : _ptr(nullptr) {} + IXWebSocketSendData_const_iterator(pointer ptr) : _ptr(ptr) {} + ~IXWebSocketSendData_const_iterator() {} + + const_iterator operator++(int) { return const_iterator(_ptr++); } + const_iterator& operator++() { ++_ptr; return *this; } + reference operator* () const { return *_ptr; } + pointer operator->() const { return _ptr; } + const_iterator operator+ (const difference_type offset) const { return const_iterator(_ptr + offset); } + const_iterator operator- (const difference_type offset) const { return const_iterator(_ptr - offset); } + difference_type operator- (const const_iterator& rhs) const { return _ptr - rhs._ptr; } + bool operator==(const const_iterator& rhs) const { return _ptr == rhs._ptr; } + bool operator!=(const const_iterator& rhs) const { return _ptr != rhs._ptr; } + const_iterator& operator+=(const difference_type offset) { _ptr += offset; return *this; } + const_iterator& operator-=(const difference_type offset) { _ptr -= offset; return *this; } + }; + + using const_iterator = IXWebSocketSendData_const_iterator; + + /* The assigned std::string must be kept alive for the lifetime of the input buffer */ + IXWebSocketSendData(const std::string& str) + : _data(str.data()) + , _size(str.size()) + { + } + + /* The assigned std::vector must be kept alive for the lifetime of the input buffer */ + IXWebSocketSendData(const std::vector& v) + : _data(v.data()) + , _size(v.size()) + { + } + + /* The assigned std::vector must be kept alive for the lifetime of the input buffer */ + IXWebSocketSendData(const std::vector& v) + : _data(reinterpret_cast(v.data())) + , _size(v.size()) + { + } + + /* The assigned memory must be kept alive for the lifetime of the input buffer */ + IXWebSocketSendData(const char* data, size_t size) + : _data(data) + , _size(data == nullptr ? 0 : size) + { + } + + bool empty() const + { + return _data == nullptr || _size == 0; + } + + const char* c_str() const + { + return _data; + } + + const char* data() const + { + return _data; + } + + size_t size() const + { + return _size; + } + + inline const_iterator begin() const + { + return const_iterator(const_cast(_data)); + } + + inline const_iterator end() const + { + return const_iterator(const_cast(_data) + _size); + } + + inline const_iterator cbegin() const + { + return begin(); + } + + inline const_iterator cend() const + { + return end(); + } + + private: + const char* _data; + const size_t _size; + }; + } \ No newline at end of file diff --git a/ixwebsocket/IXWebSocketTransport.cpp b/ixwebsocket/IXWebSocketTransport.cpp index b699a399..7e00cf5b 100644 --- a/ixwebsocket/IXWebSocketTransport.cpp +++ b/ixwebsocket/IXWebSocketTransport.cpp @@ -45,7 +45,6 @@ #include #include #include -#include #include #include #include diff --git a/ixwebsocket/IXWebSocketTransport.h b/ixwebsocket/IXWebSocketTransport.h index 8280cfe4..8473c55c 100644 --- a/ixwebsocket/IXWebSocketTransport.h +++ b/ixwebsocket/IXWebSocketTransport.h @@ -21,6 +21,7 @@ #include "IXWebSocketSendData.h" #include "IXWebSocketSendInfo.h" #include +#include #include #include #include